uk.ac.essex.common.gui.frame
Class ApplicationFrameImpl

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 uk.ac.essex.common.gui.frame.ApplicationFrameImpl
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants, ApplicationFrame
Direct Known Subclasses:
DefaultApplicationFrame, MultiFrameDesktop, TabbedFrameDesktop

public abstract class ApplicationFrameImpl
extends javax.swing.JFrame
implements ApplicationFrame


Created Date: 20-Dec-2003

You should have received a copy of Lesser GNU public license with this code. If not please visit this site

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.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  javax.swing.JComponent content
           
protected  java.awt.Container contentPane
           
static int DEFAULT_HEIGHT
          The frames default height
static java.lang.String DEFAULT_TOOLBAR_KEY
           
static int DEFAULT_WIDTH
          The frames default width
static int DEFAULT_X
           
static int DEFAULT_Y
           
protected  javax.swing.JToolBar defaultToolBar
           
protected  javax.swing.JMenuBar localMenuBar
           
static int MIN_HEIGHT
          The frames default height
static int MIN_WIDTH
          The frames default width
protected  javax.swing.JLabel statusBarLabel
           
protected  javax.swing.JPanel statusPanel
           
protected  javax.swing.JPanel toolBarPanel
           
 
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 uk.ac.essex.common.gui.ApplicationFrame
BOTTOM, LEFT, RIGHT, TOP
 
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
  ApplicationFrameImpl(Application application, ApplicationFrameParameters parameters)
           
protected ApplicationFrameImpl(java.lang.String title, boolean persistent)
          TODO: remove this const
 
Method Summary
 void addFrameListener(ApplicationFrameListener frameListener)
           
 void addToolBar(java.lang.String name, javax.swing.JToolBar toolBar)
           
 void addToToolBar(javax.swing.Action actionToAdd)
          Adds a action to the tool bar
 void addToToolBar(java.lang.String name, javax.swing.Action actionToAdd)
          Adds an action to the named tool bar
 void addViewChangeListener(ViewChangeListener viewChangeListener)
          Add a view change listener to this frame each time the view changes an event is fired calling the method fireViewChanged.
 void center()
          Centers the frame on screen
 void destroy()
           
 void dispose()
           
protected  void finalize()
           
protected  void fireFrameClosing()
           
protected  void fireFrameOpening()
           
protected  void fireViewChange(javax.swing.JPanel oldView, javax.swing.JPanel newView)
          Informs view change listeners that the current selected view has changed
protected  void fireViewClosed(javax.swing.JPanel view)
          Informs view change listeners that a wants to close
 Application getApplication()
           
 javax.swing.JComponent getContent()
           
 javax.swing.JToolBar getDefaultToolBar()
           
 javax.swing.JFrame getFrame()
           
 javax.swing.JMenuBar getJMenuBar()
          Returns the menubar set on this frame.
 javax.swing.JMenuBar getLocalMenuBar()
           
 javax.swing.JLabel getStatusBarLabel()
           
 boolean hasJMenuBar()
           
 void init()
          Component initialization
 boolean isPersistent()
           
 void removeFrameListener(ApplicationFrameListener frameListener)
           
 void removeToolBar(java.lang.String name)
           
 void restoreLocation(java.awt.Rectangle defaults)
           
 void saveLocation()
          Save the current location of the window to the preferences
 void setContent(javax.swing.JComponent content)
           
 void setJMenuBar(javax.swing.JMenuBar menubar)
          Sets the menubar for this frame.
 void setLocalMenuBar(javax.swing.JMenuBar localMenuBar)
           
 void setPersistent(boolean persistent)
           
 void setProgress(java.lang.String label, float percentage)
          TODO: Should this be here or could we combine with ApplicationFrame.setStatus(String, boolean) }??
 void setStatus(java.lang.String status, boolean isSticky)
          Sets the status message at the bottom of the GUI if the first argument is null it sets the staus message to "Ready" and ignores the second arg.
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
 
Methods inherited from class java.awt.Frame
addNotify, 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, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setVisible, 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, 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, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, 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, 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, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, 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 uk.ac.essex.common.gui.ApplicationFrame
addJMenu, addView, removeView, setTitle
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

DEFAULT_HEIGHT

public static final int DEFAULT_HEIGHT
The frames default height

See Also:
Constant Field Values

DEFAULT_WIDTH

public static final int DEFAULT_WIDTH
The frames default width

See Also:
Constant Field Values

MIN_HEIGHT

public static final int MIN_HEIGHT
The frames default height

See Also:
Constant Field Values

MIN_WIDTH

public static final int MIN_WIDTH
The frames default width

See Also:
Constant Field Values

DEFAULT_X

public static final int DEFAULT_X
See Also:
Constant Field Values

DEFAULT_Y

public static final int DEFAULT_Y
See Also:
Constant Field Values

DEFAULT_TOOLBAR_KEY

public static final java.lang.String DEFAULT_TOOLBAR_KEY
See Also:
Constant Field Values

defaultToolBar

protected javax.swing.JToolBar defaultToolBar

localMenuBar

protected javax.swing.JMenuBar localMenuBar

statusBarLabel

protected javax.swing.JLabel statusBarLabel

content

protected javax.swing.JComponent content

contentPane

protected java.awt.Container contentPane

toolBarPanel

protected javax.swing.JPanel toolBarPanel

statusPanel

protected javax.swing.JPanel statusPanel
Constructor Detail

ApplicationFrameImpl

public ApplicationFrameImpl(Application application,
                            ApplicationFrameParameters parameters)
                     throws InitialisationException
Parameters:
parameters -
Throws:
InitialisationException

