public abstract class AsyncTreeTransferHandler<N extends AsyncUniqueNode,T extends WebAsyncTree<N>>
extends javax.swing.TransferHandler
| Modifier and Type | Class and Description |
|---|---|
class |
AsyncTreeTransferHandler.NodesTransferable
Custom nodes transferable used for D&D operation.
|
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
allowUncheckedDrop
Whether should allow dropping nodes onto not-yet-loaded node or not.
|
protected java.awt.datatransfer.DataFlavor[] |
flavors
Nodes flavor array.
|
protected java.awt.datatransfer.DataFlavor |
nodesFlavor
Nodes flavor.
|
protected java.util.List<N> |
nodesToRemove
Array of dragged nodes that should be removed at the end of DnD operation.
|
protected java.util.Map<java.lang.String,java.util.List<java.lang.Integer>> |
removedUnder
Map of removed node indices lists under their parent node IDs.
|
| Constructor and Description |
|---|
AsyncTreeTransferHandler()
Constructs new async tree transfer handler.
|
| Modifier and Type | Method and Description |
|---|---|
protected abstract boolean |
canBeDragged(java.util.List<N> nodes)
Returns whether the specified nodes drag can be started or not.
|
protected abstract boolean |
canBeDropped(java.util.List<N> nodes,
N dropLocation,
int dropIndex)
Returns whether nodes can be dropped to the specified location and index or not.
|
boolean |
canImport(javax.swing.TransferHandler.TransferSupport support) |
protected abstract N |
copy(N node)
Returns node copy used in createTransferable.
|
protected java.awt.datatransfer.Transferable |
createTransferable(javax.swing.JComponent c)
Creates a Transferable to use as the source for a data transfer.
|
protected void |
exportDone(javax.swing.JComponent source,
java.awt.datatransfer.Transferable data,
int action)
Invoked after data has been exported.
|
protected int |
getAdjustedDropIndex(int dropIndex,
N parent)
Returns properly adjusted nodes drop index.
|
int |
getSourceActions(javax.swing.JComponent c)
Returns the type of transfer actions supported by the source.
|
boolean |
importData(javax.swing.TransferHandler.TransferSupport support) |
boolean |
isAllowUncheckedDrop()
Returns whether should allow dropping nodes onto not-yet-loaded node or not.
|
abstract void |
nodesDropped(java.util.List<N> nodes,
N parent,
T tree,
AsyncTreeModel<N> model,
int index)
Informs about nodes drop operation completition in a separate tree thread.
|
protected void |
performDropOperation(java.util.List<N> nodes,
N parent,
T tree,
AsyncTreeModel<N> model,
int index)
Performs actual nodes drop operation.
|
void |
setAllowUncheckedDrop(boolean allowUncheckedDrop)
Sets whether should allow dropping nodes onto not-yet-loaded node or not
|
java.lang.String |
toString() |
protected boolean allowUncheckedDrop
protected java.awt.datatransfer.DataFlavor nodesFlavor
protected java.awt.datatransfer.DataFlavor[] flavors
protected java.util.List<N extends AsyncUniqueNode> nodesToRemove
protected java.util.Map<java.lang.String,java.util.List<java.lang.Integer>> removedUnder
public AsyncTreeTransferHandler()
public boolean isAllowUncheckedDrop()
public void setAllowUncheckedDrop(boolean allowUncheckedDrop)
allowUncheckedDrop - whether should allow dropping nodes onto not-yet-loaded node or notpublic boolean canImport(javax.swing.TransferHandler.TransferSupport support)
canImport in class javax.swing.TransferHandlerprotected java.awt.datatransfer.Transferable createTransferable(javax.swing.JComponent c)
createTransferable in class javax.swing.TransferHandlerc - the component holding the data to be transferred, provided to enable sharing of TransferHandlersprotected void exportDone(javax.swing.JComponent source,
java.awt.datatransfer.Transferable data,
int action)
exportDone in class javax.swing.TransferHandlersource - the component that was the source of the datadata - the data that was transferred or possibly null if the action is NONEaction - the actual action that was performedpublic int getSourceActions(javax.swing.JComponent c)
COPY, MOVE and LINK.
Returning NONE disables transfers from the component.getSourceActions in class javax.swing.TransferHandlerc - the component holding the data to be transferredpublic boolean importData(javax.swing.TransferHandler.TransferSupport support)
importData in class javax.swing.TransferHandlerprotected int getAdjustedDropIndex(int dropIndex,
N parent)
dropIndex - drop index if dropped between nodes under dropLocation node or -1 if dropped directly onto dropLocation nodeparent - parent node to drop nodes intoprotected void performDropOperation(java.util.List<N> nodes, N parent, T tree, AsyncTreeModel<N> model, int index)
nodes - list of nodes to dropparent - parent node to drop nodes intotree - tree to drop nodes ontomodel - tree modelindex - nodes drop indexprotected abstract boolean canBeDragged(java.util.List<N> nodes)
nodes - nodes to dragprotected abstract boolean canBeDropped(java.util.List<N> nodes, N dropLocation, int dropIndex)
nodes - list of nodes to dropdropLocation - node onto which drop was performeddropIndex - drop index if dropped between nodes under dropLocation node or -1 if dropped directly onto dropLocation nodeprotected abstract N copy(N node)
node - node to copypublic abstract void nodesDropped(java.util.List<N> nodes, N parent, T tree, AsyncTreeModel<N> model, int index)
nodes - list of nodes to dropparent - parent node to drop nodes intotree - tree to drop nodes ontomodel - tree modelindex - nodes drop indexpublic java.lang.String toString()
toString in class java.lang.Object