com.bluemarsh.jswat.ui
Class BasicUIAdapter

java.lang.Object
  |
  +--com.bluemarsh.jswat.ui.BasicUIAdapter
All Implemented Interfaces:
UIAdapter
Direct Known Subclasses:
ConsoleAdapter, GraphicalAdapter

public abstract class BasicUIAdapter
extends java.lang.Object
implements UIAdapter

Abstract class BasicUIAdapter provides a limited implementation of the UIAdapter interface. Concrete adapter implementations should extend this class.

Author:
Nathan Fiedler

Field Summary
protected  java.util.Hashtable propertyTable
          Table of properties.
 
Constructor Summary
BasicUIAdapter()
          Constructor for BasicUIAdapter class.
 
Method Summary
abstract  void buildInterface()
          Construct the appropriate user interface and connect all the pieces together.
abstract  boolean canFindString()
          Indicate if this interface adapter has the ability to find a string in the currently selected source view.
abstract  boolean canShowFile()
          Indicate if this interface adapter has the ability to show source files in a manner appropriate for the user to read.
abstract  boolean canShowStatus()
          Indicate if this interface adapter has the ability to show the status in a manner appropriate for the user to view.
abstract  void destroyInterface()
          Deconstruct the user interface such that all components are made invisible and prepared for non-use.
abstract  void exit()
          This is called when there are no more open Sessions.
abstract  boolean findString(java.lang.String query, boolean ignoreCase)
          Search for the given string in the currently selected source view.
 java.lang.Object getProperty(java.lang.String key)
          Searches for the property with the specified key in the property list.
abstract  JSwatView getSelectedView()
          Retrieves the currently active view in JSwat.
abstract  void initComplete()
          Called when the Session initialization has completed.
abstract  void refreshDisplay()
          Refresh the display to reflect changes in the program.
abstract  void saveSettings()
          Save any settings to the appropriate places, the program is about the terminate.
 java.lang.Object setProperty(java.lang.String key, java.lang.Object value)
          Stores the given value in the properties list with the given key as a reference.
abstract  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.
abstract  void showStatus(java.lang.String status)
          Show a status message in a reasonable location.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

propertyTable

protected java.util.Hashtable propertyTable
Table of properties.
Constructor Detail

BasicUIAdapter

public BasicUIAdapter()
Constructor for BasicUIAdapter class.
Method Detail

buildInterface

public abstract 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.
Specified by:
buildInterface in interface UIAdapter

canFindString

public abstract boolean canFindString()
Indicate if this interface adapter has the ability to find a string in the currently selected source view.
Specified by:
canFindString in interface UIAdapter
Returns:
true if the ability exists, false otherwise.

canShowFile

public abstract boolean canShowFile()
Indicate if this interface adapter has the ability to show source files in a manner appropriate for the user to read.
Specified by:
canShowFile in interface UIAdapter
Returns:
true if the ability exists, false otherwise.

canShowStatus

public abstract boolean canShowStatus()
Indicate if this interface adapter has the ability to show the status in a manner appropriate for the user to view.
Specified by:
canShowStatus in interface UIAdapter
Returns:
true if the ability exists, false otherwise.

destroyInterface

public abstract void destroyInterface()
Deconstruct the user interface such that all components are made invisible and prepared for non-use.
Specified by:
destroyInterface in interface UIAdapter

exit

public abstract 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.
Specified by:
exit in interface UIAdapter

findString

public abstract 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.
Specified by:
findString in interface UIAdapter
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.

getProperty

public java.lang.Object getProperty(java.lang.String key)
Searches for the property with the specified key in the property list. The method returns null if the property is not found.
Specified by:
getProperty in interface UIAdapter
Parameters:
key - the property key.
Returns:
the value in the property list with the specified key value.

getSelectedView

public abstract JSwatView getSelectedView()
Retrieves the currently active view in JSwat.
Specified by:
getSelectedView in interface UIAdapter
Returns:
selected view, or null if none selected.

initComplete

public abstract void initComplete()
Called when the Session initialization has completed.
Specified by:
initComplete in interface UIAdapter

refreshDisplay

public abstract void refreshDisplay()
Refresh the display to reflect changes in the program. Generally this means refreshing the panels.
Specified by:
refreshDisplay in interface UIAdapter

saveSettings

public abstract void saveSettings()
Save any settings to the appropriate places, the program is about the terminate.
Specified by:
saveSettings in interface UIAdapter

setProperty

public java.lang.Object setProperty(java.lang.String key,
                                    java.lang.Object value)
Stores the given value in the properties list with the given key as a reference. If the value is null, then the key and value will be removed from the properties.
Specified by:
setProperty in interface UIAdapter
Parameters:
key - the key to be placed into this property list.
value - the value corresponding to key, or null to remove the key and value from the properties.
Returns:
previous value stored using this key.

showFile

public abstract 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.
Specified by:
showFile in interface UIAdapter
Parameters:
file - file to be displayed.
line - line to be made visible.
Returns:
true if successful, false if error.

showStatus

public abstract void showStatus(java.lang.String status)
Show a status message in a reasonable location.
Specified by:
showStatus in interface UIAdapter
Parameters:
status - message to be shown to the user.