org.sourcejammer.client.event
Class GUIContextImpl

java.lang.Object
  |
  +--org.sourcejammer.client.event.GUIContextImpl
All Implemented Interfaces:
GUIContext

public class GUIContextImpl
extends java.lang.Object
implements GUIContext

Title: $FileName: GUIContextImpl.java$

Version:
$VerNum: 4$
Author:
$AuthorName: Rob MacGrogan$

$Description: Implementations of client plugin objects.$
$KeyWordsOff: $

Default implementation of GUIContext.

Field Summary
private static GUIContext instance
           
 
Constructor Summary
private GUIContextImpl()
           
 
Method Summary
 void displayErrorMessage(java.lang.String message)
          Defaults eventThread to false.
 void displayErrorMessage(java.lang.String[] message)
          Defaults eventThread to false.
 void displayErrorMessage(java.lang.String[] message, boolean eventThread)
          Displays the message in an error dialog.
 void displayErrorMessage(java.lang.String message, boolean eventThread)
          Displays the message in an error dialog.
 SourceVersionChecker getChecker(java.io.File flDirectory)
          Returns a SourceVersionChecker for the specified directory.
 int getClientDefaultEOLType()
          Gets the default EOL type for the client from AppConfig.
 ProjectTreeNode getCurrentTreeNode()
          Returns the currently selected project tree node.
 java.lang.String getCurrentUserName()
          Returns the currently logged in user's user name as a String.
static GUIContext getInstance()
           
 SJPrimaryWindow getMainWindow()
          Returns a reference to the main GUI window.
 java.io.PrintStream getMessageStream()
          Returns the PrintStream that prints out to the message area on the GUI.
 javax.swing.JTable getPrimaryTable()
          Returns a reference to the file table.
 javax.swing.table.TableColumnModel getPrimaryTableColumnModel()
          Returns the TableColumnModel of the file table.
 javax.swing.JTree getProjectTree()
          Returns a reference to the project tree.
 java.lang.String[] getSelectedFileNames()
          Returns names of all files selected in the file table.
 org.sourcejammer.project.view.NodeInfo getSelectedFileNodeInfo()
          Convenience method.
 org.sourcejammer.project.view.NodeInfo[] getSelectedFilesNodeInfo()
          Returns a NodeInfo object for each file selected in the file table.

Note that NodeInfo can be case to FileNodeInfo if you need to figure out local/remote sync state.
 boolean hasLocalFileChanged(java.lang.String fileName, java.io.File flTargetDir)
          Returns true if the file with the name fileName in flTargetDir has changed in the archive since that file was last downloaded to the client.
 boolean isConnected()
          Returns true if the GUI is currently connected to an archive.
 void rebuildFileView()
          Rebuilds the cached file tables starting at the currently selected project tree node.
 void rebuildFileView(boolean fromRoot)
          Rebuilds the cached file tables.
 void selectProject(ProjectTreeNode nd)
          Select the specified project in the project tree.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance

private static GUIContext instance
Constructor Detail

GUIContextImpl

private GUIContextImpl()
Method Detail

getInstance

public static GUIContext getInstance()

getMainWindow

public SJPrimaryWindow getMainWindow()
Description copied from interface: GUIContext
Returns a reference to the main GUI window.

Specified by:
getMainWindow in interface GUIContext
See Also:
GUIContext.getMainWindow()

getProjectTree

public javax.swing.JTree getProjectTree()
Description copied from interface: GUIContext
Returns a reference to the project tree.

Specified by:
getProjectTree in interface GUIContext
See Also:
GUIContext.getProjectTree()

getPrimaryTable

public javax.swing.JTable getPrimaryTable()
Description copied from interface: GUIContext
Returns a reference to the file table.

Specified by:
getPrimaryTable in interface GUIContext
See Also:
GUIContext.getPrimaryTable()

displayErrorMessage

public void displayErrorMessage(java.lang.String message,
                                boolean eventThread)
Description copied from interface: GUIContext
Displays the message in an error dialog.

Specified by:
displayErrorMessage in interface GUIContext
Parameters:
message - -- the error message.
eventThread - -- must be true if invoked from the eventThread, and false otherwise. This is tricky. BEFORE_EVENT and AFTER_EVENT timing are in the event thread. BEFORE_REQUEST_SENT and AFTER_RESPONSE_RECEIVED are generally outside of the event thread, but not always.
See Also:
GUIContext.displayErrorMessage(String, boolean)

displayErrorMessage

public void displayErrorMessage(java.lang.String[] message,
                                boolean eventThread)
Description copied from interface: GUIContext
Displays the message in an error dialog. Each String is treated as a separate line in the dialog.

Specified by:
displayErrorMessage in interface GUIContext
Parameters:
message - -- the error message.
eventThread - -- must be true if invoked from the eventThread, and false otherwise. This is tricky. BEFORE_EVENT and AFTER_EVENT timing are in the event thread. BEFORE_REQUEST_SENT and AFTER_RESPONSE_RECEIVED are generally outside of the event thread, but not always.
See Also:
GUIContext.displayErrorMessage(String[], boolean)

displayErrorMessage

public void displayErrorMessage(java.lang.String[] message)
Description copied from interface: GUIContext
Defaults eventThread to false.

