T
- the type of the tabsM
- the type of the menusI
- the type of the additional info panelpublic abstract class CombinedStackDockComponent<T extends CombinedTab,M extends CombinedMenu,I extends CombinedInfoComponent> extends AbstractTabPane<T,M,I> implements StackDockComponent
StackDockComponent
which is a combination of other components.TabPane
and thus supports the
TabLayoutManager
.Modifier and Type | Class and Description |
---|---|
protected class |
CombinedStackDockComponent.Meta
Meta information about a
Dockable that is shown on this
CombinedStackDockComponent . |
LAYOUT_MANAGER, USE_SMALL_MINIMUM_SIZE
Constructor and Description |
---|
CombinedStackDockComponent()
Constructs a new component.
|
Modifier and Type | Method and Description |
---|---|
void |
addStackDockComponentListener(StackDockComponentListener listener)
Adds a listener to this component, it will be called if the selection changes.
|
void |
addTab(java.lang.String title,
javax.swing.Icon icon,
java.awt.Component comp,
Dockable dockable)
Adds a new child at an unspecified location.
|
protected void |
addToMenu(M menu,
Dockable dockable)
Adds
dockable somewhere to menu |
protected void |
clearTabs()
Removes all tabs from the internal data structure.
Subclasses may override this method to be informed about the exact time when a tab changes, but the overridden method must call the original method. |
protected BackgroundAlgorithm |
createBackground(CombinedStackDockComponent<T,M,I> self)
Creates the background algorithm that is used for
this component. |
protected BorderForwarder |
createContentBorderModifier(Dockable dockable,
javax.swing.JComponent component)
Creates a
BorderForwarder for the content component for the tab of dockable |
protected CombinedStackDockContentPane |
createContentPane(CombinedStackDockComponent<T,M,I> self)
Creates the content pane for
this component. |
DockElementRepresentative |
createDefaultRepresentation(DockElement target)
Creates and returns a new
DockElementRepresentative representing target ,
the new representation is to be used to cover all the empty areas on this StackDockComponent . |
protected java.awt.Component |
createLayerAt(java.awt.Component component,
Dockable dockable)
Creates a layer between
component and this panel. |
protected void |
fireTabChanged(Dockable dockable)
Calls
StackDockComponentListener.tabChanged(StackDockComponent, Dockable) on all listeners that
are currently registered. |
java.awt.Rectangle |
getAvailableArea()
Gets the area in which all the
Tab s, TabMenu s and
the visible Dockable (TabPane.setSelectedBounds(Rectangle) )
must find their place. |
java.awt.Rectangle |
getBoundsAt(int index)
Gets the location and size of the graphical element that allows
the user to select the
index 'th child. |
javax.swing.JComponent |
getComponent()
Gets a
Component on which the children of this
StackDockComponent will be displayed. |
TabConfiguration |
getConfiguration(Dockable child)
|
protected CombinedStackDockComponent.Meta |
getContentAt(int index)
Gets the meta information about the components at location
index |
Dockable |
getDockableAt(int index)
Gets the
Dockable which was placed at the index 'th position. |
int |
getIndexOfTabAt(java.awt.Point mouseLocation)
Gets the index of the tab that is beneath
mouseLocation . |
CombinedHandler<AbstractTabPaneComponent> |
getInfoHandler()
Gets a handler for info components.
|
java.awt.Component |
getLayerAt(int index)
Gets the index'th
Component on this tab. |
CombinedHandler<CombinedMenu> |
getMenuHandler()
Gets a handler for menus.
|
java.awt.Dimension |
getMinimumSize()
Gets the minimal size required to have a big enough
TabPane.getAvailableArea() to show
all content. |
java.awt.Dimension |
getMinimumSize(Dockable dockable)
Gets the minimum size that is required to show the child
dockable . |
T |
getOnTab(Dockable dockable)
Gets the tab-button for
dockable , if no tab-button
for dockable exists a new button should be created. |
java.awt.Dimension |
getPreferredSize()
Gets the preferred size required to have a big enough
TabPane.getAvailableArea() to show
all content. |
java.awt.Dimension |
getPreferredSize(Dockable dockable)
Gets the preferred size that is required to show the child
dockable . |
java.awt.Rectangle |
getSelectedBounds()
Gets the boundaries the
selected Dockable
has (independent of whether such a Dockable exists). |
int |
getSelectedIndex()
Gets the index of the currently selected dockable
|
DockElementRepresentative |
getTabAt(int index)
Gets an element representing the tab of the
Dockable at index . |
int |
getTabCount()
Gets the number of children that are added to this StackDockComponent.
|
CombinedHandler<CombinedTab> |
getTabHandler()
Gets a handler for tabs.
|
protected int |
getZOrder(java.awt.Component component)
Gets the z order of
component . |
void |
insertTab(java.lang.String title,
javax.swing.Icon icon,
java.awt.Component comp,
Dockable dockable,
int index)
Adds a new child at the location
index . |
void |
moveTab(int source,
int destination)
Moves the tab at
source to location destination . |
T |
putOnTab(Dockable dockable)
Informs this pane that its child
dockable should have a
tab-button. |
protected T |
putTab(Dockable dockable,
T tab)
Associates
tab with dockable . |
void |
remove(int index)
Removes the
index 'th element of this pane. |
void |
removeAll()
Removes all elements from this pane.
|
protected void |
removeFromMenu(M menu,
Dockable dockable)
Removes
dockable from menu . |
void |
removeStackDockComponentListener(StackDockComponentListener listener)
Removes
listener from this component. |
protected T |
removeTab(Dockable dockable)
Removes the tab of
dockable from the internal data structure. |
void |
repaint()
Repaints the contents of this component.
|
void |
revalidate()
Called when the layout of this pane has become invalid, the default
behavior is to call
AbstractTabPane.doLayout() . |
void |
setComponentAt(int index,
java.awt.Component component)
Sets the component which should be shown at tab
index . |
void |
setController(DockController controller)
Connects this pane with
controller . |
protected void |
setEnabledAt(Dockable dockable,
boolean enabled)
Changes the enabled state of the item
dockable . |
void |
setIconAt(int index,
javax.swing.Icon newIcon)
Sets the icon of the child at location
index . |
void |
setSelectedBounds(java.awt.Rectangle bounds)
Sets the boundaries of the
selected Dockable . |
void |
setSelectedDockable(Dockable dockable)
Selects the child
dockable of this pane as the one visible
element. |
void |
setSelectedIndex(int index)
Selects the component at location
index . |
void |
setTitleAt(int index,
java.lang.String newTitle)
Sets the title of the child at location
index . |
void |
setTooltipAt(int index,
java.lang.String newTooltip)
Sets the tooltip of the child at location
index . |
protected void |
setZOrder(java.awt.Component component,
int order)
Sets the z order of
component , as higher the z order
as later the component is painted, as more components it can overlap. |
addTabPaneListener, createMenu, destroyMenu, discardComponentsAndRebuild, doLayout, fireAdded, fireControllerChanged, fireInfoComponentChanged, fireRemoved, fireSelectionChanged, getController, getDockable, getDockableCount, getDockables, getDockTabPlacement, getInfoComponent, getLayoutManager, getMenu, getMenuList, getMenus, getSelectedDockable, getTab, getTabs, getTabsList, getVisibleTab, getVisibleTabCount, indexOf, indexOfVisible, insert, listeners, menuRemoved, move, newMenu, newTab, putInMenu, removeTabPaneListener, setDockTabPlacement, setInfoComponent, setLayoutManager, tabRemoved
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getDockTabPlacement, hasBorder, isSingleTabComponent, setDockTabPlacement
public CombinedStackDockComponent()
protected CombinedStackDockContentPane createContentPane(CombinedStackDockComponent<T,M,I> self)
this
component. This method
may be called by the constructor.self
- this
null
protected BackgroundAlgorithm createBackground(CombinedStackDockComponent<T,M,I> self)
this
component. This method
may be called by the constructor.self
- this
null
public void revalidate()
AbstractTabPane
AbstractTabPane.doLayout()
. Subclasses may override to
update the layout lazily.revalidate
in class AbstractTabPane<T extends CombinedTab,M extends CombinedMenu,I extends CombinedInfoComponent>
public void repaint()
public void addStackDockComponentListener(StackDockComponentListener listener)
StackDockComponent
addStackDockComponentListener
in interface StackDockComponent
listener
- the new listener, not null
public void removeStackDockComponentListener(StackDockComponentListener listener)
StackDockComponent
listener
from this component.removeStackDockComponentListener
in interface StackDockComponent
listener
- the listener to removeprotected void fireTabChanged(Dockable dockable)
StackDockComponentListener.tabChanged(StackDockComponent, Dockable)
on all listeners that
are currently registered.dockable
- the element whose tab changedpublic void setController(DockController controller)
AbstractTabPane
controller
.setController
in interface StackDockComponent
setController
in class AbstractTabPane<T extends CombinedTab,M extends CombinedMenu,I extends CombinedInfoComponent>
controller
- the realm in which this pane works, may be null
public TabConfiguration getConfiguration(Dockable child)
child
- some child of this StackDockComponent
TabConfiguration
that should be used for its tabpublic CombinedHandler<CombinedTab> getTabHandler()
CombinedTab
s from this component in order to change
their visibility.public CombinedHandler<CombinedMenu> getMenuHandler()
CombinedMenu
s from this component in order to change
their visibility.public CombinedHandler<AbstractTabPaneComponent> getInfoHandler()
AbstractTabPaneComponent
s from this component in order to change
their visibility.public java.awt.Rectangle getAvailableArea()
TabPane
Tab
s, TabMenu
s and
the visible Dockable
(TabPane.setSelectedBounds(Rectangle)
)
must find their place.getAvailableArea
in interface TabPane
width
and
height
1.public java.awt.Dimension getMinimumSize()
AbstractTabPane
TabPane.getAvailableArea()
to show
all content.getMinimumSize
in class AbstractTabPane<T extends CombinedTab,M extends CombinedMenu,I extends CombinedInfoComponent>
public java.awt.Dimension getPreferredSize()
AbstractTabPane
TabPane.getAvailableArea()
to show
all content.getPreferredSize
in class AbstractTabPane<T extends CombinedTab,M extends CombinedMenu,I extends CombinedInfoComponent>
public java.awt.Rectangle getSelectedBounds()
TabPane
selected Dockable
has (independent of whether such a Dockable
exists).getSelectedBounds
in interface TabPane
null
public void setSelectedBounds(java.awt.Rectangle bounds)
TabPane
selected Dockable
.setSelectedBounds
in interface TabPane
bounds
- the boundaries of the selected childpublic int getSelectedIndex()
StackDockComponent
getSelectedIndex
in interface StackDockComponent
public void setSelectedIndex(int index)
StackDockComponent
index
.setSelectedIndex
in interface StackDockComponent
index
- the index of the selected componentpublic void setSelectedDockable(Dockable dockable)
AbstractTabPane
dockable
of this pane as the one visible
element.setSelectedDockable
in interface TabPane
setSelectedDockable
in class AbstractTabPane<T extends CombinedTab,M extends CombinedMenu,I extends CombinedInfoComponent>
dockable
- the newly selected element, can be null
public java.awt.Rectangle getBoundsAt(int index)
StackDockComponent
index
'th child.getBoundsAt
in interface StackDockComponent
index
- the index of the childnull
if the element is not directly visiblepublic int getIndexOfTabAt(java.awt.Point mouseLocation)
StackDockComponent
mouseLocation
.getIndexOfTabAt
in interface StackDockComponent
mouseLocation
- the location of the mouse on the component
-1
public int getTabCount()
StackDockComponent
getTabCount
in interface StackDockComponent
public void addTab(java.lang.String title, javax.swing.Icon icon, java.awt.Component comp, Dockable dockable)
StackDockComponent
addTab
in interface StackDockComponent
title
- the title of the childicon
- an icon to display for the child or null
comp
- the new child to displaydockable
- the Dockable for which the tab is usedpublic void insertTab(java.lang.String title, javax.swing.Icon icon, java.awt.Component comp, Dockable dockable, int index)
StackDockComponent
index
.insertTab
in interface StackDockComponent
title
- the title of the childicon
- an icon to display for the child or null
comp
- the new child to displaydockable
- the Dockable for which the tab is usedindex
- the index that the new child should havepublic java.awt.Dimension getMinimumSize(Dockable dockable)
TabPane
dockable
.getMinimumSize
in interface TabPane
dockable
- one of the children of this panedockable
public java.awt.Dimension getPreferredSize(Dockable dockable)
TabPane
dockable
.getPreferredSize
in interface TabPane
dockable
- one of the children of this panedockable
public Dockable getDockableAt(int index)
StackDockComponent
Dockable
which was placed at the index
'th position.getDockableAt
in interface StackDockComponent
index
- the position of the elementpublic DockElementRepresentative getTabAt(int index)
StackDockComponent
Dockable
at index
.getTabAt
in interface StackDockComponent
index
- the index of some child of this stacknull
if no tab exists or tabs cannot be used as DockElementRepresentative
spublic void moveTab(int source, int destination)
StackDockComponent
source
to location destination
.moveTab
in interface StackDockComponent
source
- the item to movedestination
- the target destinationpublic void remove(int index)
AbstractTabPane
index
'th element of this pane.remove
in interface StackDockComponent
remove
in class AbstractTabPane<T extends CombinedTab,M extends CombinedMenu,I extends CombinedInfoComponent>
index
- the index of the element to removepublic void removeAll()
AbstractTabPane
removeAll
in interface StackDockComponent
removeAll
in class AbstractTabPane<T extends CombinedTab,M extends CombinedMenu,I extends CombinedInfoComponent>
public T putOnTab(Dockable dockable)
TabPane
dockable
should have a
tab-button. This TabPane
may create a new Tab
or reuse an existing Tab
. Reusing an existing tab is
recommended. If dockable
was part of a TabMenu
,
then it should be removed from that menu.dockable
already is on a tab then this tab should be reused.putOnTab
in interface TabPane
putOnTab
in class AbstractTabPane<T extends CombinedTab,M extends CombinedMenu,I extends CombinedInfoComponent>
dockable
- the element which needs a tab-buttonTab
that is only used for dockable
public T getOnTab(Dockable dockable)
TabPane
dockable
, if no tab-button
for dockable
exists a new button should be created. Reusing
existing tabs is recommended. Other than TabPane.putOnTab(Dockable)
this
method must not affect any TabMenu
showing Dockable
.getOnTab
in interface TabPane
getOnTab
in class AbstractTabPane<T extends CombinedTab,M extends CombinedMenu,I extends CombinedInfoComponent>
dockable
- the element whose tab is requesteddockable
protected T putTab(Dockable dockable, T tab)
AbstractTabPane
tab
with dockable
. this method
modifies the internal data structure in order to store the change.putTab
in class AbstractTabPane<T extends CombinedTab,M extends CombinedMenu,I extends CombinedInfoComponent>
dockable
- the key for the tab-maptab
- the value for the tab-mapdockable
protected T removeTab(Dockable dockable)
AbstractTabPane
dockable
from the internal data structure.removeTab
in class AbstractTabPane<T extends CombinedTab,M extends CombinedMenu,I extends CombinedInfoComponent>
dockable
- the key of the element to be removed from the tab-mapprotected void clearTabs()
AbstractTabPane
clearTabs
in class AbstractTabPane<T extends CombinedTab,M extends CombinedMenu,I extends CombinedInfoComponent>
protected void addToMenu(M menu, Dockable dockable)
AbstractTabPane
dockable
somewhere to menu
addToMenu
in class AbstractTabPane<T extends CombinedTab,M extends CombinedMenu,I extends CombinedInfoComponent>
menu
- a menu of this panedockable
- a new child of menu
protected void removeFromMenu(M menu, Dockable dockable)
AbstractTabPane
dockable
from menu
.removeFromMenu
in class AbstractTabPane<T extends CombinedTab,M extends CombinedMenu,I extends CombinedInfoComponent>
menu
- some menu of this panedockable
- a child of menu
protected java.awt.Component createLayerAt(java.awt.Component component, Dockable dockable)
component
and this panel. The
object component
is a representation of dockable
but not necessarily dockable
itself. The default
behavior of this method is to return component
.component
- the representation of dockable
dockable
- the element for which a new layer is createdcomponent
or component
public java.awt.Component getLayerAt(int index)
Component
on this tab. This Component
is not a Dockable
but a layer between dockable and this panel.index
- the index of a tab.protected CombinedStackDockComponent.Meta getContentAt(int index)
index
index
- the index of a tabpublic void setTitleAt(int index, java.lang.String newTitle)
StackDockComponent
index
.setTitleAt
in interface StackDockComponent
index
- the index of the childnewTitle
- the new titlepublic void setTooltipAt(int index, java.lang.String newTooltip)
StackDockComponent
index
.setTooltipAt
in interface StackDockComponent
index
- the index of the childnewTooltip
- the new tooltip, can be null
public void setIconAt(int index, javax.swing.Icon newIcon)
StackDockComponent
index
.setIconAt
in interface StackDockComponent
index
- the index of the childnewIcon
- the new icon, null
if no icon
should be displayedpublic void setComponentAt(int index, java.awt.Component component)
StackDockComponent
index
.setComponentAt
in interface StackDockComponent
index
- the index where to show component
component
- the new content, not null
protected void setEnabledAt(Dockable dockable, boolean enabled)
dockable
.dockable
- the tab whose state is to be changedenabled
- the new enabled statepublic javax.swing.JComponent getComponent()
StackDockComponent
Component
on which the children of this
StackDockComponent
will be displayed.getComponent
in interface StackDockComponent
Component
protected void setZOrder(java.awt.Component component, int order)
component
, as higher the z order
as later the component is painted, as more components it can overlap.component
- some child of this paneorder
- the orderprotected int getZOrder(java.awt.Component component)
component
.component
- some child of this panepublic DockElementRepresentative createDefaultRepresentation(DockElement target)
StackDockComponent
DockElementRepresentative
representing target
,
the new representation is to be used to cover all the empty areas on this StackDockComponent
.createDefaultRepresentation
in interface StackDockComponent
target
- the target for the new representative, may or may not be a child of this component, not null
null
if this StackDockComponent
does not allow to
use its free spacesprotected BorderForwarder createContentBorderModifier(Dockable dockable, javax.swing.JComponent component)
BorderForwarder
for the content component for the tab of dockable
dockable
- the item that is showncomponent
- the component which is influenced