com.bluemarsh.jswat.ui
Class ConsoleAdapter

java.lang.Object
  |
  +--com.bluemarsh.jswat.ui.BasicUIAdapter
        |
        +--com.bluemarsh.jswat.ui.ConsoleAdapter
All Implemented Interfaces:
UIAdapter

public class ConsoleAdapter
extends BasicUIAdapter

Class ConsoleAdapter connects the Session with the user interface of JSwat. It builds out the major interface components, connects them to the Session and managers, and handles some user input. This subclass of the UIAdapter class builds out a console interface, which runs entirely based on stdout and stdin.

Author:
Nathan Fiedler

Inner Class Summary
protected  class ConsoleAdapter.ConsoleInputAdapter
          Class ConsoleInputAdapter adapts the standard input stream to the CommandManager.
 
Field Summary
protected  Session ourSession
          Session we are associated with.
protected  com.bluemarsh.jswat.ui.ConsoleOutputAdapter outputAdapter
          Handles the output from the debuggee VM.
protected  com.bluemarsh.jswat.ui.ConsoleOutputStream outputStream
          This output stream supports printing the command prompt.
protected  Log statusLog
          Log to which messages are printed.
 
Fields inherited from class com.bluemarsh.jswat.ui.BasicUIAdapter
propertyTable
 
Constructor Summary
ConsoleAdapter(Session session)
          Constructs a ConsoleAdapter, connected to the given Session.
 
Method Summary
 void buildInterface()
          Construct the appropriate user interface and connect all the pieces together.
 boolean canFindString()
          Indicate if this interface adapter has the ability to find a string in the currently selected source view.
 boolean canShowFile()
          Indicate if this interface adapter has the ability to show source files in a manner appropriate for the user to read.
 boolean canShowStatus()
          Indicate if this interface adapter has the ability to show the status in a manner appropriate for the user to view.
 void destroyInterface()
          Deconstruct the user interface such that all components are made invisible and prepared for non-use.
 void exit()
          This is called when there are no more open Sessions.
 boolean findString(java.lang.String query, boolean ignoreCase)
          Search for the given string in the currently selected source view.
 JSwatView getSelectedView()
          Retrieves the currently active view in JSwat.
 void initComplete()
          Called when the Session initialization has completed.
 void refreshDisplay()
          Refresh the display to reflect changes in the program.
 void saveSettings()
          Save any settings to the appropriate places, the program is about the terminate.
 boolean showFile(java.io.File file, int line)
          Show the given file in the appropriate view and make the given line visible in that view.
 void showStatus(java.lang.String status)
          Show a status message in a reasonable location.
 
Methods inherited from class com.bluemarsh.jswat.ui.BasicUIAdapter
getProperty, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ourSession

protected Session ourSession
Session we are associated with.

statusLog

protected Log statusLog
Log to which messages are printed.

outputStream

protected com.bluemarsh.jswat.ui.ConsoleOutputStream outputStream
This output stream supports printing the command prompt.

outputAdapter

protected com.bluemarsh.jswat.ui.ConsoleOutputAdapter outputAdapter
Handles the output from the debuggee VM.
Constructor Detail

ConsoleAdapter

public ConsoleAdapter(Session session)
Constructs a ConsoleAdapter, connected to the given Session.
Parameters:
session - Session we are associated with.
Method Detail

buildInterface

public void buildInterface()
Construct the appropriate user interface and connect all the pieces together. The result should be a fully functional interface that is ready to be used.
Overrides:
buildInterface in class BasicUIAdapter

canFindString

public boolean canFindString()
Indicate if this interface adapter has the ability to find a string in the currently selected source view.
Overrides:
canFindString in class BasicUIAdapter
Returns:
always returns false.

canShowFile

public boolean canShowFile()
Indicate if this interface adapter has the ability to show source files in a manner appropriate for the user to read.
Overrides:
canShowFile in class BasicUIAdapter
Returns:
always returns false.

canShowStatus

public boolean canShowStatus()
Indicate if this interface adapter has the ability to show the status in a manner appropriate for the user to view.
Overrides:
canShowStatus in class BasicUIAdapter
Returns:
always returns false.

destroyInterface

public void destroyInterface()
Deconstruct the user interface such that all components are made invisible and prepared for non-use.
Overrides:
destroyInterface in class BasicUIAdapter

exit

public void exit()
This is called when there are no more open Sessions. The adapter should take the appropriate action at this time. In most cases that will be to exit the JVM.
Overrides:
exit in class BasicUIAdapter

findString

public boolean findString(java.lang.String query,
                          boolean ignoreCase)
                   throws NoOpenViewException
Search for the given string in the currently selected source view. The search should continue from the last successful match, and wrap around to the beginning when the end is reached. This implementation throws UnsupportedOperationException since the console adapter does not support views.
Overrides:
findString in class BasicUIAdapter
Parameters:
query - string to look for.
ignoreCase - true to ignore case.
Returns:
true if string was found.

getSelectedView

public JSwatView getSelectedView()
Retrieves the currently active view in JSwat. This implementation throws UnsupportedOperationException since the console adapter does not support views.
Overrides:
getSelectedView in class BasicUIAdapter
Returns:
selected view, or null if none selected.

initComplete

public void initComplete()
Called when the Session initialization has completed.
Overrides:
initComplete in class BasicUIAdapter

refreshDisplay

public void refreshDisplay()
Refresh the display to reflect changes in the program. Generally this means refreshing the panels.
Overrides:
refreshDisplay in class BasicUIAdapter

saveSettings

public void saveSettings()
Save any settings to the appropriate places, the program is about the terminate.
Overrides:
saveSettings in class BasicUIAdapter

showFile

public boolean showFile(java.io.File file,
                        int line)
Show the given file in the appropriate view and make the given line visible in that view.
Overrides:
showFile in class BasicUIAdapter
Parameters:
file - file to be displayed.
line - line to be made visible.
Returns:
true if successful, false if error.

showStatus

public void showStatus(java.lang.String status)
Show a status message in a reasonable location.
Overrides:
showStatus in class BasicUIAdapter
Parameters:
status - message to be shown to the user.