org.ceryle.ui
Class Desktop

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by javax.swing.JFrame
                      extended by org.ceryle.ui.Desktop
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants, MessageWriter, SafeQuit

public class Desktop
extends JFrame
implements MessageWriter, SafeQuit

A singleton class that creates the ceryle UI application desktop. To obtain the instance of this class:

     Desktop desktop = Desktop.getInstance();
 

Copyright 2001-2007 Murray Altheim. All Rights Reserved.

Since:
JDK1.4
Version:
$Id: Desktop.java,v 3.1 2007-06-20 01:28:15 altheim Exp $
Author:
Murray Altheim
See Also:
DocumentView, GraphView, Serialized Form

Nested Class Summary
 class Desktop.WindowEventHandler
          The listener class to handle the closing of a window.
 
Nested classes/interfaces inherited from class javax.swing.JFrame
JFrame.AccessibleJFrame
 
Nested classes/interfaces inherited from class java.awt.Frame
Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
 ImageIcon addIcon
           
 boolean autoSaveHistory
          When true, automatically saves the find, replace, and location bar histories to ".ceryle.hist".
 boolean autoSaveSettings
          When true, automatically saves the current settings to the preferences file.
 ImageIcon bookmarkIcon
           
 ImageIcon browseIcon
           
protected  HelpButton btn_help
           
 ImageIcon colIcon
           
 ImageIcon colOpenIcon
           
 ImageIcon databaseIcon
           
 ImageIcon dbrootIcon
           
protected  int defWFHeight
           
 ImageIcon dirtyDocIcon
           
 ImageIcon dirtyGraphIcon
           
 ImageIcon dirtyNoteIcon
           
 ImageIcon dirtyProjIcon
           
 ImageIcon docIcon
           
 ImageIcon docPDFIcon
           
 ImageIcon docPlainIcon
           
 ImageIcon docWordIcon
           
protected  JLabel editAlert
           
protected  JLabel editState
           
 StackSet findHistory
          Contents of find (query string) history.
 ImageIcon folderIcon
           
 ImageIcon folderOpenIcon
           
 ImageIcon graphIcon
           
 ImageIcon historyIcon
           
 boolean m_confirmQuit
          When true, pops up a confirm dialog prior to exiting the application.
 boolean m_confirmQuitHTTP
          When true, pops up a confirm dialog prior to exiting the application, if the Web server is running.
protected  JPopupMenu m_dtpopup
          The popup menu for the desktop.
protected static HelpDialog m_help_dlog
          The Help Dialog used by the Desktop.
protected  JScrollPane m_msgscroll
           
protected  JSplitPane m_msgsplit
           
protected  MessageView m_msgview
           
protected  PreferencesDialog m_prefsDlog
           
protected  ProgressBar m_progress
           
protected  FrequencyModel m_recent_graph_list
          The model behind the recently-opened graph list.
protected  JPanel m_statusArea
           
protected  JLabel m_statusMsg1
           
protected  JLabel m_statusMsg2
           
protected  WebIndicator m_webIndicator
           
protected  int maxWFHeight
           
protected  int maxWFWidth
           
 DesktopMenus menus
          The utility that creates the Desktop menus.
 ImageIcon metadataHideIcon
           
 ImageIcon metadataIcon
           
 ImageIcon metaIcon
           
protected  int minWFHeight
           
protected  int minWFWidth
           
 ImageIcon msgIcon
           
 ImageIcon noteIcon
           
 ImageIcon projIcon
           
static String PROPERTY_frameBounds
          Ceryle property determining the bounds of the application desktop.
static String PROPERTY_locationBarSearchVisible
          Ceryle property determining the visibility of the location toolbar's search field.
static String PROPERTY_locationBarVisible
          Ceryle property determining the visibility of the location toolbar.
static String PROPERTY_menubarHeight
          Ceryle property for menubar height, assisting in determining the bounds of the application frame.
static String PROPERTY_popupBounds
          Ceryle property determining the bounds of the popup frames.
static String PROPERTY_splitPaneLoc
          Ceryle property determining the location of the message split pane.
 ImageIcon removeIcon
           
 StackSet replaceHistory
          Contents of replace history.
 ImageIcon rootIcon
           
 StackSet searchLocHistory
          Contents of search directory history.
protected  SourceProcessor sproc
          The SourceProcessor used for source handling (I/O).
 ImageIcon status_dirtyDocIcon
           
 ImageIcon status_dirtyGraphIcon
           
 ImageIcon status_docIcon
           
 ImageIcon status_errorIcon
           
 ImageIcon status_graphIcon
           
 ImageIcon status_noticeIcon
           
 ImageIcon status_nullIcon
           
 ImageIcon status_warnIcon
           
 Cursor waitCursor
           
 
Fields inherited from class javax.swing.JFrame
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Method Summary
 void addToRecentGraphList(String systemId)
          Adds the system identifier at the top of the recent graph document list.
 void displayScriptConsole()
          A convenience method that starts the GroovyService (if not already running), and then displays a GroovyConsole.
 void enableBackgroundClassifier(boolean enable)
          Starts the BackgroundClassifier if it has not been started, or kills it if it has.
 void errorDialog(String title, String message)
          Displays an error containing the String message.
protected  void fireEvent()
          Fires a ChangeEvent to all registered listeners, indicating some significant change in server status.
 BackgroundClassifier getBackgroundClassifier()
          Returns the BackgroundClassifier, null if it has not been created.
 BookmarksMenu getBookmarksMenu()
          Returns the current Bookmarks menu.
 ColorLookupTable getCLUT(String name)
          Returns the ColorLookupTable corresponding to the name.
 FindReplaceDialog getFindReplaceDialog()
          Returns a FindReplaceDialog, null if it has not been created.
 FindReplaceDialog getFindReplaceDialog(String defaultString, boolean replace, boolean show)
          Returns a lazily-created FindReplaceDialog, either in Find or Replace mode.
 GroovyService getGroovyService()
          Returns a GroovyService object, providing Groovy script and console services.
static Desktop getInstance()
          As this is a singleton class, this returns the single instance of this class using the available Services object.
 ResourceOpener getLoadingThread()
          Returns the most recently added ResourceOpener thread, null if there is no open Thread.
 Iterator getLocationBarHistory()
          Returns an Iterator over the String contents of the LocationBar's history, null if empty.
 String getLocationValue()
          Returns the text content of the LocationBar's URI field as a String.
 MessageView getMessageView()
          Return the MessageView, the messaging area on the lower part of the main horizontal split pane.
 Rectangle getPopupBounds()
          Returns the current recommended size for popup windows.
 ProgressBar getProgressBar()
          Return the progress bar.
 int getProgressValue()
          Return an int representing the current the progress bar value.
 FrequencyModel getRecentGraphList()
          Returns the recent graph document list.
 Component getScriptConsole()
          Return the registered Groovy console as an Object.
 Services getServices()
          Returns the Services object used with this Desktop.
 SourceProcessor getSourceProcessor()
          Returns the SourceProcessor used for document I/O.
 ViewManager getViewManager()
          Returns the ViewManager used by this Desktop.
 boolean hasFindReplaceDialog()
          Returns true if the FindReplaceDialog has been created.
static boolean hasInstance()
          Returns true if this class has been instantiated.
 void interpretScript(File file)
          Starts the GroovyService (if not already running), and then opens and interprets a Groovy script file.
protected  boolean isLocationBarSearchVisible()
          Returns the visibility of the location bar search field.
protected  boolean isLocationBarVisible()
          Returns the visibility of the Location Bar.
 boolean isMessageVisible()
          Returns true if the message panel is visible (in this case, more than 10% visible).
 boolean isOpeningResource(String systemId)
          Returns true if a ResourceOpener is already attempting to open the provided SystemId.
 ColorLookupTable loadCLUT(String name)
          Loads the ColorLookupTable whose name is name.
 Plugin loadPlugin(String path)
          Returns a plugin whose identifier is the String path.
 Color lookup(String tableName, String colorName, Color failColor)
          Returns the Color corresponding to the named color in the specified color table.
 void maximizeWorkArea()
          Maximizes the work area by hiding various components.
 boolean openResource(ResourceOpener ro)
          If no ResourceOpener thread is active, returns true regardless of the value of the ResourceOpener ro, allowing new openers to be started.
 boolean processURI(String uri)
          Load content referenced by the URI.
 void progressFlashStart()
          Starts flashing the progress bar as a progress indicator.
 void progressFlashStop()
          Stops the flashing of the progress bar.
 void quit(boolean force)
          Quit the application.
 void quit(boolean confirm, boolean force)
          Quit the application.
 boolean resourceOpened(ResourceOpener ro)
          Removes the provided ResourceOpener from the Stack of opener Threads.
