uk.ac.starlink.ast.gui
Class PlotConfigurator

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.starlink.ast.gui.PlotConfigurator
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ChangeListener, RootPaneContainer, WindowConstants, StoreSource

public class PlotConfigurator
extends JFrame
implements StoreSource, ChangeListener

PlotConfigurator creates a dialog window for controlling the configuration of an Plot.

The configuration controls are presented as a serious of tabbed panes. Each of these panes containing a set of "related" controls (such as controls for setting the Plot title, this pane contains a text area, plus font and colour selection).

Each pane of related controls has a data model that contains the state. These can be used to save and restore the complete configuration to some XML database.

When closed this window will be hidden, not disposed. If this therefore necessary that the user disposes of it when it is really no longer required.

Version:
$Id$
Author:
Peter W. Draper
See Also:
Serialized Form

Nested Class Summary
protected  class PlotConfigurator.CloseAction
          Inner class defining Action for closing window.
protected  class PlotConfigurator.DrawAction
          Draw action.
protected  class PlotConfigurator.ResetAction
          Inner class defining action for resetting all values.
protected  class PlotConfigurator.StoreAction
          Inner class defining action for initiating the configuration storage window.
 
Nested classes/interfaces inherited from class javax.swing.JFrame
JFrame.AccessibleJFrame
 
Nested classes/interfaces inherited from class java.awt.Frame
Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow
 
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  JPanel actionBar
          Action buttons container.
protected  String applicationName
          Application name for the store to use.
protected  JMenuItem autoDrawOptionsMenu
           
protected  JMenuItem closeFileMenu
           
protected  PlotConfiguration config
          Graphics configuration object.
protected  JPanel contentPane
          Content pane of frame.
protected  PlotController controller
          PlotController.
protected  ArrayList controlsList
          List of PlotControls that have been added.
protected  Element defaultConfig
          The default configuration of all known elements.
protected static String defaultTitle
          Default title for window: "Configure AST graphics options".
protected  JMenuItem drawFileMenu
           
protected  JMenu fileMenu
           
protected  JMenuBar menuBar
          Menubar and various menus and items that it contains.
protected  JMenu optionsMenu
           
protected  JMenuItem saveConfigFileMenu
           
protected  JMenuItem saveConfigOptionsMenu
           
protected  StoreControlFrame storeControl
          Graphics configuration store window.
protected  String storeName
          Name for the store file.
protected  JTabbedPane tabbedPane
          Tabbed pane.
protected  String title
          Title for window.
 
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
PlotConfigurator()
          Create an instance.
PlotConfigurator(String title)
          Create an instance, setting the window title.
PlotConfigurator(String title, PlotController controller)
          Create an instance that controls a Plot and has a given window title.
PlotConfigurator(String title, PlotController controller, PlotConfiguration config, String applicationName, String storeName)
          Create an instance that controls a Plot, has a given window title and uses a pre-defined configuration.
 
Method Summary
protected  void addAxes()
           
protected  void addAxisLabels()
           
protected  void addBorder()
           
protected  void addControls(PlotControls controls, boolean append)
          Add a "page" of controls to the tabbed pane.
protected  void addDefaultControls()
          Add the default list of controls currently provided by the PlotConfiguration.
 void addExtraControls(PlotControls controls, boolean append)
          Add a set of extra controls to the tabbed pane.
protected  void addGrid()
           
protected  void addNumberLabels()
           
 void addText()
           
protected  void addTicks()
           
 void addTitle()
           
protected  void closeStoreConfigFrame()
          Close the config store window.
protected  void closeWindowEvent()
          Close the window.
 String getApplicationName()
          Return a name for this application.
 String getAst()
          Get the complete AST description of all default components.
 PlotConfiguration getConfiguration()
          Get the PlotConfiguration object used to store the actual state.
 String getStoreName()
          Return a name for the configuration store (without any directory information).
 String getTagName()
          Get a name for the top-level element associated with this configuration.
protected  void initFrame()
          Initialise frame properties (disposal, title, menus etc.).
protected  void initMenus()
          Initialise the menu bar, action bar and related actions.
protected  void initTabbedPane()
          Initialise the tabbed pane of controls.
 boolean isAutoDrawOption()
          Get whether any changes are to be applied immediately or only when "Draw" is pressed.
 void openStoreWindow()
          Create or open the configuration storage window.
 void reset()
          Reset everything to the default values.
 void restoreState(Element rootElement)
          Restore a previously saved configuration created by the StoreSource.saveState(org.w3c.dom.Element) method.
 void reveal(int page)
          Reveal a page of controls.
 void saveState(Element rootElement)
          Save the configuration with the given Element as the root of the document.
 void setAutoDrawOption(boolean state)
          Set whether any changes are applied immediately or only when "Draw" is pressed.
 void stateChanged(ChangeEvent e)
           
protected  void storeControlClosed()
          Configuration storage window is closed.
 void update()
          Force a send of the current configuration to the associated plot, thus hopefully getting it to re-draw itself.
 
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, setIconImage, 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, 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, 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, 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, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, 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
 

Field Detail

contentPane

protected JPanel contentPane
Content pane of frame.


actionBar

protected JPanel actionBar
Action buttons container.


tabbedPane

protected JTabbedPane tabbedPane
Tabbed pane.


menuBar

protected JMenuBar menuBar
Menubar and various menus and items that it contains.


fileMenu

protected JMenu fileMenu

saveConfigFileMenu

protected JMenuItem saveConfigFileMenu

drawFileMenu

protected JMenuItem drawFileMenu

closeFileMenu

protected JMenuItem closeFileMenu

optionsMenu

protected JMenu optionsMenu

saveConfigOptionsMenu

protected JMenuItem saveConfigOptionsMenu

autoDrawOptionsMenu

protected JMenuItem autoDrawOptionsMenu

config

protected PlotConfiguration config
Graphics configuration object.


controller

protected PlotController controller
PlotController. Used to send control instructions to the Plot we're configuring.


storeControl

protected StoreControlFrame storeControl
Graphics configuration store window.


defaultConfig

protected Element defaultConfig
The default configuration of all known elements.


defaultTitle

protected static String defaultTitle
Default title for window: "Configure AST graphics options".


applicationName

protected String applicationName
Application name for the store to use.


storeName

protected String storeName
Name for the store file.


title

protected String title
Title for window.


controlsList

protected ArrayList controlsList
List of PlotControls that have been added.

Constructor Detail

PlotConfigurator

public PlotConfigurator()
Create an instance. This has the default title and does not attempt to control a Plot.


PlotConfigurator

public PlotConfigurator(String title)
Create an instance, setting the window title.


PlotConfigurator

public PlotConfigurator(String title,
                        PlotController controller)
Create an instance that controls a Plot and has a given window title.


PlotConfigurator

public PlotConfigurator(String title,
                        PlotController controller,
                        PlotConfiguration config,
                        String applicationName,
                        String storeName)
Create an instance that controls a Plot, has a given window title and uses a pre-defined configuration. Also change the default names used for the backing store.

Method Detail

initTabbedPane

protected void initTabbedPane()
Initialise the tabbed pane of controls.


initFrame

protected void initFrame()
Initialise frame properties (disposal, title, menus etc.).


initMenus

protected void initMenus()
Initialise the menu bar, action bar and related actions.


getAst

public String getAst()
Get the complete AST description of all default components.


getConfiguration

public PlotConfiguration getConfiguration()
Get the PlotConfiguration object used to store the actual state.


setAutoDrawOption

public void setAutoDrawOption(boolean state)
Set whether any changes are applied immediately or only when "Draw" is pressed.


isAutoDrawOption

public boolean isAutoDrawOption()
Get whether any changes are to be applied immediately or only when "Draw" is pressed.


addDefaultControls

protected void addDefaultControls()
Add the default list of controls currently provided by the PlotConfiguration.


addTitle

public void addTitle()

addAxisLabels

protected void addAxisLabels()

addNumberLabels

protected void addNumberLabels()

addGrid

protected void addGrid()

addAxes

protected void addAxes()

addBorder

protected void addBorder()

addTicks

protected void addTicks()

addText

public void addText()

addExtraControls

public void addExtraControls(PlotControls controls,
                             boolean append)
Add a set of extra controls to the tabbed pane.

Parameters:
controls - the controls (a JComponent that implements the PlotControls interface).
append - whether to append the controls to the tabbed pane list.

addControls

protected void addControls(PlotControls controls,
                           boolean append)
Add a "page" of controls to the tabbed pane.


reveal

public void reveal(int page)
Reveal a page of controls.


closeWindowEvent

protected void closeWindowEvent()
Close the window.


update

public void update()
Force a send of the current configuration to the associated plot, thus hopefully getting it to re-draw itself.


reset

public void reset()
Reset everything to the default values.


saveState

public void saveState(Element rootElement)
Description copied from interface: StoreSource
Save the configuration with the given Element as the root of the document.

Specified by:
saveState in interface StoreSource

restoreState

public void restoreState(Element rootElement)
Description copied from interface: StoreSource
Restore a previously saved configuration created by the StoreSource.saveState(org.w3c.dom.Element) method.

Specified by:
restoreState in interface StoreSource

getApplicationName

public String getApplicationName()
Description copied from interface: StoreSource
Return a name for this application. This is used to create a directory for the configuration store.

Specified by:
getApplicationName in interface StoreSource

getStoreName

public String getStoreName()
Description copied from interface: StoreSource
Return a name for the configuration store (without any directory information).

Specified by:
getStoreName in interface StoreSource

getTagName

public String getTagName()
Description copied from interface: StoreSource
Get a name for the top-level element associated with this configuration.

Specified by:
getTagName in interface StoreSource

openStoreWindow

public void openStoreWindow()
Create or open the configuration storage window.


storeControlClosed

protected void storeControlClosed()
Configuration storage window is closed.


closeStoreConfigFrame

protected void closeStoreConfigFrame()
Close the config store window.


stateChanged

public void stateChanged(ChangeEvent e)
Specified by:
stateChanged in interface ChangeListener


Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.