|
Mp3dings 20100427 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.swing.TransferHandler
net.sourceforge.mp3dings.datatransfer.DataTransferHandler
public class DataTransferHandler
A TransferHandler that manages Copy/Paste for Mp3dingsTables. In principle I would like to use it for Drag and Drop as well but there is a problem when activating Swing Drag and Drop support:
JComponent.setTransferHandler(javax.swing.TransferHandler), you cannot register
one for DnD and one for Copy/Paste.
getSourceActions(JComponent c) which takes neither the type
of operation (DnD or C/P) nor the DataFlavor (text or files)
as an argument.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.TransferHandler |
|---|
TransferHandler.DropLocation, TransferHandler.TransferSupport |
| Field Summary | |
|---|---|
protected boolean |
cpSupported
Whether this TransferHandler supports Copy/Paste operations. |
protected boolean |
dndSupported
Whether this TransferHandler supports Drag and Drop operations. |
static int |
PASTE_APPEND
Append imported data to current table cell contents on paste. |
static int |
PASTE_APPEND_WITH_SPACE
Append a blank character and imported data to current table cell contents on paste. |
static int |
PASTE_OVERWRITE
Overwrite current table cell contents on paste. |
| Fields inherited from class javax.swing.TransferHandler |
|---|
COPY, COPY_OR_MOVE, LINK, MOVE, NONE |
| Constructor Summary | |
|---|---|
DataTransferHandler(boolean isDnDHandler,
boolean isCpHandler)
Constructs a new DataTransferHandler that allows the COPY sourceAction and all export flavors returned by getDefaultFlavors(). |
|
DataTransferHandler(boolean isDnDHandler,
boolean isCpHandler,
int sourceActions)
Constructs a new DataTransferHandler that supports the specified source actions and all export flavors returned by getDefaultFlavors(). |
|
DataTransferHandler(boolean isDnDHandler,
boolean isCpHandler,
int sourceActions,
DataFlavor[] initialExportFlavors)
Constructs a new DataTransferHandler that supports the specified source actions and export flavors. |
|
| Method Summary | |
|---|---|
boolean |
canImport(JComponent c,
DataFlavor[] flavors)
Description of the Method |
protected Transferable |
createTransferable(JComponent c)
Creates a Transferable from the current selection in an Mp3dingsTable. |
void |
exportAsDrag(JComponent comp,
InputEvent e,
int action)
|
protected void |
exportDone(JComponent src,
Transferable data,
int action)
Description of the Method |
void |
exportToClipboard(JComponent comp,
Clipboard clip,
int action)
|
static DataFlavor[] |
getDefaultFlavors()
Returns the DataFlavors that this class can im- and export by default. |
int |
getSourceActions(JComponent c)
Gets the sourceActions attribute of the TransferHandler object |
boolean |
importData(JComponent c,
Transferable t)
Description of the Method |
boolean |
importData(JComponent c,
Transferable t,
int pasteMode)
|
protected void |
importFiles(MainFrame mf,
File[] files)
|
protected void |
importObjectArray(Mp3dingsTable target,
Object[][] obj,
int pasteMode)
Description of the Method |
protected void |
importString(Mp3dingsTable target,
String strg,
int pasteMode)
Description of the Method |
boolean |
isExportEnabled(DataFlavor flavor)
Returns whether export of the specified flavor is currently enabled or disabled. |
void |
setExportEnabled(boolean b)
Disables or enables the export of all default flavors. |
void |
setExportEnabled(DataFlavor flavor,
boolean b)
Disables or enables the export of a specific flavor and its linked flavors. |
void |
setSourceActions(int actions)
Sets the source actions that this TransferHandler should support. |
| Methods inherited from class javax.swing.TransferHandler |
|---|
canImport, getCopyAction, getCutAction, getPasteAction, getVisualRepresentation, importData |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int PASTE_OVERWRITE
public static final int PASTE_APPEND
public static final int PASTE_APPEND_WITH_SPACE
protected boolean dndSupported
exportAsDrag(javax.swing.JComponent, java.awt.event.InputEvent, int)protected boolean cpSupported
exportToClipboard(javax.swing.JComponent, java.awt.datatransfer.Clipboard, int)| Constructor Detail |
|---|
public DataTransferHandler(boolean isDnDHandler,
boolean isCpHandler)
getDefaultFlavors().
isDnDHandler - whether this TransferHandler should handle Drag and
Drop operationsisCpHandler - whether this TransferHandler should handle
Copy/Paste operations
public DataTransferHandler(boolean isDnDHandler,
boolean isCpHandler,
int sourceActions)
getDefaultFlavors().
isDnDHandler - whether this TransferHandler should handle Drag and
Drop operationsisCpHandler - whether this TransferHandler should handle
Copy/Paste operationssourceActions - the source actions that this TransferHandler will
support, one of
TransferHandler.COPY, COPY_OR_MOVE, MOVE, NONEgetSourceActions(javax.swing.JComponent)
public DataTransferHandler(boolean isDnDHandler,
boolean isCpHandler,
int sourceActions,
DataFlavor[] initialExportFlavors)
isDnDHandler - whether this TransferHandler should handle Drag and
Drop operationsisCpHandler - whether this TransferHandler should handle
Copy/Paste operationssourceActions - the source actions that this TransferHandler will
support, one of
TransferHandler.COPY, COPY_OR_MOVE, MOVE, NONEinitialExportFlavors - an array of DataFlavors that this
TransferHandler should export.getSourceActions(javax.swing.JComponent)| Method Detail |
|---|
public static DataFlavor[] getDefaultFlavors()
public void setExportEnabled(boolean b)
b - whether export is enabled (true) or disabled (false)getDefaultFlavors(),
isExportEnabled(java.awt.datatransfer.DataFlavor)
public void setExportEnabled(DataFlavor flavor,
boolean b)
b - whether export is enabled (true) or disabled (false)flavor - the flavor whose export should be enabled or disabledisExportEnabled(java.awt.datatransfer.DataFlavor)public boolean isExportEnabled(DataFlavor flavor)
flavor - the flavor whose export should be enabled or
disabled
setExportEnabled(DataFlavor, boolean)public void setSourceActions(int actions)
actions - the source actions that this TransferHandler will
support, one of
TransferHandler.COPY, COPY_OR_MOVE, MOVE, NONEgetSourceActions(javax.swing.JComponent)protected Transferable createTransferable(JComponent c)
Mp3dingsTable. The transferable will
support those default flavors whose export is currently enabled.
createTransferable in class TransferHandlerc - the Mp3dingsTable whose selection should be exported
c if c is an Mp3dingsTable,
null otherwise.getDefaultFlavors(),
isExportEnabled(java.awt.datatransfer.DataFlavor)public int getSourceActions(JComponent c)
getSourceActions in class TransferHandlerc - Description of the Parameter
public boolean importData(JComponent c,
Transferable t,
int pasteMode)
public boolean importData(JComponent c,
Transferable t)
importData in class TransferHandlerc - Description of the Parametert - Description of the Parameter
public void exportAsDrag(JComponent comp,
InputEvent e,
int action)
exportAsDrag in class TransferHandler
public void exportToClipboard(JComponent comp,
Clipboard clip,
int action)
exportToClipboard in class TransferHandler
protected void exportDone(JComponent src,
Transferable data,
int action)
exportDone in class TransferHandlersrc - Description of the Parameterdata - Description of the Parameteraction - Description of the Parameter
public boolean canImport(JComponent c,
DataFlavor[] flavors)
canImport in class TransferHandlerc - Description of the Parameterflavors - Description of the Parameter
protected void importObjectArray(Mp3dingsTable target,
Object[][] obj,
int pasteMode)
target - Description of the Parameterobj - Description of the ParameterpasteMode - Description of the Parameter
protected void importFiles(MainFrame mf,
File[] files)
protected void importString(Mp3dingsTable target,
String strg,
int pasteMode)
target - Description of the Parameterstrg - Description of the ParameterpasteMode - Description of the Parameter
|
Mp3dings 20100427 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||