|
org.netbeans.swing.tabcontrol 1.8 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.plaf.ComponentUI
org.netbeans.swing.tabcontrol.TabbedContainerUI
org.netbeans.swing.tabcontrol.plaf.DefaultTabbedContainerUI
public class DefaultTabbedContainerUI
Default UI implementation for tabbed containers. Manages installing the tab contentDisplayer and content contentDisplayer components, and the relationship between the data models and selection models of the UI.
Note that there is typically little reasons to subclass this - to affect the display
or behavior of the tabs, implement TabDisplayerUI
,
the UI delegate for the embedded component which displays the tabs.
Nested Class Summary | |
---|---|
protected class |
DefaultTabbedContainerUI.ContainerComponentListener
A ComponentListener which listens for show/hide to add and remove the selection and model listeners |
protected class |
DefaultTabbedContainerUI.ContainerPropertyChangeListener
|
protected class |
DefaultTabbedContainerUI.ModelListener
This class does the heavy lifting of keeping the content of the content displayer up-to-date with the contents of the data model. |
protected class |
DefaultTabbedContainerUI.SelectionListener
A ChangeListener which updates the component displayed in the content displayer with the selected component in the tab displayer's selection model |
Field Summary | |
---|---|
protected ComponentListener |
componentListener
Component listener which listens on the container, and attaches/detaches listeners. |
protected JComponent |
contentDisplayer
The component which displays the selected component in the tabbed container. |
protected LayoutManager |
contentDisplayerLayout
Layout manager which will handle layout of the tabbed container. |
static String |
KEY_EDITOR_CONTENT_BORDER
UIManager key for the border of the tab displayer in editor ui type. |
static String |
KEY_EDITOR_OUTER_BORDER
UIManager key for the border of the entire tabbed container in editor ui type |
static String |
KEY_EDITOR_TABS_BORDER
UIManager key for the border of the tab displayer in editor ui type |
static String |
KEY_SLIDING_CONTENT_BORDER
UIManager key for the border of the tab displayer in sliding ui type. |
static String |
KEY_SLIDING_OUTER_BORDER
UIManager key for the border of the entire tabbed container in sliding ui type |
static String |
KEY_SLIDING_TABS_BORDER
UIManager key for the border of the tab displayer in sliding ui type |
static String |
KEY_TOOLBAR_CONTENT_BORDER
UIManager key for the border of the tab displayer in toolbar ui type. |
static String |
KEY_TOOLBAR_OUTER_BORDER
UIManager key for the border of the entire tabbed container in toolbar ui type |
static String |
KEY_TOOLBAR_TABS_BORDER
UIManager key for the border of the tab displayer in toolbar ui type |
static String |
KEY_VIEW_CONTENT_BORDER
UIManager key for the border of the tab displayer in view ui type. |
static String |
KEY_VIEW_OUTER_BORDER
UIManager key for the border of the entire tabbed container in view ui type. |
static String |
KEY_VIEW_TABS_BORDER
UIManager key for the border of the tab displayer in view ui type. |
protected ComplexListDataListener |
modelListener
Listener on the data model, which handles updating the contained components to keep them in sync with the contents of the data model. |
protected PropertyChangeListener |
propertyChangeListener
Property change listener which detects changes on the tabbed container, such as its active state, which should be propagated to the tab displayer. |
protected ChangeListener |
selectionListener
Change listener which tracks changes in the selection model and changes the displayed component to reflect the selected tab do not alter the value in this field. |
protected FxProvider |
slideEffectManager
FxProvider which will provide transition effects when tabs are changed. |
protected TabDisplayer |
tabDisplayer
The Displayer for the tabs. |
Fields inherited from class org.netbeans.swing.tabcontrol.TabbedContainerUI |
---|
container |
Constructor Summary | |
---|---|
DefaultTabbedContainerUI(TabbedContainer c)
Creates a new instance of DefaultTabbedContainerUI |
Method Summary | |
---|---|
protected void |
attachModelAndSelectionListeners()
Begin listening to the model for changes in the selection, which should cause us to update the displayed component in the content contentDisplayer. |
protected void |
cancelRequestAttention(int tab)
|
protected ComponentListener |
createComponentListener()
Create a component listener responsible for initializing the contentDisplayer component when the tabbed container is shown |
protected JPanel |
createContentDisplayer()
Create the component which will contain the content (the components which correspond to tabs). |
protected LayoutManager |
createContentDisplayerLayout()
Creates the content contentDisplayer's layout manager, responsible for ensuring that the correct component is on top and is the only one showing |
protected FxProvider |
createFxProvider()
Create an FxProvider instance which will provide transition effects when tabs are selected. |
Image |
createImageOfTab(int idx)
Create an image suitable for use in drag and drop operations, of a tab |
protected LayoutManager |
createLayout()
Create the layout manager that will manage the layout of the TabbedContainer. |
protected ComplexListDataListener |
createModelListener()
Create a listener for the TabDataModel. |
protected PropertyChangeListener |
createPropertyChangeListener()
Create a property change listener which will update the tab displayer in accordance with property changes on the container. |
protected ChangeListener |
createSelectionListener()
Create a ChangeListener which will listen to the selection model of the tab displayer, and update the displayed component in the displayer when the selection model changes. |
protected TabDisplayer |
createTabDisplayer()
Create the component which will display the tabs. |
static ComponentUI |
createUI(JComponent c)
|
protected void |
detachModelAndSelectionListeners()
Stop listening to the model for changes in the selection, which should cause us to update the displayed component in the content contentDisplayer, and changes in the data model which can affect the displayed component. |
int |
dropIndexOfPoint(Point p)
Index at which a tab would be inserted if a suitable object were dropped at this point. |
protected void |
ensureSelectedComponentIsShowing()
Ensures that the component the selection model says is selected is the one that is showing. |
Rectangle |
getContentArea()
Get a rectangle matching the area in which content is displayed |
Polygon |
getExactTabIndication(int idx)
Get a polygon matching the shape of the tab |
Polygon |
getInsertTabIndication(int idx)
Get a polygon indicating the insertion of a tab before the passed index, unless the index is equal to the model size, in which case it will return an indication for inserting a tab at the end. |
SingleSelectionModel |
getSelectionModel()
Get the selection model that tracks and determines which tab is selected. |
Rectangle |
getTabRect(int tab,
Rectangle r)
Get the bounds of a tab. |
Rectangle |
getTabsArea()
Get a rectangle matching the area in which tabs are displayed |
Rectangle |
getTabsArea(Rectangle dest)
|
protected void |
initDisplayer()
Fills contentDisplayer container with components retrieved from model. |
protected void |
install()
Subclasses may override this method to do anything they need to do on installUI(). |
protected void |
installBorders()
Installs borders on the container, content displayer and tab displayer |
protected void |
installContentDisplayer()
Installs the content displayer component and its layout manager |
protected void |
installListeners()
Installs a component listener on the component. |
protected void |
installTabDisplayer()
Installs the tab displayer component into the container. |
void |
installUI(JComponent c)
This method is final. |
boolean |
isShowCloseButton()
|
void |
makeTabVisible(int tab)
Make a tab visible. |
protected void |
requestAttention(int tab)
|
void |
setShowCloseButton(boolean val)
|
protected Component |
showComponent(Component c)
Shows the passed component. |
protected void |
showComponentWithFxProvider(Component c)
Shows a component in the control, using the FxProvider created in
createFxProvider() to manage showing it. |
int |
tabForCoordinate(Point p)
Get the tab at a given point in the coordinate space of the container. |
protected Component |
toComp(TabData data)
Convenience method for fetching a component from a TabData object via the container's ComponentConverter |
protected boolean |
uichange()
This method is called if TabbedContainer.updateUI() gets called after a UI delegate has been installed (in other words, the user did something like switch look and feels or switch the Windows desktop theme). |
protected void |
uninstall()
Subclasses may override this method to do anything they need to do on uninstallUI(). |
protected void |
uninstallDisplayers()
Uninstalls and nulls references to the content contentDisplayer and tab contentDisplayer, and removes all components from the content contentDisplayer. |
protected void |
uninstallListeners()
Uninstalls the component listener installed in installListeners() |
void |
uninstallUI(JComponent c)
This method is final. |
protected void |
updateOrientation()
Checks the position of the tabbed container relative to its parent window, and potentially updates its orientation client property. |
Methods inherited from class org.netbeans.swing.tabcontrol.TabbedContainerUI |
---|
shouldPerformAction |
Methods inherited from class javax.swing.plaf.ComponentUI |
---|
contains, getAccessibleChild, getAccessibleChildrenCount, getMaximumSize, getMinimumSize, getPreferredSize, paint, update |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String KEY_EDITOR_CONTENT_BORDER
public static final String KEY_EDITOR_TABS_BORDER
public static final String KEY_EDITOR_OUTER_BORDER
public static final String KEY_VIEW_CONTENT_BORDER
public static final String KEY_VIEW_TABS_BORDER
public static final String KEY_VIEW_OUTER_BORDER
public static final String KEY_SLIDING_CONTENT_BORDER
public static final String KEY_SLIDING_TABS_BORDER
public static final String KEY_SLIDING_OUTER_BORDER
public static final String KEY_TOOLBAR_CONTENT_BORDER
public static final String KEY_TOOLBAR_TABS_BORDER
public static final String KEY_TOOLBAR_OUTER_BORDER
protected ComponentListener componentListener
protected ChangeListener selectionListener
protected ComplexListDataListener modelListener
protected LayoutManager contentDisplayerLayout
protected PropertyChangeListener propertyChangeListener
protected FxProvider slideEffectManager
protected JComponent contentDisplayer
protected TabDisplayer tabDisplayer
TabDisplayer
. To get the actual
GUI component that is showing tabs, call its getComponent()
method.
do not alter the value in this field. To provide a different implementation,
override the appropriate creation method.
Constructor Detail |
---|
public DefaultTabbedContainerUI(TabbedContainer c)
Method Detail |
---|
public static ComponentUI createUI(JComponent c)
public final void installUI(JComponent c)
install()
installUI
in class TabbedContainerUI
c
- A JComponent, which must == the displayer field initialized in the constructorpublic final void uninstallUI(JComponent c)
uninstall()
uninstallUI
in class ComponentUI
c
- A JComponent, which must == the displayer field initialized in the constructorprotected void install()
protected void uninstall()
protected boolean uichange()
TabbedContainerUI
Normally, the only UI delegate that exists for TabbedContainer is DefaultTabbedContainerUI, so it makes no sense to replace one with another, since they do the same thing.
However, this method can be used to update the tab displayer component's UI. Subclasses are expected to override this method to call updateUI() on the displayer, or do whatever is appropriate to ensure that the UI will look right after the change - or to return true from this method, in which the entire UI delegate for the tabbed container will be replaced.
uichange
in class TabbedContainerUI
protected void installContentDisplayer()
protected void installTabDisplayer()
BorderLayout.NORTH
.
protected void installBorders()
protected void installListeners()
protected void attachModelAndSelectionListeners()
createComponentListener()
,
you will need to call this method when the component is shown.
protected void detachModelAndSelectionListeners()
createComponentListener()
,
you will need to call this method when the component is hidden.
protected void uninstallListeners()
installListeners()
protected void uninstallDisplayers()
protected TabDisplayer createTabDisplayer()
protected JPanel createContentDisplayer()
JPanel
.
protected FxProvider createFxProvider()
protected LayoutManager createContentDisplayerLayout()
protected LayoutManager createLayout()
installDisplayer()
as well.
protected ComponentListener createComponentListener()
protected PropertyChangeListener createPropertyChangeListener()
TabbedContainer.setActive()
,
which simply cause the active state to be set on the displayer.
protected void ensureSelectedComponentIsShowing()
protected final Component toComp(TabData data)
protected Component showComponent(Component c)
createContentDisplayerLayoutModel()
to
provide your own layout manager to arrange the displayed component, you
need to override this to tell the layout (or do whatever is needed) to
change the component that is shown.
c
- The component to be shown
protected final void showComponentWithFxProvider(Component c)
FxProvider
created in
createFxProvider()
to manage showing it. Equivalent to calling showComponent
,
but there may be a delay while the effect is performed. If no FxProvider
is installed,
this will simply delegate to showComponent
; if not, the FxProvider
is expected
to do that when its effect is completed.
c
- The component to be shown.protected void initDisplayer()
protected ComplexListDataListener createModelListener()
protected ChangeListener createSelectionListener()
public Rectangle getTabRect(int tab, Rectangle r)
TabbedContainerUI
getTabRect
in class TabbedContainerUI
tab
- A tab indexr
- A rectangle to configure with the information, or null
protected void requestAttention(int tab)
requestAttention
in class TabbedContainerUI
protected void cancelRequestAttention(int tab)
cancelRequestAttention
in class TabbedContainerUI
public void setShowCloseButton(boolean val)
setShowCloseButton
in class TabbedContainerUI
public boolean isShowCloseButton()
isShowCloseButton
in class TabbedContainerUI
protected final void updateOrientation()
TabDisplayer.PROP_ORIENTATION
public int tabForCoordinate(Point p)
TabbedContainerUI
tabForCoordinate
in class TabbedContainerUI
p
- A point
public void makeTabVisible(int tab)
TabbedContainerUI
makeTabVisible
in class TabbedContainerUI
tab
- A tab indexpublic SingleSelectionModel getSelectionModel()
TabbedContainerUI
getSelectionModel
in class TabbedContainerUI
public Image createImageOfTab(int idx)
TabbedContainerUI
createImageOfTab
in class TabbedContainerUI
public Polygon getExactTabIndication(int idx)
TabbedContainerUI
getExactTabIndication
in class TabbedContainerUI
public Polygon getInsertTabIndication(int idx)
TabbedContainerUI
getInsertTabIndication
in class TabbedContainerUI
idx
- A tab index
public Rectangle getContentArea()
TabbedContainerUI
getContentArea
in class TabbedContainerUI
public Rectangle getTabsArea()
TabbedContainerUI
getTabsArea
in class TabbedContainerUI
public int dropIndexOfPoint(Point p)
TabbedContainerUI
dropIndexOfPoint
in class TabbedContainerUI
p
- A point
public Rectangle getTabsArea(Rectangle dest)
|
org.netbeans.swing.tabcontrol 1.8 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |