bibliothek.gui.dock.station.stack
Class CombinedStackDockComponent<C extends CombinedTab>

java.lang.Object
  extended by bibliothek.gui.dock.station.stack.CombinedStackDockComponent<C>
Type Parameters:
C - the type of the tabs
All Implemented Interfaces:
StackDockComponent
Direct Known Subclasses:
BubbleStackDockComponent, FlatTab

public abstract class CombinedStackDockComponent<C extends CombinedTab>
extends Object
implements StackDockComponent

A StackDockComponent which is a combination of other components.

Author:
Benjamin Sigg

Constructor Summary
CombinedStackDockComponent()
          Constructs a new FlatTab
 
Method Summary
 void addChangeListener(ChangeListener listener)
          Adds a ChangeListener to this component.
 void addTab(String title, Icon icon, Component comp, Dockable dockable)
          Adds a new child at an unspecified location.
protected abstract  C createTab(Dockable dockable)
          Creates a new tab which will be shown on this component.
protected abstract  void destroy(C tab)
          Deletes a tab that was earlier created by #createTab().
protected  void fireStateChange()
          Sends a ChangeEvent to all registered ChangeListeners
 Rectangle getBoundsAt(int index)
          Gets the location and size of the graphical element that allows the user to select the index'th child.
 JComponent getComponent()
          Gets a Component on which the children of this StackDockComponent will be displayed.
 DockController getController()
          Gets the controller for which this component renders its content.
 int getSelectedIndex()
          Gets the index of the currently selected component
 C getTab(int index)
          Gets the index'th tab of this component.
 int getTabCount()
          Gets the number of children that are added to this StackDockComponent.
 void insertTab(String title, Icon icon, Component comp, Dockable dockable, int index)
          Adds a new child at the location index.
 void remove(int index)
          Removes the child at location index.
 void removeAll()
          Removes all children from this component
 void removeChangeListener(ChangeListener listener)
          Removes a ChangeListener which was added earlier.
 void setController(DockController controller)
          Sets the controller for which this component manages its children.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CombinedStackDockComponent

public CombinedStackDockComponent()
Constructs a new FlatTab

Method Detail

setController

public void setController(DockController controller)
Description copied from interface: StackDockComponent
Sets the controller for which this component manages its children.

Specified by:
setController in interface StackDockComponent
Parameters:
controller - the controller or null

getController

public DockController getController()
Gets the controller for which this component renders its content.

Returns:
the indirect owner of this component

getTab

public C getTab(int index)
Gets the index'th tab of this component.

Parameters:
index - the index of the tab
Returns:
the tab

createTab

protected abstract C createTab(Dockable dockable)
Creates a new tab which will be shown on this component.

Parameters:
dockable - the Dockable for which the tab will be used
Returns:
the new tab

destroy

protected abstract void destroy(C tab)
Deletes a tab that was earlier created by #createTab().

Parameters:
tab - the tab which is no longer needed

addChangeListener

public void addChangeListener(ChangeListener listener)
Description copied from interface: StackDockComponent
Adds a ChangeListener to this component. The listener will be called when the selected component changes.

Specified by:
addChangeListener in interface StackDockComponent
Parameters:
listener - the new listener

removeChangeListener

public void removeChangeListener(ChangeListener listener)
Description copied from interface: StackDockComponent
Removes a ChangeListener which was added earlier.

Specified by:
removeChangeListener in interface StackDockComponent
Parameters:
listener - the listener to remove

fireStateChange

protected void fireStateChange()
Sends a ChangeEvent to all registered ChangeListeners


getSelectedIndex

public int getSelectedIndex()
Description copied from interface: StackDockComponent
Gets the index of the currently selected component

Specified by:
getSelectedIndex in interface StackDockComponent
Returns:
the index

setSelectedIndex

public void setSelectedIndex(int index)
Description copied from interface: StackDockComponent
Selects the component at location index.

Specified by:
setSelectedIndex in interface StackDockComponent
Parameters:
index - the index of the selected component

getBoundsAt

public Rectangle getBoundsAt(int index)
Description copied from interface: StackDockComponent
Gets the location and size of the graphical element that allows the user to select the index'th child.

Specified by:
getBoundsAt in interface StackDockComponent
Parameters:
index - the index of the child
Returns:
the bounds of the graphical selection-element

addTab

public void addTab(String title,
                   Icon icon,
                   Component comp,
                   Dockable dockable)
Description copied from interface: StackDockComponent
Adds a new child at an unspecified location.

Specified by:
addTab in interface StackDockComponent
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

insertTab

public void insertTab(String title,
                      Icon icon,
                      Component comp,
                      Dockable dockable,
                      int index)
Description copied from interface: StackDockComponent
Adds a new child at the location index.

Specified by:
insertTab in interface StackDockComponent
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

public int getTabCount()
Description copied from interface: StackDockComponent
Gets the number of children that are added to this StackDockComponent.

Specified by:
getTabCount in interface StackDockComponent
Returns:
the number of children

removeAll

public void removeAll()
Description copied from interface: StackDockComponent
Removes all children from this component

Specified by:
removeAll in interface StackDockComponent

remove

public void remove(int index)
Description copied from interface: StackDockComponent
Removes the child at location index.

Specified by:
remove in interface StackDockComponent
Parameters:
index - the index of the child

setTitleAt

public void setTitleAt(int index,
                       String newTitle)
Description copied from interface: StackDockComponent
Sets the title of the child at location index.

Specified by:
setTitleAt in interface StackDockComponent
Parameters:
index - the index of the child
newTitle - the new title

setIconAt

public void setIconAt(int index,
                      Icon newIcon)
Description copied from interface: StackDockComponent
Sets the icon of the child at location index.

Specified by:
setIconAt in interface StackDockComponent
Parameters:
index - the index of the child
newIcon - the new icon, null if no icon should be displayed

getComponent

public JComponent getComponent()
Description copied from interface: StackDockComponent
Gets a Component on which the children of this StackDockComponent will be displayed.

Specified by:
getComponent in interface StackDockComponent
Returns:
the Component