Class DnDList<T>

    • Constructor Detail

      • DnDList

        public DnDList()
        Default constructor. An DnDListModel object will be created for the list.
      • DnDList

        public DnDList​(DnDListModel<T> model)
        Constructor allowing the list model to be specified
        Parameters:
        model - an instance of DnDListModel
        Throws:
        IllegalArgumentException - if model is null
    • Method Detail

      • dragEnter

        public void dragEnter​(DragSourceDragEvent dsde)
        DragSourceListener method - presently ignored

        Description copied from interface:
        Called as the cursor's hotspot enters a platform-dependent drop site. This method is invoked when all the following conditions are true:

        • The cursor's hotspot enters the operable part of a platform- dependent drop site.
        • The drop site is active.
        • The drop site accepts the drag.
        Specified by:
        dragEnter in interface DragSourceListener
      • dragOver

        public void dragOver​(DragSourceDragEvent dsde)
        DragSourceListener method - presently ignored

        Description copied from interface:
        Called as the cursor's hotspot moves over a platform-dependent drop site. This method is invoked when all the following conditions are true:

        • The cursor's hotspot has moved, but still intersects the operable part of the drop site associated with the previous dragEnter() invocation.
        • The drop site is still active.
        • The drop site accepts the drag.
        Specified by:
        dragOver in interface DragSourceListener
      • dropActionChanged

        public void dropActionChanged​(DragSourceDragEvent dsde)
        DragSourceListener method - presently ignored

        Description copied from interface:
        Called when the user has modified the drop gesture. This method is invoked when the state of the input device(s) that the user is interacting with changes. Such devices are typically the mouse buttons or keyboard modifiers that the user is interacting with.

        Specified by:
        dropActionChanged in interface DragSourceListener
      • dragExit

        public void dragExit​(DragSourceEvent dse)
        DragSourceListener method - presently ignored

        Description copied from interface:
        Called as the cursor's hotspot exits a platform-dependent drop site. This method is invoked when any of the following conditions are true:

        • The cursor's hotspot no longer intersects the operable part of the drop site associated with the previous dragEnter() invocation.
        • The drop site associated with the previous dragEnter() invocation is no longer active.
        • The drop site associated with the previous dragEnter() invocation has rejected the drag.
        Specified by:
        dragExit in interface DragSourceListener
      • dragDropEnd

        public void dragDropEnd​(DragSourceDropEvent dsde)
        Description copied from interface:
        This method is invoked to signify that the Drag and Drop operation is complete. The getDropSuccess() method of the DragSourceDropEvent can be used to determine the termination state. The getDropAction() method returns the operation that the drop site selected to apply to the Drop operation. Once this method is complete, the current DragSourceContext and associated resources become invalid.
        Specified by:
        dragDropEnd in interface DragSourceListener
      • dragEnter

        public void dragEnter​(DropTargetDragEvent dtde)
        Records the index of the list item (if any) pointed to by the mouse cursor

        Description copied from interface:
        Called while a drag operation is ongoing, when the mouse pointer enters the operable part of the drop site for the DropTarget registered with this listener.

        Specified by:
        dragEnter in interface DropTargetListener
      • dragOver

        public void dragOver​(DropTargetDragEvent dtde)
        Records the index of the list item (if any) pointed to by the mouse cursor

        Description copied from interface:
        Called when a drag operation is ongoing, while the mouse pointer is still over the operable part of the drop site for the DropTarget registered with this listener.

        Specified by:
        dragOver in interface DropTargetListener
      • dropActionChanged

        public void dropActionChanged​(DropTargetDragEvent dtde)
        DropTargetListener method - presently ignored

        Description copied from interface:
        Called if the user has modified the current drop gesture.

        Specified by:
        dropActionChanged in interface DropTargetListener
      • dragExit

        public void dragExit​(DropTargetEvent dte)
        Description copied from interface:
        Called while a drag operation is ongoing, when the mouse pointer has exited the operable part of the drop site for the DropTarget registered with this listener.
        Specified by:
        dragExit in interface DropTargetListener
      • drop

        public void drop​(DropTargetDropEvent dtde)
        Handles the moving (for drag and drop actions within this list) or transfer (for actions between lists) of list items. Description copied from interface:
        Called when the drag operation has terminated with a drop on the operable part of the drop site for the DropTarget registered with this listener.

        This method is responsible for undertaking the transfer of the data associated with the gesture. The DropTargetDropEvent provides a means to obtain a Transferable object that represents the data object(s) to be transfered.

        From this method, the DropTargetListener shall accept or reject the drop via the acceptDrop(int dropAction) or rejectDrop() methods of the DropTargetDropEvent parameter.

        Subsequent to acceptDrop(), but not before, DropTargetDropEvent's getTransferable() method may be invoked, and data transfer may be performed via the returned Transferable's getTransferData() method.

        At the completion of a drop, an implementation of this method is required to signal the success/failure of the drop by passing an appropriate boolean to the DropTargetDropEvent's dropComplete(boolean success) method.

        Note: The data transfer should be completed before the call to the DropTargetDropEvent's dropComplete(boolean success) method. After that, a call to the getTransferData() method of the Transferable returned by DropTargetDropEvent.getTransferable() is guaranteed to succeed only if the data transfer is local; that is, only if DropTargetDropEvent.isLocalTransfer() returns true. Otherwise, the behavior of the call is implementation-dependent.

        Specified by:
        drop in interface DropTargetListener