hades.gui
Class CreateSubdesignCommand

java.lang.Object
  extended byjava.util.EventObject
      extended byhades.gui.Command
          extended byhades.gui.CreateSubdesignCommand
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 CreateSubdesignCommand
extends Command
implements java.awt.event.ActionListener

CreateSubdesignCommand - put a subdesign into a design.

See Also:
Serialized Form

Field Summary
(package private)  ObjectCanvas canvas
           
(package private)  boolean hasName
           
(package private)  java.awt.Point newPos
           
(package private)  java.lang.String resname
           
(package private)  StringDialog stringDialog
           
(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
CreateSubdesignCommand(Editor editor, java.lang.String designName)
          select a HADES subdesign in the DesignManager, and include it with the current editor's design.
 
Method Summary
 void execute()
          if we arrive here, the user has selected a valid subdesign and the position where to place it.
 java.lang.String getDescription()
           
 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)
          select the subdesign target position.
 java.lang.String toString()
          toString(): identify this CreateSubdesignCommand
 void undo()
          undo this CreateSubdesignCommand object: we simply delete the subdesign.
 
Methods inherited from class hades.gui.Command
actionPerformed, cancel, dbg, getLogExtraArguments, 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
 
Methods inherited from interface java.awt.event.ActionListener
actionPerformed
 

Field Detail

newPos

java.awt.Point newPos

target

SimObject target

canvas

ObjectCanvas canvas

stringDialog

StringDialog stringDialog

hasName

boolean hasName

resname

java.lang.String resname
Constructor Detail

CreateSubdesignCommand

public CreateSubdesignCommand(Editor editor,
                              java.lang.String designName)
select a HADES subdesign in the DesignManager, and include it with the current editor's design.

Method Detail

execute

public void execute()
if we arrive here, the user has selected a valid subdesign and the position where to place it. Actually include the subdesign with the editor's design, and register this Command with the UndoStack.

Overrides:
execute in class Command

undo

public void undo()
undo this CreateSubdesignCommand object: we simply delete the subdesign.

Overrides:
undo 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)
select the subdesign target position.

Overrides:
setPosition in class Command

toString

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

Overrides:
toString in class Command

getDescription

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