javax.swing.plaf.basic
Class BasicTreeUI.TreeTransferHandler

java.lang.Object
  extended byjavax.swing.TransferHandler
      extended byjavax.swing.plaf.basic.BasicTreeUI.TreeTransferHandler
All Implemented Interfaces:
Comparator, Serializable, UIResource
Enclosing class:
BasicTreeUI

static class BasicTreeUI.TreeTransferHandler
extends TransferHandler
implements UIResource, Comparator


Nested Class Summary
 
Nested classes inherited from class javax.swing.TransferHandler
 
Field Summary
private  JTree tree
           
 
Fields inherited from class javax.swing.TransferHandler
COPY, COPY_OR_MOVE, MOVE, NONE
 
Constructor Summary
(package private) BasicTreeUI.TreeTransferHandler()
           
 
Method Summary
 int compare(Object o1, Object o2)
          Compares its two arguments for order.
protected  Transferable createTransferable(JComponent c)
          Create a Transferable to use as the source for a data transfer.
(package private)  TreePath[] getDisplayOrderPaths(TreePath[] paths)
          Selection paths are in selection order.
(package private)  String getDisplayString(TreePath path, boolean selected, boolean leaf)
           
 int getSourceActions(JComponent c)
          Returns the type of transfer actions supported by the source.
 
Methods inherited from class javax.swing.TransferHandler
canImport, exportAsDrag, exportDone, exportToClipboard, getCopyAction, getCutAction, getPasteAction, getVisualRepresentation, importData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Field Detail

tree

private JTree tree
Constructor Detail

BasicTreeUI.TreeTransferHandler

BasicTreeUI.TreeTransferHandler()
Method Detail

createTransferable

protected Transferable createTransferable(JComponent c)
Create a Transferable to use as the source for a data transfer.

Overrides:
createTransferable in class TransferHandler
Parameters:
c - The component holding the data to be transfered. This argument is provided to enable sharing of TransferHandlers by multiple components.
Returns:
The representation of the data to be transfered.

compare

public int compare(Object o1,
                   Object o2)
Description copied from interface: Comparator
Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.

The implementor must ensure that sgn(compare(x, y)) == -sgn(compare(y, x)) for all x and y. (This implies that compare(x, y) must throw an exception if and only if compare(y, x) throws an exception.)

The implementor must also ensure that the relation is transitive: ((compare(x, y)>0) && (compare(y, z)>0)) implies compare(x, z)>0.

Finally, the implementer must ensure that compare(x, y)==0 implies that sgn(compare(x, z))==sgn(compare(y, z)) for all z.

It is generally the case, but not strictly required that (compare(x, y)==0) == (x.equals(y)). Generally speaking, any comparator that violates this condition should clearly indicate this fact. The recommended language is "Note: this comparator imposes orderings that are inconsistent with equals."

Specified by:
compare in interface Comparator
Parameters:
o1 - the first object to be compared.
o2 - the second object to be compared.
Returns:
a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.

getDisplayString

String getDisplayString(TreePath path,
                        boolean selected,
                        boolean leaf)

getDisplayOrderPaths

TreePath[] getDisplayOrderPaths(TreePath[] paths)
Selection paths are in selection order. The conversion to HTML requires display order. This method resorts the paths to be in the display order.


getSourceActions

public int getSourceActions(JComponent c)
Description copied from class: TransferHandler
Returns the type of transfer actions supported by the source. Some models are not mutable, so a transfer operation of COPY only should be advertised in that case.

Overrides:
getSourceActions in class TransferHandler
Parameters:
c - the component holding the data to be transferred; this argument is provided to enable sharing of TransferHandlers by multiple components.
Returns:
COPY if the transfer property can be found, otherwise returns NONE; a return value of of NONE disables any transfers out of the component