protected  void restoreSplitPaneLocation()
          Restore the editor's split pane location from the preferences file, or set to 93% if unavailable.
 void runTests(boolean all)
          Run the application-level test harness.
 void saveDefaultViewProperty()
          Store the frontmost view type as the startup view to the preferences file.
 void saveDefaultViewProperty(int type)
          Store the View type int type as the startup view to the preferences file.
 void saveHistory()
          Store the current location, find and replace histories to a preferences file.
protected  void saveLocationBarVisibility()
          Store the visibility of the location bar to the preferences file.
protected  void saveSettings()
          Saves various session preferences to the preferences file.
 Iterator selectCollections(String title, String message, boolean multiple)
          Shows a dialog allowing discontiguous selection among the list of Collections when multiple is true, a single selection when false, returning an Iterator over the chosen Collections.
 Font selectFont()
          Shows a dialog allowing a selection among the list of available fonts, returning the selected Font, or null null if no selection was made.
 Iterator selectNodes(String cid, String title, String message, boolean multiple)
          Shows a dialog allowing discontiguous selection among the list of Nodes in the Collection cid when multiple is true, a single selection when false, returning an Iterator over the chosen Node IDs (not the nodes themselves).
protected  void setAlertIcon(int status, String tooltip)
          Sets the alert icon on the status bar to indicate the current notice, warning, or error status.
 void setF1Visible(boolean active)
          Indicate the active state of the help dialog (use true when in tutorial).
 void setGraphPriority(boolean hasPriority)
          Sets the thread priority of the graph display to a high value when the parameter is true, a low value when false.
protected  void setLocationBarSearchVisible(boolean visible)
          Store the visibility of the location bar search to the boolean visible.
protected  void setLocationBarVisible(boolean visible)
          Store the visibility of the Location Bar to the boolean visible.
 void setLocationValue(String uri, boolean helpersActive)
          Sets the text content of the LocationBar's URI field to the String uri.
 void setMessageDividerLocation(double loc)
          Sets the position of the vertical divider location between the message area and the desktop.
 void setPopupBounds(Rectangle bounds)
          Sets the current recommended size for popup windows to the provided Rectangle.
 void setProgressLimits(int min, int max)
          Set the progress bar minimum and maximum to the provided int values.
 void setProgressString(String s)
          Set the progress bar text to the provided String.
 void setProgressValue(int value)
          Set the progress bar value to the provided int.
 void setScriptConsole(Component console)
          Register an Component as a Groovy console.
 void setScriptObject(Object o)
           
 void setSourceProcessor(SourceProcessor sourceProcessor)
          Sets the SourceProcessor used for document I/O to sourceproc.
protected  void setStatusIcon(int type, boolean isDirty)
          Sets the icon on the status bar to indicate the current ViewPanel.
 void setWebServerActive(boolean active)
          Sets the visibility of the web server indicator.
 void showAbout()
          Display the Ceryle About dialog.
 void showDesktop()
          Show the Desktop with the initial view set to either the default, or that stored in session preferences.
 void showDesktop(int type)
          Show the Desktop, with the initial view set to the enumerated int type.
 FindReplaceDialog showFindReplaceDialog(int mode)
          Shows the FindReplaceDialog configured via int mode, whose values are the BitSet in FindReplaceDialog.
 void showHelp(boolean reset, String id, boolean modal)
          Display the Ceryle application help.
 void showHelp(String id)
          Display the Ceryle application help with the provided Topic shown.
 void showPreferences(String type)
          Sets various user preferences.
 void showWaitCursor(boolean wait)
          Sets the wait cursor when the parameter is true.
 boolean terminateOnError(int warnings, int maxWarnings, int errors, int maxErrors)
          This method is called by the MessageHandler if the number of warnings or errors exceeds the set maximum.
 void unimplemented()
          A temporary method to handle unimplemented menu and button method calls.
 void webServerActivity()
          When called, briefly indicates activity on the web server.
 void writeInfo(String message)
          Sets the text content of the secondary status message area to the String message.
 String writeMessage(int status, String message)
          Write the contents of the String message to the MessageView area, prepending an indicator of the status.
 void writeMessage(String message)
          Write the contents of the String message to the MessageView area.
 void writeStatus(String message)
          Sets the text content of the primary status message area to the String message.
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Frame
addNotify, finalize, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setAlwaysOnTop, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationByPlatform, setLocationRelativeTo, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

