|
org.netbeans.swing.tabcontrol 1.8 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.netbeans.swing.tabcontrol.plaf.ScrollingTabLayoutModel
public final class ScrollingTabLayoutModel
Layout model which manages an offset into a set of scrollable tabs, and recalculates its layout on a change. Also handles adding extra pixels to the selected tab if necessary. Basics of how it works:
Wrapppers a DefaultTabLayoutModel, which can simply calculate tab widths and 0 based positions. Listens to the data model for changes, and sets a flag when a change happens to mark the cached widths and positions as dirty. On any call to fetch sizes, first checks if the cached values are good, recalculates if needed, and returns the result.
Constructor Summary | |
---|---|
ScrollingTabLayoutModel(TabLayoutModel wrapped,
SingleSelectionModel sel,
TabDataModel mdl)
Creates a new instance of ScrollingTabLayoutModel |
|
ScrollingTabLayoutModel(TabLayoutModel wrapped,
SingleSelectionModel sel,
TabDataModel mdl,
int minimumXposition)
|
Method Summary | |
---|---|
void |
clearCachedData()
External operations on the selection or data model can invalidate cached widths. |
int |
countVisibleTabs(int width)
Return the number of tabs currently visible |
int |
dropIndexOfPoint(int x,
int y)
Gets the index of possibly dropped component (as a new tab). |
Action |
getBackwardAction()
Returns an Action that the control buttons can call to scroll backward |
int |
getFirstVisibleTab(int width)
Returns the index of the first tab that is visible (may be clipped - if it == getOffset() then it is |
Action |
getForwardAction()
Returns an Action that the control buttons can call to scroll forward |
int |
getH(int index)
Get the height of the tab rectangle for the tab at index index in the data model. |
int |
getLastVisibleTab(int width)
Returns the last visible tab, which may or may not be clipped |
int |
getOffset()
Get the offset - the number of tabs that are scrolled over. |
int |
getPixelsToAddToSelection()
Some look and feel specs require that the selected tab be wider. |
int |
getW(int index)
Returns a cached width, after checking the changed flag and calling change() if recalculation is needed |
int |
getX(int index)
Get the x coordinate of the tab rectangle for the tab at index index in the data model. |
int |
getY(int index)
Get the y coordinate of the tab rectangle for the tab at index index in the data model. |
int |
indexOfPoint(int x,
int y)
Get the index of the tab in the data model for the supplied point. |
boolean |
isLastTabClipped()
Returns true if the last tab displayed is clipped and should therefore be painted as a clipped tab |
boolean |
makeVisible(int index,
int width)
Make a tab visible, according to the rules of the spec. |
void |
setMinimumXposition(int x)
|
int |
setOffset(int i)
Set the offset - the number of tabs that should be hidden to the left. |
void |
setPadding(Dimension d)
|
void |
setPixelsToAddToSelection(int i)
Some UIs will want to make the selected tab a little wider than the rest. |
void |
setWidth(int width)
Sets the current cached width the model thinks it has for displaying tabs. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ScrollingTabLayoutModel(TabLayoutModel wrapped, SingleSelectionModel sel, TabDataModel mdl)
public ScrollingTabLayoutModel(TabLayoutModel wrapped, SingleSelectionModel sel, TabDataModel mdl, int minimumXposition)
Method Detail |
---|
public void setMinimumXposition(int x)
public void setPixelsToAddToSelection(int i)
i
- public void clearCachedData()
public int getOffset()
public int getPixelsToAddToSelection()
public boolean isLastTabClipped()
public boolean makeVisible(int index, int width)
This method will not trigger a repaint - it just adjusts the cached withs and positions of tabs so that the next repaint will paint correctly. It may be called as part of a more complex operation which would not want to trigger spurious repaints - but the return value should be noted, and if the return value is true, the caller should repaint the tab displayer whenever it is done doing what it is doing.
public void setWidth(int width)
public int setOffset(int i)
public int getFirstVisibleTab(int width)
public int countVisibleTabs(int width)
public int getLastVisibleTab(int width)
public int dropIndexOfPoint(int x, int y)
TabLayoutModel
dropIndexOfPoint
in interface TabLayoutModel
public void setPadding(Dimension d)
setPadding
in interface TabLayoutModel
public int getH(int index)
TabLayoutModel
index
in the data model.
getH
in interface TabLayoutModel
index
- The tab index
public int getW(int index)
getW
in interface TabLayoutModel
index
- The tab index
public int getX(int index)
TabLayoutModel
index
in the data model.
getX
in interface TabLayoutModel
index
- The tab index
public int getY(int index)
TabLayoutModel
index
in the data model.
getY
in interface TabLayoutModel
index
- The tab index
public int indexOfPoint(int x, int y)
TabLayoutModel
indexOfPoint
in interface TabLayoutModel
x
- X coordinate of a point representing a set of pixel coordinate in the space
modeled by this layout modely
- Y coordinate
public Action getForwardAction()
public Action getBackwardAction()
|
org.netbeans.swing.tabcontrol 1.8 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |