edu.rice.cs.drjava.ui.config
Class ConfigFrame

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 edu.rice.cs.util.swing.SwingFrame
                          extended by edu.rice.cs.drjava.ui.config.ConfigFrame
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants

public class ConfigFrame
extends SwingFrame

The frame for setting Configuration options on the fly

Version:
$Id: ConfigFrame.java 5439 2011-08-11 17:13:04Z rcartwright $
See Also:
Serialized Form

Nested Class Summary
private  class ConfigFrame.PanelTreeNode
          Private class to handle rendering of tree nodes, each of which corresponds to a ConfigPanel.
private  class ConfigFrame.PanelTreeSelectionListener
           
 
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.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
private  JButton _applyButton
           
private  JFileChooser _browserChooser
           
private  JButton _cancelButton
           
private  OptionComponent.ChangeListener _changeListener
           
private  ConfigOptionListeners.RequiresInteractionsRestartListener<String> _concJUnitChecksEnabledListener
           
private  DirectoryChooser _dirChooser
           
private  JFileChooser _fileOptionChooser
           
private  JFileChooser _jarChooser
           
private  ConfigOptionListeners.RequiresInteractionsRestartListener<Boolean> _junitLocationEnabledListener
           
private  ConfigOptionListeners.RequiresInteractionsRestartListener<File> _junitLocationListener
           
private  MainFrame _mainFrame
           
private  JPanel _mainPanel
           
private  JButton _okButton
           
private  ConfigFrame.PanelTreeNode _rootNode
           
private  ConfigOptionListeners.RequiresInteractionsRestartListener<File> _rtConcJUnitLocationListener
           
private  JTree _tree
           
private  DefaultTreeModel _treeModel
           
protected  Runnable1<WindowEvent> CANCEL
          Thunk that calls _cancel.
private static int FRAME_HEIGHT
           
private static int FRAME_WIDTH
           
private  StringOptionComponent javadocCustomParams
           
protected  String SEPS
           
 
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
ConfigFrame(MainFrame frame)
          Sets up the frame and displays it.
 
Method Summary
private  ConfigFrame.PanelTreeNode _createPanel(String t)
          Creates an individual panel, adds it to the JTree and the list of panels, and returns the tree node.
private  ConfigFrame.PanelTreeNode _createPanel(String t, ConfigFrame.PanelTreeNode parent)
          Creates an individual panel, adds it to the JTree and the list of panels, and returns the tree node.
private  void _createPanels()
          Creates all of the panels contained within the frame.
private  void _displayPanel(ConfigPanel cf)
          Sets the given ConfigPanel as the visible panel.
private  File _getWorkDir()
          Returns the current master working directory, or the user's current directory if none is set.
private  void _initTree()
          Creates the JTree to display preferences categories.
private  void _setupColorPanel(ConfigPanel panel)
          Adds all of the components for the Color panel of the preferences window.
private  void _setupCompilerPanel(ConfigPanel panel)
          Adds all of the components for the Compiler Options Panel of the preferences window
private  void _setupDebugPanel(ConfigPanel panel)
          Add all of the components for the Debugger panel of the preferences window.
private  void _setupDisplayPanel(ConfigPanel panel)
          Add all of the components for the Display Options panel of the preferences window.
private  void _setupFileTypesPanel(ConfigPanel panel)
          Adds all of the components for the file types panel of the preferences window.
private  void _setupFontPanel(ConfigPanel panel)
          Add all of the components for the Font panel of the preferences window.
private  void _setupInteractionsPanel(ConfigPanel panel)
          Add all of the components for the Interactions panel of the preferences window.
private  void _setupJavadocPanel(ConfigPanel panel)
          Add all of the components for the Javadoc panel of the preferences window.
private  void _setupJUnitPanel(ConfigPanel panel)
          Add all of the components for the JUnit panel of the preferences window.
private  void _setupJVMsPanel(ConfigPanel panel)
          Adds all of the components for the JVMs panel of the preferences window.
private  void _setupKeyBindingsPanel(ConfigPanel panel)
          Adds all of the components for the Key Bindings panel of the preferences window.
private  void _setupMiscPanel(ConfigPanel panel)
          Adds all of the components for the Miscellaneous panel of the preferences window.
private  void _setupNotificationsPanel(ConfigPanel panel)
          Adds all of the components for the Prompts panel of the preferences window.
private  void _setupPositionsPanel(ConfigPanel panel)
          Add all of the components for the Positions panel of the preferences window.
private  void _setupResourceLocPanel(ConfigPanel panel)
          Add all of the components for the Resource Locations panel of the preferences window.
<X,C extends JComponent>
void
addOptionComponent(ConfigPanel panel, OptionComponent<X,C> oc)
           
 boolean apply()
          Call the update method to propagate down the tree, parsing input values into their config options.
 void cancel()
          Resets the frame and hides it.
private  void disableChangeListeners()
           
private  void enableChangeListeners()
           
protected  BooleanOptionComponent newBooleanOptionComponent(BooleanOption o)
           
protected  BooleanOptionComponent newBooleanOptionComponent(BooleanOption o, boolean left)
           
protected  ColorOptionComponent newColorOptionComponent(ColorOption o)
           
protected  ColorOptionComponent newColorOptionComponent(ColorOption o, boolean isBackground)
           
protected  ColorOptionComponent newColorOptionComponent(ColorOption o, boolean isBackground, boolean isBold)
           
protected  DirectoryOptionComponent newDirectoryOptionComponent(FileOption o, DirectoryChooser c)
           
protected  FileOptionComponent newFileOptionComponent(FileOption o, FileSelectorComponent c)
           
protected  FileOptionComponent newFileOptionComponent(FileOption o, JFileChooser c)
           
protected  FontOptionComponent newFontOptionComponent(FontOption o)
           
protected  ForcedChoiceOptionComponent newForcedChoiceOptionComponent(ForcedChoiceOption o)
           
protected  IntegerOptionComponent newIntegerOptionComponent(IntegerOption o)
           
protected  StringOptionComponent newStringOptionComponent(StringOption o)
           
protected  VectorFileOptionComponent newVectorFileOptionComponent(VectorOption<File> o, boolean mbe)
           
protected  VectorStringOptionComponent newVectorStringOptionComponent(VectorOption<String> o, boolean mbe)
           
 void resetToCurrent()
          Resets the field of each option in the Preferences window to its actual stored value.
 boolean saveSettings()
          Write the configured option values to disk.
 void setUp()
          Performs deferred initialization.
 void setVisible(boolean vis)
          Validates before changing visibility.
 
Methods inherited from class edu.rice.cs.util.swing.SwingFrame
duringInit, initDone
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, 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, dispose, 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, 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, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

FRAME_WIDTH

private static final int FRAME_WIDTH
See Also:
Constant Field Values

FRAME_HEIGHT

private static final int FRAME_HEIGHT
See Also:
Constant Field Values

_mainFrame

private final MainFrame _mainFrame

_tree

private final JTree _tree

_treeModel

private final DefaultTreeModel _treeModel

_rootNode

private final ConfigFrame.PanelTreeNode _rootNode

_okButton

private final JButton _okButton

_applyButton

private final JButton _applyButton

_cancelButton

private final JButton _cancelButton

_mainPanel

private final JPanel _mainPanel

_fileOptionChooser

private final JFileChooser _fileOptionChooser

_browserChooser

private final JFileChooser _browserChooser

_jarChooser

private final JFileChooser _jarChooser

_dirChooser

private final DirectoryChooser _dirChooser

_junitLocationEnabledListener

private final ConfigOptionListeners.RequiresInteractionsRestartListener<Boolean> _junitLocationEnabledListener

_junitLocationListener

private final ConfigOptionListeners.RequiresInteractionsRestartListener<File> _junitLocationListener

_concJUnitChecksEnabledListener

private final ConfigOptionListeners.RequiresInteractionsRestartListener<String> _concJUnitChecksEnabledListener

_rtConcJUnitLocationListener

private final ConfigOptionListeners.RequiresInteractionsRestartListener<File> _rtConcJUnitLocationListener

javadocCustomParams

private StringOptionComponent javadocCustomParams

SEPS

protected final String SEPS
See Also:
Constant Field Values

_changeListener

private OptionComponent.ChangeListener _changeListener

CANCEL

protected final Runnable1<WindowEvent> CANCEL
Thunk that calls _cancel.

Constructor Detail

ConfigFrame

public ConfigFrame(MainFrame frame)
Sets up the frame and displays it. This a Swing view class! With the exception of initialization, this code should only be executed in the event-handling thread.

Method Detail

setUp

public void setUp()
Performs deferred initialization. Only runs in the event thread. Some of this code occasionally generated swing exceptions when run in themain thread as part of MainFrame construction prior to making MainFrame visible.


enableChangeListeners

private void enableChangeListeners()

disableChangeListeners

private void disableChangeListeners()

_getWorkDir

private File _getWorkDir()
Returns the current master working directory, or the user's current directory if none is set. 20040213 Changed default value to user's current directory.


apply

public boolean apply()
Call the update method to propagate down the tree, parsing input values into their config options.


resetToCurrent

public void resetToCurrent()
Resets the field of each option in the Preferences window to its actual stored value.


cancel

public void cancel()
Resets the frame and hides it.


setVisible

public void setVisible(boolean vis)
Validates before changing visibility. Only runs in the event thread.

Overrides:
setVisible in class Window
Parameters:
vis - true if frame should be shown, false if it should be hidden.

saveSettings

public boolean saveSettings()
                     throws IOException
Write the configured option values to disk.

Throws:
IOException

_displayPanel

private void _displayPanel(ConfigPanel cf)
Sets the given ConfigPanel as the visible panel.


