com.bluemarsh.jswat.ui
Interface UIAdapter

All Known Implementing Classes:
BasicUIAdapter

public interface UIAdapter

Interface UIAdapter 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 most user input.

Author:
Nathan Fiedler

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.
 java.lang.Object getProperty(java.lang.String key)
          Searches for the property with the specified key in the property list.
 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.
 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.
 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.
 

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.

canFindString

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

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.
Returns:
true if the ability exists, false otherwise.

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.
Returns:
true if the ability exists, false otherwise.

destroyInterface

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

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.

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.
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.
Parameters:
key - the property key.
Returns:
the value in the property list with the specified key value.

getSelectedView

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

initComplete

public void initComplete()
Called when the Session initialization has completed.

refreshDisplay

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

saveSettings

public void saveSettings()
Save any settings to the appropriate places, the program is about the terminate.

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.
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 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.
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.
Parameters:
status - message to be shown to the user.