org.browsecode.helpers.reorderablelistpanel
Class ReorderableDragNDropHandler<T>

java.lang.Object
  extended by org.browsecode.helpers.reorderablelistpanel.ReorderableDragNDropHandler<T>
All Implemented Interfaces:
java.awt.dnd.DropTargetListener, java.util.EventListener

public class ReorderableDragNDropHandler<T>
extends java.lang.Object
implements java.awt.dnd.DropTargetListener


Nested Class Summary
static class ReorderableDragNDropHandler.IndexParent
           
 
Field Summary
static java.lang.String _____________________
          I just want a separator in eclipse Handling the drag
 
Constructor Summary
ReorderableDragNDropHandler(ReorderableListPanel<T> dragContainer, boolean dragHorizontally)
           
 
Method Summary
static void cleanUpCurrentDragPeriod(boolean succeeded, ReorderableListPanel newParent)
          like cleanUpCurrentDrag, but ignores parentage.
 void dragEnter(java.awt.dnd.DropTargetDragEvent dtde)
           
 void dragExit(java.awt.dnd.DropTargetEvent dte)
           
 void dragOver(java.awt.dnd.DropTargetDragEvent dtde)
           
 void drop(java.awt.dnd.DropTargetDropEvent dtde)
           
 void dropActionChanged(java.awt.dnd.DropTargetDragEvent dtde)
           
 void dropIntoAndRemoveComponent(ReorderableListItemPanel<T> rItem, int action)
           
 java.awt.Component getAlwaysLastComponent()
           
 int getIndexToDropAt()
           
 ReorderableDragNDropHandler.IndexParent getIndexToDropAtAndRemove(ReorderableListItemPanel<T> rItem, int action)
           
 void handle(ReorderableListItemPanel<T> componentToDrag, java.awt.event.MouseEvent mouseEvent)
           
 void install(javax.swing.JComponent component)
           
 boolean isHorizontal()
           
 boolean moveElsewhere(ReorderableListItemPanel<T> rItem)
           
 void setAlwaysLastComponent(java.awt.Component alwaysLastComponent)
           
 void setHorizontal(boolean isHorizontal)
          Warning: you should not call this in the middle of a drag.
 void setNotifyThisDragDone(ReorderableListPanel.RunnableWithSuccessNotification<T> runnable)
          Notify this when the current drag is finished.
 void setRefreshComponent(java.awt.Component component)
          This is part of a heinous hack to get a lack of refreshing parents automatically.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_____________________

public static final java.lang.String _____________________
I just want a separator in eclipse Handling the drag

See Also:
Constant Field Values
Constructor Detail

ReorderableDragNDropHandler

public ReorderableDragNDropHandler(ReorderableListPanel<T> dragContainer,
                                   boolean dragHorizontally)
Parameters:
dragContainer -
dragHorizontally - If true, the dragging is assumed to be primarily horizontal (by default, true). If false, dragging is assumed to be primarily vertical.
Method Detail

handle

public void handle(ReorderableListItemPanel<T> componentToDrag,
                   java.awt.event.MouseEvent mouseEvent)

setNotifyThisDragDone

public void setNotifyThisDragDone(ReorderableListPanel.RunnableWithSuccessNotification<T> runnable)
Notify this when the current drag is finished. Only notify about this drag (deletes reference after first notification).

Parameters:
runnable -

install

public void install(javax.swing.JComponent component)

dragEnter

public void dragEnter(java.awt.dnd.DropTargetDragEvent dtde)
Specified by:
dragEnter in interface java.awt.dnd.DropTargetListener

dragOver

public void dragOver(java.awt.dnd.DropTargetDragEvent dtde)
Specified by:
dragOver in interface java.awt.dnd.DropTargetListener

dropActionChanged

public void dropActionChanged(java.awt.dnd.DropTargetDragEvent dtde)
Specified by:
dropActionChanged in interface java.awt.dnd.DropTargetListener

drop

public void drop(java.awt.dnd.DropTargetDropEvent dtde)
Specified by:
drop in interface java.awt.dnd.DropTargetListener

dragExit

public void dragExit(java.awt.dnd.DropTargetEvent dte)
Specified by:
dragExit in interface java.awt.dnd.DropTargetListener

getIndexToDropAt

public int getIndexToDropAt()

moveElsewhere

public boolean moveElsewhere(ReorderableListItemPanel<T> rItem)

getIndexToDropAtAndRemove

public ReorderableDragNDropHandler.IndexParent getIndexToDropAtAndRemove(ReorderableListItemPanel<T> rItem,
                                                                         int action)

dropIntoAndRemoveComponent

public void dropIntoAndRemoveComponent(ReorderableListItemPanel<T> rItem,
                                       int action)

cleanUpCurrentDragPeriod

public static void cleanUpCurrentDragPeriod(boolean succeeded,
                                            ReorderableListPanel newParent)
like cleanUpCurrentDrag, but ignores parentage.


setRefreshComponent

public void setRefreshComponent(java.awt.Component component)
This is part of a heinous hack to get a lack of refreshing parents automatically. If someone sets the refreshComponent, this assumes that that is a parent that needs to be repainted and re-laid-out since the size of the component has changed. I wish there was a better way...

Parameters:
component -

getAlwaysLastComponent

public java.awt.Component getAlwaysLastComponent()
Returns:
Returns the alwaysLastComponent.

setAlwaysLastComponent

public void setAlwaysLastComponent(java.awt.Component alwaysLastComponent)
Parameters:
alwaysLastComponent - The alwaysLastComponent to set.

isHorizontal

public boolean isHorizontal()

setHorizontal

public void setHorizontal(boolean isHorizontal)
Warning: you should not call this in the middle of a drag. Only between drags should it be changed! (Changing during drags has not been tested).

Parameters:
isHorizontal -