PROPERTY_splitPaneLoc

public static final String PROPERTY_splitPaneLoc
Ceryle property determining the location of the message split pane.

See Also:
Constant Field Values

PROPERTY_frameBounds

public static final String PROPERTY_frameBounds
Ceryle property determining the bounds of the application desktop.

See Also:
Constant Field Values

PROPERTY_popupBounds

public static final String PROPERTY_popupBounds
Ceryle property determining the bounds of the popup frames.

See Also:
Constant Field Values

PROPERTY_menubarHeight

public static final String PROPERTY_menubarHeight
Ceryle property for menubar height, assisting in determining the bounds of the application frame.

See Also:
Constant Field Values

PROPERTY_locationBarVisible

public static final String PROPERTY_locationBarVisible
Ceryle property determining the visibility of the location toolbar.

See Also:
Constant Field Values

PROPERTY_locationBarSearchVisible

public static final String PROPERTY_locationBarSearchVisible
Ceryle property determining the visibility of the location toolbar's search field.

See Also:
Constant Field Values

autoSaveHistory

public boolean autoSaveHistory
When true, automatically saves the find, replace, and location bar histories to ".ceryle.hist". Default is true.


autoSaveSettings

public boolean autoSaveSettings
When true, automatically saves the current settings to the preferences file. Default is true.


searchLocHistory

public StackSet searchLocHistory
Contents of search directory history.


findHistory

public StackSet findHistory
Contents of find (query string) history.


replaceHistory

public StackSet replaceHistory
Contents of replace history.


colIcon

public ImageIcon colIcon

colOpenIcon

public ImageIcon colOpenIcon

rootIcon

public ImageIcon rootIcon

dbrootIcon

public ImageIcon dbrootIcon

folderIcon

public ImageIcon folderIcon

folderOpenIcon

public ImageIcon folderOpenIcon

docIcon

public ImageIcon docIcon

docPlainIcon

public ImageIcon docPlainIcon

docWordIcon

public ImageIcon docWordIcon

docPDFIcon

public ImageIcon docPDFIcon

noteIcon

public ImageIcon noteIcon

dirtyNoteIcon

public ImageIcon dirtyNoteIcon

dirtyDocIcon

public ImageIcon dirtyDocIcon

projIcon

public ImageIcon projIcon

dirtyProjIcon

public ImageIcon dirtyProjIcon

graphIcon

public ImageIcon graphIcon

dirtyGraphIcon

public ImageIcon dirtyGraphIcon

browseIcon

public ImageIcon browseIcon

msgIcon

public ImageIcon msgIcon

addIcon

public ImageIcon addIcon

removeIcon

public ImageIcon removeIcon

metaIcon

public ImageIcon metaIcon

metadataIcon

public ImageIcon metadataIcon

metadataHideIcon

public ImageIcon metadataHideIcon

databaseIcon

public ImageIcon databaseIcon

bookmarkIcon

public ImageIcon bookmarkIcon

historyIcon

public ImageIcon historyIcon

status_noticeIcon

public ImageIcon status_noticeIcon

status_warnIcon

public ImageIcon status_warnIcon

status_errorIcon

public ImageIcon status_errorIcon

status_docIcon

public ImageIcon status_docIcon

status_dirtyDocIcon

public ImageIcon status_dirtyDocIcon

status_graphIcon

public ImageIcon status_graphIcon

status_dirtyGraphIcon

public ImageIcon status_dirtyGraphIcon

status_nullIcon

public ImageIcon status_nullIcon

menus

