jigcell.compare.ui
Class CompareFrontEnd

java.lang.Object
  extended by jigcell.compare.impl.Compare
      extended by jigcell.compare.ui.CompareFrontEnd
All Implemented Interfaces:
java.awt.event.ComponentListener, java.awt.event.WindowListener, java.awt.event.WindowStateListener, java.util.EventListener, javax.swing.event.ChangeListener, ITab
Direct Known Subclasses:
CellCycleFrontEnd

public class CompareFrontEnd
extends Compare
implements javax.swing.event.ChangeListener, java.awt.event.ComponentListener, ITab, java.awt.event.WindowListener, java.awt.event.WindowStateListener

The Comparator frontend.

This code is licensed under the DARPA BioCOMP Open Source License. See LICENSE for more details.

Author:
Nicholas Allen

Nested Class Summary
protected static class CompareFrontEnd.FrontEndTabInfo
          Information about a Comparator tab.
protected  class CompareFrontEnd.SplashScreen
          A splash screen to display while things are loading.
 
Nested classes/interfaces inherited from class jigcell.compare.impl.Compare
Compare.CompareSecurityManager, Compare.TabInfo
 
Field Summary
static java.lang.String CONFIG_LOOKFEEL
          Property key for look and feel class
static java.lang.String CONFIG_TABCONFIG
          Property key for tab config names
static java.lang.String CONFIG_WINDOWCOORDINATES
          Property key for window coordinates
static java.lang.String CONFIG_WINDOWMAXIMIZED
          Property key for window maximized state
protected static int COUNT_FRAMEBUFFER
          Number of screen buffers to request
private  ITabAccessory currentTabAccessory
          Current tab accessory
private  ITabAccessory defaultTabAccessory
          Default tab accessory
protected static java.awt.Dimension DIMENSION_WINDOW
          Initial dimensions of the Comparator window
private  javax.swing.JFrame displayFrame
          Display frame for frontend shell
protected  InterfaceBuilder manager
          Provides interface help for the view
protected static java.lang.String MENUBAR_DEFAULT
          Default menu bar name
protected  MenuBuilder menuManager
          Menu builder
protected  javax.swing.JTabbedPane pane
          Main interface
private  ITab selectedTab
          Currently selected tab in the display frame
private static java.lang.Class[] SIGNATURE_TAB
          Method signature of tabs
private  CompareFrontEnd.SplashScreen splash
          Splash screen while loading
private  java.awt.Component tabComponent
          Component of the tab to add to pane
private  ITab tabImplementation
          Tab to add to pane
protected  javax.swing.JToolBar toolbar
          Toolbar
 
Fields inherited from class jigcell.compare.impl.Compare
CONFIG_CLASSNAME, CONFIG_DATASOURCE, configMarkers, configSource, DEFAULT_CONFIG, MESSAGE_ERROR, MESSAGE_WARNING, PARAMETER_DEBUG_EXCEPTIONS, PROPERTY_CONFIG_EDIT, PROPERTY_DEBUG_EXCEPTIONS, RESOURCE_CONFIG, RESOURCE_DATAMANAGER, RESOURCE_TABS, securityManager, TAB_LOCK
 
Fields inherited from interface jigcell.compare.ITab
CONFIG_TABNAME, STATE_ENDINITIALIZE, STATE_ENDUI, STATE_INITIALIZE, STATE_RUNNING, STATES
 
Constructor Summary
CompareFrontEnd(java.lang.String configFile)
          Creates a new graphical Comparator.
 
Method Summary
protected  void about(ITab tab)
          Displays information about a Comparator tab.
 Compare.TabInfo addTab(ITab component)
          Adds a tab to the main Comparator display.
 Compare.TabInfo addTab(ITab component, boolean wrapped, javax.swing.JMenu[] menus, javax.swing.JButton[] tools)
          Adds a tab to the main Comparator display.
protected  void addTabToView()
          Inserts a new tab into the interface.
 void componentHidden(java.awt.event.ComponentEvent e)
           
 void componentMoved(java.awt.event.ComponentEvent e)
           
 void componentResized(java.awt.event.ComponentEvent e)
           
 void componentShown(java.awt.event.ComponentEvent e)
           
 void configure(ITab tab)
          Starts configuring a Comparator tab.
 javax.swing.JDialog createAboutDialog()
          Creates an about dialog for this tab or null if this tab does not describe itself.
 IConfigEditor createConfigEditor()
          Creates a configuration editor for this tab or null if this tab does not support graphical configuration.
