gov.nih.nlm.mms
Class MetamorphoSysGUI

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Window
              extended byjava.awt.Frame
                  extended byjavax.swing.JFrame
                      extended bygov.nih.nlm.mms.MetamorphoSysGUI
All Implemented Interfaces:
Accessible, ChangeListener, DataChangeListener, EventListener, GlassPaneListener, ImageObserver, MenuContainer, RootPaneContainer, Serializable, WindowConstants

public class MetamorphoSysGUI
extends JFrame
implements DataChangeListener, ChangeListener, GlassPaneListener

GUI application for configuring the MetamorphoSys subsetting operation. This JFrame provides the means to completely configure a subsetting run. The screen is built around a series of tabbed panes for each configurable thing involved in the processing of a subset. A user can configure input and ouptut options, as well as configuring the basic three filters (sources, precedence, suppressibility). Users can enable inactive filters or import new ones as well, which adds additional tabs with configuration options. The application is really a skeletal structure built around the GUIConfigurable interface and roughly lets the plugged-in components decide what the user is to do.

Author:
Deborah Shapiro
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JFrame
JFrame.AccessibleJFrame
 
Nested classes inherited from class java.awt.Frame
Frame.AccessibleAWTFrame
 
Nested classes inherited from class java.awt.Window
Window.AccessibleAWTWindow
 
Nested classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
 
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
 
Constructor Summary
MetamorphoSysGUI(MetamorphoSys mms)
          Instantiates a MetamorphoSysGUI and builds the frame.
 
Method Summary
 void addSourcesToRemoveListener(SourcesToRemoveListener l)
          Adds the specified listener to the list of listeners to be informed when the sources to remove list is changed.
 void addTab(GUIConfigurable gc)
          Adds a GUIConfigurable to the GUI.
 void cancel()
          Handles a cancel operation from the progress monitor.
 void changeInputStream(MetamorphoSysInputStream input_stream, JTextField misf, JPanel content_panel)
          Updates the MetamorphoSysInputStream on the gui.
 void changeOutputStream(MetamorphoSysOutputStream output_stream, JTextField mosf, JPanel content_panel)
          Updates the MetamorphoSysOutputStream on the gui.
 void checkEnableOptionsMenu()
          Enables or disables options menu items for input and output handlers.
 void dataChanged(DataChangeEvent e)
          Responds to a change in the user configuration for one of the active filters.
 void disableGlassPane()
          Disable glass pane.
 void enableGlassPane()
          Enable glass pane.
protected  void fireSourcesToRemoveChanged()
          Fires a SourcesToRemoveEvent to inform all listening filters to respond to the change in the sources to exclude list.
 ApplicationConfiguration getApplicationConfiguration()
          Returns the ApplicationConfiguration.
 Component getComponentForTab(GUIConfigurable gui_configurable)
          Returns the GUI Component for the specified Filter.
 UserConfiguration getUserConfiguration()
          Returns the UserConfiguration.
 void initialize()
          Initializes the GUI.
 void initializeGUIConfigurable(GUIConfigurable gc)
          Configure the gui aspects of a GUIConfigurable.
 Object[] popOffRedoStack()
          Removes and returns top tuple off the redo stack.
 Object[] popOffUndoStack()
          Removes and returns top tuple off the undo stack.
 void pushOnRedoStack(Object[] tuple)
          Pushes an Object[] tuple onto the redo stack.
 void pushOnUndoStack(Object[] tuple)
          Pushes an Object[] tuple onto the undo stack.
 void removeSourcesToRemoveListener(SourcesToRemoveListener l)
          Removes the specfied listener from the list of listeners to be informed when the sources to remove list is changed.
 void removeTab(GUIConfigurable gc)
          Removes a GUIConfigurable tab from the GUI.
 void resetTabTitleForFilter(Filter filter, String title)
          Changes the title of a tab on the XTabbedPane.
 void resetTitleForFilter(JPanel panel, String title)
          Changes the title of a JPanel with a compound, titled border.
 void selectTabForFilter(GUIConfigurable gc)
          Programatically selects the tab in the tabbed pane corresponding to the specified GUIConfigurable.
 void setIgnoreEvents(boolean b)
          Sets the gui to ignore reponding to ChangeEvents.
 void stateChanged(ChangeEvent e)
          Responds to a user switching tabs in the tabbed pane.
 boolean validateGUIConfigurables()
          Confirms that GUIConfigurables are in valid states.
 
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, 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, setIconImage, 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, isFocusableWindow, isFocusCycleRoot, isFocused, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setCursor, setFocusableWindowState, setFocusCycleRoot, 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, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setFocusTraversalKeys, setFocusTraversalPolicy, 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, 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, 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, isOpaque, 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, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, 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
 

Constructor Detail

MetamorphoSysGUI

public MetamorphoSysGUI(MetamorphoSys mms)
Instantiates a MetamorphoSysGUI and builds the frame.

Parameters:
mms - the MetamorphoSys object, used for configuration should override settings in the configuration files.
Method Detail

initialize

public void initialize()
Initializes the GUI.


initializeGUIConfigurable

public void initializeGUIConfigurable(GUIConfigurable gc)
Configure the gui aspects of a GUIConfigurable.

Parameters:
gc - GUIConfigurable

popOffUndoStack

public Object[] popOffUndoStack()
Removes and returns top tuple off the undo stack.