public DesktopMenus menus
The utility that creates the Desktop menus.


waitCursor

public final Cursor waitCursor

m_confirmQuit

public boolean m_confirmQuit
When true, pops up a confirm dialog prior to exiting the application. Default is true.


m_confirmQuitHTTP

public boolean m_confirmQuitHTTP
When true, pops up a confirm dialog prior to exiting the application, if the Web server is running. Default is true.


m_help_dlog

protected static HelpDialog m_help_dlog
The Help Dialog used by the Desktop.


m_recent_graph_list

protected FrequencyModel m_recent_graph_list
The model behind the recently-opened graph list. This is lazily-created, and shared by all GraphView instances.


btn_help

protected HelpButton btn_help

m_statusArea

protected JPanel m_statusArea

m_statusMsg1

protected JLabel m_statusMsg1

m_statusMsg2

protected JLabel m_statusMsg2

m_progress

protected final ProgressBar m_progress

m_msgsplit

protected JSplitPane m_msgsplit

m_msgscroll

protected JScrollPane m_msgscroll

m_msgview

protected MessageView m_msgview

m_prefsDlog

protected PreferencesDialog m_prefsDlog

m_webIndicator

protected final WebIndicator m_webIndicator

editState

protected final JLabel editState

editAlert

protected final JLabel editAlert

minWFWidth

protected int minWFWidth

maxWFWidth

protected int maxWFWidth

defWFHeight

protected int defWFHeight

minWFHeight

protected int minWFHeight

maxWFHeight

protected int maxWFHeight

sproc

protected SourceProcessor sproc
The SourceProcessor used for source handling (I/O).


m_dtpopup

protected JPopupMenu m_dtpopup
The popup menu for the desktop.

Method Detail

hasInstance

public static boolean hasInstance()
Returns true if this class has been instantiated.


terminateOnError

public boolean terminateOnError(int warnings,
                                int maxWarnings,
                                int errors,
                                int maxErrors)
