jfig.commands
Class JOpenCompoundCommand

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

public class JOpenCompoundCommand
extends Command

open a compound object for editing. This command pushes the current FIG drawing onto a stack and substitutes the drawing with the contents of the selected compound object. It also creates a non-modal dialog window that allows the user to close the compound object and resume working on the parent drawing.


Field Summary
(package private)  FigCompound compound
           
(package private)  JModularEditor editor
           
(package private)  ModularEditorState state
           
 
Fields inherited from class jfig.commands.Command
objectCanvas, ready
 
Constructor Summary
JOpenCompoundCommand(FigBasicEditor _editor, FigCanvas objectCanvas)
           
 
Method Summary
 void cancel()
          cancel the current editor command
static void closeAllCompounds()
           
static void closeOneCompound()
          closeOneCompound: add all current editor objects to an compound, restore the editor to its previous state, then add our new compound to the restored editor's object list.
 void execute()
          execute: the user has selected a FigCompound object to be opened.
 java.lang.String getDescription()
          one-line description of this command
 FigObject[] getModifiedObjects()
          return an array-wrapped reference to the compound object modified by this command.
 boolean isReady()
          check whether this command is completed/ready, or not
 void mousePressed(FigCanvasEvent evt)
          react to a mouse click on the editor canvas
 void showAllCompounds()
           
 java.lang.String toString()
          return a (possibly verbose) description of this JOpenCompoundCommand object
 void undo()
          undo this command
 
Methods inherited from class jfig.commands.Command
message, notifyEditor, statusMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

compound

FigCompound compound

state

ModularEditorState state

editor

JModularEditor editor
Constructor Detail

JOpenCompoundCommand

public JOpenCompoundCommand(FigBasicEditor _editor,
                            FigCanvas objectCanvas)
Method Detail

getModifiedObjects

public FigObject[] getModifiedObjects()
return an array-wrapped reference to the compound object modified by this command. The compound reference may be null.

Overrides:
getModifiedObjects in class Command

cancel

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

cancel and cleanup the current command. Note that this method is empty for class Command, but might be implemented by subclasses.

Overrides:
cancel in class Command

execute

public void execute()
execute: the user has selected a FigCompound object to be opened. We save the current editor state and create a new editor state with the compound's member objects. This command object is then registered with the internal stack of JOpenCompoundCommand objects. Also, we display (and create on the first call) the CloseCompoundDialog.

Overrides:
execute in class Command

undo

public void undo()
undo this command

Try to undo this command as far as possible. Don't try to undo() a command that has never been execute()d before. This method is NOT YET IMPLEMENTED for class JOpenCompoundCommand.

Overrides:
undo in class Command

mousePressed

public void mousePressed(FigCanvasEvent evt)
Description copied from class: Command
react to a mouse click on the editor canvas

This method provides the central callback from the editor to its current command object. Passing a FigCanvasEvent parameter, the editor provides information both about the screen coordinates and the world coordinates of the mouse event.

Naturally, mouse presses are ignored for class Command.

Overrides:
mousePressed in class Command

isReady

public boolean isReady()
check whether this command is completed/ready, or not

Overrides:
isReady in class Command

showAllCompounds

public void showAllCompounds()

closeOneCompound

public static void closeOneCompound()
closeOneCompound: add all current editor objects to an compound, restore the editor to its previous state, then add our new compound to the restored editor's object list. Some bookkeeping is needed, too...


closeAllCompounds

public static void closeAllCompounds()

getDescription

public java.lang.String getDescription()
one-line description of this command

Overrides:
getDescription in class Command

toString

public java.lang.String toString()
return a (possibly verbose) description of this JOpenCompoundCommand object

Overrides:
toString in class Command