Package docking.widgets.values
Class FileValue
Value class for
File types. FileValues can be used for either file or directory values,
depending on the constructor options. The editor component uses a JTextField with
a browse button for bringing up a GhidraFileChooser for picking files or directories.
This class and other subclasses of AbstractValue are part of a subsystem for easily
defining a set of values that can be displayed in an input dialog (ValuesMapDialog).
Typically, these values are created indirectly using a GValuesMap which is then
given to the constructor of the dialog. However, an alternate approach is to create the
dialog without a ValuesMap and then use its ValuesMapDialog.addValue(AbstractValue)
method directly.
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a FileValue that expects its value to represent a file and not a directory.Constructs a FileValue that expects its value to represent a file and not a directory.FileValue(String name, File defaultValue, File startingDir, GhidraFileChooserMode mode) Constructs a FileValue that could represent either a File or Directory, depending on the mode value. -
Method Summary
Modifier and TypeMethodDescriptionfromString(String valueString) Parses the given string into a value of type TReturns a JComponent for entering or editing a value of this type.voidUpdates the JComponent returned fromAbstractValue.getComponent()to represent the current value of this object.voidCauses the stored value for this object to be updated based on the state of the JComponent returned fromAbstractValue.getComponent()
-
Constructor Details
-
FileValue
Constructs a FileValue that expects its value to represent a file and not a directory.- Parameters:
name- the name of the value
-
FileValue
Constructs a FileValue that expects its value to represent a file and not a directory.- Parameters:
name- the name of the valuedefaultValue- the optional default File value.
-
FileValue
Constructs a FileValue that could represent either a File or Directory, depending on the mode value.- Parameters:
name- the name of the valuedefaultValue- the optional default File value. If non-null this can be either a file or directory, but it should match the givenGhidraFileChooserModestartingDir- an optional directory specifying where the FileChooser should intialize its starting selected directory.mode- theGhidraFileChooserModeused to indicate if this File represents a file or directory. It will put the GhidraFileChooser in a mode for choosing files or directories.
-
-
Method Details
-
getComponent
Description copied from class:AbstractValueReturns a JComponent for entering or editing a value of this type.- Specified by:
getComponentin classAbstractValue<File>- Returns:
- a JComponent for entering or editing a value of this type.
-
updateValueFromComponent
public void updateValueFromComponent()Description copied from class:AbstractValueCauses the stored value for this object to be updated based on the state of the JComponent returned fromAbstractValue.getComponent()- Specified by:
updateValueFromComponentin classAbstractValue<File>
-
updateComponentFromValue
public void updateComponentFromValue()Description copied from class:AbstractValueUpdates the JComponent returned fromAbstractValue.getComponent()to represent the current value of this object.- Specified by:
updateComponentFromValuein classAbstractValue<File>
-
fromString
Description copied from class:AbstractValueParses the given string into a value of type T- Specified by:
fromStringin classAbstractValue<File>- Parameters:
valueString- the string to parse- Returns:
- a value of type T
-