bibliothek.extension.gui.dock.theme.eclipse.stack
Class EclipseTab

java.lang.Object
  extended by bibliothek.gui.dock.station.stack.tab.AbstractTabPaneComponent
      extended by bibliothek.gui.dock.station.stack.tab.AbstractTab
          extended by bibliothek.extension.gui.dock.theme.eclipse.stack.EclipseTab
All Implemented Interfaces:
DockElementRepresentative, CombinedTab, Tab, TabPaneComponent

public class EclipseTab
extends AbstractTab
implements CombinedTab

A wrapper around a TabComponent allowing to use the TabComponent also as CombinedTab.

Author:
Benjamin Sigg

Constructor Summary
EclipseTab(EclipseTabPane parent, Dockable dockable, TabComponent delegate)
          Creates a new tab.
 
Method Summary
 void addMouseInputListener(MouseInputListener listener)
          Adds a listener to this representative, it is not defined what to do with that listener, but most subclasses would just add the listener to their component.
 void bind()
          Adds observers to parent and DockController to keep the user interface up to date.
 Component getComponent()
          Gets the Component which is wrapped into this AbstractTabPaneComponent.
 DockElement getElement()
          Gets the element which is represented by this.
 Dimension getMinimumSize(Tab[] tabs)
          Gets the minimum size of this tab under the assumption that this tab is displayed together with tabs.
 Insets getOverlap(TabPaneComponent other)
          Tells how much of this component may be overlapped by another component other.
 Point getPopupLocation(Point click, boolean popupTrigger)
          Tells whether a popup menu should be opened when the user clicks at click with the mouse.
 Dimension getPreferredSize(Tab[] tabs)
          Gets the preferred size of this tab under the assumption that this tab is displayed together with tabs.
 TabComponent getTabComponent()
          Gets the TabComponent which is shown on this tab.
 int getZOrder()
          Gets the value of the z order.
protected  void informFocusChanged(boolean focused)
          Called when the focus state of this tab has been changed.
protected  void informSelectionChanged(boolean selected)
          Called when the selection state of this tab has been changed.
 boolean isPaneVisible()
          Tells whether this component is visible or not.
 boolean isUsedAsTitle()
          Tells whether this DockElementRepresentative is used as title.
Some modules grant more rights to titles than to non-titles, i.e.
 void removeMouseInputListener(MouseInputListener listener)
          Removes a listener from this representative.
 void setConfiguration(TabConfiguration configuration)
          Fine tunes this tab.
 void setEnabled(boolean enabled)
          Enables or disables this tab.
 void setIcon(Icon icon)
          Sets the image of this tab.
 void setOrientation(TabPlacement orientation)
          Tells this component how to paint itself.
 void setPaintIconWhenInactive(boolean paint)
          Tells this tab to paint icons when not selected.
 void setPaneVisible(boolean visible)
          Changes the visibility state of this component.
 void setText(String text)
          Sets the text of this tab.
 void setTooltip(String tooltip)
          Sets the tooltip of this tab.
 void setZOrder(int order)
          Sets the z order of this component.
 boolean shouldFocus()
          Tells whether a click onto this component should transfer the focus either to this component or to the Dockable.
 boolean shouldTransfersFocus()
          Tells whether a click onto this component should transfer the focus to the Dockable or not.
 String toString()
           
 void unbind()
          Removes observers from parent and DockController.
 
Methods inherited from class bibliothek.gui.dock.station.stack.tab.AbstractTab
getDockable, isFocused, isSelected, setController
 
Methods inherited from class bibliothek.gui.dock.station.stack.tab.AbstractTabPaneComponent
getBounds, getMaximumSize, getMinimumSize, getOrientation, getPreferredSize, getTabParent, setBounds
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface bibliothek.gui.dock.station.stack.tab.Tab
getDockable
 
Methods inherited from interface bibliothek.gui.dock.station.stack.tab.TabPaneComponent
getBounds, getMaximumSize, getMinimumSize, getPreferredSize, getTabParent, setBounds
 