_initTree

private void _initTree()
Creates the JTree to display preferences categories.


_createPanel

private ConfigFrame.PanelTreeNode _createPanel(String t,
                                               ConfigFrame.PanelTreeNode parent)
Creates an individual panel, adds it to the JTree and the list of panels, and returns the tree node.

Parameters:
t - the title of this panel
parent - the parent tree node
Returns:
this tree node

_createPanel

private ConfigFrame.PanelTreeNode _createPanel(String t)
Creates an individual panel, adds it to the JTree and the list of panels, and returns the tree node. Adds to the root node.

Parameters:
t - the title of this panel
Returns:
this tree node

_createPanels

private void _createPanels()
Creates all of the panels contained within the frame.


addOptionComponent

public <X,C extends JComponent> void addOptionComponent(ConfigPanel panel,
                                                        OptionComponent<X,C> oc)

newFileOptionComponent

protected FileOptionComponent newFileOptionComponent(FileOption o,
                                                     JFileChooser c)

newFileOptionComponent

protected FileOptionComponent newFileOptionComponent(FileOption o,
                                                     FileSelectorComponent c)

newStringOptionComponent

protected StringOptionComponent newStringOptionComponent(StringOption o)

newBooleanOptionComponent

protected BooleanOptionComponent newBooleanOptionComponent(BooleanOption o)

newBooleanOptionComponent

protected BooleanOptionComponent newBooleanOptionComponent(BooleanOption o,
                                                           boolean left)

newVectorFileOptionComponent

protected VectorFileOptionComponent newVectorFileOptionComponent(VectorOption<File> o,
                                                                 boolean mbe)

newVectorStringOptionComponent

protected VectorStringOptionComponent newVectorStringOptionComponent(VectorOption<String> o,
                                                                     boolean mbe)

newForcedChoiceOptionComponent

protected ForcedChoiceOptionComponent newForcedChoiceOptionComponent(ForcedChoiceOption o)

newIntegerOptionComponent

protected IntegerOptionComponent newIntegerOptionComponent(IntegerOption o)

newFontOptionComponent

protected FontOptionComponent newFontOptionComponent(FontOption o)

newColorOptionComponent

protected ColorOptionComponent newColorOptionComponent(ColorOption o,
                                                       boolean isBackground,
                                                       boolean isBold)

newColorOptionComponent

protected ColorOptionComponent newColorOptionComponent(ColorOption o,
                                                       boolean isBackground)

newColorOptionComponent

protected ColorOptionComponent newColorOptionComponent(ColorOption o)

newDirectoryOptionComponent

protected DirectoryOptionComponent newDirectoryOptionComponent(FileOption o,
                                                               DirectoryChooser c)

_setupResourceLocPanel

private void _setupResourceLocPanel(ConfigPanel panel)
Add all of the components for the Resource Locations panel of the preferences window.


_setupDisplayPanel

private void _setupDisplayPanel(ConfigPanel panel)
Add all of the components for the Display Options panel of the preferences window.


_setupFontPanel

private void _setupFontPanel(ConfigPanel panel)
Add all of the components for the Font panel of the preferences window.


_setupColorPanel

private void _setupColorPanel(ConfigPanel panel)
Adds all of the components for the Color panel of the preferences window.


_setupPositionsPanel

private void _setupPositionsPanel(ConfigPanel panel)
Add all of the components for the Positions panel of the preferences window.


_setupKeyBindingsPanel

private void _setupKeyBindingsPanel(ConfigPanel panel)
Adds all of the components for the Key Bindings panel of the preferences window.


_setupDebugPanel

private void _setupDebugPanel(ConfigPanel panel)
Add all of the components for the Debugger panel of the preferences window.


_setupJavadocPanel

private void _setupJavadocPanel(ConfigPanel panel)
Add all of the components for the Javadoc panel of the preferences window.


_setupNotificationsPanel

private void _setupNotificationsPanel(ConfigPanel panel)
Adds all of the components for the Prompts panel of the preferences window.


_setupMiscPanel

private void _setupMiscPanel(ConfigPanel panel)
Adds all of the components for the Miscellaneous panel of the preferences window.


_setupJVMsPanel

private void _setupJVMsPanel(ConfigPanel panel)
Adds all of the components for the JVMs panel of the preferences window.


_setupFileTypesPanel

private void _setupFileTypesPanel(ConfigPanel panel)
Adds all of the components for the file types panel of the preferences window.


_setupCompilerPanel

private void _setupCompilerPanel(ConfigPanel panel)
Adds all of the components for the Compiler Options Panel of the preferences window


_setupInteractionsPanel

private void _setupInteractionsPanel(ConfigPanel panel)
Add all of the components for the Interactions panel of the preferences window.


_setupJUnitPanel

private void _setupJUnitPanel(ConfigPanel panel)
Add all of the components for the JUnit panel of the preferences window.