T - the kind of tabs this pane supportsM - the kind of menus this pane supportsI - the kind of info panel this pane supportspublic abstract class AbstractTabPane<T extends Tab,M extends TabMenu,I extends LonelyTabPaneComponent> extends Object implements TabPane
TabPane. This class handles creation,
storage and destruction of Tabs and TabMenus, it also stores
a list of currently visible Dockables.setController(DockController) to make sure
this pane can use all available information.LAYOUT_MANAGER, USE_SMALL_MINIMUM_SIZE| Constructor and Description |
|---|
AbstractTabPane() |
| Modifier and Type | Method and Description |
|---|---|
void |
addTabPaneListener(TabPaneListener listener)
Adds a listener to this pane, the listener has to be informed when
elements are added or removed, and when the selection changes.
|
protected abstract 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. |
TabMenu |
createMenu()
Creates a new menu for this pane.
|
void |
destroyMenu(TabMenu menu)
Destroys
menu which was created by
this pane. |
void |
discardComponentsAndRebuild()
|
void |
doLayout()
Updates the layout of this pane, assuming a
TabLayoutManager
is installed. |
protected void |
fireAdded(Dockable dockable)
Informs all
TabPaneListeners that dockable
has been added. |
protected void |
fireControllerChanged()
Informs all
TabPaneListener that the current DockController changed. |
protected void |
fireInfoComponentChanged(I oldInfo,
I newInfo)
Informs all
TabPaneListeners that the info component has been
replaced. |
protected void |
fireRemoved(Dockable dockable)
Informs all
TabPaneListeners that dockable
has been removed. |
protected void |
fireSelectionChanged()
Informs all
TabPaneListeners that the selection changed. |
DockController |
getController()
Gets the
DockController this pane is associated with. |
Dockable |
getDockable(int index)
Gets the
index'th element of this pane. |
int |
getDockableCount()
Gets the number of elements that are displayed on this pane.
|
Dockable[] |
getDockables()
Gets a list of all
Dockables that are stored on this pane. |
TabPlacement |
getDockTabPlacement()
Tells at which side tabs are to be displayed.
|
I |
getInfoComponent()
Gets the info component, the info component shows some additional
information.
|
TabLayoutManager |
getLayoutManager()
Gets the layout manager that is currently used to layout the contents
of this pane.
|
M |
getMenu(Dockable dockable)
Gets the menu on which
dockable is shown. |
List<M> |
getMenuList()
Gets a list of all the menus of this pane, includes visible and
invisible menus
|
TabMenu[] |
getMenus()
Gets all the menus of this pane, visible and invisible
|
Dimension |
getMinimumSize()
Gets the minimal size required to have a big enough
TabPane.getAvailableArea() to show
all content. |
T |
getOnTab(Dockable dockable)
Gets the tab-button for
dockable, if no tab-button
for dockable exists a new button should be created. |
Dimension |
getPreferredSize()
Gets the preferred size required to have a big enough
TabPane.getAvailableArea() to show
all content. |
Dockable |
getSelectedDockable()
Gets the currently selected
Dockable on this pane (this
is the one child that is visible). |
T |
getTab(Dockable dockable)
Gets the tab that is used to display
dockable. |
Tab[] |
getTabs()
Gets all the tabs that are currently visible on this pane.
|
List<T> |
getTabsList()
Gets all known tabs of this pane, including invisible tabs.
|
T |
getVisibleTab(int index)
Gets the index'th visible tab.
|
int |
getVisibleTabCount()
Gets the number of tabs that are currently visible.
|
int |
indexOf(Dockable dockable)
Gets the index of
dockable on this pane. |
int |
indexOfVisible(Tab tab)
Returns the index of
tab following the indices of
Dockables but ignoring invisible tabs. |
void |
insert(int index,
Dockable dockable)
Adds
dockable as child to this tab-pane. |
protected TabPaneListener[] |
listeners()
Gets all the
TabPaneListeners that are known to this TabPane |
protected abstract void |
menuRemoved(M menu)
Informs this pane that
menu will never be used again and
all resources associated with menu should be freed. |
void |
move(int source,
int destination)
Moves the element at location
source to destination. |
abstract M |
newMenu()
Creates a new
TabMenu that has this as parent. |
protected abstract T |
newTab(Dockable dockable)
|
void |
putInMenu(TabMenu menu,
Dockable dockable)
Adds
dockable somewhere on menu. |
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 abstract void |
removeFromMenu(M menu,
Dockable dockable)
Removes
dockable from menu. |
protected T |
removeTab(Dockable dockable)
Removes the tab of
dockable from the internal data structure. |
void |
removeTabPaneListener(TabPaneListener listener)
Removes a listener from this pane.
|
void |
revalidate()
Called when the layout of this pane has become invalid, the default
behavior is to call
doLayout(). |
void |
setController(DockController controller)
Connects this pane with
controller. |
void |
setDockTabPlacement(TabPlacement tabPlacement)
Tells this pane where to paint the tabs.
|
void |
setInfoComponent(I info)
Sets the info component.
|
void |
setLayoutManager(TabLayoutManager layoutManager)
Sets the layout manager that will layout the contents of this pane, a
value of
null will reinstall the default layout manager. |
void |
setSelectedDockable(Dockable dockable)
Selects the child
dockable of this pane as the one visible
element. |
protected abstract void |
tabRemoved(T tab)
Informs this pane that
tab will never be used again and
all resources associated with tab should be freed. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetAvailableArea, getMinimumSize, getPreferredSize, getSelectedBounds, setSelectedBoundspublic void setController(DockController controller)
controller.controller - the realm in which this pane works, may be nullpublic DockController getController()
TabPaneDockController this pane is associated with.getController in interface TabPanenullpublic void setDockTabPlacement(TabPlacement tabPlacement)
tabPlacement - a side, not nullpublic TabPlacement getDockTabPlacement()
TabPaneTabLayoutManager, but may be ignored.getDockTabPlacement in interface TabPanenullpublic void doLayout()
TabLayoutManager
is installed.public Dimension getMinimumSize()
TabPane.getAvailableArea() to show
all content.public Dimension getPreferredSize()
TabPane.getAvailableArea() to show
all content.public void revalidate()
doLayout(). Subclasses may override to
update the layout lazily.public void addTabPaneListener(TabPaneListener listener)
TabPaneaddTabPaneListener in interface TabPanelistener - the new listenerpublic void removeTabPaneListener(TabPaneListener listener)
TabPaneremoveTabPaneListener in interface TabPanelistener - the listener to removeprotected TabPaneListener[] listeners()
TabPaneListeners that are known to this TabPaneprotected void fireSelectionChanged()
TabPaneListeners that the selection changed.protected void fireAdded(Dockable dockable)
TabPaneListeners that dockable
has been added.dockable - the new childprotected void fireRemoved(Dockable dockable)
TabPaneListeners that dockable
has been removed.dockable - the removed childprotected void fireInfoComponentChanged(I oldInfo, I newInfo)
TabPaneListeners that the info component has been
replaced.oldInfo - the old info componentnewInfo - the new info componentprotected void fireControllerChanged()
TabPaneListener that the current DockController changed.public TabLayoutManager getLayoutManager()
nullpublic void setLayoutManager(TabLayoutManager layoutManager)
null will reinstall the default layout manager.layoutManager - the new manager, may be nullpublic void insert(int index,
Dockable dockable)
dockable as child to this tab-pane.index - the index of the new childdockable - the new childpublic void move(int source,
int destination)
source to destination.source - where to find the element to movedestination - the target locationpublic void remove(int index)
index'th element of this pane.index - the index of the element to removepublic void removeAll()
public void discardComponentsAndRebuild()
public Dockable getSelectedDockable()
TabPaneDockable on this pane (this
is the one child that is visible).getSelectedDockable in interface TabPanenull unless there are no
children at allpublic void setSelectedDockable(Dockable dockable)
dockable of this pane as the one visible
element.setSelectedDockable in interface TabPanedockable - the newly selected element, can be nullpublic Dockable[] getDockables()
TabPaneDockables that are stored on this pane. The list
should be ordered.getDockables in interface TabPanenull but maybe emptypublic int getDockableCount()
public Dockable getDockable(int index)
index'th element of this pane.index - the index of an elementindexpublic int indexOf(Dockable dockable)
dockable on this pane.dockable - the element to searchdockable was not foundpublic Tab[] getTabs()
TabPanegetTabs in interface TabPanenull but maybe empty. Note
that the size of this array must be smaller or equal to the array returned
by TabPane.getDockables().public int indexOfVisible(Tab tab)
tab following the indices of
Dockables but ignoring invisible tabs.tab - the tab to searchpublic T getVisibleTab(int index)
index - the index of some visible tabnull if index
is too big.IllegalArgumentException - if index is smaller than 0.indexOfVisible(Tab)public int getVisibleTabCount()
getVisibleTab(int)public List<T> getTabsList()
public T getTab(Dockable dockable)
dockable.dockable - the element to searchnullpublic T putOnTab(Dockable dockable)
TabPanedockable 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.public T getOnTab(Dockable dockable)
TabPanedockable, 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.public void setInfoComponent(I info)
info - the new component, can be nullgetInfoComponent()public I getInfoComponent()
TabPanegetInfoComponent in interface TabPanenullpublic List<M> getMenuList()
public TabMenu[] getMenus()
public M getMenu(Dockable dockable)
dockable is shown.dockable - some child of this panenullpublic void putInMenu(TabMenu menu, Dockable dockable)
TabPanedockable somewhere on menu. If dockable
is already shown on another menu or Tab, then it has to
be removed from that other menu or tab.putInMenu in interface TabPanemenu - a menu created by this TabPanedockable - some child of thisTabPane.putOnTab(Dockable)public TabMenu createMenu()
TabPanecreateMenu in interface TabPanepublic void destroyMenu(TabMenu menu)
TabPanemenu which was created by
this pane.destroyMenu in interface TabPanemenu - a menu to destroyprotected abstract void addToMenu(M menu, Dockable dockable)
dockable somewhere to menumenu - a menu of this panedockable - a new child of menuprotected abstract void removeFromMenu(M menu, Dockable dockable)
dockable from menu.menu - some menu of this panedockable - a child of menuprotected T putTab(Dockable dockable, T tab)
tab with dockable. this method
modifies the internal data structure in order to store the change.dockable - the key for the tab-maptab - the value for the tab-mapdockableprotected T removeTab(Dockable dockable)
dockable from the internal data structure.dockable - the key of the element to be removed from the tab-mapprotected void clearTabs()
protected abstract T newTab(Dockable dockable)
Tab that has this as parent and
represents dockable. The new tab should not be stored in
any collection.dockable - the element for which a new tab is requiredpublic abstract M newMenu()
TabMenu that has this as parent.protected abstract void tabRemoved(T tab)
tab will never be used again and
all resources associated with tab should be freed. This
method is only called if tab is invisible.tab - the tab to destroyprotected abstract void menuRemoved(M menu)
menu will never be used again and
all resources associated with menu should be freed. This
method is only called if menu is invisible.menu - the destroyed menuCopyright © 2017 Docking Frames. All rights reserved.