This method is called by the MessageHandler if the number of warnings or errors exceeds the set maximum. This displays a user query asking if they would like to terminate the application or reset the error handler, returning true if the user wishes to terminate. (This method doesn't itself do anything except return a query result.)

Note that if the user chooses to exit, the ViewManager is sent a ViewManager.closeAllFrames() message.

Implements the SafeQuit API.

Specified by:
terminateOnError in interface SafeQuit

getInstance

public static Desktop getInstance()
As this is a singleton class, this returns the single instance of this class using the available Services object. If the Desktop object has already been created, this method returns it.


loadPlugin

public Plugin loadPlugin(String path)
Returns a plugin whose identifier is the String path.


getCLUT

public ColorLookupTable getCLUT(String name)
Returns the ColorLookupTable corresponding to the name. If unavailable, an attempt is made to load a file by the name plus the addition of ".clt" from the $CERYLE_HOME/resource/clut/ directory.


loadCLUT

public ColorLookupTable loadCLUT(String name)
Loads the ColorLookupTable whose name is name. The pathname is obtained by adding ".clt" to the CLUT name, and looking for the file in Ceryle's $CERYLE_HOME/resource/clut subdirectory. This is a protected method because the proper method is getCLUT(String), which caches existing ones.


lookup

public Color lookup(String tableName,
                    String colorName,
                    Color failColor)
Returns the Color corresponding to the named color in the specified color table. If failColor is non-null, it will be returned if the lookup fails.

Note that currently the table name is ignored - there's only one loaded CLUT at a time.


setWebServerActive

public void setWebServerActive(boolean active)
Sets the visibility of the web server indicator.


webServerActivity

public void webServerActivity()
When called, briefly indicates activity on the web server.


setF1Visible

public void setF1Visible(boolean active)
Indicate the active state of the help dialog (use true when in tutorial).


hasFindReplaceDialog

public boolean hasFindReplaceDialog()
Returns true if the FindReplaceDialog has been created.


showFindReplaceDialog

public FindReplaceDialog showFindReplaceDialog(int mode)
Shows the FindReplaceDialog configured via int mode, whose values are the BitSet in FindReplaceDialog. If the value is -1, the keyword mode will be used.


getFindReplaceDialog

public FindReplaceDialog getFindReplaceDialog()
Returns a FindReplaceDialog, null if it has not been created. This does not alter any settings, just returns the existing dialog. Use getFindReplaceDialog(String,boolean,boolean) to create it.


getFindReplaceDialog

public FindReplaceDialog getFindReplaceDialog(String defaultString,
                                              boolean replace,
                                              boolean show)
Returns a lazily-created FindReplaceDialog, either in Find or Replace mode. If show is true, it will be shown/set visible. These are reused within a session.


getGroovyService

public GroovyService getGroovyService()
Returns a GroovyService object, providing Groovy script and console services.


displayScriptConsole

public void displayScriptConsole()
A convenience method that starts the GroovyService (if not already running), and then displays a GroovyConsole.


setScriptObject

public void setScriptObject(Object o)

setScriptConsole

public void setScriptConsole(Component console)
Register an Component as a Groovy console.

Notes

This generally uses the groovy.swing.impl.ComponentFacade API to provide access to the Groovy implementation of the component used for the console window, providing a common reference point for Groovy scripts to obtain access to the console frame, no matter what Component subclass it might be.

Consoles implementing the ComponentFacade interface can set their frames as the outer Component (generally for purposes of positioning dialog boxes) using setScriptConsole(Component) and then any Groovy scripts can obtain the console window via this method.

  import org.ceryle.ui.Desktop
  import java.awt.Component
  ...
  Component console = Desktop.getInstance().getScriptConsole()
  

See Also:
getScriptConsole()

getScriptConsole

public Component getScriptConsole()
Return the registered Groovy console as an Object.

See Also:
for notes.

interpretScript

public void interpretScript(File file)
Starts the GroovyService (if not already running), and then opens and interprets a Groovy script file. If the File parameter is not supplied, a dialog requests it.


getBookmarksMenu

public BookmarksMenu getBookmarksMenu()
Returns the current Bookmarks menu.


showDesktop

public void showDesktop()
Show the Desktop with the initial view set to either the default, or that stored in session preferences.


getBackgroundClassifier

public BackgroundClassifier getBackgroundClassifier()
Returns the BackgroundClassifier, null if it has not been created. This is a temporary test method.


enableBackgroundClassifier

public void enableBackgroundClassifier(boolean enable)
Starts the BackgroundClassifier if it has not been started, or kills it if it has. The method is ignored if enable is true and it is already running or false and not running.


showDesktop

public void showDesktop(int type)
Show the Desktop, with the initial view set to the enumerated int type. If the value is -1, no default view is shown.

See Also:
View.NOTE, View.DOCUMENT, View.GRAPH

fireEvent

protected final void fireEvent()
Fires a ChangeEvent to all registered listeners, indicating some significant change in server status.


getServices

public Services getServices()
Returns the Services object used with this Desktop.

See Also:
Ceryle, Services

getViewManager

public ViewManager getViewManager()
Returns the ViewManager used by this Desktop.

See Also:
ViewManager

selectCollections

public Iterator selectCollections(String title,
                                  String message,
                                  boolean multiple)
Shows a dialog allowing discontiguous selection among the list of Collections when multiple is true, a single selection when false, returning an Iterator over the chosen Collections.

The title and message are optional; defaults will be used when null values are provided. Returns null if no selection was made, the database is not connected, or there are no collections in the database.

Parameters:
title - the optional dialog box title
message - the optional dialog box message
multiple - when true, allows multiple selection
Returns:
an Iterator over the selected Collection IDs, or null if none available

selectNodes

public Iterator selectNodes(String cid,
                            String title,
                            String message,
                            boolean multiple)
                     throws ProcessException
Shows a dialog allowing discontiguous selection among the list of Nodes in the Collection cid when multiple is true, a single selection when false, returning an Iterator over the chosen Node IDs (not the nodes themselves). This uses DC Titles for display when available, node IDs when not. Returns null if no selection was made. If the database is not connected, or there is no collection matching the CID in the database, throws a ProcessException.

Returns:
an Iterator over the selected Node IDs
Throws:
ProcessException

selectFont

public Font selectFont()
Shows a dialog allowing a selection among the list of available fonts, returning the selected Font, or null null if no selection was made.


writeMessage

public void writeMessage(String message)
Write the contents of the String message to the MessageView area. This method implements the MessageWriter API.

Specified by:
writeMessage in interface MessageWriter

writeMessage

public String writeMessage(int status,
                           String message)
Write the contents of the String message to the MessageView area, prepending an indicator of the status. For the MessageView this also alters the text color. This method implements the MessageWriter API.

Specified by:
writeMessage in interface MessageWriter
Returns:
the String value of the message, including any changes made.
See Also:
MessageHandler

writeStatus

public void writeStatus(String message)
Sets the text content of the primary status message area to the String message. If the parameter is null, clears the status message area. HTML can be used, if pre-processed by G27y.getStyleString(int,String). The primary status area resides at the leftmost part of the status bar. This method implements the MessageWriter API.

Specified by:
writeStatus in interface MessageWriter

writeInfo

public void writeInfo(String message)
Sets the text content of the secondary status message area to the String message. The secondary status area resides just to the left of the progress bar.


getLocationValue

public String getLocationValue()
Returns the text content of the LocationBar's URI field as a String.


setLocationValue

public void setLocationValue(String uri,
                             boolean helpersActive)
Sets the text content of the LocationBar's URI field to the String uri. If helpersActive is true, this will request loading from any helper applications.


getLocationBarHistory

public Iterator getLocationBarHistory()
Returns an Iterator over the String contents of the LocationBar's history, null if empty.


setLocationBarVisible

protected void setLocationBarVisible(boolean visible)
Store the visibility of the Location Bar to the boolean visible.


isLocationBarVisible

protected boolean isLocationBarVisible()
Returns the visibility of the Location Bar.


saveLocationBarVisibility

protected void saveLocationBarVisibility()
Store the visibility of the location bar to the preferences file.


setLocationBarSearchVisible

protected void setLocationBarSearchVisible(boolean visible)
Store the visibility of the location bar search to the boolean visible.


isLocationBarSearchVisible

protected boolean isLocationBarSearchVisible()
Returns the visibility of the location bar search field.


getRecentGraphList

public FrequencyModel getRecentGraphList()
Returns the recent graph document list.


addToRecentGraphList

public void addToRecentGraphList(String systemId)
Adds the system identifier at the top of the recent graph document list.


runTests

public void runTests(boolean all)
Run the application-level test harness. If the parameter is true, all tests are run. If false, a selection dialog is displayed.


saveSettings

protected void saveSettings()
Saves various session preferences to the preferences file. Note that the ".ceryle.prop" (Ceryle properties file) is the basis of the preferences file. In order to reset all preferences, delete the "ceryle.pref" file (not the properties file!). This does not save the history (use saveHistory()).


showPreferences

public void showPreferences(String type)
Sets various user preferences. If the pref type is non-null it will select the specified preference panel. The type should be one of the key values used in the PreferencesDialog.


getPopupBounds

public Rectangle getPopupBounds()
Returns the current recommended size for popup windows.


setPopupBounds

public void setPopupBounds(Rectangle bounds)
Sets the current recommended size for popup windows to the provided Rectangle.


saveDefaultViewProperty

public void saveDefaultViewProperty()
Store the frontmost view type as the startup view to the preferences file. This ignores notes.


saveDefaultViewProperty

public void saveDefaultViewProperty(int type)
Store the View type int type as the startup view to the preferences file.


saveHistory

public void saveHistory()
Store the current location, find and replace histories to a preferences file. If all three histories are empty, storage of their properties is bypassed.


isMessageVisible

public boolean isMessageVisible()
Returns true if the message panel is visible (in this case, more than 10% visible).


restoreSplitPaneLocation

protected void restoreSplitPaneLocation()
Restore the editor's split pane location from the preferences file, or set to 93% if unavailable.


setProgressLimits

public void setProgressLimits(int min,
                              int max)
Set the progress bar minimum and maximum to the provided int values.


setProgressString

public void setProgressString(String s)
Set the progress bar text to the provided String. A null value will clear it.


setProgressValue

public void setProgressValue(int value)
Set the progress bar value to the provided int.


getProgressBar

public ProgressBar getProgressBar()
Return the progress bar.


getProgressValue

public int getProgressValue()
Return an int representing the current the progress bar value.


progressFlashStart

public void progressFlashStart()
Starts flashing the progress bar as a progress indicator.


progressFlashStop

public void progressFlashStop()
Stops the flashing of the progress bar.


setGraphPriority

public void setGraphPriority(boolean hasPriority)
Sets the thread priority of the graph display to a high value when the parameter is true, a low value when false. If the current View is not a GraphView, this method does nothing.


getLoadingThread

public ResourceOpener getLoadingThread()
Returns the most recently added ResourceOpener thread, null if there is no open Thread. This can be set using the openResource(ResourceOpener) method.


resourceOpened

public boolean resourceOpened(ResourceOpener ro)
Removes the provided ResourceOpener from the Stack of opener Threads.

Returns:
true if the ResourceOpener was in the stack and removed.

isOpeningResource

public boolean isOpeningResource(String systemId)
Returns true if a ResourceOpener is already attempting to open the provided SystemId.


openResource

public boolean openResource(ResourceOpener ro)
If no ResourceOpener thread is active, returns true regardless of the value of the ResourceOpener ro, allowing new openers to be started. This adds the provided ResourceOpener to the Stack of threads if there isn't already a ResourceOpener trying to open that resource (identified by systemId). This returns false only if a ResourceOpener is already trying to open that resource.


processURI

public boolean processURI(String uri)
Load content referenced by the URI. This involves first determining the protocol for opening the resource, then determining its type to open the correct view pane:

Returns:
an indication that the resource has loaded (this may fail)

showWaitCursor

public void showWaitCursor(boolean wait)
Sets the wait cursor when the parameter is true.


getMessageView

public MessageView getMessageView()
Return the MessageView, the messaging area on the lower part of the main horizontal split pane.


setMessageDividerLocation

public void setMessageDividerLocation(double loc)
Sets the position of the vertical divider location between the message area and the desktop. Setting the value to -1 hides the message area.


maximizeWorkArea

public void maximizeWorkArea()
Maximizes the work area by hiding various components.


errorDialog

public void errorDialog(String title,
                        String message)
Displays an error containing the String message. The String title is optional.


setStatusIcon

protected void setStatusIcon(int type,
                             boolean isDirty)
Sets the icon on the status bar to indicate the current ViewPanel. The boolean isDirty is only significant when a DocumentView is the front view.


setAlertIcon

protected void setAlertIcon(int status,
                            String tooltip)
Sets the alert icon on the status bar to indicate the current notice, warning, or error status. The status parameter must be one of the states from MessageHandler: Other states will cause no change to the current icon.

If the tooltip parameter is non-null it will be applied to the status alert icon regardless of state.


setSourceProcessor

public void setSourceProcessor(SourceProcessor sourceProcessor)
Sets the SourceProcessor used for document I/O to sourceproc.


getSourceProcessor

public SourceProcessor getSourceProcessor()
Returns the SourceProcessor used for document I/O.


quit

public void quit(boolean force)
Quit the application. This uses the current settings for confirmations, though if force is true, things proceed apace.


quit

public void quit(boolean confirm,
                 boolean force)
Quit the application. If confirm is true, displays a dialog, waits for the user, and quits upon confirmation. If the current document is dirty, gives one more chance to abort. This closes any database connections, etc. If force is true, the assumption is that there are to be no options - the application is forceably being closed.

Implements the SafeQuit API.

Specified by:
quit in interface SafeQuit

showAbout

public void showAbout()
Display the Ceryle About dialog.


showHelp

public void showHelp(String id)
Display the Ceryle application help with the provided Topic shown. This will display a non-modal dialog.


showHelp

public void showHelp(boolean reset,
                     String id,
                     boolean modal)
Display the Ceryle application help. This also hides the Help dialog if it is currently visible. If reset is true, recreates the Help window. The optional id is a node ID in the 'help' Collection. If supplied, Help will open with this topic visible. The dialog will be displayed as modal depending upon the like-named parameter value.


unimplemented

public void unimplemented()
A temporary method to handle unimplemented menu and button method calls.



The Ceryle Project. Copyright ©2001-2007 Murray Altheim, All Rights Reserved. See LICENSE included with distribution.