public class FileParameterRenderer extends AbstractParameterRenderer<FileParameter>
FileParameter
in the JavaFX GUI.
The FileParameter
is rendered as a drop-down list of all admissible files (or results) that are already in the ResultRepository
and
a button for loading new files from disk. This button opens a file dialog for selecting files from disk.Modifier and Type | Method and Description |
---|---|
protected void |
addInputs(FileParameter parameter,
Pane parent,
Label name,
Node comment,
Label error,
Application.ToolReady ready)
Adds the parameter-specific input fields to the provided parent pane.
|
static ChoiceBox |
getBox(FileParameter parameter)
Returns the
ChoiceBox that represents this provided FileParameter in the GUI. |
protected void |
loadFromFile(FileParameter parameter,
ChoiceBox<de.jstacs.fx.renderers.parameters.FileParameterRenderer.ResultContainer> box,
Label error,
Application.ToolReady ready)
Loads the contents of a file.
|
static void |
register()
|
render
public static void register()
public static ChoiceBox getBox(FileParameter parameter)
ChoiceBox
that represents this provided FileParameter
in the GUI.parameter
- the parameterprotected void loadFromFile(FileParameter parameter, ChoiceBox<de.jstacs.fx.renderers.parameters.FileParameterRenderer.ResultContainer> box, Label error, Application.ToolReady ready)
FileParameter.FileRepresentation
to the ResultRepository
, and selects the loaded file in the drop-down list of admissible files.
Extensions of accepted files are obtained from the FileParameter.getAcceptedMimeType()
method.parameter
- the FileParameter
that is renderedbox
- the drop-down list of admissible fileserror
- the error label, required if a file could not be loadedready
- the object for checking if all parameters have been setprotected void addInputs(FileParameter parameter, Pane parent, Label name, Node comment, Label error, Application.ToolReady ready)
AbstractParameterRenderer
addInputs
in class AbstractParameterRenderer<FileParameter>
parameter
- the parameter that is renderedparent
- the parent pane containing the rendered parametername
- the name label that has been created by AbstractParameterRenderer.render(Parameter, Pane, Application.ToolReady)
comment
- the comment label that has been created by AbstractParameterRenderer.render(Parameter, Pane, Application.ToolReady)
error
- the error label that has been created by AbstractParameterRenderer.render(Parameter, Pane, Application.ToolReady)
ready
- object that checks if all parameters have been specified. Any change to a parameter value should issue the method Application.ToolReady.testReady()
to test this condition.