public final class FileOption extends AbstractOption
| Modifier and Type | Field and Description | 
|---|---|
private JButton | 
browseButton
Used to pop up a  
JFileChooser. | 
private static String | 
BUNDLE_DIR
Name of the "bundle" subdirectory of the user path. 
 | 
static String | 
BUNDLE_FIELD_TIP
Tool tip used by  
bundleField. | 
private JTextField | 
bundleField
Shows current default bundle. 
 | 
private static String | 
BUTTON_LABEL
Label for  
browseButton. | 
private boolean | 
checkbox
Current state of  
enableCheckBox. | 
private static String | 
CHECKBOX_LABEL
Label for  
enableCheckBox. | 
private static Pattern | 
CLEAN_VALUE_REGEX
Regular expression pattern for ensuring that no quote marks are present. 
 | 
private String | 
defaultBundle
Default path for  
bundleField. | 
private boolean | 
defaultCheckBox
Default state of  
enableCheckBox. | 
private String | 
defaultValue
Default option value. 
 | 
private JCheckBox | 
enableCheckBox
Whether or not the default bundle should be used. 
 | 
private static String | 
FALSE_STRING
Constant that represents string version of the  
0 boolean. | 
private static String | 
FORMAT
Formatting string used by  
toString(). | 
private String | 
path
Current contents of  
bundleField. | 
private static String | 
TRUE_STRING
Constant that represents string version of the  
1 boolean. | 
private static String | 
USERPATH
System property that points to the McIDAS-V user path. 
 | 
| Constructor and Description | 
|---|
FileOption(String id,
          String label,
          String defaultValue,
          OptionMaster.OptionPlatform platform,
          OptionMaster.Visibility visibility)
Create a new "file option" that allows the user to select
 a file. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
static boolean | 
booleanFromFormat(String value)
Convert the strings  
1 and 0 to their corresponding
 boolean values. | 
private void | 
browseButtonActionPerformed(ActionEvent event)
Handles the user clicking on the  
browseButton. | 
String | 
getBundlePath()
Returns a string representating the path to the startup bundle. 
 | 
String | 
getCheckBoxValue()
Returns a string representation of  
enableCheckBox. | 
JComponent | 
getComponent()
Returns the GUI component that represents the option. 
 | 
String | 
getValue()
Returns a string containing the state of  
enableCheckBox and
 bundleField. | 
static String[] | 
parseFormat(String format)
Attempt to extract something sensible from the value given in
 "runMcV-Prefs". 
 | 
private String | 
selectBundle(String bundleDirectory)
Show a  
JFileChooser dialog that allows the user to select a
 bundle. | 
void | 
setValue(String newValue)
Forces the value of the option to the data specified. 
 | 
String | 
toString()
Friendly string representation of the option. 
 | 
fromPrefsFormat, getLabel, getOptionId, getOptionPlatform, getOptionType, getOptionVisibility, isValidPrefFormat, onValidPlatform, toPrefsFormatprivate static final String BUTTON_LABEL
browseButton.private static final String CHECKBOX_LABEL
enableCheckBox.private static final String USERPATH
private static final String BUNDLE_DIR
private static final String TRUE_STRING
1 boolean.private static final String FALSE_STRING
0 boolean.private static final Pattern CLEAN_VALUE_REGEX
private static final String FORMAT
toString().public static final String BUNDLE_FIELD_TIP
bundleField.private final String defaultValue
OptionMaster.blahblah.private final boolean defaultCheckBox
enableCheckBox.private final String defaultBundle
bundleField.private JTextField bundleField
null!private JButton browseButton
JFileChooser. May be null!private JCheckBox enableCheckBox
null!private boolean checkbox
enableCheckBox.private String path
bundleField. Value may be null!public FileOption(String id, String label, String defaultValue, OptionMaster.OptionPlatform platform, OptionMaster.Visibility visibility)
id - Option ID.label - Option label (used in GUI).defaultValue - Default option value.platform - Platform restrictions for the option.visibility - Visibility restrictions for the option.private void browseButtonActionPerformed(ActionEvent event)
browseButton.event - Currently ignored.private String selectBundle(String bundleDirectory)
JFileChooser dialog that allows the user to select a
 bundle.bundleDirectory - Initial directory for the JFileChooser.defaultValue if the user cancelled.public JComponent getComponent()
getComponent in interface OptiongetComponent in class AbstractOptionpublic String getValue()
enableCheckBox and
 bundleField.
 Results should look like 0;/path/to/bundle.mcv.
getValue in interface OptiongetValue in class AbstractOptionpublic String getCheckBoxValue()
enableCheckBox.1 or 0 depending upon the state of
 enableCheckBox.public String getBundlePath()
bundleField is null, defaultBundle
 is returned. Otherwise the contents of the text field are returned.public void setValue(String newValue)
setValue in interface OptionsetValue in class AbstractOptionnewValue - New value to use.public String toString()
toString in interface OptiontoString in class AbstractOptionString containing relevant info about the option.TextOption.toString(), 
BooleanOption.toString()public static String[] parseFormat(String format)
Expected format is something like "0;/path/to/bundle.mcv" or
 "1;". The first example would signify that
 enableCheckBox is not selected, and the contents of
 bundleField are /path/to/bundle.mcv. The second
 example would signify that enableCheckBox is selected, and the
 contents of bundleField should be an empty string.
format - See method description for details. null not
 allowed.enableCheckBox and the second is the bundle path. Note that
 the bundle path may be empty.booleanFromFormat(String)public static boolean booleanFromFormat(String value)
1 and 0 to their corresponding
 boolean values.value - String to convert. null or empty strings accepted.true if value is 1. Otherwise
 returns false.