hades.gui
Class Command

java.lang.Object
  extended byjava.util.EventObject
      extended byhades.gui.Command
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
Direct Known Subclasses:
AddProbeToSignalCommand, AddSegmentToSignalCommand, AutoconnectCommand, ChangeNameCommand, ChangeSignalNameCommand, ColibriCreateCommand, CopyCommand, CreateByNameCommand, CreateCommand, CreateSignalCommand, CreateSubdesignCommand, DeleteAllCommand, DeleteCommand, DeleteComponentCommand, DeleteProbeFromSignalCommand, DeleteSegmentFromSignalCommand, DeleteSelectionCommand, DeleteSignalCommand, DeselectAllCommand, DisconnectCommand, DisconnectPortCommand, EditCommand, InsertVertexIntoSignalCommand, MirrorXCommand, MirrorYCommand, MoveCommand, MoveSelectionCommand, MoveToPositiveQuadrantCommand, OpenDesignCommand, SelectAllCommand, SelectObjectCommand, SelectRegionCommand, SetDesignNameCommand, SignalMovePointCommand, SignalSetValueCommand, ZoomRegionCommand

public class Command
extends java.util.EventObject
implements java.awt.event.ActionListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.KeyListener, FigCanvasListener

Command - the common base class for all HADES editing command objects. It models the 'idle command' that does nothing.

See Also:
Serialized Form

Field Summary
protected  Console console
           
protected static boolean debug
           
protected  Editor editor
           
protected  boolean ready
           
protected static java.lang.String versionString
           
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
Command(Editor editor)
          the default constructor for all Command objects, belonging to an HADES editor.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
 void cancel()
           
static void dbg(java.lang.String msg)
           
 void execute()
          perform the action corresponding to this Command 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.
 boolean initialize(java.lang.String s)
           
 boolean isReady()
          check whether the current Command object is ready (has all required parameters, etc.).
 void keyPressed(java.awt.event.KeyEvent e)
           
 void keyReleased(java.awt.event.KeyEvent e)
           
 void keyTyped(java.awt.event.KeyEvent e)
           
 void message(java.lang.String msg)
           
 void mouseClicked(java.awt.event.MouseEvent e)
           
 void mouseDragged(java.awt.event.MouseEvent e)
           
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 void mouseMoved(java.awt.event.MouseEvent e)
           
 void mousePressed(FigCanvasEvent e)
          process a mouse event ME at world coordinates WP and screen coords SP
 void mousePressed(java.awt.event.MouseEvent e)
           
 void mouseReleased(java.awt.event.MouseEvent e)
           
 void setPosition(java.awt.Point SP, java.awt.Point WP)
          the following method is used to pass the (snapped!) coordinates of an MouseEvent to a Command object.
 void statusMessage(java.lang.String msg)
           
 java.lang.String toString()
           
 void undo()
          try to undo the action corresponding to this Command object.
 void writePositionLogMessage(java.awt.Point SP, java.awt.Point WP)
           
 
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

ready

protected boolean ready

editor

protected Editor editor

versionString

protected static java.lang.String versionString

debug

protected static boolean debug

console

protected Console console
Constructor Detail

Command

public Command(Editor editor)
the default constructor for all Command objects, belonging to an HADES editor.

Note that other parameter values (like names, event sources, ...) should be set later on with calls to the corresponding event dispatcher methods, e.g. mousePressed().

Method Detail

isReady

public boolean isReady()
check whether the current Command object is ready (has all required parameters, etc.). Note that an Command itself, the base class 'idle command', is always ready.

As long as the Command object tells the Editor that it is not ready, all relevant (=registered) Events will be delivered to the Command object.


execute

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


undo

public void undo()
try to undo the action corresponding to this Command object.


cancel

public void cancel()

initialize

public boolean initialize(java.lang.String s)

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Specified by:
mouseExited in interface java.awt.event.MouseListener

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)
Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener

keyPressed

public void keyPressed(java.awt.event.KeyEvent e)
Specified by:
keyPressed in interface java.awt.event.KeyListener

keyReleased

public void keyReleased(java.awt.event.KeyEvent e)
Specified by:
keyReleased in interface java.awt.event.KeyListener

keyTyped

public void keyTyped(java.awt.event.KeyEvent e)
Specified by:
keyTyped in interface java.awt.event.KeyListener

mousePressed

public void mousePressed(FigCanvasEvent e)
Description copied from interface: FigCanvasListener
process a mouse event ME at world coordinates WP and screen coords SP

Specified by:
mousePressed in interface FigCanvasListener

setPosition

public void setPosition(java.awt.Point SP,
                        java.awt.Point WP)
the following method is used to pass the (snapped!) coordinates of an MouseEvent to a Command object.


writePositionLogMessage

public void writePositionLogMessage(java.awt.Point SP,
                                    java.awt.Point WP)

statusMessage

public void statusMessage(java.lang.String msg)

toString

public java.lang.String toString()

getDescription

public java.lang.String getDescription()

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.


message

public void message(java.lang.String msg)

dbg

public static void dbg(java.lang.String msg)