protected  javax.swing.JMenu[] createSharedMenus()
          Creates the menus that will appear for all tabs.
protected  void exit(int status)
          Exits from the Comparator.
protected static java.lang.Class findLookAndFeelClass(java.lang.String name)
          Finds the class for a given look and feel name.
 javax.swing.JFrame getDisplayFrame()
          The frontend shell display frame.
 java.lang.String getName()
          The name of this tab.
 ITab getSelectedTab()
          The currently selected tab in the display frame.
 ITabAccessory getTabAccessory(ITab tab)
          The accessory component for a tab.
protected  CompareFrontEnd.FrontEndTabInfo getTabInfo(ITab tab)
          The tab info for a tab.
protected static void installLookAndFeel(java.lang.String name, java.lang.String className)
          Installs a new look and feel if it has not already been registered.
static void main(java.lang.String[] args)
          Starts a new graphical Comparator.
protected  void propertyChange(java.beans.PropertyChangeEvent e)
           
 void readConfiguration(java.lang.String state)
          Reads the view configuration from the Comparator.
protected  void saveWindowSettings()
           
 void selectTab(ITab tab)
          Selects one of the tabs for the display frame.
 void setTabAccessory(ITab tab, ITabAccessory accessory)
          Sets the accessory component displayed for a tab.
 void shellHandleException(java.lang.String type, java.lang.Object message, java.lang.Throwable t)
          Handle an exception in a Comparator component.
 void shellHandleMessage(java.lang.String type, java.lang.Object message)
          Handle an informational message in a Comparator component.
protected  void shellStableHook()
          Stable hook for frontend shell.
protected  void shellStartHook()
          Start hook for frontend shell.
 void stateChanged(javax.swing.event.ChangeEvent e)
           
protected  void updateLookAndFeel(java.lang.String state)
          Modifies the application look and feel to match the current configuration.
protected  void updateViewAccessory(CompareFrontEnd.FrontEndTabInfo info)
          Fills in the tab accessory using the provided tab info.
protected  void updateViewMenus(CompareFrontEnd.FrontEndTabInfo info)
          Fills in the menu bar using the provided tab info.
protected  void updateViewTools(CompareFrontEnd.FrontEndTabInfo info)
          Fills in the toolbar using the provided tab info.
 void windowActivated(java.awt.event.WindowEvent e)
           
 void windowClosed(java.awt.event.WindowEvent e)
           
 void windowClosing(java.awt.event.WindowEvent e)
           
 void windowDeactivated(java.awt.event.WindowEvent e)
           
 void windowDeiconified(java.awt.event.WindowEvent e)
           
 void windowIconified(java.awt.event.WindowEvent e)
           
 void windowOpened(java.awt.event.WindowEvent e)
           
 void windowStateChanged(java.awt.event.WindowEvent e)
           
 
Methods inherited from class jigcell.compare.impl.Compare
acquireSync, addDelegate, addPropertyChangeListener, addPropertyChangeListener, addResource, addResourceBundle, addTransient, assertion, assertion, attemptSync, createDataManager, findTabByClass, findTabByClassExact, findTabByName, firePropertyChange, firePropertyChange, formatString, formatString, getConfig, getDataManager, getDebugExceptions, getPropertyChangeListeners, getPropertyChangeListeners, getResource, getResourceMap, getResourceNames, getString, getTabMap, getTabs, message, removePropertyChangeListener, removePropertyChangeListener, removeResource, replaceResource, scanResourceCatalog, scanResourceMap, scanResources, setConfig, setDataManager, setDebugExceptions, shellHandleException, throwUncheckedException, updateEncoder, updateResourceMap, warning, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONFIG_LOOKFEEL

public static final java.lang.String CONFIG_LOOKFEEL
Property key for look and feel class

See Also:
Constant Field Values

CONFIG_TABCONFIG

public static final java.lang.String CONFIG_TABCONFIG
Property key for tab config names

See Also:
Constant Field Values

CONFIG_WINDOWCOORDINATES

public static final java.lang.String CONFIG_WINDOWCOORDINATES
Property key for window coordinates

See Also:
Constant Field Values

