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

java.lang.Object
  |
  +--edu.rice.cs.drjava.ui.config.OptionComponent
        |
        +--edu.rice.cs.drjava.ui.config.FileOptionComponent
All Implemented Interfaces:
OptionConstants

public class FileOptionComponent
extends OptionComponent
implements OptionConstants

Graphical form of a FileOption.

Version:
$Id: FileOptionComponent.java,v 1.7 2002/09/02 21:24:13 csreis Exp $

Field Summary
private  JButton _button
           
private  File _currentFile
           
private  FileFilter _fileFilter
           
private  JFileChooser _jfc
           
private  JTextField _jtf
           
private  File _newFile
           
private  JPanel _panel
           
 
Fields inherited from class edu.rice.cs.drjava.ui.config.OptionComponent
_label, _option, _parent
 
Fields inherited from interface edu.rice.cs.drjava.config.OptionConstants
COMPILER_ERROR_COLOR, DEBUG_BREAKPOINT_COLOR, DEBUG_SHOW_THREADS, DEBUG_SOURCEPATH, DEBUG_STEP_DRJAVA, DEBUG_STEP_INTERPRETER, DEBUG_STEP_JAVA, DEBUG_THREAD_COLOR, DEFINITIONS_BACKGROUND_COLOR, DEFINITIONS_COMMENT_COLOR, DEFINITIONS_DOUBLE_QUOTED_COLOR, DEFINITIONS_KEYWORD_COLOR, DEFINITIONS_MATCH_COLOR, DEFINITIONS_NORMAL_COLOR, DEFINITIONS_NUMBER_COLOR, DEFINITIONS_SINGLE_QUOTED_COLOR, DEFINITIONS_TYPE_COLOR, EXTRA_CLASSPATH, FONT_DOCLIST, FONT_MAIN, FONT_TOOLBAR, HISTORY_MAX_SIZE, INDENT_LEVEL, INTERACTIONS_EXIT_PROMPT, JAVAC_ALLOW_ASSERT, JAVAC_LOCATION, JSR14_COLLECTIONSPATH, JSR14_LOCATION, KEY_BACKWARD, KEY_BEGIN_DOCUMENT, KEY_BEGIN_LINE, KEY_CLOSE_FILE, KEY_COMPILE, KEY_COMPILE_ALL, KEY_COPY, KEY_CUT, KEY_CUT_LINE, KEY_DEBUG_BREAKPOINT_TOGGLE, KEY_DEBUG_MODE_TOGGLE, KEY_DEBUG_RESUME, KEY_DEBUG_STEP_INTO, KEY_DEBUG_STEP_OUT, KEY_DEBUG_STEP_OVER, KEY_DELETE_NEXT, KEY_DELETE_PREVIOUS, KEY_DOWN, KEY_END_DOCUMENT, KEY_END_LINE, KEY_FIND_NEXT, KEY_FIND_REPLACE, KEY_FORWARD, KEY_GOTO_LINE, KEY_NEW_FILE, KEY_NEXT_DOCUMENT, KEY_NEXT_WORD, KEY_OPEN_FILE, KEY_PAGE_DOWN, KEY_PAGE_UP, KEY_PASTE, KEY_PREVIOUS_DOCUMENT, KEY_PREVIOUS_WORD, KEY_PRINT, KEY_PRINT_PREVIEW, KEY_QUIT, KEY_REDO, KEY_SAVE_FILE, KEY_SAVE_FILE_AS, KEY_SELECT_ALL, KEY_UNDO, KEY_UP, LINEENUM_ENABLED, mask, QUIT_PROMPT, RECENT_FILES, RECENT_FILES_MAX_SIZE, TOOLBAR_ICONS_ENABLED, TOOLBAR_TEXT_ENABLED, WORKING_DIRECTORY
 
Constructor Summary
FileOptionComponent(FileOption opt, String text, Frame parent)
           
 
Method Summary
private  void _updateTextField(File c)
          Updates the text field to display the given file.
 void chooseFile()
          Shows a file chooser to pick a new file.
 boolean chooseFileFromField()
          The chooser method for the validation of filenames that are manually entered into the text field.
 JComponent getComponent()
          Return's this OptionComponent's configurable component.
 void resetToCurrent()
          Resets this component to the current config value.
 void resetToDefault()
          Resets this component to the option's default value.
 void setFileFilter(FileFilter fileFilter)
          Set the file filter for this file option component
 void setValue(File value)
          Displays the given value.
 void setValue(Object x0)
          Sets the value that is currently displayed by this component.
 boolean updateConfig()
          Updates the config object with the new setting.
 
Methods inherited from class edu.rice.cs.drjava.ui.config.OptionComponent
getLabel, getLabelText, getOption, showErrorMessage, showErrorMessage
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

_button

private JButton _button

_jtf

private JTextField _jtf

_currentFile

private File _currentFile

_newFile

private File _newFile

_jfc

private JFileChooser _jfc

_fileFilter

private FileFilter _fileFilter

_panel

private JPanel _panel
Constructor Detail

FileOptionComponent

public FileOptionComponent(FileOption opt,
                           String text,
                           Frame parent)
Method Detail

updateConfig

public boolean updateConfig()
Updates the config object with the new setting.
Overrides:
updateConfig in class OptionComponent
Returns:
true if the new value is set successfully

resetToCurrent

public void resetToCurrent()
Resets this component to the current config value.
Overrides:
resetToCurrent in class OptionComponent

resetToDefault

public void resetToDefault()
Resets this component to the option's default value.
Overrides:
resetToDefault in class OptionComponent

setValue

public void setValue(File value)
Displays the given value.

getComponent

public JComponent getComponent()
Return's this OptionComponent's configurable component.
Overrides:
getComponent in class OptionComponent

_updateTextField

private void _updateTextField(File c)
Updates the text field to display the given file.

setFileFilter

public void setFileFilter(FileFilter fileFilter)
Set the file filter for this file option component

chooseFile

public void chooseFile()
Shows a file chooser to pick a new file. Allows picking directories.

chooseFileFromField

public boolean chooseFileFromField()
The chooser method for the validation of filenames that are manually entered into the text field.
Returns:
False, if file does not exist. True, otherwise.

setValue

public void setValue(Object x0)
Description copied from class: OptionComponent
Sets the value that is currently displayed by this component.
Overrides:
setValue in class OptionComponent