bibliothek.extension.gui.dock.theme.eclipse.stack.tab
Class DockTitleTab

java.lang.Object
  extended by bibliothek.extension.gui.dock.theme.eclipse.stack.tab.DockTitleTab
All Implemented Interfaces:
TabComponent, DockElementRepresentative

public class DockTitleTab
extends Object
implements TabComponent

A DockTitleTab is a wrapper around an ordinary DockTitle to get a TabComponent.
This DockTitleTab will use EclipseDockTitleEvents to inform its DockTitle when a property has changed, the method DockTitle.changed(bibliothek.gui.dock.event.DockTitleEvent) is called for that purpose.

Author:
Benjamin Sigg

Field Summary
static TabPainter FACTORY
          A TabPainter that uses the id EclipseTheme.TAB_DOCK_TITLE to get a DockTitleVersion from the DockTitleManager and create a new DockTitle which is then wrapped by a DockTitleTab.
 
Constructor Summary
DockTitleTab(DockStation station, Dockable dockable, DockTitle title)
          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 addMouseListener(MouseListener listener)
           
 void addMouseMotionListener(MouseMotionListener listener)
           
 void bind()
          Informs this tab that it will be shown soon
static TabPainter createFactory(TabPainter fallback)
          Creates a new factory which uses fallback to create a TabComponent when no DockTitle is available.
protected  void fire()
          Fires an event to the DockTitle of this DockTitleTab.
 Component getComponent()
          Gets the Component which represents the element.
 Border getContentBorder()
           
 DockElement getElement()
          Gets the element which is represented by this.
 Insets getOverlap(TabComponent other)
          Gets the number of pixels which should be covered at the sides of this component.
 Point getPopupLocation(Point click, boolean popupTrigger)
          Tells whether a popup menu should be opened when the user clicks at click with the mouse.
 boolean isUsedAsTitle()
          Tells whether this DockElementRepresentative is used as title.
 void removeMouseInputListener(MouseInputListener listener)
          Removes a listener from this representative.
 void removeMouseListener(MouseListener listener)
           
 void removeMouseMotionListener(MouseMotionListener listener)
           
 void setFocused(boolean focused)
           
 void setPaintIconWhenInactive(boolean paint)
           
 void setSelected(boolean selected)
           
 void unbind()
          Informs this tab that it is invisible and must not have any connections to other resources
 void update()
          Called when a property of the tab has been changed and this component has to reevaluate its content.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FACTORY

public static final TabPainter FACTORY
A TabPainter that uses the id EclipseTheme.TAB_DOCK_TITLE to get a DockTitleVersion from the DockTitleManager and create a new DockTitle which is then wrapped by a DockTitleTab.

Constructor Detail

DockTitleTab

public DockTitleTab(DockStation station,
                    Dockable dockable,
                    DockTitle title)
Creates a new tab.

Parameters:
station - the station which uses the tabbed pane, might be null
dockable - the element for which this tab is shown
title - the title which represents the tab
Method Detail

createFactory

public static final TabPainter createFactory(TabPainter fallback)
Creates a new factory which uses fallback to create a TabComponent when no DockTitle is available.

Parameters:
fallback - the backup-factory
Returns:
a new TabPainter

bind

public void bind()
Description copied from interface: TabComponent
Informs this tab that it will be shown soon

Specified by:
bind in interface TabComponent

unbind

public void unbind()
Description copied from interface: TabComponent
Informs this tab that it is invisible and must not have any connections to other resources

Specified by:
unbind in interface TabComponent

addMouseListener

public void addMouseListener(MouseListener listener)
Specified by:
addMouseListener in interface TabComponent

addMouseMotionListener

public void addMouseMotionListener(MouseMotionListener listener)
Specified by:
addMouseMotionListener in interface TabComponent

getComponent

public Component getComponent()
Description copied from interface: DockElementRepresentative
Gets the Component which represents the element. The result of this method must not change.

Specified by:
getComponent in interface TabComponent
Specified by:
getComponent in interface DockElementRepresentative
Returns:
the component, never null

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

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

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

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

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

getContentBorder

public Border getContentBorder()

getOverlap

public Insets getOverlap(TabComponent other)
Description copied from interface: TabComponent
Gets the number of pixels which should be covered at the sides of this component.

Specified by:
getOverlap in interface TabComponent
Parameters:
other - the component which may overlap this component
Returns:
the number of overlapped pixels

removeMouseListener

public void removeMouseListener(MouseListener listener)
Specified by:
removeMouseListener in interface TabComponent

removeMouseMotionListener

public void removeMouseMotionListener(MouseMotionListener listener)
Specified by:
removeMouseMotionListener in interface TabComponent

setFocused

public void setFocused(boolean focused)
Specified by:
setFocused in interface TabComponent

setPaintIconWhenInactive

public void setPaintIconWhenInactive(boolean paint)
Specified by:
setPaintIconWhenInactive in interface TabComponent

setSelected

public void setSelected(boolean selected)
Specified by:
setSelected in interface TabComponent

update

public void update()
Description copied from interface: TabComponent
Called when a property of the tab has been changed and this component has to reevaluate its content.

Specified by:
update in interface TabComponent

fire

protected void fire()
Fires an event to the DockTitle of this DockTitleTab.