|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.TransferHandler com.alee.extended.tree.AsyncTreeTransferHandler<N,T>
public abstract class AsyncTreeTransferHandler<N extends AsyncUniqueNode,T extends WebAsyncTree<N>>
Custom TransferHandler for WebAsyncTree that provides a quick and convenient way to implement nodes DnD.
Nested Class Summary | |
---|---|
class |
AsyncTreeTransferHandler.NodesTransferable
Custom nodes transferable used for D&D operation. |
Nested classes/interfaces inherited from class javax.swing.TransferHandler |
---|
javax.swing.TransferHandler.DropLocation, javax.swing.TransferHandler.TransferSupport |
Field Summary | |
---|---|
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. |
Fields inherited from class javax.swing.TransferHandler |
---|
COPY, COPY_OR_MOVE, LINK, MOVE, NONE |
Constructor Summary | |
---|---|
AsyncTreeTransferHandler()
Constructs new async tree transfer handler. |
Method Summary | |
---|---|
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()
|
Methods inherited from class javax.swing.TransferHandler |
---|
canImport, exportAsDrag, exportToClipboard, getCopyAction, getCutAction, getPasteAction, getVisualRepresentation, importData |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
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
Constructor Detail |
---|
public AsyncTreeTransferHandler()
Method Detail |
---|
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.TransferHandler
protected java.awt.datatransfer.Transferable createTransferable(javax.swing.JComponent c)
createTransferable
in class javax.swing.TransferHandler
c
- the component holding the data to be transferred, provided to enable sharing of TransferHandlers
protected void exportDone(javax.swing.JComponent source, java.awt.datatransfer.Transferable data, int action)
exportDone
in class javax.swing.TransferHandler
source
- 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.TransferHandler
c
- the component holding the data to be transferred
public boolean importData(javax.swing.TransferHandler.TransferSupport support)
importData
in class javax.swing.TransferHandler
protected 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 into
protected 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 drag
protected 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 node
protected abstract N copy(N node)
node
- node to copy
public 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
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |