|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjavax.swing.TransferHandler
ch.epfl.craft.magmap.MagnetTransferHandler
Drag & Drop support for magnets. This TransferHandler
use the id of the node in the model as identifier. It is then easy to
get a reference on the MagnetNode.
| Nested Class Summary | |
class |
MagnetTransferHandler.IndexTransferable
Custom class that encapsulate a number == index of the magnet in the model. |
| Field Summary | |
java.awt.datatransfer.DataFlavor |
localArrayListFlavor
|
java.lang.String |
localArrayListType
|
static java.awt.datatransfer.DataFlavor |
localIndexFlavor
|
static java.lang.String |
localIndexType
|
java.awt.datatransfer.DataFlavor |
serialArrayListFlavor
|
| Fields inherited from class javax.swing.TransferHandler |
COPY, COPY_OR_MOVE, MOVE, NONE |
| Constructor Summary | |
MagnetTransferHandler()
Creates a new MagnetTransferHandler instance. |
|
| Method Summary | |
boolean |
canImport(javax.swing.JComponent c,
java.awt.datatransfer.DataFlavor[] flavors)
Returns true if this c can import the kind of flavors,
else returns false |
protected java.awt.datatransfer.Transferable |
createTransferable(javax.swing.JComponent c)
Create the instance that will be transeferred to the source from c component. |
protected void |
exportDone(javax.swing.JComponent c,
java.awt.datatransfer.Transferable data,
int action)
Called on the source when the dragged has finished. |
int |
getSourceActions(javax.swing.JComponent c)
Returns the kind of action supported by this source. |
boolean |
importData(javax.swing.JComponent c,
java.awt.datatransfer.Transferable t)
Import the data t in c. |
| Methods inherited from class javax.swing.TransferHandler |
exportAsDrag, exportToClipboard, getCopyAction, getCutAction, getPasteAction, getVisualRepresentation |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public java.awt.datatransfer.DataFlavor localArrayListFlavor
public java.awt.datatransfer.DataFlavor serialArrayListFlavor
public java.lang.String localArrayListType
public static java.lang.String localIndexType
public static java.awt.datatransfer.DataFlavor localIndexFlavor
| Constructor Detail |
public MagnetTransferHandler()
MagnetTransferHandler instance.
| Method Detail |
public boolean importData(javax.swing.JComponent c,
java.awt.datatransfer.Transferable t)
t in c.
t - the transferred datac - the target component
protected void exportDone(javax.swing.JComponent c,
java.awt.datatransfer.Transferable data,
int action)
c - the component on which dragged occureddata - the data that was transferedaction - the kind of action that was done (COPY or MOVE)
public boolean canImport(javax.swing.JComponent c,
java.awt.datatransfer.DataFlavor[] flavors)
c can import the kind of flavors,
else returns false
c - the component destination to testflavors - the list of flavors
protected java.awt.datatransfer.Transferable createTransferable(javax.swing.JComponent c)
c component. We simply create some class of transferrable number
that contains the index in the JList (==Model too) of
the selected (== dragged) magnet.
c - the component from which the data is transferred (source)
public int getSourceActions(javax.swing.JComponent c)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||