public class CopyPasteHandler extends AbstractEditActionHandler
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ARCHIVE_TYPE_COMPONENTS |
static java.lang.String |
ARCHIVE_TYPE_KEY |
static java.lang.String |
ARCHIVE_TYPE_TEMPLATE |
static java.lang.String |
ARCHIVE_TYPE_WINDOW |
listenerList
Constructor and Description |
---|
CopyPasteHandler(WindowWorkspace workspace) |
Modifier and Type | Method and Description |
---|---|
void |
addCopyPasteListener(CopyPasteListener listener) |
void |
cancelPaste()
Cancels and pending paste requests.
|
boolean |
canCopy()
Can this edit action handler handle the copy action, given its current selection? Note that if this and
EditActionHandler.canDelete() both return true, the cut action will also be enabled. |
boolean |
canDelete()
Can this edit action handler handle the delete action, given its current selection? Note that if this and
EditActionHandler.canCopy() both return true, the cut action will also be enabled. |
boolean |
canPaste(java.awt.datatransfer.Clipboard clipboard)
Can this action handler handle a paste given the data flavors currently available in the clipboard?
|
boolean |
canPaste(java.awt.datatransfer.Transferable data) |
java.awt.datatransfer.Transferable |
doCopy()
Performs a copy operation on the current selection, returning the serialized XML results as a
StringSelection |
void |
doCopyToClipboard()
Performs a copy operation on the current selection, using the system clipboard to store the XML serialized data.
|
java.awt.datatransfer.Transferable |
doCut()
Performs a cut operation on the current selection, returning the serialized XML results as a
StringSelection . |
void |
doCutToClipboard()
Performs a cut operation on the current selection, using the system clipboard to store the XML serialized data.
|
void |
doDelete()
Called when the delete action is performed
|
void |
doDuplicateSelection()
Copies and then PasteImmediates the selection.
|
void |
doPaste(java.awt.datatransfer.Transferable t)
Called when the paste action is performed
|
void |
doPaste(VisionContainer dropContainer,
java.awt.Point dropLocation) |
void |
doPaste(VisionContainer dropContainer,
java.awt.Point dropLocation,
boolean pasteAgain) |
boolean |
doPasteImpl(java.awt.datatransfer.Transferable t) |
boolean |
isPastePending()
Returns whether or not a past is pending, which is caused by calling startPaste(), but not yet calling doPaste()
|
void |
removeCopyPasteListener(CopyPasteListener listener) |
protected void |
setPastePending(boolean b) |
void |
startLegacyPaste(java.lang.String xml,
boolean isWindow,
boolean interactive) |
void |
startPaste(boolean interactive)
Starts a paste using the contents of the clipboard.
|
void |
startPaste(java.io.InputStream data,
java.lang.String dataType,
boolean interactive)
Starts a paste operation using the data in the input stream.
|
void |
startPaste(java.lang.String xml,
boolean interactive) |
addChangeListener, fireChangeEvent, removeChangeListener
public static final java.lang.String ARCHIVE_TYPE_KEY
public static final java.lang.String ARCHIVE_TYPE_WINDOW
public static final java.lang.String ARCHIVE_TYPE_TEMPLATE
public static final java.lang.String ARCHIVE_TYPE_COMPONENTS
public CopyPasteHandler(WindowWorkspace workspace)
public boolean canDelete()
EditActionHandler
EditActionHandler.canCopy()
both return true, the cut action will also be enabled.public boolean canCopy()
EditActionHandler
EditActionHandler.canDelete()
both return true, the cut action will also be enabled.public boolean canPaste(java.awt.datatransfer.Clipboard clipboard)
EditActionHandler
public boolean canPaste(java.awt.datatransfer.Transferable data)
public void startLegacyPaste(java.lang.String xml, boolean isWindow, boolean interactive)
public void startPaste(boolean interactive)
public void startPaste(java.lang.String xml, boolean interactive)
public void doPaste(VisionContainer dropContainer, java.awt.Point dropLocation)
public void doPaste(VisionContainer dropContainer, java.awt.Point dropLocation, boolean pasteAgain)
public void startPaste(java.io.InputStream data, java.lang.String dataType, boolean interactive)
data
- The data for the past (xml)dataType
- Should be one of:
interactive
- If true, the workspace will switch to the paste tool. If not, you should call
doPaste after calling startPastepublic void cancelPaste()
public boolean isPastePending()
protected void setPastePending(boolean b)
public void doDelete()
EditActionHandler
public void doDuplicateSelection()
public void doCopyToClipboard()
public void doCutToClipboard()
public java.awt.datatransfer.Transferable doCopy()
StringSelection
Transferable
, or null if the copy failed. Will be added to
the system clipboard.public java.awt.datatransfer.Transferable doCut()
StringSelection
.Transferable
, or null if the cut failed. Will be added to the
system clipboard.public void doPaste(java.awt.datatransfer.Transferable t)
EditActionHandler
t
- The current contents of the clipboard to paste.public boolean doPasteImpl(java.awt.datatransfer.Transferable t)
public void addCopyPasteListener(CopyPasteListener listener)
public void removeCopyPasteListener(CopyPasteListener listener)