Constructor Detail

EclipseTab

public EclipseTab(EclipseTabPane parent,
                  Dockable dockable,
                  TabComponent delegate)
Creates a new tab.

Parameters:
parent - the owner of this tab.
dockable - the element associated with this tab.
delegate - the real TabComponent
Method Detail

setConfiguration

public void setConfiguration(TabConfiguration configuration)
Description copied from interface: CombinedTab
Fine tunes this tab.

Specified by:
setConfiguration in interface CombinedTab
Parameters:
configuration - the new configuration to use
See Also:
CombinedStackDockComponent.getConfiguration(bibliothek.gui.Dockable)

getComponent

public Component getComponent()
Description copied from class: AbstractTabPaneComponent
Gets the Component which is wrapped into this AbstractTabPaneComponent. This method is not called from the constructor.

Specified by:
getComponent in interface DockElementRepresentative
Specified by:
getComponent in interface CombinedTab
Specified by:
getComponent in class AbstractTabPaneComponent
Returns:
the wrapped Component, not null

getTabComponent

public TabComponent getTabComponent()
Gets the TabComponent which is shown on this tab.

Returns:
the component

setPaneVisible

public void setPaneVisible(boolean visible)
Description copied from interface: TabPaneComponent
Changes the visibility state of this component. Invisible components should be removed from any parent.

Specified by:
setPaneVisible in interface TabPaneComponent
Parameters:
visible - the new state

isPaneVisible

public boolean isPaneVisible()
Description copied from interface: TabPaneComponent
Tells whether this component is visible or not.

Specified by:
isPaneVisible in interface TabPaneComponent
Returns:
true if visible, false otherwise

setZOrder

public void setZOrder(int order)
Description copied from interface: TabPaneComponent
Sets the z order of this component. The z order tells which component to paint first, as lower the order as earlier a component is to be painted. If two components overlap, then the one with the higher z order appears in front of the one with the lower z order. If two components have the same z order, then it is unspecified which component is painted first.
A z-order is at least 0 and must not exceed the number of TabPaneComponents on the parent TabPane. The implementation may increase or decrease z-orders to prevent collisions between components with the same order.

Specified by:
setZOrder in interface TabPaneComponent
Parameters:
order - the order, can be any integer.

getZOrder

public int getZOrder()
Description copied from interface: TabPaneComponent
Gets the value of the z order.

Specified by:
getZOrder in interface TabPaneComponent
Returns:
the z order
See Also:
TabPaneComponent.setZOrder(int)

setIcon

public void setIcon(Icon icon)
Description copied from interface: CombinedTab
Sets the image of this tab.

Specified by:
setIcon in interface CombinedTab
Parameters:
icon - an icon that should be shown, can be null

setText

public void setText(String text)
Description copied from interface: CombinedTab
Sets the text of this tab.

Specified by:
setText in interface CombinedTab
Parameters:
text - the text to display

setTooltip

public void setTooltip(String tooltip)
Description copied from interface: CombinedTab
Sets the tooltip of this tab.

Specified by:
setTooltip in interface CombinedTab
Parameters:
tooltip - the tooltip text, can be null

setOrientation

public void setOrientation(TabPlacement orientation)
Description copied from interface: TabPaneComponent
Tells this component how to paint itself.

Specified by:
setOrientation in interface TabPaneComponent
Overrides:
setOrientation in class AbstractTabPaneComponent
Parameters:
orientation - the orientation, not null

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
Overrides:
getMinimumSize in class AbstractTab
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
Overrides:
getPreferredSize in class AbstractTab
Parameters:
tabs - the displayed tabs, exactly one entry is this and no entry is null
Returns:
the preferred size of this tab

getElement

public DockElement getElement()
Description copied from interface: DockElementRepresentative
Gets the element which is represented by this. The result of this method must not change.

Specified by:
getElement in interface DockElementRepresentative
Returns:
the element, never null

getPopupLocation

public Point getPopupLocation(Point click,
                              boolean popupTrigger)
