bibliothek.gui.dock
Interface DockElementRepresentative

All Known Subinterfaces:
CombinedTab, CommonDockable, CommonStation<S>, Dockable, DockTitle, TabComponent
All Known Implementing Classes:
AbstractBubbleDockTitle, AbstractDockable, AbstractDockableStation, AbstractDockTitle, ArchGradientPainter, BaseTabComponent, BasicButtonDockTitle, BasicDockTitle, BasicStationTitle, BasicTabDockTitle, BubbleButtonDockTitle, BubbleDockTitle, BubbleTab, CSplitDockStation, DefaultCommonDockable, DefaultDockable, DockTitleTab, EclipseTab, FlapDockStation, FlatButtonTitle, FlatTab, RectGradientPainter, SecureCSplitDockStation, SecureFlapDockStation, SecureSplitDockStation, SecureStackDockStation, SimpleDockElementRepresentative, SmoothDefaultButtonTitle, SmoothDefaultStationTitle, SmoothDefaultTitle, SplitDockStation, StackDockStation

public interface DockElementRepresentative

A DockElementRepresentative is a Component that represents a DockElement. For example a DockTitle would be a representation of a Dockable. Or a small image in an overview-view might represent any DockElement.
If a DockElementRepresentative is added to a DockController then it may gain new abilities. Clicking on the representative might open the Dockables popup menu, dragging it will drag the Dockable. However, events on the representative are not automatically transfered to its DockElement, that step is always performed by the module that observes the representative.

Author:
Benjamin Sigg

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.
 Component getComponent()
          Gets the Component which represents the element.
 DockElement getElement()
          Gets the element which is represented by this.
 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.
 

Method Detail

getComponent

Component getComponent()
Gets the Component which represents the element. The result of this method must not change.

Returns:
the component, never null

getElement

DockElement getElement()
Gets the element which is represented by this. The result of this method must not change.

Returns:
the element, never null

isUsedAsTitle

boolean isUsedAsTitle()
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.

Returns:
true if this representative should be seen as title

addMouseInputListener

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. It is valid to do nothing.

Parameters:
listener - the new listener

removeMouseInputListener

void removeMouseInputListener(MouseInputListener listener)
Removes a listener from this representative.

Parameters:
listener - the listener to remove

getPopupLocation

Point getPopupLocation(Point click,
                       boolean popupTrigger)
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.

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