Returns:
an Object[] tuple from the undo stack

popOffRedoStack

public Object[] popOffRedoStack()
Removes and returns top tuple off the redo stack.

Returns:
an Object[] tuple from the redo stack

pushOnUndoStack

public void pushOnUndoStack(Object[] tuple)
Pushes an Object[] tuple onto the undo stack.

Parameters:
tuple - an Object[] tuple

pushOnRedoStack

public void pushOnRedoStack(Object[] tuple)
Pushes an Object[] tuple onto the redo stack.

Parameters:
tuple - an Object[] tuple

selectTabForFilter

public void selectTabForFilter(GUIConfigurable gc)
Programatically selects the tab in the tabbed pane corresponding to the specified GUIConfigurable.

Parameters:
gc - the specified GUIConfigurable

getComponentForTab

public Component getComponentForTab(GUIConfigurable gui_configurable)
Returns the GUI Component for the specified Filter. The application maintains a private hash map that allows this mapping to take place. If the map does not contain an entry for the filter, a panel is built, added to the map and returned.

Parameters:
gui_configurable - the specified GUIConfigurable
Returns:
the GUI Component for the specified Filter.

addTab

public void addTab(GUIConfigurable gc)
Adds a GUIConfigurable to the GUI. Calls methods to create the gui configurable component, and to make reset, options and help menu items.

Parameters:
gc - a GUIConfigurable to add to the GUI.

removeTab

public void removeTab(GUIConfigurable gc)
Removes a GUIConfigurable tab from the GUI.

Parameters:
gc - a GUIConfigurable to remove from the GUI.

validateGUIConfigurables

public boolean validateGUIConfigurables()
Confirms that GUIConfigurables are in valid states. Notifies user if a GUIConfigurable is not in a valid state and switches the tab pane focus to the display for that GUIConfigurable so that it can be corrected.

Returns:
true if all GUIConfigurables are valid false if any of the GUIConfigurables are invalid

addSourcesToRemoveListener

public void addSourcesToRemoveListener(SourcesToRemoveListener l)
Adds the specified listener to the list of listeners to be informed when the sources to remove list is changed.

Parameters:
l - the SourcesToRemoveListener

removeSourcesToRemoveListener

public void removeSourcesToRemoveListener(SourcesToRemoveListener l)
Removes the specfied listener from the list of listeners to be informed when the sources to remove list is changed.

Parameters:
l - the SourcesToRemoveListener

getUserConfiguration

public UserConfiguration getUserConfiguration()
Returns the UserConfiguration.

Returns:
the UserConfiguration

getApplicationConfiguration

public ApplicationConfiguration getApplicationConfiguration()
Returns the ApplicationConfiguration.

Returns:
the ApplicationConfiguration

stateChanged

public void stateChanged(ChangeEvent e)
Responds to a user switching tabs in the tabbed pane. When this happens, we validate the filter being switched away from and prevent the action if validation fails.

Specified by:
stateChanged in interface ChangeListener
Parameters:
e - a ChangeEvent

setIgnoreEvents

public void setIgnoreEvents(boolean b)
Sets the gui to ignore reponding to ChangeEvents.

Parameters:
b - boolean

dataChanged

public void dataChanged(DataChangeEvent e)
Responds to a change in the user configuration for one of the active filters. The main function is to push the filter state onto the undo stack and mark the user configuration as changed.

Specified by:
dataChanged in interface DataChangeListener
Parameters:
e - a DataChangeEvent

fireSourcesToRemoveChanged

protected void fireSourcesToRemoveChanged()
Fires a SourcesToRemoveEvent to inform all listening filters to respond to the change in the sources to exclude list.


checkEnableOptionsMenu

public void checkEnableOptionsMenu()
Enables or disables options menu items for input and output handlers.


resetTitleForFilter

public void resetTitleForFilter(JPanel panel,
                                String title)
Changes the title of a JPanel with a compound, titled border.

Parameters:
panel - a JPanel with a compound, titled border
title - the new title

resetTabTitleForFilter

public void resetTabTitleForFilter(Filter filter,
                                   String title)
Changes the title of a tab on the XTabbedPane.

Parameters:
filter - Filter whose tab title will be changed
title - the new title for the tab

cancel

public void cancel()
Handles a cancel operation from the progress monitor.


changeInputStream

public void changeInputStream(MetamorphoSysInputStream input_stream,
                              JTextField misf,
                              JPanel content_panel)
Updates the MetamorphoSysInputStream on the gui.

Parameters:
input_stream - MetamorphoSysInputStream
misf - JTextField where name of input stream is displayed
content_panel - JPanel associated with the MetamorphoSysInputStream

changeOutputStream

public void changeOutputStream(MetamorphoSysOutputStream output_stream,
                               JTextField mosf,
                               JPanel content_panel)
Updates the MetamorphoSysOutputStream on the gui.

Parameters:
output_stream - MetamorphoSysOutputStream
mosf - JTextField where name of output stream is displayed
content_panel - JPanel associated with the MetamorphoSysOutputStream

enableGlassPane

public void enableGlassPane()
Enable glass pane.

Specified by:
enableGlassPane in interface GlassPaneListener

disableGlassPane

public void disableGlassPane()
Disable glass pane.

Specified by:
disableGlassPane in interface GlassPaneListener


Copyright ©2005