bibliothek.gui.dock.station.stack.tab
Interface TabPane

All Known Implementing Classes:
AbstractTabPane, BubbleStackDockComponent, CombinedStackDockComponent, EclipseTabPane, FlatTabPane

public interface TabPane

A TabPane is a view onto some component that shows a set of Dockables. Only one Dockable is visible at any time, the others are hidden behind the visible Dockable. The user can select the visible Dockable by clicking onto some button (called a "tab"). There is always one or none button per Dockable.
TabPane can be seen as an extension of StackDockComponent providing more control over the content of the component.

Author:
Benjamin Sigg

Field Summary
static PropertyKey<TabLayoutManager> LAYOUT_MANAGER
          The layout manager used by any TabPane to set the boundaries of its children.
static PropertyKey<Boolean> USE_SMALL_MINIMUM_SIZE
          When calculating the minimum size of a TabPane, then prefer using really small minimum sizes over showing the content correctly.
 
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.
 TabMenu createMenu()
          Creates a new menu for this pane.
 void destroyMenu(TabMenu menu)
          Destroys menu which was created by this pane.
 Rectangle getAvailableArea()
          Gets the area in which all the Tabs, TabMenus and the visible Dockable (setSelectedBounds(Rectangle)) must find their place.
 DockController getController()
          Gets the DockController this pane is associated with.
 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.
 LonelyTabPaneComponent getInfoComponent()
          Gets the info component, the info component shows some additional information.
 Dimension getMinimumSize(Dockable dockable)
          Gets the minimum size that is required to show the child dockable.
 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(Dockable dockable)
          Gets the preferred size that is required to show the child dockable.
 Rectangle getSelectedBounds()
          Gets the boundaries the selected Dockable has (independent of whether such a Dockable exists).
 Dockable getSelectedDockable()
          Gets the currently selected Dockable on this pane (this is the one child that is visible).
 Tab[] getTabs()
          Gets all the tabs that are currently visible on this pane.
 void putInMenu(TabMenu menu, Dockable dockable)
          Adds dockable somewhere on menu.
 Tab putOnTab(Dockable dockable)
          Informs this pane that its child dockable should have a tab-button.
 void removeTabPaneListener(TabPaneListener listener)
          Removes a listener from this pane.
 void setSelectedBounds(Rectangle bounds)
          Sets the boundaries of the selected Dockable.
 void setSelectedDockable(Dockable dockable)
          Sets the dockable which is current selected on this pane.
 

Field Detail

LAYOUT_MANAGER

static final PropertyKey<TabLayoutManager> LAYOUT_MANAGER
The layout manager used by any TabPane to set the boundaries of its children.


USE_SMALL_MINIMUM_SIZE

static final PropertyKey<Boolean> USE_SMALL_MINIMUM_SIZE
When calculating the minimum size of a TabPane, then prefer using really small minimum sizes over showing the content correctly.

Method Detail

addTabPaneListener

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.

Parameters:
listener - the new listener

removeTabPaneListener

void removeTabPaneListener(TabPaneListener listener)
Removes a listener from this pane.

Parameters:
listener - the listener to remove

getController

DockController getController()
Gets the DockController this pane is associated with.

Returns:
the controller, might be null

getDockables

Dockable[] getDockables()
Gets a list of all Dockables that are stored on this pane. The list should be ordered.

Returns:
the list of children, not null but maybe empty

getMinimumSize

Dimension getMinimumSize(Dockable dockable)
Gets the minimum size that is required to show the child dockable.

Parameters:
dockable - one of the children of this pane
Returns:
the minimum size required to show dockable

getPreferredSize

Dimension getPreferredSize(Dockable dockable)
Gets the preferred size that is required to show the child dockable.

Parameters:
dockable - one of the children of this pane
Returns:
the preferred size required to show dockable

getSelectedDockable

Dockable getSelectedDockable()
Gets the currently selected Dockable on this pane (this is the one child that is visible).

Returns:
the selection, not null unless there are no children at all

setSelectedDockable

void setSelectedDockable(Dockable dockable)
Sets the dockable which is current selected on this pane. Must be called with a Dockable that is already a child of this pane.

Parameters:
dockable - the newly selected dockable

getDockTabPlacement

TabPlacement getDockTabPlacement()
Tells at which side tabs are to be displayed. This property is intended for a TabLayoutManager, but may be ignored.

Returns:
the side, not null

getTabs

Tab[] getTabs()
Gets all the tabs that are currently visible on this pane.

Returns:
the current tabs, not null but maybe empty. Note that the size of this array must be smaller or equal to the array returned by getDockables().

putOnTab

Tab putOnTab(Dockable dockable)
Informs this pane that its child 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.
If dockable already is on a tab then this tab should be reused.

Parameters:
dockable - the element which needs a tab-button
Returns:
a Tab that is only used for dockable
Throws:
IllegalArgumentException - if dockable is either null or not child of this pane

getOnTab

Tab getOnTab(Dockable dockable)
Gets the tab-button for dockable, if no tab-button for dockable exists a new button should be created. Reusing existing tabs is recommended. Other than putOnTab(Dockable) this method must not affect any TabMenu showing Dockable.

Parameters:
dockable - the element whose tab is requested
Returns:
the tab matching dockable

createMenu

TabMenu createMenu()
Creates a new menu for this pane.

Returns:
the new menu

destroyMenu

void destroyMenu(TabMenu menu)
Destroys menu which was created by this pane.

Parameters:
menu - a menu to destroy

putInMenu

void putInMenu(TabMenu menu,
               Dockable dockable)
Adds 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.

Parameters:
menu - a menu created by this TabPane
dockable - some child of this
See Also:
putOnTab(Dockable)

getAvailableArea

Rectangle getAvailableArea()
Gets the area in which all the Tabs, TabMenus and the visible Dockable (setSelectedBounds(Rectangle)) must find their place.

Returns:
the available space, has at least width and height 1.

getSelectedBounds

Rectangle getSelectedBounds()
Gets the boundaries the selected Dockable has (independent of whether such a Dockable exists).

Returns:
the boundaries of the selected child, not null

setSelectedBounds

void setSelectedBounds(Rectangle bounds)
Sets the boundaries of the selected Dockable.

Parameters:
bounds - the boundaries of the selected child
Throws:
IllegalArgumentException - if bounds is null

getInfoComponent

LonelyTabPaneComponent getInfoComponent()
Gets the info component, the info component shows some additional information. E.g. the info component may show information about the current selection.

Returns:
Gets the current info component, may be null