| java.lang.Object org.netbeans.spi.palette.DragAndDropHandler
DragAndDropHandler | abstract public class DragAndDropHandler (Code) | | An abstract class implemented by palette clients to implement drag and drop
of new items into the palette window and to customize the default Transferable
instance of items being dragged from the palette window to editor area.
Client's can support multiple DataFlavors that may help to enable/disable the drop
when dragging an item over different editor area parts that allow only certain
item types to be dropped into them.
author: S. Aubrecht |
Method Summary | |
public boolean | canDrop(Lookup targetCategory, DataFlavor[] flavors, int dndAction) Parameters: targetCategory - Lookup of the category under the drop cursor. Parameters: flavors - Supported DataFlavors. Parameters: dndAction - Drop action type. | public boolean | canReorderCategories(Lookup paletteRoot) Parameters: paletteRoot - Lookup of palette's root node. | abstract public void | customize(ExTransferable t, Lookup item) Add your own custom DataFlavor as need to suppor drag-over a different
parts of editor area. | public boolean | doDrop(Lookup targetCategory, Transferable item, int dndAction, int dropIndex) Perform the drop operation and add the dragged item into the given category.
Parameters: targetCategory - Lookup of the category that accepts the drop. Parameters: item - Transferable holding the item being dragged. Parameters: dndAction - Drag'n'drop action type. Parameters: dropIndex - Zero-based position where the dragged item should be dropped. | static DragAndDropHandler | getDefault() | public boolean | moveCategory(Lookup category, int moveToIndex) Move the given category to a new position.
Parameters: category - The lookup of category that is being dragged. Parameters: moveToIndex - Zero-based index to palette's root children Nodes where the category should move to. |
canDrop | public boolean canDrop(Lookup targetCategory, DataFlavor[] flavors, int dndAction)(Code) | | Parameters: targetCategory - Lookup of the category under the drop cursor. Parameters: flavors - Supported DataFlavors. Parameters: dndAction - Drop action type. True if the given category can accept the item being dragged. |
canReorderCategories | public boolean canReorderCategories(Lookup paletteRoot)(Code) | | Parameters: paletteRoot - Lookup of palette's root node. True if it is possible to reorder categories by drag and drop operations. |
customize | abstract public void customize(ExTransferable t, Lookup item)(Code) | | Add your own custom DataFlavor as need to suppor drag-over a different
parts of editor area.
Parameters: t - Item's default Transferable. Parameters: item - Palette item's Lookup. |
doDrop | public boolean doDrop(Lookup targetCategory, Transferable item, int dndAction, int dropIndex)(Code) | | Perform the drop operation and add the dragged item into the given category.
Parameters: targetCategory - Lookup of the category that accepts the drop. Parameters: item - Transferable holding the item being dragged. Parameters: dndAction - Drag'n'drop action type. Parameters: dropIndex - Zero-based position where the dragged item should be dropped. True if the drop has been successful, false otherwise. |
moveCategory | public boolean moveCategory(Lookup category, int moveToIndex)(Code) | | Move the given category to a new position.
Parameters: category - The lookup of category that is being dragged. Parameters: moveToIndex - Zero-based index to palette's root children Nodes where the category should move to. True if the move operation was successful. |
|
|