com.bluemarsh.jswat.ui
Class GraphicalInputAdapter

java.lang.Object
  |
  +--com.bluemarsh.jswat.ui.GraphicalInputAdapter
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener, SessionListener

public class GraphicalInputAdapter
extends java.lang.Object
implements java.awt.event.ActionListener, SessionListener

Class GraphicalInputAdapter is responsible for providing the input to a debuggee process through a text field. This class uses the ActionListener interface to catch text field action events. Unfortunately, this has two disadvantages:

Fortunately, Java's method for reading from standard input matches exactly the behavior we replicate. How convenient...

For this class to operate correctly it must be added as a session listener.

Author:
Nathan Fiedler

Field Summary
protected  javax.swing.JTextField inputField
          Text area displaying the messages.
protected  java.io.OutputStreamWriter inputWriter
          Output stream writer to write to the debuggee's stdin.
 
Constructor Summary
GraphicalInputAdapter()
          Constructs a GraphicalInputAdapter with the default text field.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent event)
          Invoked when user hits Enter in the input text field.
 void activate(Session session)
          Called when the Session is about to begin an active debugging session.
 void close(Session session)
          Called when the Session is about to close down.
 void deactivate(Session session)
          Called when the Session is about to end an active debugging session.
 javax.swing.JComponent getUI()
          Returns a reference to the UI component.
 void init(Session session)
          Called after the Session has added this listener to the Session listener list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

inputField

protected javax.swing.JTextField inputField
Text area displaying the messages.

inputWriter

protected java.io.OutputStreamWriter inputWriter
Output stream writer to write to the debuggee's stdin.
Constructor Detail

GraphicalInputAdapter

public GraphicalInputAdapter()
Constructs a GraphicalInputAdapter with the default text field.
Method Detail

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent event)
Invoked when user hits Enter in the input text field.
Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
event - Action event.

activate

public void activate(Session session)
Called when the Session is about to begin an active debugging session. That is, JSwat is about to debug a debuggee VM. Panels are not activated in any particular order.
Specified by:
activate in interface SessionListener
Parameters:
session - Session being activated.

close

public void close(Session session)
Called when the Session is about to close down.
Specified by:
close in interface SessionListener
Parameters:
session - Session being closed.

deactivate

public void deactivate(Session session)
Called when the Session is about to end an active debugging session. That is, JSwat is about to terminate the connection with the debuggee VM. Panels are not deactivated in any particular order.
Specified by:
deactivate in interface SessionListener
Parameters:
session - Session being deactivated.

getUI

public javax.swing.JComponent getUI()
Returns a reference to the UI component.
Returns:
ui component object

init

public void init(Session session)
Called after the Session has added this listener to the Session listener list.
Specified by:
init in interface SessionListener
Parameters:
session - Session adding this listener.