jfig.commands
Class CopyToClipboardCommand

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

public class CopyToClipboardCommand
extends Command

copy jfig objects to the system clipboard.

CopyToClipboardCommand allows the user to copy single or multiple jfig objects to the system clipboard. 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 ("meta"+click or "shift+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
CopyToClipboardCommand(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()
          returns an array-wrapped reference to the compound object which has been (or will be) copied 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()
          no need to undo this 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

CopyToClipboardCommand

public CopyToClipboardCommand(FigBasicEditor editor,
                              FigCanvas objectCanvas)
Method Detail

getModifiedObjects

public FigObject[] getModifiedObjects()
returns an array-wrapped reference to the compound object which has been (or will be) copied to the clipboard. Note that the compound reference may be null until a valid compound has been created.

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()
no need to undo this command.

Overrides:
undo in class Command

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