bibliothek.gui.dock.control.relocator
Class AbstractDockRelocator

java.lang.Object
  extended by bibliothek.gui.dock.control.relocator.AbstractDockRelocator
All Implemented Interfaces:
DockRelocator
Direct Known Subclasses:
DefaultDockRelocator

public abstract class AbstractDockRelocator
extends Object
implements DockRelocator

A manager adding MouseListener and MouseMotionListener to every DockElementRepresentatives and handling the drag and drop events.
The behaviour of a drag and drop operation can be made dependent of the keys that are pressed, using some DockRelocatorModes. These modes are added through addMode(DockRelocatorMode)

Author:
Benjamin Sigg

Constructor Summary
AbstractDockRelocator(DockController controller)
          Creates a new manager.
 
Method Summary
 void addMode(DockRelocatorMode mode)
          Adds a mode to this relocator, a mode can be activated or deactivated when the user presses a button like "ctrl" or "shift" during a drag and drop operation.
 void addVetoableDockRelocatorListener(VetoableDockRelocatorListener listener)
          Adds a listener to this manager.
protected  void checkModes(int modifiers)
          Ensures that all DockRelocatorModes are in the state that fits the current set of modifiers.
protected  void disableAllModes()
          Sets all DockRelocatorModes to inactive.
protected  void fireCanceled(DockRelocatorEvent event)
          Calls VetoableDockRelocatorListener.grabbing(DockRelocatorEvent) on all listeners that are currently registered.
protected  void fireDragged(DockRelocatorEvent event)
          Calls VetoableDockRelocatorListener.dragged(DockRelocatorEvent) on all listeners that are currently registered.
protected  void fireDragging(DockRelocatorEvent event)
          Calls VetoableDockRelocatorListener.dragging(DockRelocatorEvent) on all listeners that are currently registered.
protected  void fireDropped(DockRelocatorEvent event)
          Calls VetoableDockRelocatorListener.canceled(DockRelocatorEvent) on all listeners that are currently registered.
protected  void fireDropping(DockRelocatorEvent event)
          Calls VetoableDockRelocatorListener.dropping(DockRelocatorEvent) on all listeners that are currently registered.
protected  void fireGrabbed(DockRelocatorEvent event)
          Calls VetoableDockRelocatorListener.grabbed(DockRelocatorEvent) on all listeners that are currently registered.
protected  void fireGrabbing(DockRelocatorEvent event)
          Calls VetoableDockRelocatorListener.grabbing(DockRelocatorEvent) on all listeners that are currently registered.
