jwo.landserf.gui
Class GUIFrame

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Window
              extended byjava.awt.Frame
                  extended byjavax.swing.JFrame
                      extended byjwo.utils.gui.JWFrame
                          extended byjwo.landserf.gui.GUIFrame
All Implemented Interfaces:
Accessible, ActionListener, EventListener, GISFrame, ImageObserver, JWDialogueListener, MenuContainer, Printable, RootPaneContainer, Runnable, Serializable, WindowConstants

public class GUIFrame
extends JWFrame
implements ActionListener, JWDialogueListener, GISFrame, Printable

Creates the main GUI window for controlling LandSerf.

Version:
2.2, 7th March, 2005.
Author:
Jo Wood.
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, 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 jwo.landserf.gui.GISFrame
NOT_SELECTED, PRIMARY, SECONDARY
 
Fields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
 
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
GUIFrame(String title)
          Creates the LandSerf main GUI window, ignoring any command line parameters.
GUIFrame(String title, String[] args)
          Creates the LandSerf main GUI window and initialises with the given command line arguments.
 
Method Summary
 void actionPerformed(ActionEvent event)
          Responds to a selection of menu item or button press.
 void addFootprintListener(FootprintListener fpListener)
          Adds a footprint listener to the list of objects to be informed when a footprint is broadcast.
 void addRaster(RasterMap newRast, int selection)
          Adds a new raster map to the collection shown in the GUIFrame.
 void addVectorMap(VectorMap newVect, int selection)
          Adds a new vector map to the collection stored in the GUIFrame.
 void broadcastFootprint(Footprint fp)
          Broadcasts the given footprint to any footprint listeners.
 void closeDown()
          Closes down the application neatly.
 Frame getFrame()
          Reports the AWT frame in which this should be embedded.
 GraphicsArea getGraphicsArea()
          Returns the graphics area used for display of geographic objects.
 PrintUtilities getPrintUtilities()
          Passes on the printer utilites from the frame.
 RasterMap getRaster1()
          Returns the primary raster surface associated with the window.
 RasterMap getRaster2()
          Returns the secondary raster surface associated with the window.
 Vector getRasterMaps()
          Returns a collection of all the stored raster maps associated with this GUIFrame.
 VectorMap getVectorMap1()
          Returns the primary vector map associated with the window.
 VectorMap getVectorMap2()
          Returns the secondary vector map associated with the window.
 Vector getVectorMaps()
          Returns a collection of all the stored vector maps associated with this GUIFrame.
protected  void initWindow()
          Updates the initial display to take into account, any command line options that have loaded spatial objects or set display types at initialisation.
 boolean isExperimental()
          Reports whether experimental functionality is available to the GUI.
 int print(Graphics g, PageFormat pageFormat, int pageIndex)
          Creates a printable version of the current LandSerf display.
 void redisplay(boolean recalcRaster)
          Redisplays the contents of the frame.
 void removeFootprintListener(FootprintListener fpListener)
          Removes a given listener from the list of objects to be informed when a footprint is broadcast.
 void removeSpatialObject(SpatialObject spObj)
          Removes the given spatial object from those stored by the GISFrame
 void setBroadcastPointQuery(boolean queryMode, FootprintListener fpListener)
          Turns broadcast point query mode on or off.
 void setBusy(boolean busy)
          Indicates that some process has started or stopped.
 void setMessage(String message)
          Displays the given message in the window and also logs the message for possible error diagnosis.
 void setRaster1(RasterMap raster)
          Makes the given raster surface the primary one to be processed.
 void setRaster2(RasterMap raster)
          Makes the given raster surface the secondary one to be processed.
 void setVectorMap1(VectorMap vectorMap)
          Makes the given vector map the primary one associated with the window.
 void setVectorMap2(VectorMap vectorMap)
          Makes the given vector map the secondary one associated with the window.
 void updateFromDialogue(JWDialogue dialogue)
          Responds to the closing of non-modal dialogues.
 void updateInputGUI()
          Updates the window's menu/button items according to what is currently stored or displayed.
 
Methods inherited from class jwo.utils.gui.JWFrame
addActionItem, addActionItem, addActionItem, addActionItem, addActionItem, addBinActionItem, addBinActionItem, addBinActionItem, addBinActionItem, addBinActionItem, addBinActionItem, addBinActionItem, addBinActionItem, addButtonSeparator, addInterruptionListener, addMenu, addMenu, addMenu, addMenuSeparator, getAction, removeInterruptionListener, run, setMaxProgress, setMinProgress, setProgress, showProgress
 
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 jwo.landserf.gui.GISFrame
setMaxProgress, setMinProgress, setProgress
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Constructor Detail

GUIFrame

public GUIFrame(String title)
Creates the LandSerf main GUI window, ignoring any command line parameters.

Parameters:
title - Title of window (should contain current version number).

GUIFrame

public GUIFrame(String title,
                String[] args)
Creates the LandSerf main GUI window and initialises with the given command line arguments.

Parameters:
title - Title of window (should contain current version number).
args - Command line arguments, or null if none provided.
Method Detail

initWindow

protected void initWindow()
Updates the initial display to take into account, any command line options that have loaded spatial objects or set display types at initialisation.

Overrides:
initWindow in class JWFrame

updateFromDialogue

public void updateFromDialogue(JWDialogue dialogue)
Responds to the closing of non-modal dialogues.

Specified by:
updateFromDialogue in interface JWDialogueListener
Parameters:
dialogue - The dialogue window that has been closed.

getGraphicsArea

public GraphicsArea getGraphicsArea()
Returns the graphics area used for display of geographic objects.

Specified by:
getGraphicsArea in interface GISFrame
Returns:
Graphics area.

updateInputGUI

public void updateInputGUI()
Updates the window's menu/button items according to what is currently stored or displayed.

Specified by:
updateInputGUI in interface GISFrame

redisplay

public void redisplay(boolean recalcRaster)
Redisplays the contents of the frame. Redisplays both the main graphics area and the thumbnail summary. If reclacRaster is true, the raster image is recalculated (can take some time for shaded relief), if not, the vector (if set to draw) will be redrawn.

Specified by:
redisplay in interface GISFrame
Parameters:
recalcRaster - If true, raster image is recalucated before redisplaying. If false, then only vector is redrawn (if displayed at all).

addRaster

public void addRaster(RasterMap newRast,
                      int selection)
Adds a new raster map to the collection shown in the GUIFrame.

Specified by:
addRaster in interface GISFrame
Parameters:
newRast - new Raster to add.
selection - Selection type (PRIMARY, SECONDARY or NOT_SELECTED).

addVectorMap

public void addVectorMap(VectorMap newVect,
                         int selection)
Adds a new vector map to the collection stored in the GUIFrame.

Specified by:
addVectorMap in interface GISFrame
Parameters:
newVect - new vector map to add.
selection - Selection type (PRIMARY, SECONDARY or NOT_SELECTED).

setBroadcastPointQuery

public void setBroadcastPointQuery(boolean queryMode,
                                   FootprintListener fpListener)
Turns broadcast point query mode on or off.

Specified by:
setBroadcastPointQuery in interface GISFrame
Parameters:
queryMode - Point query mode is on if true, otherwise off.

broadcastFootprint

public void broadcastFootprint(Footprint fp)
Broadcasts the given footprint to any footprint listeners.

Specified by:
broadcastFootprint in interface GISFrame
Parameters:
fp - Footprint to broadcast.

addFootprintListener

public void addFootprintListener(FootprintListener fpListener)
Adds a footprint listener to the list of objects to be informed when a footprint is broadcast. Can be used to pass location information between non-modal objects at runtime.

Parameters:
fpListener - Object listening out for a footprint event.

removeFootprintListener

public void removeFootprintListener(FootprintListener fpListener)
Removes a given listener from the list of objects to be informed when a footprint is broadcast.

Parameters:
fpListener - Object to be removed from listeners.

getRaster1

public RasterMap getRaster1()
Returns the primary raster surface associated with the window.

Specified by:
getRaster1 in interface GISFrame
Returns:
Primary raster surface associated with this window.

getRaster2

public RasterMap getRaster2()
Returns the secondary raster surface associated with the window.

Specified by:
getRaster2 in interface GISFrame
Returns:
Secondary raster surface associated with this window.

getRasterMaps

public Vector getRasterMaps()
Returns a collection of all the stored raster maps associated with this GUIFrame.

Specified by:
getRasterMaps in interface GISFrame
Returns:
Collection of raster maps associated with this GUIFrame.

setRaster1

public void setRaster1(RasterMap raster)
Makes the given raster surface the primary one to be processed. If the given raster is not already part of the collection stored by this GISFrame, it will be added. If it is already stored, it is simply recorded as being the primary raster.

Specified by:
setRaster1 in interface GISFrame
Parameters:
raster - New primary raster to be associated with this window.

setRaster2

public void setRaster2(RasterMap raster)
Makes the given raster surface the secondary one to be processed. If the given raster is not already part of the collection stored by this GISFrame, it will be added. If it is already stored, it is simply recorded as being the secondary raster.

Specified by:
setRaster2 in interface GISFrame
Parameters:
raster - New secondary raster to be associated with this window.

getVectorMap1

public VectorMap getVectorMap1()
Returns the primary vector map associated with the window.

Specified by:
getVectorMap1 in interface GISFrame
Returns:
Primary vector map associated with this window.

getVectorMap2

public VectorMap getVectorMap2()
Returns the secondary vector map associated with the window.

Specified by:
getVectorMap2 in interface GISFrame
Returns:
Secondary vector map associated with this window.

getVectorMaps

public Vector getVectorMaps()
Returns a collection of all the stored vector maps associated with this GUIFrame.

Specified by:
getVectorMaps in interface GISFrame
Returns:
Collection of vector maps associated with this GUIFrame.

setVectorMap1

public void setVectorMap1(VectorMap vectorMap)
Makes the given vector map the primary one associated with the window. If the given vector map is not already part of the collection stored by this GISFrame, it will be added. If it is already stored, it is simply recorded as being the primary vector map.

Specified by:
setVectorMap1 in interface GISFrame
Parameters:
vectorMap - New primary vector map to be associated with this window.

setVectorMap2

public void setVectorMap2(VectorMap vectorMap)
Makes the given vector map the secondary one associated with the window. If the given vector map is not already part of the collection stored by this GISFrame, it will be added. If it is already stored, it is simply recorded as being the secondary vector map.

Specified by:
setVectorMap2 in interface GISFrame
Parameters:
vectorMap - New secondary vector map to be associated with this window.

getFrame

public Frame getFrame()
Reports the AWT frame in which this should be embedded.

Specified by:
getFrame in interface GISFrame
Returns:
AWT frame in which this is embedded.

isExperimental

public boolean isExperimental()
Reports whether experimental functionality is available to the GUI. This can be useful when testing new functionality that may not be available to the general user.

Specified by:
isExperimental in interface GISFrame
Returns:
True if experimental functionality is to be made available.

actionPerformed

public void actionPerformed(ActionEvent event)
Responds to a selection of menu item or button press.

Specified by:
actionPerformed in interface ActionListener
Parameters:
event - Menu/button selection event.

setMessage

public void setMessage(String message)
Displays the given message in the window and also logs the message for possible error diagnosis.

Specified by:
setMessage in interface GISFrame
Overrides:
setMessage in class JWFrame
Parameters:
message - Message to display and log.

setBusy

public void setBusy(boolean busy)
Indicates that some process has started or stopped. When busy, a 'busy' cursor is shown.

Specified by:
setBusy in interface GISFrame
Parameters:
busy - Busy if true.

print

public int print(Graphics g,
                 PageFormat pageFormat,
                 int pageIndex)
Creates a printable version of the current LandSerf display. Scales output to the given page format.

Specified by:
print in interface Printable
Parameters:
g - Graphics to print.
pageFormat - Format of page on which to print.
pageIndex - Page to print.

getPrintUtilities

public PrintUtilities getPrintUtilities()
Passes on the printer utilites from the frame. If the utilities have not been initialised, they will be at this point. This is used since printer initialisation can be expensive so is better passed by reference rather than recreated.

Specified by:
getPrintUtilities in interface GISFrame
Returns:
Set of printer utilities for printing, previewing and storing printer settings.

removeSpatialObject

public void removeSpatialObject(SpatialObject spObj)
Removes the given spatial object from those stored by the GISFrame

Specified by:
removeSpatialObject in interface GISFrame
Parameters:
spObj - Spatial object to remove.

closeDown

public void closeDown()
Closes down the application neatly.

Overrides:
closeDown in class JWFrame


Copyright Jo Wood, 1996-2005, last modified, 11th March, 2005