com.alee.managers.drag
Class NodesDragViewHandler<E extends javax.swing.tree.DefaultMutableTreeNode>

java.lang.Object
  extended by com.alee.managers.drag.NodesDragViewHandler<E>
All Implemented Interfaces:
DragViewHandler<java.util.List<E>>

public abstract class NodesDragViewHandler<E extends javax.swing.tree.DefaultMutableTreeNode>
extends java.lang.Object
implements DragViewHandler<java.util.List<E>>

Author:
Mikle Garin

Constructor Summary
NodesDragViewHandler()
           
 
Method Summary
 void dragEnded(java.util.List<E> nodes, java.awt.dnd.DragSourceDropEvent event)
          Notifies about drag operation end.
 java.awt.Insets getMoreTextMargin()
          Retturns additional X offset for "more" text.
abstract  int getNodesViewLimit()
          Returns maximum amount of nodes displayed when dragged.
 java.awt.image.BufferedImage getView(java.util.List<E> nodes, java.awt.dnd.DragSourceDragEvent dragSourceDragEvent)
          Returns image object representation.
 java.awt.Point getViewRelativeLocation(java.util.List<E> nodes, java.awt.dnd.DragSourceDragEvent dragSourceDragEvent)
          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
 

Constructor Detail

NodesDragViewHandler

public NodesDragViewHandler()
Method Detail

getNodesViewLimit

public abstract int getNodesViewLimit()
Returns maximum amount of nodes displayed when dragged. If there are more nodes than limit allows additional label will be added informing about it.

Returns:
maximum amount of nodes displayed when dragged

getMoreTextMargin

public java.awt.Insets getMoreTextMargin()
Retturns additional X offset for "more" text. Might be useful to move this text according to node icons.

Returns:
additional X offset for "more" text

getView

public java.awt.image.BufferedImage getView(java.util.List<E> nodes,
                                            java.awt.dnd.DragSourceDragEvent dragSourceDragEvent)
Returns image object representation. This method is called once per drag operation to initialize dragged object view.

Specified by:
getView in interface DragViewHandler<java.util.List<E extends javax.swing.tree.DefaultMutableTreeNode>>
Parameters:
nodes - object to create image representation for
dragSourceDragEvent - drag source drag event
Returns:
image object representation

getViewRelativeLocation

public java.awt.Point getViewRelativeLocation(java.util.List<E> nodes,
                                              java.awt.dnd.DragSourceDragEvent dragSourceDragEvent)
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<java.util.List<E extends javax.swing.tree.DefaultMutableTreeNode>>
Parameters:
nodes - object return image representation location for
dragSourceDragEvent - drag source drag event
Returns:
image object representation location relative to mouse location

dragEnded

public void dragEnded(java.util.List<E> nodes,
                      java.awt.dnd.DragSourceDropEvent event)
Notifies about drag operation end. This method is called once per drag operation.

Specified by:
dragEnded in interface DragViewHandler<java.util.List<E extends javax.swing.tree.DefaultMutableTreeNode>>
Parameters:
nodes - dragged object
event - drag source drop event