bibliothek.gui.dock.control
Class DockRelocator

java.lang.Object
  extended by bibliothek.gui.dock.control.DockRelocator
Direct Known Subclasses:
DefaultDockRelocator

public abstract class DockRelocator
extends java.lang.Object

A manager adding MouseListener and MouseMotionListener to every Dockable and DockTitle and handling the drag and drop.

Author:
Benjamin Sigg

Field Summary
private  DockController controller
          the controller whose dockables are moved
private  int dragDistance
          how many pixels the mouse must be moved until a title is dragged
private  boolean dragOnlyTitel
          Whether a drag event can only be initialized by dragging a title or not
private  java.util.List<DockRelocatorListener> listeners
          a set of listeners informed whenever a dockable is moved
 
Constructor Summary
DockRelocator(DockController controller)
          Creates a new manager.
 
Method Summary
 void addDockRelocatorListener(DockRelocatorListener listener)
          Adds a listener to this manager.
abstract  DirectRemoteRelocator createDirectRemote(Dockable dockable)
          Creates a device with which drag&drop operations concerning dockable can be initiated and executed.
abstract  RemoteRelocator createRemote(Dockable dockable)
          Creates a device with which drag&drop operations concerning dockable can be initiated and executed.
protected  void fireDockableDrag(Dockable dockable, DockStation station)
          Informs all listeners that dockable will be dragged.
protected  void fireDockablePut(Dockable dockable, DockStation station)
          Informs all listeners that dockable was dropped on station.
 DockController getController()
          Gets the controller for which this relocator works.
 int getDragDistance()
          Gets the distance the user must move the mouse in order to begin a drag operation.
 boolean isDragOnlyTitel()
          Tells whether dockables can only be dragged through their title or not.
abstract  boolean isOnMove()
          Tells whether the user has currently grabbed a dockable and moves the dockable around.
abstract  boolean isOnPut()
          Tells whether this relocator currently puts a Dockable.
protected  DockRelocatorListener[] listListeners()
          Gets a list of all currently registered listeners.
 void removeDockRelocatorListener(DockRelocatorListener listener)
          Removes a listener from this manager.
 void setDragDistance(int dragDistance)
          Sets the distance the user must move the mouse in order to begin a drag operation.
 void setDragOnlyTitel(boolean dragOnlyTitel)
          Tells whether dockables can only be dragged through their title or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

listeners

private java.util.List<DockRelocatorListener> listeners
a set of listeners informed whenever a dockable is moved


controller

private DockController controller
the controller whose dockables are moved


dragDistance

private int dragDistance
how many pixels the mouse must be moved until a title is dragged


dragOnlyTitel

private boolean dragOnlyTitel
Whether a drag event can only be initialized by dragging a title or not

Constructor Detail

DockRelocator

public DockRelocator(DockController controller)
Creates a new manager.

Parameters:
controller - the controller whose dockables are moved
Method Detail

getController

public DockController getController()
Gets the controller for which this relocator works.

Returns:
the controller

addDockRelocatorListener

public void addDockRelocatorListener(DockRelocatorListener listener)
Adds a listener to this manager. The listener will be informed whenever a Dockable is moved.

Parameters:
listener - the new listener

removeDockRelocatorListener

public void removeDockRelocatorListener(DockRelocatorListener listener)
Removes a listener from this manager.

Parameters:
listener - the listener to remove

listListeners

protected DockRelocatorListener[] listListeners()
Gets a list of all currently registered listeners.

Returns:
the list of listeners

fireDockableDrag

protected void fireDockableDrag(Dockable dockable,
                                DockStation station)
Informs all listeners that dockable will be dragged.

Parameters:
dockable - the dragged Dockable
station - the parent of dockable

fireDockablePut

protected void fireDockablePut(Dockable dockable,
                               DockStation station)
Informs all listeners that dockable was dropped on station.

Parameters:
dockable - the dropped Dockable
station - the new owner of dockable

isDragOnlyTitel

public boolean isDragOnlyTitel()
Tells whether dockables can only be dragged through their title or not.

Returns:
true if a Dockable must be dragged through their titles, false if every part of the dockable can be grabbed by the mouse.
See Also:
setDragOnlyTitel(boolean)

setDragOnlyTitel

public void setDragOnlyTitel(boolean dragOnlyTitel)
Tells whether dockables can only be dragged through their title or not.

Parameters:
dragOnlyTitel - true if a Dockable must be dragged through its title, false if every part of the dockable can be grabbed by the mouse.

getDragDistance

public int getDragDistance()
Gets the distance the user must move the mouse in order to begin a drag operation.

Returns:
the distance in pixel

setDragDistance

public void setDragDistance(int dragDistance)
Sets the distance the user must move the mouse in order to begin a drag operation.

Parameters:
dragDistance - the distance in pixel

isOnMove

public abstract boolean isOnMove()
Tells whether the user has currently grabbed a dockable and moves the dockable around.

Returns:
true if a Dockable is currently dragged

isOnPut

public abstract boolean isOnPut()
Tells whether this relocator currently puts a Dockable. A Dockable is put as soon as the user releases the mouse.

Returns:
true if a Dockable is moved

createDirectRemote

public abstract DirectRemoteRelocator createDirectRemote(Dockable dockable)
Creates a device with which drag&drop operations concerning dockable can be initiated and executed.

Parameters:
dockable - the dockable which might be moved
Returns:
the new remote

createRemote

public abstract RemoteRelocator createRemote(Dockable dockable)
Creates a device with which drag&drop operations concerning dockable can be initiated and executed.

Parameters:
dockable - the dockable which might be moved
Returns:
the new remote