bibliothek.gui.dock.station.stack.tab
Class AbstractTab

java.lang.Object
  extended by bibliothek.gui.dock.station.stack.tab.AbstractTabPaneComponent
      extended by bibliothek.gui.dock.station.stack.tab.AbstractTab
All Implemented Interfaces:
Tab, TabPaneComponent
Direct Known Subclasses:
EclipseTab

public abstract class AbstractTab
extends AbstractTabPaneComponent
implements Tab

Abstract implemention of Tab based on a real Component. Clients should call bind(), unbind() and setController(DockController) to fully utilize this class.

Author:
Benjamin Sigg

Constructor Summary
AbstractTab(TabPane parent, Dockable dockable)
          Creates a new abstract tab.
 
Method Summary
 void bind()
          Connects this tab with its parent and the DockController.
 Dockable getDockable()
          Gets the element that is associated with this tab.
 Dimension getMinimumSize(Tab[] tabs)
          Gets the minimum size of this tab under the assumption that this tab is displayed together with tabs.
 Dimension getPreferredSize(Tab[] tabs)
          Gets the preferred size of this tab under the assumption that this tab is displayed together with tabs.
protected abstract  void informFocusChanged(boolean focused)
          Called when the focus state of this tab has been changed.
protected abstract  void informSelectionChanged(boolean selected)
          Called when the selection state of this tab has been changed.
 boolean isFocused()
          Tells whether this tab is focused.
 boolean isSelected()
          Tells whether this tab is selected.
 void setController(DockController controller)
          Sets the controller in whose realm this AbstractTab works.
 void unbind()
          Disconnects this tab from its parent and from the DockController.
 
Methods inherited from class bibliothek.gui.dock.station.stack.tab.AbstractTabPaneComponent
getBounds, getComponent, getMaximumSize, getMinimumSize, getOrientation, getOverlap, getPreferredSize, getTabParent, setBounds, setOrientation
 
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.TabPaneComponent
getBounds, getMaximumSize, getMinimumSize, getOverlap, getPreferredSize, getTabParent, getZOrder, isPaneVisible, setBounds, setOrientation, setPaneVisible, setZOrder
 

Constructor Detail

AbstractTab

public AbstractTab(TabPane parent,
                   Dockable dockable)
Creates a new abstract tab.

Parameters:
parent - the owner of this tab
dockable - the element to show, not null
Method Detail

getDockable

public Dockable getDockable()
Description copied from interface: Tab
Gets the element that is associated with this tab.

Specified by:
getDockable in interface Tab
Returns:
the element

getMinimumSize

public Dimension getMinimumSize(Tab[] tabs)
Description copied from interface: Tab
Gets the minimum size of this tab under the assumption that this tab is displayed together with tabs.

Specified by:
getMinimumSize in interface Tab
Parameters:
tabs - the displayed tabs, exactly one entry is this and no entry is null
Returns:
the minimum size of this tab

getPreferredSize

public Dimension getPreferredSize(Tab[] tabs)
Description copied from interface: Tab
Gets the preferred size of this tab under the assumption that this tab is displayed together with tabs.

Specified by:
getPreferredSize in interface Tab
Parameters:
tabs - the displayed tabs, exactly one entry is this and no entry is null
Returns:
the preferred size of this tab

bind

public void bind()
Connects this tab with its parent and the DockController.

Throws:
IllegalStateException - if this method has already been invoked

unbind

public void unbind()
Disconnects this tab from its parent and from the DockController.

Throws:
IllegalStateException - if this method has already been invoked.

isSelected

public boolean isSelected()
Tells whether this tab is selected. This property is updated a TabPaneListener and might not be the correct value while a selection changes.

Returns:
whether this tab is selected

informSelectionChanged

protected abstract void informSelectionChanged(boolean selected)
Called when the selection state of this tab has been changed. Subclasses may choose to ignore the event.

Parameters:
selected - the new selection state

isFocused

public boolean isFocused()
Tells whether this tab is focused. A tab is focused if its Dockable is focused. This property is updated by a DockableFocusListener, hence it might not be accurate while the focus changes.

Returns:
whether this tab is focused

informFocusChanged

protected abstract void informFocusChanged(boolean focused)
Called when the focus state of this tab has been changed. Subclasses may choose to ignore the event.

Parameters:
focused - the new focus state

setController

public void setController(DockController controller)
Sets the controller in whose realm this AbstractTab works.

Parameters:
controller - the controller