jpl.mipl.jade.tools.stereo.ui
Class ApplicationMenu

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JMenuBar
                  extended by jpl.mipl.jade.tools.stereo.ui.ApplicationMenu
All Implemented Interfaces:
ImageObserver, MenuContainer, PropertyChangeListener, Serializable, EventListener, Accessible, MenuElement

public class ApplicationMenu
extends JMenuBar
implements PropertyChangeListener

Purpose: Menu object to be used with SITH viewer main panel components. Current options include file save, label view, exit, stretch options, and help.

   Copyright 2003, California Institute of Technology.
   ALL RIGHTS RESERVED.
   U.S. Government Sponsorship acknowledge. 2003.
   
 ============================================================================
 Modification History :
 ----------------------

 Date              Who              What
 ----------------------------------------------------------------------------
 12/16/2003        Nick             Initial Release
 03/16/2004        Nick             Added exception handling to the image
                                    save worker thread.
 03/16/2006        Nick             Checks OPTION_SAVE_DIRECTORY for saving
                                    files to cache last location.             
 ============================================================================
 

Version:
$Id: ApplicationMenu.java,v 1.2 2008/05/29 23:31:46 ntt Exp $
Author:
Nicholas Toole (Nicholas.T.Toole@jpl.nasa.gov)
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JMenuBar
JMenuBar.AccessibleJMenuBar
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
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
protected  String _aboutString
           
protected  ImageIcon _icon
           
protected  JFrame _labelFrame
           
protected  PropertyManager _model
           
protected  JDialog _percentDialog
           
protected  JDialog _rotateDialog
           
protected  JPanel _viewPanel
           
static int FILE_MENU
          Indicates action to performed on file menu
protected  JMenuItem help_about_item
           
protected  JMenuItem help_help_item
           
protected  JMenu help_menu
           
static int HELP_MENU
          Indicates action to performed on help menu
static int INSERT_AT_BEGINNING
          Prepends component to the beginning of a menu
static int INSERT_AT_END
          Appends component to the end of a menu
protected  JMenuItem main_exit_item
           
protected  JMenuItem main_finder_item
           
protected  JMenuItem main_label_list_item
           
protected  JMenu main_menu
           
protected  JMenuItem main_open_item
           
protected  JMenu options_menu
           
static int OPTIONS_MENU
          Indicates action to performed on options menu
protected  JMenuItem options_rotate_item
           
protected  JMenu options_stretch_menu
           
protected  JMenuItem stretch_percent_param_item
           
protected  JCheckBoxMenuItem stretch_use_extrema_item
           
protected  JCheckBoxMenuItem stretch_use_percent_item
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ApplicationMenu(PropertyManager model, JPanel view_panel, JFrame label_frame, String about_string, ImageIcon icon)
          Constructs an instance of MarsImageViewMenu for use with Mars View main panel components.
 
Method Summary
protected  void buildMenu()
          Builds menu GUI and sets up action listeners.
 void insertMenuItem(int menuId, Component newMenuItem, boolean separate, int placement)
          Inserts a custom menu component to a menu.
 void propertyChange(PropertyChangeEvent pce)
          Implementation of the PropertyChangeListener interface.
 
Methods inherited from class javax.swing.JMenuBar
add, addNotify, getAccessibleContext, getComponent, getComponentAtIndex, getComponentIndex, getHelpMenu, getMargin, getMenu, getMenuCount, getSelectionModel, getSubElements, getUI, getUIClassID, isBorderPainted, isSelected, menuSelectionChanged, paintBorder, paramString, processKeyBinding, processKeyEvent, processMouseEvent, removeNotify, setBorderPainted, setHelpMenu, setMargin, setSelected, setSelectionModel, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, 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, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

INSERT_AT_BEGINNING

public static final int INSERT_AT_BEGINNING
Prepends component to the beginning of a menu

See Also:
Constant Field Values

INSERT_AT_END

public static final int INSERT_AT_END
Appends component to the end of a menu

See Also:
Constant Field Values

FILE_MENU

public static final int FILE_MENU
Indicates action to performed on file menu

See Also:
Constant Field Values

OPTIONS_MENU

public static final int OPTIONS_MENU
Indicates action to performed on options menu

See Also:
Constant Field Values

HELP_MENU

public static final int HELP_MENU
Indicates action to performed on help menu

See Also:
Constant Field Values

_model

protected PropertyManager _model

_viewPanel

protected JPanel _viewPanel

_labelFrame

protected JFrame _labelFrame

_aboutString

protected String _aboutString

_percentDialog

protected JDialog _percentDialog

_rotateDialog

protected JDialog _rotateDialog

main_menu

protected JMenu main_menu

main_finder_item

protected JMenuItem main_finder_item

main_open_item

protected JMenuItem main_open_item

main_label_list_item

protected JMenuItem main_label_list_item

main_exit_item

protected JMenuItem main_exit_item

help_menu

protected JMenu help_menu

help_help_item

protected JMenuItem help_help_item

help_about_item

protected JMenuItem help_about_item

options_menu

protected JMenu options_menu

options_stretch_menu

protected JMenu options_stretch_menu

options_rotate_item

protected JMenuItem options_rotate_item

stretch_use_extrema_item

protected JCheckBoxMenuItem stretch_use_extrema_item

stretch_use_percent_item

protected JCheckBoxMenuItem stretch_use_percent_item

stretch_percent_param_item

protected JMenuItem stretch_percent_param_item

_icon

protected ImageIcon _icon
Constructor Detail

ApplicationMenu

public ApplicationMenu(PropertyManager model,
                       JPanel view_panel,
                       JFrame label_frame,
                       String about_string,
                       ImageIcon icon)
Constructs an instance of MarsImageViewMenu for use with Mars View main panel components.

Parameters:
model - Instance of application model
view_panel - Reference to the main view panel to which menu bar will be added
label_frame - Reference to label frame containing image label tree
about_string - Text which will appear in the About box for application
Method Detail

buildMenu

protected void buildMenu()
Builds menu GUI and sets up action listeners.


insertMenuItem

public void insertMenuItem(int menuId,
                           Component newMenuItem,
                           boolean separate,
                           int placement)
Inserts a custom menu component to a menu.

Parameters:
menuId - Menu to which component will be added, one of FILE_MENU, OPTIONS_MENU, HELP_MENU.
newMenuItem - The component to be added
separate - Flag indicating whether to add separators
placement - Where in menu to place component, one of INSERT_AT_BEGINNING, INSERT_AT_END.

propertyChange

public void propertyChange(PropertyChangeEvent pce)
Implementation of the PropertyChangeListener interface. For interaction with the MarsImageViewModel. Method is called whenever a change is made to a model property.

Specified by:
propertyChange in interface PropertyChangeListener
Parameters:
evt - A PropertyChangeEvent object describing the event source and the property that has changed.