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,