hades.gui
Class MoveSelectionCommand

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

MoveSelectionCommand - move the selected SimObjects in a HADES Design. move all selected SimObjects and all (if any) selected WireSegments to a new position inside a HADES design schematic. status: incomplete. FIXME: Moving a selected WireSegment connected to a non-selected SimObject will correctly move the WireSegment but not dis-connect the WireSegment. This leads to inconsistent schematics. FIXME: no undo yet

See Also:
Serialized Form

Field Summary
(package private)  java.awt.Point anchor
           
(package private)  ObjectCanvas canvas
           
(package private)  java.util.Hashtable syTable
           
(package private)  java.awt.Point target
           
(package private)  java.util.Hashtable wsTable
           
 
Fields inherited from class hades.gui.Command
console, debug, editor, ready, versionString
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
MoveSelectionCommand(Editor editor)
          create a new MoveSelectionCommand.
 
Method Summary
 void execute()
          move the selected objects and register this command with the Undo stack.
 java.lang.String getDescription()
           
 void markFirstPoint(WireSegment segment)
           
 void markSecondPoint(WireSegment segment)
           
 void markWireSegments(Signal signal, java.awt.Point WP)
          mark all WireSegments on "signal" that end on the "vertex" position.
 void markWireSegments(Symbol symbol, Port port)
          mark all WireSegments connected to "port" at "symbol".
 void mousePressed(FigCanvasEvent ME)
          extract the screen and world coordinates of this Event, and dispatch to setPosition().
 void moveFigObject(FigObject tmp)
           
 void moveFirstPoint(WireSegment segment, int dx, int dy)
           
 void moveSecondPoint(WireSegment segment, int dx, int dy)
           
 void msg(java.lang.String s)
           
 void setPosition(java.awt.Point SP, java.awt.Point WP)
          this method should be called twice for a move selection command.
 java.lang.String toString()
          toString(): identify this MoveSelectionCommand
 void undo()
          try to undo the action corresponding to this MoveSelectionCommand object.
 void unknownObject(java.lang.Object tmp)
           
 
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

anchor

java.awt.Point anchor

target

java.awt.Point target

canvas

ObjectCanvas canvas

syTable

java.util.Hashtable syTable

wsTable

java.util.Hashtable wsTable
Constructor Detail

MoveSelectionCommand

public MoveSelectionCommand(Editor editor)
create a new MoveSelectionCommand.

Method Detail

execute

public void execute()
move the selected objects and register this command with the Undo stack. The behaviour of this command is as follows: For selected SimObject's we simply move the corresponding Symbols. If any WireSegments are connected to the SimObject but not selected, the WireSegment vertex connected to the SimObject is moved as well (without autorouting, however, so that Manhattan geometry might be lost). For each Signal that has a selected component (WireSegment or Solderdot), the selected components are moved by moving the corresponding Signal vertices. All WireSegments ending in one of the moved vertices will be updated as well. The movedObjects hashtable is used for bookkeeping of all moved objects.

Overrides:
execute in class Command

markWireSegments

public void markWireSegments(Symbol symbol,
                             Port port)
mark all WireSegments connected to "port" at "symbol". For each WireSegment, there are four different possibilies, namely whether to move "none", "first", "second", or "both" WireSegment vertices.


markWireSegments

public void markWireSegments(Signal signal,
                             java.awt.Point WP)
mark all WireSegments on "signal" that end on the "vertex" position. For each WireSegment, the possible marker values are "none", "first", "second", "both".


markFirstPoint

public void markFirstPoint(WireSegment segment)

markSecondPoint

public void markSecondPoint(WireSegment segment)

moveFirstPoint

public void moveFirstPoint(WireSegment segment,
                           int dx,
                           int dy)

moveSecondPoint

public void moveSecondPoint(WireSegment segment,
                            int dx,
                            int dy)

moveFigObject

public void moveFigObject(FigObject tmp)

unknownObject

public void unknownObject(java.lang.Object tmp)

undo

public void undo()
try to undo the action corresponding to this MoveSelectionCommand 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)
this method should be called twice for a move selection command. The first call is used to specify the anchor point for the move, while the second call specifies the target point. The relative distance of target and anchor is used for the move.

Overrides:
setPosition in class Command

toString

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

Overrides:
toString in class Command

getDescription

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

msg

public void msg(java.lang.String s)