hades.gui
Class DisconnectCommand

java.lang.Object
  extended byjava.util.EventObject
      extended byhades.gui.Command
          extended byhades.gui.DisconnectCommand
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 DisconnectCommand
extends Command

DisconnectCommand - disconnect a SimObject from all wires (accidentally) positioned on its Ports.

See Also:
Serialized Form

Field Summary
(package private)  ObjectCanvas canvas
           
(package private)  java.awt.Point oldPos
           
(package private)  Symbol symbol
           
(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
DisconnectCommand(Editor editor)
          create an DisconnectCommand without reference to a SimObject yet.
 
Method Summary
 void execute()
          perform the DisconnectCommand: check all Ports of SimObject target and connect them to any Signals whose WireSegments are on the Port positions.
 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)
          specify the SimObject to 'autoconnect' by giving its position.
 java.lang.String toString()
          toString(): identify this DisconnectCommand
 void undo()
          try to undo this DisconnectCommand object.
 
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
 

Field Detail

oldPos

java.awt.Point oldPos

symbol

Symbol symbol

target

SimObject target

canvas

ObjectCanvas canvas
Constructor Detail

DisconnectCommand

public DisconnectCommand(Editor editor)
create an DisconnectCommand without reference to a SimObject yet.

Method Detail

execute

public void execute()
perform the DisconnectCommand: check all Ports of SimObject target and connect them to any Signals whose WireSegments are on the Port positions. Then register it with the UndoStack.

Overrides:
execute in class Command

undo

public void undo()
try to undo this DisconnectCommand object.

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)
specify the SimObject to 'autoconnect' by giving its position. moved, and on the second call its target position.

Overrides:
setPosition in class Command

toString

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

Overrides:
toString in class Command

getDescription

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