com.bluemarsh.jswat.ui
Class GraphicalAdapter

java.lang.Object
  |
  +--com.bluemarsh.jswat.ui.BasicUIAdapter
        |
        +--com.bluemarsh.jswat.ui.GraphicalAdapter
All Implemented Interfaces:
com.bluemarsh.config.ConfigureListener, java.util.EventListener, UIAdapter

public class GraphicalAdapter
extends BasicUIAdapter
implements com.bluemarsh.config.ConfigureListener

Class GraphicalAdapter 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 graphical interface made up of JFC components.

Author:
Nathan Fiedler

Inner Class Summary
protected  class GraphicalAdapter.FrameListener
          Class to listen to internal frames for closure.
 
Field Summary
protected  javax.swing.JSplitPane bottomSplitter
          Bottom horizontal window splitter.
protected  javax.swing.JDesktopPane desktopPane
          Desktop pane which holds the source file views.
protected  GraphicalAdapter.FrameListener frameListener
          Object for listening to the internal frames.
protected  GraphicalInputAdapter inputAdapter
          Handles the intput to the debuggee VM.
protected  MainWindow mainWindow
          Top-most frame that contains everything.
protected  GraphicalMessageAdapter messageAdapter
          Handles the status log display.
protected  java.util.Hashtable openFiles
          Table of open files.
protected  java.util.Hashtable openViews
          Table of open views.
protected  java.util.Hashtable openWindows
          Table of open windows.
protected  Session ourSession
          Session we are associated with.
protected  GraphicalOutputAdapter outputAdapter
          Handles the output from the debuggee VM.
protected  java.util.List panelList
          List of all panels we've created.
protected  com.bluemarsh.jswat.ui.GraphicalSourceRefresher sourceRefresher
          Source view refresher.
protected  Log statusLog
          Log to which messages are printed.
protected  javax.swing.JSplitPane topSplitter
          Top horizontal window splitter.
protected  javax.swing.JSplitPane vertSplitter
          Vertical window splitter.
 
Fields inherited from class com.bluemarsh.jswat.ui.BasicUIAdapter
propertyTable
 
Constructor Summary
GraphicalAdapter(Session session)
          Constructs a GraphicalAdapter, connected to the given Session.
 
Method Summary
protected  void buildBreakpoints(javax.swing.JTabbedPane tabbedPane)
          Create the panel to contain the breakpoints panel.
protected  void buildCommand(javax.swing.JTabbedPane tabbedPane)
          Create the panel to contain the message panel and command input fields.
 void buildInterface()
          Construct the appropriate user interface and connect all the pieces together.
protected  void buildStandard(javax.swing.JTabbedPane tabbedPane)
          Create the panel to contain the stdout, stderr, and stdin fields.
 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 configurationChanged()
          Invoked when the configuration has been accepted by the user.
 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.
protected  void setPreferences()
          Use the configured preferences to modify our interface.
 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.

mainWindow

protected MainWindow mainWindow
Top-most frame that contains everything.

topSplitter

protected javax.swing.JSplitPane topSplitter
Top horizontal window splitter.

bottomSplitter

protected javax.swing.JSplitPane bottomSplitter
Bottom horizontal window splitter.

vertSplitter

protected javax.swing.JSplitPane vertSplitter
Vertical window splitter.

desktopPane

protected javax.swing.JDesktopPane desktopPane
Desktop pane which holds the source file views.

messageAdapter

protected GraphicalMessageAdapter messageAdapter
Handles the status log display.

outputAdapter

protected GraphicalOutputAdapter outputAdapter
Handles the output from the debuggee VM.

inputAdapter

protected GraphicalInputAdapter inputAdapter
Handles the intput to the debuggee VM.

sourceRefresher

protected com.bluemarsh.jswat.ui.GraphicalSourceRefresher sourceRefresher
Source view refresher.

openFiles

protected java.util.Hashtable openFiles
Table of open files. Keys are the File objects, values are the JInternalFrame objects.

openWindows

protected java.util.Hashtable openWindows
Table of open windows. Keys are the JInternalFrame objects, values are the File objects.

openViews

protected java.util.Hashtable openViews
Table of open views. Keys are the JInternalFrame objects, values are the SourceView objects.

frameListener

protected GraphicalAdapter.FrameListener frameListener
Object for listening to the internal frames.

panelList

protected java.util.List panelList
List of all panels we've created. Used to refresh them when needed.
Constructor Detail

GraphicalAdapter

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

buildBreakpoints

protected void buildBreakpoints(javax.swing.JTabbedPane tabbedPane)
Create the panel to contain the breakpoints panel.
Parameters:
tabbedPane - Tabbed pane to add command panel to.

buildCommand

protected void buildCommand(javax.swing.JTabbedPane tabbedPane)
Create the panel to contain the message panel and command input fields.
Parameters:
tabbedPane - Tabbed pane to add command panel to.

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

buildStandard

protected void buildStandard(javax.swing.JTabbedPane tabbedPane)
Create the panel to contain the stdout, stderr, and stdin fields.
Parameters:
tabbedPane - Tabbed pane to add command panel to.

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 true.

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 true.

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 true.

configurationChanged

public void configurationChanged()
Invoked when the configuration has been accepted by the user.
Specified by:
configurationChanged in interface com.bluemarsh.config.ConfigureListener

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.
Overrides:
findString in class BasicUIAdapter
Parameters:
query - string to look for.
ignoreCase - true to ignore case.
Returns:
true if string was found.
Throws:
NoOpenViewException - Thrown if there is no view to be searched.

getSelectedView

public JSwatView getSelectedView()
Retrieves the currently active view in JSwat.
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

setPreferences

protected void setPreferences()
Use the configured preferences to modify our interface.

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.