jfig.commands
Class CutToClipboardCommand

java.lang.Object
  extended byjfig.commands.Command
      extended byjfig.commands.CutToClipboardCommand

public class CutToClipboardCommand
extends Command

cut jfig objects to the system clipboard.

CutToClipboardCommand allows the user to copy single or multiple jfig objects to the system clipboard, which are then deleted from the current drawing. To allow for data-exchange with other applications (like xfig and text editors), the objects are written to the clipboard as text data in FIG file format.

The command first collects all objects clicked on (at/near the mouse position), until the user uses a right-click to finish and execute the command.

See Also:
PasteFromClipboardCommand

Field Summary
protected  FigCompound compound
           
protected  boolean hasUnfinishedRegion
           
protected  java.awt.Point P1
           
protected  java.awt.Point P2
           
 
Fields inherited from class jfig.commands.Command
editor, objectCanvas, ready
 
Constructor Summary
CutToClipboardCommand(FigBasicEditor editor, FigCanvas objectCanvas)
           
 
Method Summary
 void execute()
          execute the current editor command
 java.lang.String getDescription()
          one-line description of this command
 FigObject[] getModifiedObjects()
          return an array-wrapped reference to the compound object which has been (or will be) deleted and transferred to the clipboard.
 void mousePressed(FigCanvasEvent evt)
          mousePressed: select the objects to copy to the system clipboard
 java.lang.String toString()
          return a (possibly verbose) description of this Command object
 void undo()
          undo: instead of providing a direct undo, please use a 'paste from clipboard' command.
 
Methods inherited from class jfig.commands.Command
cancel, isReady, message, notifyEditor, statusMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

compound

protected FigCompound compound

P1

protected java.awt.Point P1

P2

protected java.awt.Point P2

hasUnfinishedRegion

protected boolean hasUnfinishedRegion
Constructor Detail

CutToClipboardCommand

public CutToClipboardCommand(FigBasicEditor editor,
                             FigCanvas objectCanvas)
Method Detail

getModifiedObjects

public FigObject[] getModifiedObjects()
return an array-wrapped reference to the compound object which has been (or will be) deleted and transferred to the clipboard. The compound reference may be null.

Overrides:
getModifiedObjects in class Command

execute

public void execute()
Description copied from class: Command
execute the current editor command

This method is empty for class Command.

Overrides:
execute in class Command

undo

public void undo()
undo: instead of providing a direct undo, please use a 'paste from clipboard' command.

Overrides:
undo in class Command
See Also:
PasteFromClipboardCommand

mousePressed

public void mousePressed(FigCanvasEvent evt)
mousePressed: select the objects to copy to the system clipboard

We first collect all objects clicked on (at/near the mouse position), until the user uses a right-click ("meta"+click or "shift+click) to finish and execute the command.

Overrides:
mousePressed in class Command

getDescription

public java.lang.String getDescription()
Description copied from class: Command
one-line description of this command

return a one-line desription of this command, e.g. to label the undo/redo buttons, if any

Overrides:
getDescription in class Command

toString

public java.lang.String toString()
Description copied from class: Command
return a (possibly verbose) description of this Command object

Overrides:
toString in class Command