bibliothek.gui.dock.station.stack
Interface StackDockComponent

All Known Implementing Classes:
BasicStackDockComponent, BubbleStackDockComponent, CombinedStackDockComponent, DefaultStackDockComponent, EclipseDockableDisplayer, EclipseTabPane, FlatTabPane

public interface StackDockComponent

A StackDockComponent is a Component that can show other Components. StackDockComponents are used by StackDockStations to display their children.
The component has one child which is "selected" (assuming there is at least one child). This one child should be visible, the other children should be hidden. The user must have an interface to change the selection at any time.
A StackDockComponent should respect the side at which the tabs are to be placed.

Author:
Janni Kovacs, Benjamin Sigg
See Also:
StackDockStation, DefaultStackDockComponent, JTabbedPane

Method Summary
 void addStackDockComponentListener(StackDockComponentListener listener)
          Adds a listener to this component, it will be called if the selection changes.
 void addTab(String title, Icon icon, Component comp, Dockable dockable)
          Adds a new child at an unspecified location.
 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.
 Rectangle getBoundsAt(int index)
          Gets the location and size of the graphical element that allows the user to select the index'th child.
 Component getComponent()
          Gets a Component on which the children of this StackDockComponent will be displayed.
 Dockable getDockableAt(int index)
          Gets the Dockable which was placed at the index'th position.
 TabPlacement getDockTabPlacement()
          Tells at which side tabs should be displayer.
 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.
 boolean hasBorder()
          Whether this kind of component already has a border.
 void insertTab(String title, Icon icon, Component comp, Dockable dockable, int index)
          Adds a new child at the location index.
 boolean isSingleTabComponent()
          Tells whether this StackDockComponent should be shown even if the StackDockStation has only one child.
 void moveTab(int source, int destination)
          Moves the tab at source to location destination.
 void remove(int index)
          Removes the child at location index.
 void removeAll()
          Removes all children from this component
 void removeStackDockComponentListener(StackDockComponentListener listener)
          Removes listener from this component.
 void setComponentAt(int index, Component component)
          Sets the component which should be shown at tab index.
 void setController(DockController controller)
          Sets the controller for which this component manages its children.
 void setDockTabPlacement(TabPlacement tabSide)
          Sets at which side tabs should be displayed.
 void setIconAt(int index, Icon newIcon)
          Sets the icon of the child at location index.
 void setSelectedIndex(int index)
          Selects the component at location index.
 void setTitleAt(int index, String newTitle)
          Sets the title of the child at location index.
 void setTooltipAt(int index, String newTooltip)
          Sets the tooltip of the child at location index.
 

Method Detail

addStackDockComponentListener

void addStackDockComponentListener(StackDockComponentListener listener)
Adds a listener to this component, it will be called if the selection changes.

Parameters:
listener - the new listener, not null

removeStackDockComponentListener

void removeStackDockComponentListener(StackDockComponentListener listener)
Removes listener from this component.

Parameters:
listener - the listener to remove

getSelectedIndex

int getSelectedIndex()
Gets the index of the currently selected dockable

Returns:
the index

setSelectedIndex

void setSelectedIndex(int index)
Selects the component at location index.

Parameters:
index - the index of the selected component

getBoundsAt

Rectangle getBoundsAt(int index)
Gets the location and size of the graphical element that allows the user to select the index'th child.

Parameters:
index - the index of the child
Returns:
the bounds of the graphical selection-element, null if the element is not directly visible

addTab

void addTab(String title,
            Icon icon,
            Component comp,
            Dockable dockable)
Adds a new child at an unspecified location.

Parameters:
title - the title of the child
icon - an icon to display for the child or null
comp - the new child to display
dockable - the Dockable for which the tab is used

moveTab

void moveTab(int source,
             int destination)
Moves the tab at source to location destination.

Parameters:
source - the item to move
destination - the target destination

insertTab

void insertTab(String title,
               Icon icon,
               Component comp,
               Dockable dockable,
               int index)
Adds a new child at the location index.

Parameters:
title - the title of the child
icon - an icon to display for the child or null
comp - the new child to display
dockable - the Dockable for which the tab is used
index - the index that the new child should have

getTabCount

int getTabCount()
Gets the number of children that are added to this StackDockComponent.

Returns:
the number of children

getDockableAt

Dockable getDockableAt(int index)
Gets the Dockable which was placed at the index'th position.

Parameters:
index - the position of the element
Returns:
the element

getTabAt

DockElementRepresentative getTabAt(int index)
Gets an element representing the tab of the Dockable at index.

Parameters:
index - the index of some child of this stack
Returns:
the tab or null if no tab exists or tabs cannot be used as DockElementRepresentatives

removeAll

void removeAll()
Removes all children from this component


remove

void remove(int index)
Removes the child at location index.

Parameters:
index - the index of the child

setTitleAt

void setTitleAt(int index,
                String newTitle)
Sets the title of the child at location index.

Parameters:
index - the index of the child
newTitle - the new title

setTooltipAt

void setTooltipAt(int index,
                  String newTooltip)
Sets the tooltip of the child at location index.

Parameters:
index - the index of the child
newTooltip - the new tooltip, can be null

setIconAt

void setIconAt(int index,
               Icon newIcon)
Sets the icon of the child at location index.

Parameters:
index - the index of the child
newIcon - the new icon, null if no icon should be displayed

setComponentAt

void setComponentAt(int index,
                    Component component)
Sets the component which should be shown at tab index.

Parameters:
index - the index where to show component
component - the new content, not null

setDockTabPlacement

void setDockTabPlacement(TabPlacement tabSide)
Sets at which side tabs should be displayed.

Parameters:
tabSide - the side, not null

getDockTabPlacement

TabPlacement getDockTabPlacement()
Tells at which side tabs should be displayer.

Returns:
the placement, not null
See Also:
setDockTabPlacement(TabPlacement)

getComponent

Component getComponent()
Gets a Component on which the children of this StackDockComponent will be displayed.

Returns:
the Component

setController

void setController(DockController controller)
Sets the controller for which this component manages its children.

Parameters:
controller - the controller or null

hasBorder

boolean hasBorder()
Whether this kind of component already has a border.

Returns:
true if this has a border, false if the parent should paint one.

isSingleTabComponent

boolean isSingleTabComponent()
Tells whether this StackDockComponent should be shown even if the StackDockStation has only one child.

Returns:
true if this component should always be shown

createDefaultRepresentation

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.

Parameters:
target - the target for the new representative, may or may not be a child of this component, not null
Returns:
the new representation, can be null if this StackDockComponent does not allow to use its free spaces