Development Guide

Config Pane

Config Pane is abstract class used to create configuration pane for data class of your choice. To get this to work, you have to create the ConfigPane in the Configurator (see its documentation).

Config class

com.warxim.petep.gui.component.ConfigPane
/**
 * Configuration pane for configuration of given generic type.
 * @param <C> Type of configuration
 */
@PetepAPI
public abstract class ConfigPane<C> extends AnchorPane {
    /**
     * Creates configuration pane from specified template and sets the object as controller.
     * @param template Path to FXML template
     * @throws IOException If the template could not be loaded
     */
    protected ConfigPane(String template) throws IOException {
        var loader = new FXMLLoader(getClass().getResource(template));
        loader.setRoot(this);
        loader.setController(this);
        loader.load();
        getStylesheets().add(GuiConstant.MAIN_CSS_PATH);
    }

    /**
     * Obtains configuration from pane.
     * @return Configuration created by the user in GUI
     */
    public abstract C getConfig();

    /**
     * Sets configuration to pane.
     * @param config Configuration to be set
     */
    public abstract void setConfig(C config);

    /**
     * Checks if configuration is valid.
     * @return {@code true} if the configuration in GUI is valid
     */
    public abstract boolean isValid();
}