diva.gui
Class ApplicationContext

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 diva.gui.ApplicationContext
All Implemented Interfaces:
AppContext, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
Direct Known Subclasses:
BasicFrame

public class ApplicationContext
extends javax.swing.JFrame
implements AppContext

A context for an application in the diva.gui infrastructure. This class represents an AppContext as a JFrame. Generally, all this class does is to pipe the AppContext method through to the appropriate method in the JFrame class. In addition, a listener is attached to the frame that fires the context's exit action when a WINDOW_CLOSING event is created. In this class, the default exit action kills the JVM. This class does not contain a menu bar or a toolbar by default.

Version:
$Id: ApplicationContext.java 57040 2010-01-27 20:52:32Z cxh $
Author:
Steve Neuendorffer, Michael Shilman, John Reekie
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
 
Nested classes/interfaces inherited from class java.awt.Frame
java.awt.Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
private  javax.swing.Action _exitAction
          The action that is called when this exits.
 
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
ApplicationContext()
          Create a new ApplicationContext.
 
Method Summary
 javax.swing.Action getExitAction()
          Return the action that is called back when the user exits the app.
 java.awt.Image getIconImage()
          Get the image that represents this frame.
 javax.swing.JMenuBar getJMenuBar()
          Return the menu bar that the container uses.
 java.lang.String getTitle()
          Return the title of the context.
 boolean isVisible()
          Return whether or not the frame is visible.
 java.awt.Component makeComponent()
          Return "this" as a component.
 void setExitAction(javax.swing.Action exitAction)
          Set the action that is called back when the user exits the app.
 void setIconImage(java.awt.Image image)
          Set the icon that represents this frame.
 void setJMenuBar(javax.swing.JMenuBar menu)
          Set the menu bar that the container uses.
 void setTitle(java.lang.String title)
          Set the title of the context.
 void setVisible(boolean visible)
          Set the frame's visibility.
 void showStatus(java.lang.String status)
          Show the given status string at the bottom of the context.
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Frame
addNotify, finalize, getCursorType, getExtendedState, getFrames, getMaximizedBounds, getMenuBar, getState, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, 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, 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, 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 diva.gui.AppContext
setSize
 
Methods inherited from interface javax.swing.RootPaneContainer
getContentPane, getGlassPane, getLayeredPane, getRootPane, setContentPane, setGlassPane, setLayeredPane
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

_exitAction

private transient javax.swing.Action _exitAction
The action that is called when this exits.

Constructor Detail

ApplicationContext

public ApplicationContext()
Create a new ApplicationContext. Add a hook to the frame that will cause the exit action to be fired when a user attempts to close the window. Set the default close operation of the frame to be DO_NOTHING_ON_CLOSE, since this is handled by the default exit action.

Method Detail

getExitAction

public javax.swing.Action getExitAction()
Return the action that is called back when the user exits the app.

Specified by:
getExitAction in interface AppContext

getIconImage

public java.awt.Image getIconImage()
Get the image that represents this frame.

Specified by:
getIconImage in interface AppContext
Overrides:
getIconImage in class java.awt.Frame

getTitle

public java.lang.String getTitle()
Return the title of the context.

Specified by:
getTitle in interface AppContext
Overrides:
getTitle in class java.awt.Frame

getJMenuBar

public javax.swing.JMenuBar getJMenuBar()
Return the menu bar that the container uses.

Specified by:
getJMenuBar in interface AppContext
Overrides:
getJMenuBar in class javax.swing.JFrame

isVisible

public boolean isVisible()
Return whether or not the frame is visible.

Specified by:
isVisible in interface AppContext
Overrides:
isVisible in class java.awt.Component

makeComponent

public java.awt.Component makeComponent()
Return "this" as a component.

Specified by:
makeComponent in interface AppContext

showStatus

public void showStatus(java.lang.String status)
Show the given status string at the bottom of the context. This base class does nothing.

Specified by:
showStatus in interface AppContext

setVisible

public void setVisible(boolean visible)
Set the frame's visibility.

Specified by:
setVisible in interface AppContext
Overrides:
setVisible in class java.awt.Component

setExitAction

public void setExitAction(javax.swing.Action exitAction)
Set the action that is called back when the user exits the app.

Specified by:
setExitAction in interface AppContext

setTitle

public void setTitle(java.lang.String title)
Set the title of the context.

Specified by:
setTitle in interface AppContext
Overrides:
setTitle in class java.awt.Frame

setIconImage

public void setIconImage(java.awt.Image image)
Set the icon that represents this frame.

Specified by:
setIconImage in interface AppContext
Overrides:
setIconImage in class javax.swing.JFrame

setJMenuBar

public void setJMenuBar(javax.swing.JMenuBar menu)
Set the menu bar that the container uses.

Specified by:
setJMenuBar in interface AppContext
Overrides:
setJMenuBar in class javax.swing.JFrame