Development Guide

GUI Helper

GUI Helper allows extensions to:

  • register graphical elements to the applicaton GUI (tabs),
  • register guides,
  • get PETEP icon.

You can get instance of GuiHelper inside Extension.initGui() method.

If you want to register Tab, you can use order parameter to make the tab position constant. (Order of internal tabs can be found in GuiConstant class.)

GuiHelper interface

com.warxim.petep.helper.GuiHelper
/**
 * Helper for extensions with GUI that allows extensions to use internal GUI components, register
 * GUI components etc.
 */
@PetepAPI
public interface GuiHelper {
    /*
     * APPLICATION TABS
     */
    /**
     * Registers tab (adds it to the main application tabs).
     * <p>Node will be automatically wrapped into {@link javafx.scene.control.ScrollPane} and added into {@link javafx.scene.control.Tab}.</p>
     * @param title Text displayed in the tab title
     * @param node Node to be added as child into the tab
     */
    void registerTab(String title, Node node);

    /**
     * Registers tab (adds it to the main application tabs).
     * <p>Node will be automatically wrapped into {@link javafx.scene.control.ScrollPane} and added into {@link javafx.scene.control.Tab}.</p>
     * @param title Text displayed in the tab title
     * @param node Node to be added as child into the tab
     * @param order Order of the tab (internal tabs use orders defined in {@link com.warxim.petep.gui.common.GuiConstant})
     */
    void registerTab(String title, Node node, Integer order);

    /**
     * Unregisters tab (removes it from the main application tabs).
     * <p>Automatically searches for tab with given node.</p>
     * @param node Node to be removed from the application tabs
     */
    void unregisterTab(Node node);

    /*
     * SETTINGS
     */
    /**
     * Registers tab (adds it to the settings tabs).
     * <p>Node will be automatically wrapped into {@link javafx.scene.control.ScrollPane} and added into {@link javafx.scene.control.Tab}.</p>
     * @param title Text displayed in the tab title
     * @param node Node to be added as child into the tab
     */
    void registerSettingsTab(String title, Node node);

    /**
     * Registers tab (adds it to the settings tabs).
     * <p>Node will be automatically wrapped into {@link javafx.scene.control.ScrollPane} and added into {@link javafx.scene.control.Tab}.</p>
     * @param title Text displayed in the tab title
     * @param node Node to be added as child into the tab
     * @param order Order of the tab (internal tabs use orders defined in {@link com.warxim.petep.gui.common.GuiConstant})
     */
    void registerSettingsTab(String title, Node node, Integer order);

    /**
     * Unregisters tab (removes it from the settings tabs).
     * <p>Automatically searches for tab with given node.</p>
     * @param node Node to be removed from the application tabs
     */
    void unregisterSettingsTab(Node node);

    /*
     * GUIDES
     */
    /**
     * Registers guide into application guides.
     * <p>Registered guide will be accessible through the application menu.</p>
     * @param guide Guide to register
     */
    void registerGuide(Guide guide);

    /**
     * Unregisters guide from application guides.
     * @param guide Guide to unregister
     */
    void unregisterGuide(Guide guide);

    /*
     * OTHER
     */
    /**
     * Obtains PETEP icon.
     * @return JavaFX Image with PETEP icon
     */
    Image getPetepIcon();
}