hades.gui
Class LogManager

java.lang.Object
  extended byhades.gui.LogManager

public class LogManager
extends java.lang.Object

manage to write Hades command to a log file in order to later playback and analyze the user interaction with the editor. This allows us to trace some of intermittent GUI bugs and also provides a means to better help students in case of design errors and/or problems with the GUI. We currently support to log the following:

 Hades Command creation - consisting of the command class name 
       and optional string-encoded arguments. So far, only the
       'hades.gui.ColibriCreateCommand' uses an argument - the class name
       of the SimObject to create

 mousePressed events on the Hades ObjectCanvas; we log the screen
       coordinates and world coordinates of the event, the modifier mask,
       and the current FigTrafo2D anchor point and zoom factor

 keyPressed events on the ObjectCanvas; we log the key code, key char,
       modifier mask, and the key text.

 selected Hades Editor function calls, e.g. _doLoadFileOrURL and
       _doSaveFileAs() calls.

 showPopupMenu messages record the mouse position where the popup
       menu was activated on the canvas. This is required for some commands,
       but is also controversial: FIXME: It might be better to always simply
       log the mousePressed events and reconstruct the popup menu action later.

 setPosition calls to command objects. FIXME: this does not work yet.
   
Note that the current algorithm does not yet work, because some events are recorded twice; for example when a keyPressed events is used to create a MoveCommand or DeleteCommand, the internally generated setPosition() calls conflict with the external user-inputs.

Note that simulation control events like start, pause, or runFor are not logged.

Summary of Hades-internal event dispatch: mouseMoved: only handled in (AWT|J)ObjectCanvas can be faked with corresponding MouseMotionEvents mouseReleased: only handled in (AWT|J)ObjectCanvas must record whether popup trigger or not mousePressed: only handled in (AWT|J)ObjectCanvas, must record whether popup trigger or not calls back to Editor.mousePressed if not popup trigger actionPerformed: only handled in Editor, dispatches to __call( methodname, argument ) can be handled inside of __call keyReleased: handled (and ignored!) in Editor keyTyped: handled in Editor, dispatches to KeyHandler.keyTyped keyPressed: handled in Editor, dispatches to KeyHandler for most (but not all keys).


Field Summary
static java.lang.String logdirname
           
 
Constructor Summary
LogManager(Editor _editor)
           
 
Method Summary
 void checkCreateLogStream()
           
 void closeLogStream()
           
 java.io.PrintStream getLogStream()
           
static void main(java.lang.String[] argv)
           
static void msg(java.lang.String s)
           
 void writeDoCancel()
           
 void writeDoCancelAndEnablePopupOnNextMouseRelease()
           
 void writeKeyPressed(java.awt.event.KeyEvent evt)
           
 void writeLogComment(java.lang.String s)
           
 void writeLogMessage(java.lang.String s)
           
 void writeMethodCall(java.lang.String methodname, java.lang.Object arg)
           
 void writeMouseMoved()
           
 void writeMousePressed(FigCanvasEvent fce)
          write a MousePressed event to the logfile, consisting of the marker "m:", the screen coordinates of the event, the corresponding world coordinates, the modifier keys shift, alt, control, and meta, the current FigTrafo2D anchor point and zoom factor.
 void writeMouseReleased(java.awt.event.MouseEvent me)
           
 void writeSetCommand(Command c)
           
 void writeSetPosition(java.awt.Point sp, java.awt.Point wp)
           
 void writeShowPopupPosition(java.awt.Point sp, java.awt.Point wp)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logdirname

public static final java.lang.String logdirname
See Also:
Constant Field Values
Constructor Detail

LogManager

public LogManager(Editor _editor)
Method Detail

getLogStream

public java.io.PrintStream getLogStream()

checkCreateLogStream

public void checkCreateLogStream()

closeLogStream

public void closeLogStream()

writeLogMessage

public void writeLogMessage(java.lang.String s)

writeLogComment

public void writeLogComment(java.lang.String s)

writeMethodCall

public void writeMethodCall(java.lang.String methodname,
                            java.lang.Object arg)

writeSetCommand

public void writeSetCommand(Command c)

writeSetPosition

public void writeSetPosition(java.awt.Point sp,
                             java.awt.Point wp)

writeDoCancel

public void writeDoCancel()

writeDoCancelAndEnablePopupOnNextMouseRelease

public void writeDoCancelAndEnablePopupOnNextMouseRelease()

writeMousePressed

public void writeMousePressed(FigCanvasEvent fce)
write a MousePressed event to the logfile, consisting of the marker "m:", the screen coordinates of the event, the corresponding world coordinates, the modifier keys shift, alt, control, and meta, the current FigTrafo2D anchor point and zoom factor. For example:
m: 100,200  s--m  781,0  2.0


writeMouseMoved

public void writeMouseMoved()

writeMouseReleased

public void writeMouseReleased(java.awt.event.MouseEvent me)

writeShowPopupPosition

public void writeShowPopupPosition(java.awt.Point sp,
                                   java.awt.Point wp)

writeKeyPressed

public void writeKeyPressed(java.awt.event.KeyEvent evt)

msg

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

main

public static void main(java.lang.String[] argv)