Data fields

Data fields are used to enter values in Fields that will then be usable from your theme. In this Section we will see how the data fields work and How we use them in a theme.

Setting up data fields

In the management of your theme you have a category called “Data Fields”.

../../_images/data_fields_screenshot.png

You can add as many fields as you want, there is noneof limit at that level.

../../_images/add_field.png

When you click on the “Add Field” button, a new line with several fields appears.

The “name of the field” corresponds to the label of the field that will be displayed in the “Fields” section in your launcher management panel. If the “Optional” option is selected, the control will be followed by a indication “Optional” next to the label.

The field identifier is very important since it is thanks to this information that you will be able to access the data that will be enteredby the user of your theme. Be sure to enter a consistent so you can easily recover it from yourtheme.

The type of field corresponds to a validation rule that will be executedAfter modifying your launcher. For example, if you select the type “Email”, the system will verify that the user has entered a Address in valid format.

Some fields a particularity such as the type “color” which will display a color palette simplifying color selection or for example the “time” field which will ask the time from a small one window that is set to the current time and that will simplify typing of the hour.

You can delete your fields at any time using the Deletion.

Exploitation of data fields from the theme

To exploit the data fields you have added, it will allow youjust declare the variable dataFields as in the example belowunderneath.

This variable makes the association between the identifier of the field that youHave created in your theme management and the value that has been entered byThe user when modifying his launcher.

Be sure to indicate the correct identifier corresponding to your fieldIn which case this one will be wrong and you will have no value.

You are free to do whatever you want with this information. You can pass it to a component as you can see in The example below.

public class ApplicationController implements Initializable {
    private Stage stage;
    private boolean doGameFilesInstallationBeforeRunGame = false;
    private boolean doGameFilesInstallationFromLauncherUI = true;
    private boolean isWindowMoveable = true;
    private boolean isWindowMoveableOnOutScreen = true;
    private boolean isStatutServerMCEnabled = false;
    private boolean isNewsMLEnabled = false;

    private HashMap<String, Object> dataFields;

    @FXML
    private ImageView myImageComponent;

    @Override
    public void initialize(URL location, ResourceBundle resources) {
        Object fieldValueFilledByUser = dataFields.get('field ID');
        myImageComponent.setImage(fieldValueFilledByUser);
    }

}