ApplicationFrameImpl

protected ApplicationFrameImpl(java.lang.String title,
                               boolean persistent)
                        throws java.awt.HeadlessException,
                               InitialisationException
TODO: remove this const

Parameters:
title -
persistent -
Throws:
java.awt.HeadlessException
InitialisationException
Method Detail

getContent

public javax.swing.JComponent getContent()

saveLocation

public void saveLocation()
Save the current location of the window to the preferences


restoreLocation

public void restoreLocation(java.awt.Rectangle defaults)

setContent

public void setContent(javax.swing.JComponent content)

dispose

public void dispose()
Overrides:
dispose in class java.awt.Window

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable

getApplication

public Application getApplication()
Specified by:
getApplication in interface ApplicationFrame

getLocalMenuBar

public javax.swing.JMenuBar getLocalMenuBar()

setLocalMenuBar

public void setLocalMenuBar(javax.swing.JMenuBar localMenuBar)

init

public void init()
          throws InitialisationException
Component initialization

Specified by:
init in interface ApplicationFrame
Throws:
InitialisationException

destroy

public void destroy()
Specified by:
destroy in interface ApplicationFrame

getFrame

public javax.swing.JFrame getFrame()
Specified by:
getFrame in interface ApplicationFrame
Returns:

getDefaultToolBar

public javax.swing.JToolBar getDefaultToolBar()
Specified by:
getDefaultToolBar in interface ApplicationFrame
Returns:
JToolBar - The tool bar for this frame

addToolBar

public void addToolBar(java.lang.String name,
                       javax.swing.JToolBar toolBar)
Specified by:
addToolBar in interface ApplicationFrame
Parameters:
name -
toolBar -

removeToolBar

public void removeToolBar(java.lang.String name)
Specified by:
removeToolBar in interface ApplicationFrame
Parameters:
name -

addToToolBar

public void addToToolBar(javax.swing.Action actionToAdd)
Adds a action to the tool bar

Specified by:
addToToolBar in interface ApplicationFrame
Parameters:
actionToAdd - - the action to put on the tool bar

addToToolBar

public void addToToolBar(java.lang.String name,
                         javax.swing.Action actionToAdd)
Adds an action to the named tool bar

Specified by:
addToToolBar in interface ApplicationFrame
Parameters:
name - - The name of the toolbar to add to
actionToAdd - - The action to put on the tool bar
See Also:
addToolBar(java.lang.String, javax.swing.JToolBar)

getStatusBarLabel

public javax.swing.JLabel getStatusBarLabel()
Specified by:
getStatusBarLabel in interface ApplicationFrame
Returns:
JLabel - That is used for the text message on the status bar

getJMenuBar

public javax.swing.JMenuBar getJMenuBar()
Returns the menubar set on this frame.

Specified by:
getJMenuBar in interface ApplicationFrame
Overrides:
getJMenuBar in class javax.swing.JFrame
Returns:
the menubar for this frame
See Also:
setJMenuBar(javax.swing.JMenuBar)

setJMenuBar

public void setJMenuBar(javax.swing.JMenuBar menubar)
Sets the menubar for this frame.

Specified by:
setJMenuBar in interface ApplicationFrame
Overrides:
setJMenuBar in class javax.swing.JFrame
Parameters:
menubar - the menubar being placed in the frame
See Also:
getJMenuBar()

hasJMenuBar

public boolean hasJMenuBar()
Specified by:
hasJMenuBar in interface ApplicationFrame
Returns:

addViewChangeListener

public void addViewChangeListener(ViewChangeListener viewChangeListener)
Add a view change listener to this frame each time the view changes an event is fired calling the method fireViewChanged.

Specified by:
addViewChangeListener in interface ApplicationFrame
Parameters:
viewChangeListener -

setStatus

public void setStatus(java.lang.String status,
                      boolean isSticky)
Sets the status message at the bottom of the GUI if the first argument is null it sets the staus message to "Ready" and ignores the second arg.

Specified by:
setStatus in interface ApplicationFrame
Parameters:
status - - The String to display
isSticky - - Should the message be permanent or stay for 3 seconds then go

setProgress

public void setProgress(java.lang.String label,
                        float percentage)
Description copied from interface: ApplicationFrame
TODO: Should this be here or could we combine with ApplicationFrame.setStatus(String, boolean) }??

Specified by:
setProgress in interface ApplicationFrame
Parameters:
label - - String to display on the progress bar
percentage - - Should be in the range 0 - 100 inclusive

center

public void center()
Centers the frame on screen

Specified by:
center in interface ApplicationFrame

isPersistent

public boolean isPersistent()
Specified by:
isPersistent in interface ApplicationFrame

setPersistent

public void setPersistent(boolean persistent)
Specified by:
setPersistent in interface ApplicationFrame

addFrameListener

public void addFrameListener(ApplicationFrameListener frameListener)
Specified by:
addFrameListener in interface ApplicationFrame

removeFrameListener

public void removeFrameListener(ApplicationFrameListener frameListener)
Specified by:
removeFrameListener in interface ApplicationFrame
Parameters:
frameListener -

fireFrameClosing

protected void fireFrameClosing()

fireFrameOpening

protected void fireFrameOpening()

fireViewChange

protected void fireViewChange(javax.swing.JPanel oldView,
                              javax.swing.JPanel newView)
Informs view change listeners that the current selected view has changed

Parameters:
oldView - - The previous selected view
newView - - The new selected view

fireViewClosed

protected void fireViewClosed(javax.swing.JPanel view)
Informs view change listeners that a wants to close

Parameters:
view -