hades.gui
Class ColibriCreateCommand

java.lang.Object
  extended byjava.util.EventObject
      extended byhades.gui.Command
          extended byhades.gui.ColibriCreateCommand
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener, FigCanvasListener, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.io.Serializable

public class ColibriCreateCommand
extends Command

ColibriCreateCommand - copy an object in an HADES Design.

See Also:
Serialized Form

Field Summary
(package private)  ObjectCanvas canvas
           
(package private)  java.awt.Point newPos
           
(package private)  java.awt.Point oldPos
           
(package private)  SimObject target
           
 
Fields inherited from class hades.gui.Command
console, debug, editor, ready, versionString
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
ColibriCreateCommand(Editor editor, SimObject simobj)
          ColibriCreateCommand: add a SimObject to the current Design at a user-selected position.
 
Method Summary
 void cancel()
           
 void execute()
          perform the action corresponding to this CreateCommand object and register it with the UndoStack.
 java.lang.String getDescription()
           
 java.lang.String getLogExtraArguments()
          return a text-encoding of any extra argument we might want to use for LogManager.
 void mousePressed(FigCanvasEvent ME)
          extract the screen and world coordinates of this Event, and dispatch to setPosition().
 void setPosition(java.awt.Point SP, java.awt.Point WP)
          this method should be called twice for a ColibriCreateCommand.
 java.lang.String toString()
          toString(): identify this CreateCommand
 void undo()
          try to undo the action corresponding to this CreateCommand object: we simply delete the copied object.
 
Methods inherited from class hades.gui.Command
actionPerformed, dbg, initialize, isReady, keyPressed, keyReleased, keyTyped, message, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, statusMessage, writePositionLogMessage
 
Methods inherited from class java.util.EventObject
getSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

newPos

java.awt.Point newPos

oldPos

java.awt.Point oldPos

target

SimObject target

canvas

ObjectCanvas canvas
Constructor Detail

ColibriCreateCommand

public ColibriCreateCommand(Editor editor,
                            SimObject simobj)
ColibriCreateCommand: add a SimObject to the current Design at a user-selected position. Afterwards, create the next ColibriCreateCommand to allow for easy multiple-object-creation.

Method Detail

execute

public void execute()
perform the action corresponding to this CreateCommand object and register it with the UndoStack.

Overrides:
execute in class Command

cancel

public void cancel()
Overrides:
cancel in class Command

mousePressed

public void mousePressed(FigCanvasEvent ME)
extract the screen and world coordinates of this Event, and dispatch to setPosition().

Specified by:
mousePressed in interface FigCanvasListener
Overrides:
mousePressed in class Command

setPosition

public void setPosition(java.awt.Point SP,
                        java.awt.Point WP)
this method should be called twice for a ColibriCreateCommand. At the first call, we expect the old position of the object to be moved, and on the second call its target position.

Overrides:
setPosition in class Command

undo

public void undo()
try to undo the action corresponding to this CreateCommand object: we simply delete the copied object. However, to allow for consistent later redo, we must also move the object's Symbol back to the origin.

Overrides:
undo in class Command

toString

public java.lang.String toString()
toString(): identify this CreateCommand

Overrides:
toString in class Command

getDescription

public java.lang.String getDescription()
Overrides:
getDescription in class Command

getLogExtraArguments

public java.lang.String getLogExtraArguments()
return a text-encoding of any extra argument we might want to use for LogManager. Returns the empty string.

Overrides:
getLogExtraArguments in class Command