protected  void fireSearched(DockRelocatorEvent event)
          Calls VetoableDockRelocatorListener.searched(DockRelocatorEvent) on all listeners that are currently registered.
 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.
 Inserter getInserter()
          Gets the algorithm used to override decisions of a DockStation.
 Merger getMerger()
          Gets an algorithm useful for merging two DockStations.
 boolean isDragOnlyTitle()
          Tells whether dockables can only be dragged through their title or not.
 void removeMode(DockRelocatorMode mode)
          Removes a mode that has earlier been added to this relocator.
 void removeVetoableDockRelocatorListener(VetoableDockRelocatorListener 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 setDragOnlyTitle(boolean dragOnlyTitle)
          Tells whether dockables can only be dragged through their title or not.
 void setInserter(Inserter inserter)
          Sets the algorithm which is used to override decisions of a DockStation.
 void setMerger(Merger merger)
          Sets an algorithm for merging two DockStations.
protected  VetoableDockRelocatorListener[] vetoableListeners()
          Gets all the VetoableDockRelocatorListener that are currently registered.
 
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.control.DockRelocator
cancel, createDirectRemote, createDirectRemote, createRemote, createRemote, hasTarget, isOnMove, isOnPut
 

Constructor Detail

AbstractDockRelocator

public AbstractDockRelocator(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

addVetoableDockRelocatorListener

public void addVetoableDockRelocatorListener(VetoableDockRelocatorListener listener)
Description copied from interface: DockRelocator
Adds a listener to this manager. The listener will be informed whenever a Dockable is moved.

Specified by:
addVetoableDockRelocatorListener in interface DockRelocator
Parameters:
listener - the new listener

removeVetoableDockRelocatorListener

public void removeVetoableDockRelocatorListener(VetoableDockRelocatorListener listener)
Description copied from interface: DockRelocator
Removes a listener from this manager.

Specified by:
removeVetoableDockRelocatorListener in interface DockRelocator
Parameters:
listener - the listener to remove

vetoableListeners

protected VetoableDockRelocatorListener[] vetoableListeners()
Gets all the VetoableDockRelocatorListener that are currently registered.

Returns:
all the listeners

fireGrabbing

protected void fireGrabbing(DockRelocatorEvent event)
Calls VetoableDockRelocatorListener.grabbing(DockRelocatorEvent) on all listeners that are currently registered.

Parameters:
event - the event to forward

fireGrabbed

protected void fireGrabbed(DockRelocatorEvent event)
Calls VetoableDockRelocatorListener.grabbed(DockRelocatorEvent) on all listeners that are currently registered.

Parameters:
event - the event to forward

fireSearched

protected void fireSearched(DockRelocatorEvent event)
Calls VetoableDockRelocatorListener.searched(DockRelocatorEvent) on all listeners that are currently registered.

Parameters:
event - the event to forward

fireDragged

protected void fireDragged(DockRelocatorEvent event)
Calls VetoableDockRelocatorListener.dragged(DockRelocatorEvent) on all listeners that are currently registered.

Parameters:
event - the event to forward

fireDragging

protected void fireDragging(DockRelocatorEvent event)
Calls VetoableDockRelocatorListener.dragging(DockRelocatorEvent) on all listeners that are currently registered.

Parameters:
event - the event to forward

fireDropping

protected void fireDropping(DockRelocatorEvent event)
Calls VetoableDockRelocatorListener.dropping(DockRelocatorEvent) on all listeners that are currently registered.

Parameters:
event - the event to forward

fireDropped

protected void fireDropped(DockRelocatorEvent event)
Calls VetoableDockRelocatorListener.canceled(DockRelocatorEvent) on all listeners that are currently registered.

Parameters:
event - the event to forward

fireCanceled

protected void fireCanceled(DockRelocatorEvent event)
Calls VetoableDockRelocatorListener.grabbing(DockRelocatorEvent) on all listeners that are currently registered.

Parameters:
event - the event to forward

isDragOnlyTitle

public boolean isDragOnlyTitle()
Description copied from interface: DockRelocator
Tells whether dockables can only be dragged through their title or not.

Specified by:
isDragOnlyTitle in interface DockRelocator
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:
DockRelocator.setDragOnlyTitle(boolean)

setDragOnlyTitle

public void setDragOnlyTitle(boolean dragOnlyTitle)
Description copied from interface: DockRelocator
Tells whether dockables can only be dragged through their title or not.

Specified by:
setDragOnlyTitle in interface DockRelocator
Parameters:
dragOnlyTitle - 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()
Description copied from interface: DockRelocator
Gets the distance the user must move the mouse in order to begin a drag operation.

Specified by:
getDragDistance in interface DockRelocator
Returns:
the distance in pixel

setDragDistance

public void setDragDistance(int dragDistance)
Description copied from interface: DockRelocator
Sets the distance the user must move the mouse in order to begin a drag operation.

Specified by:
setDragDistance in interface DockRelocator
Parameters:
dragDistance - the distance in pixel

getMerger

public Merger getMerger()
Description copied from interface: DockRelocator
Gets an algorithm useful for merging two DockStations.

Specified by:
getMerger in interface DockRelocator
Returns:
the algorithm, can be null

setMerger

public void setMerger(Merger merger)
Description copied from interface: DockRelocator
Sets an algorithm for merging two DockStations.

Specified by:
setMerger in interface DockRelocator
Parameters:
merger - the new algorithm, can be null

setInserter

public void setInserter(Inserter inserter)
Description copied from interface: DockRelocator
Sets the algorithm which is used to override decisions of a DockStation.

Specified by:
setInserter in interface DockRelocator
Parameters:
inserter - the algorithm, can be null

getInserter

public Inserter getInserter()
Description copied from interface: DockRelocator
Gets the algorithm used to override decisions of a DockStation.

Specified by:
getInserter in interface DockRelocator
Returns:
the algorithm, can be null

addMode

public void addMode(DockRelocatorMode mode)
Adds a mode to this relocator, a mode can be activated or deactivated when the user presses a button like "ctrl" or "shift" during a drag and drop operation.

Specified by:
addMode in interface DockRelocator
Parameters:
mode - the new mode, not null

removeMode

public void removeMode(DockRelocatorMode mode)
Removes a mode that has earlier been added to this relocator.

Specified by:
removeMode in interface DockRelocator
Parameters:
mode - the mode to remove

disableAllModes

protected void disableAllModes()
Sets all DockRelocatorModes to inactive.


checkModes

protected void checkModes(int modifiers)
Ensures that all DockRelocatorModes are in the state that fits the current set of modifiers.

Parameters:
modifiers - the state of the last MouseEvent, see InputEvent.getModifiersEx()