We need you!

Icon

The IzPack documentation needs work, and you are invited to edit it!

Skip to end of metadata
Go to start of metadata

Description

The button input field gives your user the option to run a custom button action, which can act as a optional action or validator.
A common use case for the button field is to validate connections to a LDAP or web server.
The (Custom Actions) page may be helpful to get your started on designing your custom action or validator.
We will provide an example of a custom button action here, it can be found at the end of this document.
Currently there are no default button actions available for use.
Currently all strings should be defined in the appropriate CusomtLangPack file(s), a 'txt' attribute may be added in the future.

Attributes

Attribute

Usage

RequiredDefault Value
idSet the text you want to appear on the left columnNo""


Specification Attributes

Attribute

Usage

RequiredDefault Value
idSet the text you want to appear on the button.
Attempts to retrieve text from the appropriate CusomLangPack file.
No""
successMsgDisplay the success message if the action or validator executed without issue.No""

Run Attributes

Attribute

Usage

Required
classPath to the class to be run when the button is clickedYes

 

Msg Attributes

Attribute

Usage

Required
nameIndicate the key to be used to obtain the given text from the your cusom action or validator.
Common names may include 'warn', 'error', 'info', this will become more apparent if default button actions are implemented.
Yes
idThe text you want to pass to your custom button action class.
Attempts to retrieve text from the appropriate CustomLangPack file.
Yes

 

Example definition of button field in the userInputSpec

In this example we create a button with a label 'pokedex query'.
The button will contain the text 'pokedex.button', and when the PokemonConnectionTest completes successfully, the 'pokedex.working' message will be displayed.
We have passed in the 'pokedex.error' string to our PokemonConnectionTest, so that it can refer to this string through the key 'error'.
Note that all strings attempt to be resolved from the CustomLangPack file. If the string is not present in the CustomLangPack file, and empty string will be available.

 

Example implementation of a custom button action

Below we see an implementation of a custom ButtonAction, it attempts to verify the connection to the web server hosted at http://www.pokeapi.co/.
It is required that all button actions extend the ButtonAction class, and that the execute methods for GUI (Prompt) and Console (Console) installation are implemented.
Notice that messages are retrieved by the 'messages' HashMap.
In the implementation below if the execution methods return true then the SuccessMsg will be displayed, otherwise the ERROR message will be shown.

  • No labels