com.tensegrity.gui.swing.dnd
Class DragContext

java.lang.Object
  extended bycom.tensegrity.gui.swing.dnd.DragContext

public class DragContext
extends java.lang.Object

The DragContext interface defines an object that provides additional information during the drag and drop operation. Such a class remembers the most recently dragged VisualGraphObject in order to indicate the drag and drop action not only with the mouse cursor but also with a visible feedback within the view.

It is possible to define another representation for the recently dragged VisualGraphObject in form of a BaseComposite. If such a representation is defined it will be drawn instead of the BaseComposite that is assigned to the VisualGraphObject.

It is also possible to define a scale factor that is used to scale the BaseComposite that is drawn while dragging takes place.

Version:
$Id: DragContext.java,v 1.7 2006/01/02 13:41:01 BurkhardWick Exp $ TODO: Move this class to gui, as it is not Swing dependent
Author:
MichaelKegel

Constructor Summary
DragContext()
          Constructs a new DragContext instance with a default scaling-factor of 1.0
 
Method Summary
 java.lang.Object[] getAdditionalRecentlyDraggedObjects()
           
 VisualGraphObject[] getAdditionalRecentlyDraggedVGOS()
           
 BaseComposite getDragRepresentation()
          Returns the drag representation for the recently dragged VisualGraphObject.
 java.lang.Object getRecentlyDraggedObject()
          Returns the most recently dragged VisualGraphObject.
 double getScaleFactor()
          Returns the scale factor that is used to draw the recently dragged VisualGraphObject or its drag representation.
 void setAdditionalRecentlyDraggedObjects(java.lang.Object[] additional_objects)
           
 void setDragRepresentation(BaseComposite dragRepresentation)
          Sets the drag representation for the recently dragged VisualGraphObject to the value given by dragRepresentation.
 void setRecentlyDraggedObject(java.lang.Object recentlyDraggedObject)
          Sets the most recently dragged VisualGraphObject.
 void setScaleFactor(double scalefactor)
          Sets the scale factor to the value given by scalefactor.
 void transformDrag(GraphPanel graphPanel, BaseComposite basecomposite)
          Invoked each time a dragEnter() occurs.
 void transformDrop(GraphPanel graphPanel, BaseComposite basecomposite)
          Invoked each time a dragEnter() occurs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DragContext

public DragContext()
Constructs a new DragContext instance with a default scaling-factor of 1.0

Method Detail

getRecentlyDraggedObject

public java.lang.Object getRecentlyDraggedObject()
Returns the most recently dragged VisualGraphObject.

Returns:
the most recently dragged VisualGraphObject.

setRecentlyDraggedObject

public void setRecentlyDraggedObject(java.lang.Object recentlyDraggedObject)
Sets the most recently dragged VisualGraphObject.

Parameters:
recentlyDraggedObject - the most recently dragged VisualGraphObject.

getAdditionalRecentlyDraggedObjects

public java.lang.Object[] getAdditionalRecentlyDraggedObjects()

setAdditionalRecentlyDraggedObjects

public void setAdditionalRecentlyDraggedObjects(java.lang.Object[] additional_objects)

getAdditionalRecentlyDraggedVGOS

public VisualGraphObject[] getAdditionalRecentlyDraggedVGOS()

getScaleFactor

public double getScaleFactor()
Returns the scale factor that is used to draw the recently dragged VisualGraphObject or its drag representation.

Returns:
double the used scale factor

setScaleFactor

public void setScaleFactor(double scalefactor)
Sets the scale factor to the value given by scalefactor. The scale factor is used to draw the recently dragged VisualGraphObject or its drag representation.

Parameters:
scalefactor - the new scale factor to use

getDragRepresentation

public BaseComposite getDragRepresentation()
Returns the drag representation for the recently dragged VisualGraphObject. The drag representation is drawn instead of the VisualGraphObject itself while dragging. If null is returned there is no drag representation defined.

Returns:
BaseComposite the drag representation of the recently dragged VisualGraphObject

setDragRepresentation

public void setDragRepresentation(BaseComposite dragRepresentation)
Sets the drag representation for the recently dragged VisualGraphObject to the value given by dragRepresentation. If the value is null the BaseComposite assigned to the recently dragged VisualGraphObject will be drawn while dragging otherwise the BaseComposite given by dragRepresentation will be drawn instead.

Parameters:
dragRepresentation - the representation of the recently dragged VisualGraphObject that should drawn while dragging

transformDrag

public void transformDrag(GraphPanel graphPanel,
                          BaseComposite basecomposite)
Invoked each time a dragEnter() occurs. Allows client to adjust the dragged BaseComposite to its custom needs.

Parameters:
graphPanel - the GraphPanel in which the drag occured.
basecomposite - the BaseComposite that is dragged.

transformDrop

public void transformDrop(GraphPanel graphPanel,
                          BaseComposite basecomposite)
Invoked each time a dragEnter() occurs. Allows client to adjust the dragged BaseComposite to its custom needs.

Parameters:
graphPanel - the GraphPanel in which the drop occured.
basecomposite - the BaseComposite that was dropped.


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.