So how can the encoder receive the additional input?
Actually I tried to do it as simple as I could. To tell the Encoder Tool that your encoder needs input, you'll need to annotate the field with the InputField annotation.
So the Encoder Tool will know that prior to performing the actual encoding, it should pop-up the input dialog, get the input from user and populate the fields.
Let's take a look on the example:
The field nowrap is annotated with the InputField. So when the user invokes the encoder, the following dialog will pop-up:
I guess that the idea is clear. So let's just mention what java types are supported as input fields:
- String - can be a single line, a text box or a combo box. See TextField annotation for more details.
- Boolean - check box
- Integer - spinner
- Enum - combo box
- File - input dialog for a file or a directory. See InputFileField and InputDirectoryField annoations for more details.
- Properties - table of properties
- Arrays - list. See InputListField for more details.
The input dialog supports on going validations. To do so, the encoder must implement the tarlog.encoder.tool.api.fields.Validator interface. Let's take a look on the example:
The method isValid() will be invoked each time the user changes input.