|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.swing.TransferHandler
org.tbee.swing.dnd.StringTransferHandler
public abstract class StringTransferHandler
This is a wrapper class for simple String drag and drop. It converts the whole Drag and drop to three new straight forward methods to implement. Whether this is for a list or table. The only drawback is: it is a string being DnDed. See LabelTransferHandler for an implementation of these methods. It also is a great teacher on how to implement DnD.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.TransferHandler |
|---|
TransferHandler.DropLocation, TransferHandler.TransferSupport |
| Field Summary |
|---|
| Fields inherited from class javax.swing.TransferHandler |
|---|
COPY, COPY_OR_MOVE, LINK, MOVE, NONE |
| Constructor Summary | |
|---|---|
StringTransferHandler()
|
|
| Method Summary | |
|---|---|
boolean |
canImport(JComponent c,
DataFlavor[] flavors)
Check to see if we can import what ever is offered to us |
protected Transferable |
createTransferable(JComponent c)
This method actually creates the transferable to be exported to somewhere else, uses exportString to get the string. |
protected void |
exportDone(JComponent c,
Transferable data,
int action)
The export is done. |
protected String |
exportString(JComponent c)
Return the string to copy or move. |
abstract int |
getSourceActions(JComponent c)
This method determines what can be be done, copy, move or link |
boolean |
importData(JComponent c,
Transferable t)
This method converts an transferable to an importString. |
protected void |
importString(JComponent c,
String str)
Process the string. |
protected abstract boolean |
isDropTarget()
Can something be dropped on us |
| 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, toString, wait, wait, wait |
| Constructor Detail |
|---|
public StringTransferHandler()
| Method Detail |
|---|
public abstract int getSourceActions(JComponent c)
getSourceActions in class TransferHandlerc - the source componentprotected Transferable createTransferable(JComponent c)
createTransferable in class TransferHandlerc - the source componentprotected String exportString(JComponent c)
c - the source component
protected void exportDone(JComponent c,
Transferable data,
int action)
exportDone in class TransferHandlerc - the target componentprotected abstract boolean isDropTarget()
public boolean canImport(JComponent c,
DataFlavor[] flavors)
canImport in class TransferHandlerc - the target component
public boolean importData(JComponent c,
Transferable t)
importData in class TransferHandlerc - the target component
protected void importString(JComponent c,
String str)
c - the target componentstr -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||