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
in
#value . |
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 |
FORMAT
Formatting string used by
toString() . |
private String |
path
Current contents of
bundleField . |
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 optionPlatform,
OptionMaster.Visibility optionVisibility)
Create a new "file option" that allows the user to select
a file.
|
Modifier and Type | Method and Description |
---|---|
static boolean |
booleanFromFormat(String value) |
private void |
browseButtonActionPerformed(ActionEvent event)
Handles the user clicking on the
browseButton . |
String |
getBundlePath() |
String |
getCheckBoxValue() |
JComponent |
getComponent()
Returns the GUI component that represents the option.
|
String |
getValue()
Returns the value of the option.
|
static String[] |
parseFormat(String format) |
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, toPrefsFormat
private 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 Pattern CLEAN_VALUE_REGEX
#value
.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 optionPlatform, OptionMaster.Visibility optionVisibility)
id
- Option ID.label
- Option label (used in GUI).defaultValue
- Default option value.optionPlatform
- Platform restrictions for the option.optionVisibility
- 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 Option
getComponent
in class AbstractOption
public String getValue()
AbstractOption
BooleanOptions
return either "0" or
"1".getValue
in interface Option
getValue
in class AbstractOption
public String getCheckBoxValue()
public String getBundlePath()
public void setValue(String newValue)
setValue
in interface Option
setValue
in class AbstractOption
newValue
- New value to use.public String toString()
toString
in interface Option
toString
in class AbstractOption
String
containing relevant info about the option.TextOption.toString()
,
BooleanOption.toString()
public static String[] parseFormat(String format)
public static boolean booleanFromFormat(String value)