CONFIG_WINDOWMAXIMIZED

public static final java.lang.String CONFIG_WINDOWMAXIMIZED
Property key for window maximized state

See Also:
Constant Field Values

DIMENSION_WINDOW

protected static final java.awt.Dimension DIMENSION_WINDOW
Initial dimensions of the Comparator window


COUNT_FRAMEBUFFER

protected static final int COUNT_FRAMEBUFFER
Number of screen buffers to request

See Also:
Constant Field Values

MENUBAR_DEFAULT

protected static final java.lang.String MENUBAR_DEFAULT
Default menu bar name

See Also:
Constant Field Values

SIGNATURE_TAB

private static final java.lang.Class[] SIGNATURE_TAB
Method signature of tabs


manager

protected InterfaceBuilder manager
Provides interface help for the view


pane

protected javax.swing.JTabbedPane pane
Main interface


toolbar

protected javax.swing.JToolBar toolbar
Toolbar


menuManager

protected MenuBuilder menuManager
Menu builder


tabComponent

private java.awt.Component tabComponent
Component of the tab to add to pane


selectedTab

private ITab selectedTab
Currently selected tab in the display frame


tabImplementation

private ITab tabImplementation
Tab to add to pane


currentTabAccessory

private ITabAccessory currentTabAccessory
Current tab accessory


defaultTabAccessory

private ITabAccessory defaultTabAccessory
Default tab accessory


displayFrame

private javax.swing.JFrame displayFrame
Display frame for frontend shell


splash

private CompareFrontEnd.SplashScreen splash
Splash screen while loading

Constructor Detail

CompareFrontEnd

public CompareFrontEnd(java.lang.String configFile)
Creates a new graphical Comparator.

Parameters:
configFile - Name of configuration file
Method Detail

main

public static void main(java.lang.String[] args)
Starts a new graphical Comparator.

Parameters:
args - Program arguments

findLookAndFeelClass

protected static java.lang.Class findLookAndFeelClass(java.lang.String name)
Finds the class for a given look and feel name.

Parameters:
name - Name of look and feel

installLookAndFeel

protected static void installLookAndFeel(java.lang.String name,
                                         java.lang.String className)
Installs a new look and feel if it has not already been registered.

Parameters:
name - Name of new look and feel
className - Class for new look and feel

addTab

public Compare.TabInfo addTab(ITab component)
Adds a tab to the main Comparator display.

Overrides:
addTab in class Compare
Parameters:
component - Contents of the tab

addTab

public Compare.TabInfo addTab(ITab component,
                              boolean wrapped,
                              javax.swing.JMenu[] menus,
                              javax.swing.JButton[] tools)
Adds a tab to the main Comparator display.

Parameters:
component - Contents of the tab
wrapped - Whether component should be wrapped in a scrollpane
menus - Menus to be displayed when tab is active
tools - Tools to place in toolbar

componentHidden

public void componentHidden(java.awt.event.ComponentEvent e)
Specified by:
componentHidden in interface java.awt.event.ComponentListener

componentMoved

public void componentMoved(java.awt.event.ComponentEvent e)
Specified by:
componentMoved in interface java.awt.event.ComponentListener

componentResized

public void componentResized(java.awt.event.ComponentEvent e)
Specified by:
componentResized in interface java.awt.event.ComponentListener

componentShown

public void componentShown(java.awt.event.ComponentEvent e)
Specified by:
componentShown in interface java.awt.event.ComponentListener

configure

public void configure(ITab tab)
Starts configuring a Comparator tab.


createAboutDialog

public javax.swing.JDialog createAboutDialog()
Creates an about dialog for this tab or null if this tab does not describe itself.

Specified by:
createAboutDialog in interface ITab

createConfigEditor

public IConfigEditor createConfigEditor()
Creates a configuration editor for this tab or null if this tab does not support graphical configuration.

Specified by:
createConfigEditor in interface ITab

getDisplayFrame

public javax.swing.JFrame getDisplayFrame()
The frontend shell display frame. Returns null if this is a headless Comparator.

Overrides:
getDisplayFrame in class Compare

getName

public java.lang.String getName()
The name of this tab.

Specified by:
getName in interface ITab

getTabAccessory

public ITabAccessory getTabAccessory(ITab tab)
The accessory component for a tab.


getSelectedTab

