|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object bibliothek.gui.dock.station.stack.tab.AbstractTabPane<T,M,I>
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>
An abstract implementation of TabPane
. This class handles creation,
storage and destruction of Tab
s and TabMenu
s, it also stores
a list of currently visible Dockable
s.
Subclasses should call setController(DockController)
to make sure
this pane can use all available information.
Field Summary |
---|
Fields inherited from interface bibliothek.gui.dock.station.stack.tab.TabPane |
---|
LAYOUT_MANAGER |
Constructor Summary | |
---|---|
AbstractTabPane()
|
Method Summary | |
---|---|
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 |
TabMenu |
createMenu()
Creates a new menu for this pane. |
void |
destroyMenu(TabMenu menu)
Destroys menu which was created by
this pane. |
void |
discardComponentsAndRebuild()
Deletes all Tab s and TabMenu s of this TabPane
and rebuilds them. |
void |
doLayout()
Updates the layout of this pane, assuming a TabLayoutManager
is installed. |
protected void |
fireAdded(Dockable dockable)
Informs all TabPaneListener s that dockable
has been added. |
protected void |
fireInfoComponentChanged(I oldInfo,
I newInfo)
Informs all TabPaneListener s that the info component has been
replaced. |
protected void |
fireRemoved(Dockable dockable)
Informs all TabPaneListener s that dockable
has been removed. |
protected void |
fireSelectionChanged()
Informs all TabPaneListener s 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 Dockable s that onto this pane. |
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 that TabPane.getAvailableArea() should return. |
Tab |
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 that TabPane.getAvailableArea() should return. |
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 . |
TabPlacement |
getTabPlacement()
Tells at which side tabs are to be displayed. |
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 TabPaneListener s 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)
Creates a new Tab that has this as parent and
represents 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. |
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 . |
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 |
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. |
void |
setTabPlacement(TabPlacement tabPlacement)
Tells this pane where to paint the tabs. |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface bibliothek.gui.dock.station.stack.tab.TabPane |
---|
getAvailableArea, getSelectedBounds, setSelectedBounds |
Constructor Detail |
---|
public AbstractTabPane()
Method Detail |
---|
public void setController(DockController controller)
controller
.
controller
- the realm in which this pane works, may be null
public DockController getController()
TabPane
DockController
this pane is associated with.
getController
in interface TabPane
null
public void setTabPlacement(TabPlacement tabPlacement)
tabPlacement
- a side, not null
public TabPlacement getTabPlacement()
TabPane
TabLayoutManager
, but may be ignored.
getTabPlacement
in interface TabPane
null
public void doLayout()
TabLayoutManager
is installed.
public Dimension getMinimumSize()
TabPane.getAvailableArea()
should return.
public Dimension getPreferredSize()
TabPane.getAvailableArea()
should return.
public void revalidate()
doLayout()
. Subclasses may override to
update the layout lazily.
public void addTabPaneListener(TabPaneListener listener)
TabPane
addTabPaneListener
in interface TabPane
listener
- the new listenerpublic void removeTabPaneListener(TabPaneListener listener)
TabPane
removeTabPaneListener
in interface TabPane
listener
- the listener to removeprotected TabPaneListener[] listeners()
TabPaneListener
s that are known to this TabPane
protected void fireSelectionChanged()
TabPaneListener
s that the selection changed.
protected void fireAdded(Dockable dockable)
TabPaneListener
s that dockable
has been added.
dockable
- the new childprotected void fireRemoved(Dockable dockable)
TabPaneListener
s that dockable
has been removed.
dockable
- the removed childprotected void fireInfoComponentChanged(I oldInfo, I newInfo)
TabPaneListener
s that the info component has been
replaced.
oldInfo
- the old info componentnewInfo
- the new info componentpublic TabLayoutManager getLayoutManager()
null
public void setLayoutManager(TabLayoutManager layoutManager)
null
will reinstall the default layout manager.
layoutManager
- the new manager, may be null
public 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()
Tab
s and TabMenu
s of this TabPane
and rebuilds them.
public Dockable getSelectedDockable()
TabPane
Dockable
on this pane (this
is the one child that is visible).
getSelectedDockable
in interface TabPane
null
unless there are no
children at allpublic void setSelectedDockable(Dockable dockable)
dockable
of this pane as the one visible
element.
dockable
- the newly selected element, can be null
public Dockable[] getDockables()
TabPane
Dockable
s that onto this pane. The list
should be ordered.
getDockables
in interface TabPane
null
but maybe emptypublic int getDockableCount()
public Dockable getDockable(int index)
index
'th element of this pane.
index
- the index of an element
index
public int indexOf(Dockable dockable)
dockable
on this pane.
dockable
- the element to search
dockable
was not foundpublic Tab[] getTabs()
TabPane
getTabs
in interface TabPane
null
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 search
public T getVisibleTab(int index)
index
- the index of some visible tab
null
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 search
null
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
dockable
- the element which needs a tab-button
Tab
that is only used for dockable
public Tab 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
dockable
- the element whose tab is requested
dockable
public void setInfoComponent(I info)
info
- the new component, can be null
getInfoComponent()
public I getInfoComponent()
TabPane
getInfoComponent
in interface TabPane
null
public List<M> getMenuList()
public TabMenu[] getMenus()
public M getMenu(Dockable dockable)
dockable
is shown.
dockable
- some child of this pane
null
public void putInMenu(TabMenu menu, Dockable dockable)
TabPane
dockable
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 TabPane
menu
- a menu created by this TabPane
dockable
- some child of thisTabPane.putOnTab(Dockable)
public TabMenu createMenu()
TabPane
createMenu
in interface TabPane
public void destroyMenu(TabMenu menu)
TabPane
menu
which was created
by
this pane.
destroyMenu
in interface TabPane
menu
- a menu to destroyprotected abstract void addToMenu(M menu, Dockable dockable)
dockable
somewhere to menu
menu
- a menu of this panedockable
- a new child of menu
protected abstract void removeFromMenu(M menu, Dockable dockable)
dockable
from menu
.
menu
- some menu of this panedockable
- a child of menu
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 required
public 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 menu
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |