com.ryanm.config.swing
Class SwingGUI

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JLayeredPane
                  extended by javax.swing.JDesktopPane
                      extended by com.ryanm.config.swing.SwingGUI
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public class SwingGUI
extends javax.swing.JDesktopPane

A desktop-type area where configuration options are presented

Author:
ryanm
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JDesktopPane
javax.swing.JDesktopPane.AccessibleJDesktopPane
 
Nested classes/interfaces inherited from class javax.swing.JLayeredPane
javax.swing.JLayeredPane.AccessibleJLayeredPane
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
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
 
Fields inherited from class javax.swing.JDesktopPane
LIVE_DRAG_MODE, OUTLINE_DRAG_MODE
 
Fields inherited from class javax.swing.JLayeredPane
DEFAULT_LAYER, DRAG_LAYER, FRAME_CONTENT_LAYER, LAYER_PROPERTY, MODAL_LAYER, PALETTE_LAYER, POPUP_LAYER
 
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
SwingGUI(java.lang.String savePrefix)
          Constructs a new SwingGUI
 
Method Summary
 void addRootConfigurator(Configurator conf)
          Adds a configurator to this gui.
 void deleteGUIState(java.lang.String saveName)
          Deletes a saved GUI state
 void expose(java.lang.String path)
          Exposes the controls referred to by the supplied path
 void expose(java.lang.String path, java.awt.Point point)
          Exposes the controls referred to by the supplied path
 void expose(java.lang.String path, java.awt.Point location, int zOrder)
          Exposes the controls referred to by the supplied path
 void expose(java.lang.String path, java.awt.Rectangle bounds)
          Exposes the controls referred to by the supplied path
 void expose(java.lang.String path, java.awt.Rectangle bounds, int zOrder)
          Exposes the controls referred to by the supplied path
 void fitToDesk(javax.swing.JInternalFrame frame)
          Alters the supplied frame's bounds the minimum necessary amount so that it fits entirely within this desktop
 void hideAll()
          Hides all controls
 void hideTree(Configurator conf)
          Hides the controls for a configurator and all its subconfigurators
 void loadGUIState(java.lang.String saveName)
          Loads a saved GUI state
 void removeConfigurator(Configurator conf)
          Removes all gui resources associated with the supplied Configurator and its descendants
 void saveGUIState(java.lang.String saveName)
          Saves the current state of the gui to the java.util.prefs system, under the supplied name
 void setControlsEnabled(Configurator conf, boolean enabled)
          Sets the enabled status of any controls associated with the configurator tree rooted at the supplied configurator
 void setDefaultConfigFile(java.io.File file)
          Sets the default configuration file.
 
Methods inherited from class javax.swing.JDesktopPane
addImpl, getAccessibleContext, getAllFrames, getAllFramesInLayer, getDesktopManager, getDragMode, getSelectedFrame, getUI, getUIClassID, paramString, remove, removeAll, selectFrame, setComponentZOrder, setDesktopManager, setDragMode, setSelectedFrame, setUI, updateUI
 
Methods inherited from class javax.swing.JLayeredPane
getComponentCountInLayer, getComponentsInLayer, getComponentToLayer, getIndexOf, getLayer, getLayer, getLayeredPaneAbove, getObjectForLayer, getPosition, highestLayer, insertIndexForLayer, isOptimizedDrawingEnabled, lowestLayer, moveToBack, moveToFront, paint, putLayer, setLayer, setLayer, setPosition
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, 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, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, 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, 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, removeContainerListener, 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
 

Constructor Detail

SwingGUI

public SwingGUI(java.lang.String savePrefix)
Constructs a new SwingGUI

Parameters:
savePrefix - The prefix to use for saving the state of this gui
Method Detail

addRootConfigurator

public void addRootConfigurator(Configurator conf)
Adds a configurator to this gui. The controls for this configurator can then be displayed with a call to expose( path of configurator )

Parameters:
conf - The configurator object

removeConfigurator

public void removeConfigurator(Configurator conf)
Removes all gui resources associated with the supplied Configurator and its descendants

Parameters:
conf - The configurator to remove

expose

public void expose(java.lang.String path,
                   java.awt.Point point)
Exposes the controls referred to by the supplied path

Parameters:
path - The path to the controls. A "/" separated sequence of Configurator names
point - A suggested location for the ConfigurationFrame to be displayed.

expose

public void expose(java.lang.String path,
                   java.awt.Rectangle bounds)
Exposes the controls referred to by the supplied path

Parameters:
path - The path to the controls. A "/" separated sequence of Configurator names
bounds - A suggested bounding box for the ConfigurationFrame to be displayed.

expose

public void expose(java.lang.String path,
                   java.awt.Rectangle bounds,
                   int zOrder)
Exposes the controls referred to by the supplied path

Parameters:
path - The path to the controls. A "/" separated sequence of Configurator names
bounds - A suggested bounding box for the ConfigurationFrame to be displayed.
zOrder - The z order of the frame

expose

public void expose(java.lang.String path,
                   java.awt.Point location,
                   int zOrder)
Exposes the controls referred to by the supplied path

Parameters:
path - The path to the controls. A "/" separated sequence of Configurator names
location - A suggested Location for the ConfigurationFrame to be displayed.
zOrder - The z order of the frame

expose

public void expose(java.lang.String path)
Exposes the controls referred to by the supplied path

Parameters:
path - The path to the controls. A "/" separated sequence of Configurator names

hideTree

public void hideTree(Configurator conf)
Hides the controls for a configurator and all its subconfigurators

Parameters:
conf - The controls to hide

hideAll

public void hideAll()
Hides all controls


setDefaultConfigFile

public void setDefaultConfigFile(java.io.File file)
Sets the default configuration file. This file will be selected by default in the save and load file chooser dialogs

Parameters:
file -

saveGUIState

public void saveGUIState(java.lang.String saveName)
Saves the current state of the gui to the java.util.prefs system, under the supplied name

Parameters:
saveName - The name to save this config to

loadGUIState

public void loadGUIState(java.lang.String saveName)
Loads a saved GUI state

Parameters:
saveName - The name of the saved state

deleteGUIState

public void deleteGUIState(java.lang.String saveName)
Deletes a saved GUI state

Parameters:
saveName - The name of the saved state

fitToDesk

public void fitToDesk(javax.swing.JInternalFrame frame)
Alters the supplied frame's bounds the minimum necessary amount so that it fits entirely within this desktop

Parameters:
frame - The frame to fit

setControlsEnabled

public void setControlsEnabled(Configurator conf,
                               boolean enabled)
Sets the enabled status of any controls associated with the configurator tree rooted at the supplied configurator

Parameters:
conf - The root of the configurator tree to affect
enabled - true to enable, false to disable