public ITab getSelectedTab()
The currently selected tab in the display frame.


propertyChange

protected void propertyChange(java.beans.PropertyChangeEvent e)
Overrides:
propertyChange in class Compare

readConfiguration

public void readConfiguration(java.lang.String state)
Reads the view configuration from the Comparator.

Specified by:
readConfiguration in interface ITab
Parameters:
state - Current state of the view

selectTab

public void selectTab(ITab tab)
Selects one of the tabs for the display frame.

Parameters:
tab - Underlying tab component

setTabAccessory

public void setTabAccessory(ITab tab,
                            ITabAccessory accessory)
Sets the accessory component displayed for a tab. If the accessory is null, the default accessory will be displayed.

Parameters:
tab - Comparator tab
accessory - Accessory

shellHandleException

public void shellHandleException(java.lang.String type,
                                 java.lang.Object message,
                                 java.lang.Throwable t)
Handle an exception in a Comparator component.

Overrides:
shellHandleException in class Compare
Parameters:
type - Exception type
message - Display message
t - Throwable

shellHandleMessage

public void shellHandleMessage(java.lang.String type,
                               java.lang.Object message)
Handle an informational message in a Comparator component.

Overrides:
shellHandleMessage in class Compare
Parameters:
type - Message type
message - Display message

stateChanged

public void stateChanged(javax.swing.event.ChangeEvent e)
Specified by:
stateChanged in interface javax.swing.event.ChangeListener

windowActivated

public void windowActivated(java.awt.event.WindowEvent e)
Specified by:
windowActivated in interface java.awt.event.WindowListener

windowClosed

public void windowClosed(java.awt.event.WindowEvent e)
Specified by:
windowClosed in interface java.awt.event.WindowListener

windowClosing

public void windowClosing(java.awt.event.WindowEvent e)
Specified by:
windowClosing in interface java.awt.event.WindowListener

windowDeactivated

public void windowDeactivated(java.awt.event.WindowEvent e)
Specified by:
windowDeactivated in interface java.awt.event.WindowListener

windowDeiconified

public void windowDeiconified(java.awt.event.WindowEvent e)
Specified by:
windowDeiconified in interface java.awt.event.WindowListener

windowIconified

public void windowIconified(java.awt.event.WindowEvent e)
Specified by:
windowIconified in interface java.awt.event.WindowListener

windowOpened

public void windowOpened(java.awt.event.WindowEvent e)
Specified by:
windowOpened in interface java.awt.event.WindowListener

windowStateChanged

public void windowStateChanged(java.awt.event.WindowEvent e)
Specified by:
windowStateChanged in interface java.awt.event.WindowStateListener

saveWindowSettings

protected void saveWindowSettings()

about

protected void about(ITab tab)
Displays information about a Comparator tab.


addTabToView

protected void addTabToView()
Inserts a new tab into the interface.


createSharedMenus

protected javax.swing.JMenu[] createSharedMenus()
Creates the menus that will appear for all tabs.


exit

protected void exit(int status)
Exits from the Comparator.

Overrides:
exit in class Compare
Parameters:
status - Status code

getTabInfo

protected CompareFrontEnd.FrontEndTabInfo getTabInfo(ITab tab)
The tab info for a tab.

Parameters:
tab - Tab

shellStableHook

protected void shellStableHook()
Stable hook for frontend shell. The system configuration is guaranteed to have been loaded but no processing has been done.

Overrides:
shellStableHook in class Compare

shellStartHook

protected void shellStartHook()
Start hook for frontend shell. No initialization is guaranteed to have taken place at this point.

Overrides:
shellStartHook in class Compare

updateLookAndFeel

protected void updateLookAndFeel(java.lang.String state)
Modifies the application look and feel to match the current configuration.

Parameters:
state - Application state

updateViewAccessory

protected void updateViewAccessory(CompareFrontEnd.FrontEndTabInfo info)
Fills in the tab accessory using the provided tab info.

Parameters:
info - Tab info

updateViewMenus

protected void updateViewMenus(CompareFrontEnd.FrontEndTabInfo info)
Fills in the menu bar using the provided tab info.

Parameters:
info - Tab info

updateViewTools

protected void updateViewTools(CompareFrontEnd.FrontEndTabInfo info)
Fills in the toolbar using the provided tab info.

Parameters:
info - Tab info