org.netbeans.spi.viewmodel/2 1.32.1

org.netbeans.spi.viewmodel
Interface DnDNodeModelFilter

All Superinterfaces:
Model, NodeModelFilter

public interface DnDNodeModelFilter
extends NodeModelFilter

Extension of NodeModelFilter with support for Drag and Drop of nodes.

Since:
1.24

Method Summary
 Transferable drag(DnDNodeModel original, Object node)
          Initiate a drag operation.
 int getAllowedDragActions(DnDNodeModel original)
          Action constants from DnDConstants.
 int getAllowedDropActions(DnDNodeModel original, Transferable t)
          Action constants from DnDConstants.
 PasteType getDropType(DnDNodeModel original, Object object, Transferable t, int action, int index)
          Determines if there is a paste operation that can be performed on provided transferable when drop is done.
 
Methods inherited from interface org.netbeans.spi.viewmodel.NodeModelFilter
addModelListener, getDisplayName, getIconBase, getShortDescription, removeModelListener
 

Method Detail

getAllowedDragActions

int getAllowedDragActions(DnDNodeModel original)
Action constants from DnDConstants. No actions are allowed by default.

Parameters:
original - The original DnDNodeModel to filter
Returns:
int representing set of actions which are allowed when dragging from asociated component.

getAllowedDropActions

int getAllowedDropActions(DnDNodeModel original,
                          Transferable t)
Action constants from DnDConstants. No actions are allowed by default.

Parameters:
original - The original DnDNodeModel to filter
t - The transferable for which the allowed drop actions are requested, or null to get actions for the creation of DropTarget for the view.
Returns:
int representing set of actions which are allowed when dropping the transferable into the asociated component.

drag

Transferable drag(DnDNodeModel original,
                  Object node)
                  throws IOException,
                         UnknownTypeException
Initiate a drag operation.

Parameters:
original - The original DnDNodeModel to filter
node - The node to drag
Returns:
transferable to represent this node during a drag
Throws:
IOException - when the drag cannot be performed
UnknownTypeException - if this model implementation is not able to perform drag for given node type

getDropType

PasteType getDropType(DnDNodeModel original,
                      Object object,
                      Transferable t,
                      int action,
                      int index)
                      throws UnknownTypeException
Determines if there is a paste operation that can be performed on provided transferable when drop is done.

Parameters:
original - The original DnDNodeModel to filter
node - The node where to drop
t - the transferable to drop
action - the Drag and Drop action from DnDConstants
index - index between children the drop occured at or -1 if not specified
Returns:
the paste type or null when the transferable cannot be accepted
Throws:
UnknownTypeException - if this model implementation is not able to perform drop for given node type

org.netbeans.spi.viewmodel/2 1.32.1

Built on December 5 2011.  |  Portions Copyright 1997-2011 Sun Microsystems, Inc. All rights reserved.