com.alee.managers.drag
Class SimpleDragViewHandler<T>

java.lang.Object
  extended by com.alee.managers.drag.SimpleDragViewHandler<T>
All Implemented Interfaces:
DragViewHandler<T>
Direct Known Subclasses:
DocumentDragViewHandler

public abstract class SimpleDragViewHandler<T>
extends java.lang.Object
implements DragViewHandler<T>

Author:
Mikle Garin

Field Summary
protected static java.awt.Insets margin
          Document description margin.
protected static int textSideSpacing
          Additional spacing at text sides.
 
Constructor Summary
SimpleDragViewHandler()
           
 
Method Summary
 void dragEnded(T object, java.awt.dnd.DragSourceDropEvent event)
          Notifies about drag operation end.
protected  java.awt.FontMetrics getFontMetrics(T object)
          Returns font metrics used to display text.
protected abstract  javax.swing.Icon getIcon(T object)
          Returns displayed icon.
protected abstract  java.lang.String getText(T object)
          Returns displayed text.
 java.awt.image.BufferedImage getView(T object, java.awt.dnd.DragSourceDragEvent event)
          Returns image object representation.
 java.awt.Point getViewRelativeLocation(T document, java.awt.dnd.DragSourceDragEvent event)
          Returns image object representation location relative to mouse location.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.alee.managers.drag.DragViewHandler
getObjectFlavor
 

Field Detail

margin

protected static final java.awt.Insets margin
Document description margin.


textSideSpacing

protected static final int textSideSpacing
Additional spacing at text sides.

See Also:
Constant Field Values
Constructor Detail

SimpleDragViewHandler

public SimpleDragViewHandler()
Method Detail

getFontMetrics

protected java.awt.FontMetrics getFontMetrics(T object)
Returns font metrics used to display text.

Returns:
font metrics used to display text

getIcon

protected abstract javax.swing.Icon getIcon(T object)
Returns displayed icon.

Returns:
displayed icon

getText

protected abstract java.lang.String getText(T object)
Returns displayed text.

Returns:
displayed text

getView

public java.awt.image.BufferedImage getView(T object,
                                            java.awt.dnd.DragSourceDragEvent event)
Returns image object representation. This method is called once per drag operation to initialize dragged object view.

Specified by:
getView in interface DragViewHandler<T>
Parameters:
object - object to create image representation for
event - drag source drag event
Returns:
image object representation

getViewRelativeLocation

public java.awt.Point getViewRelativeLocation(T document,
                                              java.awt.dnd.DragSourceDragEvent event)
Returns image object representation location relative to mouse location. This method is called each time image location should be updated.

Specified by:
getViewRelativeLocation in interface DragViewHandler<T>
Parameters:
document - object return image representation location for
event - drag source drag event
Returns:
image object representation location relative to mouse location

dragEnded

public void dragEnded(T object,
                      java.awt.dnd.DragSourceDropEvent event)
Notifies about drag operation end. This method is called once per drag operation.

Specified by:
dragEnded in interface DragViewHandler<T>
Parameters:
object - dragged object
event - drag source drop event