Description copied from interface: DockElementRepresentative
Tells whether a popup menu should be opened when the user clicks at click with the mouse. If yes, then the top left edge of the popup should be returned, otherwise null should be returned.

Specified by:
getPopupLocation in interface DockElementRepresentative
Parameters:
click - the location where the user clicked with the mouse
popupTrigger - whether the invocation is the systems popup trigger or not. Many implementations of this method will return click in case of true, and null in case of false
Returns:
the preferred location of a popup or null if no popup-menu should be opened

isUsedAsTitle

public boolean isUsedAsTitle()
Description copied from interface: DockElementRepresentative
Tells whether this DockElementRepresentative is used as title.
Some modules grant more rights to titles than to non-titles, i.e. a DockRelocator can allow drag & drop only for titles.
Normally a Dockable should have only one element that is a title, so if in doubt return false.

Specified by:
isUsedAsTitle in interface DockElementRepresentative
Returns:
true if this representative should be seen as title

shouldFocus

public boolean shouldFocus()
Description copied from interface: DockElementRepresentative
Tells whether a click onto this component should transfer the focus either to this component or to the Dockable.

Specified by:
shouldFocus in interface DockElementRepresentative
Returns:
true if clicking this component should influence focus

shouldTransfersFocus

public boolean shouldTransfersFocus()
Description copied from interface: DockElementRepresentative
Tells whether a click onto this component should transfer the focus to the Dockable or not. If this object is a Dockable, then a result of true might change the currently focused item of itself. This property is ignored if DockElementRepresentative.shouldFocus() returns false.

Specified by:
shouldTransfersFocus in interface DockElementRepresentative
Returns:
whether to change the focused component or not

setEnabled

public void setEnabled(boolean enabled)
Description copied from interface: CombinedTab
Enables or disables this tab. A disabled shoutl not react to any mouse input, and it should be visually distinct from enabled tabs.

Specified by:
setEnabled in interface CombinedTab
Parameters:
enabled - whether to enable or disable this tab

removeMouseInputListener

public void removeMouseInputListener(MouseInputListener listener)
Description copied from interface: DockElementRepresentative
Removes a listener from this representative.

Specified by:
removeMouseInputListener in interface DockElementRepresentative
Parameters:
listener - the listener to remove

addMouseInputListener

public void addMouseInputListener(MouseInputListener listener)
Description copied from interface: DockElementRepresentative
Adds a listener to this representative, it is not defined what to do with that listener, but most subclasses would just add the listener to their component. It is valid to do nothing.

Specified by:
addMouseInputListener in interface DockElementRepresentative
Parameters:
listener - the new listener

bind

public void bind()
Adds observers to parent and DockController to keep the user interface up to date.

Overrides:
bind in class AbstractTab

unbind

public void unbind()
Removes observers from parent and DockController.

Overrides:
unbind in class AbstractTab

getOverlap

public Insets getOverlap(TabPaneComponent other)
Description copied from interface: TabPaneComponent
Tells how much of this component may be overlapped by another component other.

Specified by:
getOverlap in interface TabPaneComponent
Overrides:
getOverlap in class AbstractTabPaneComponent
Parameters:
other - another component which may be painted over this component
Returns:
the border of this component that may not be visible, not null

setPaintIconWhenInactive

public void setPaintIconWhenInactive(boolean paint)
Tells this tab to paint icons when not selected.

Parameters:
paint - whether to paint the icons

informFocusChanged

protected void informFocusChanged(boolean focused)
Description copied from class: AbstractTab
Called when the focus state of this tab has been changed. Subclasses may choose to ignore the event.

Specified by:
informFocusChanged in class AbstractTab
Parameters:
focused - the new focus state

informSelectionChanged

protected void informSelectionChanged(boolean selected)
Description copied from class: AbstractTab
Called when the selection state of this tab has been changed. Subclasses may choose to ignore the event.

Specified by:
informSelectionChanged in class AbstractTab
Parameters:
selected - the new selection state

toString

public String toString()
Overrides:
toString in class Object