Specified by:
displayErrorMessage in interface GUIContext
See Also:
GUIContext.displayErrorMessage(String[])

displayErrorMessage

public void displayErrorMessage(java.lang.String message)
Description copied from interface: GUIContext
Defaults eventThread to false.

Specified by:
displayErrorMessage in interface GUIContext
See Also:
GUIContext.displayErrorMessage(String)

selectProject

public void selectProject(ProjectTreeNode nd)
Description copied from interface: GUIContext
Select the specified project in the project tree.

Specified by:
selectProject in interface GUIContext
See Also:
GUIContext.selectProject(ProjectTreeNode)

isConnected

public boolean isConnected()
Description copied from interface: GUIContext
Returns true if the GUI is currently connected to an archive.

Specified by:
isConnected in interface GUIContext
See Also:
GUIContext.isConnected()

getChecker

public SourceVersionChecker getChecker(java.io.File flDirectory)
                                throws java.io.IOException
Description copied from interface: GUIContext
Returns a SourceVersionChecker for the specified directory. SourceVersionChecker is used to determine the version info for the version of a file in the local directory. See API doc on SourceVersionChecker for details.

Specified by:
getChecker in interface GUIContext
java.io.IOException
See Also:
GUIContext.getChecker(File)

getClientDefaultEOLType

public int getClientDefaultEOLType()
Description copied from interface: GUIContext
Gets the default EOL type for the client from AppConfig.

Specified by:
getClientDefaultEOLType in interface GUIContext
See Also:
GUIContext.getClientDefaultEOLType()

getMessageStream

public java.io.PrintStream getMessageStream()
Description copied from interface: GUIContext
Returns the PrintStream that prints out to the message area on the GUI.

Specified by:
getMessageStream in interface GUIContext
See Also:
GUIContext.getMessageStream()

getCurrentTreeNode

public ProjectTreeNode getCurrentTreeNode()
Description copied from interface: GUIContext
Returns the currently selected project tree node.

Specified by:
getCurrentTreeNode in interface GUIContext
See Also:
GUIContext.getCurrentTreeNode()

getCurrentUserName

public java.lang.String getCurrentUserName()
Description copied from interface: GUIContext
Returns the currently logged in user's user name as a String.

Specified by:
getCurrentUserName in interface GUIContext
See Also:
GUIContext.getCurrentUserName()

getPrimaryTableColumnModel

public javax.swing.table.TableColumnModel getPrimaryTableColumnModel()
Description copied from interface: GUIContext
Returns the TableColumnModel of the file table.

Specified by:
getPrimaryTableColumnModel in interface GUIContext
See Also:
GUIContext.getPrimaryTableColumnModel()

getSelectedFileNames

public java.lang.String[] getSelectedFileNames()
Description copied from interface: GUIContext
Returns names of all files selected in the file table.

Specified by:
getSelectedFileNames in interface GUIContext
See Also:
GUIContext.getSelectedFileNames()

getSelectedFileNodeInfo

public org.sourcejammer.project.view.NodeInfo getSelectedFileNodeInfo()
Description copied from interface: GUIContext
Convenience method. Returns the "first" file selected in the file table as a NodeInfo object. If only one file is selected, returns that file.

Note that NodeInfo can be case to FileNodeInfo if you need to figure out local/remote sync state.

Specified by:
getSelectedFileNodeInfo in interface GUIContext
See Also:
GUIContext.getSelectedFileNodeInfo()

getSelectedFilesNodeInfo

public org.sourcejammer.project.view.NodeInfo[] getSelectedFilesNodeInfo()
Description copied from interface: GUIContext
Returns a NodeInfo object for each file selected in the file table.

Note that NodeInfo can be case to FileNodeInfo if you need to figure out local/remote sync state.

Specified by:
getSelectedFilesNodeInfo in interface GUIContext
See Also:
GUIContext.getSelectedFilesNodeInfo()

hasLocalFileChanged

public boolean hasLocalFileChanged(java.lang.String fileName,
                                   java.io.File flTargetDir)
                            throws java.io.IOException
Description copied from interface: GUIContext
Returns true if the file with the name fileName in flTargetDir has changed in the archive since that file was last downloaded to the client.

Specified by:
hasLocalFileChanged in interface GUIContext
java.io.IOException
See Also:
GUIContext.hasLocalFileChanged(String, File)

rebuildFileView

public void rebuildFileView()
                     throws org.sourcejammer.project.NodeExistsException,
                            java.io.IOException
Description copied from interface: GUIContext
Rebuilds the cached file tables starting at the currently selected project tree node. Does not involve a server hit.

Specified by:
rebuildFileView in interface GUIContext
org.sourcejammer.project.NodeExistsException
java.io.IOException
See Also:
GUIContext.rebuildFileView()

rebuildFileView

public void rebuildFileView(boolean fromRoot)
                     throws org.sourcejammer.project.NodeExistsException,
                            java.io.IOException
Description copied from interface: GUIContext
Rebuilds the cached file tables. Does not involve a server hit.

Specified by:
rebuildFileView in interface GUIContext
Parameters:
fromRoot - -- if true starts rebuilding from archive root project.
org.sourcejammer.project.NodeExistsException
java.io.IOException
See Also:
GUIContext.rebuildFileView(boolean)


Copyright 2003 Soucejammer project.