All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.dlsc.preferencesfx.view.View Maven / Gradle / Ivy

There is a newer version: 2.0.3
Show newest version
package com.dlsc.preferencesfx.view;

import java.util.List;

/**
 * Defines a view of PreferencesFX.
 *
 * @author François Martin
 * @author Marco Sanfratello
 */
public interface View {

  /**
   * Holds a list of stylesheets.
   *
   * @return list of stylesheets.
   */
  List getStylesheets();

  /**
   * Calls all the other methods for easier initialization.
   */
  default void init() {
    initializeSelf();
    initializeParts();
    layoutParts();
    bindFieldsToModel();
  }

  /**
   * Initializes the view.
   */
  default void initializeSelf() {
  }

  /**
   * Initializes all parts of the view.
   */
  void initializeParts();

  /**
   * Defines the layout of all parts in the view.
   */
  void layoutParts();

  /**
   * Binds properties from the model to the view.
   */
  default void bindFieldsToModel() {
  }

  /**
   * Adds the stylesheet files to the getStylesheets method.
   *
   * @param stylesheetFile list of stylesheet files
   */
  default void addStylesheetFiles(String... stylesheetFile) {
    for (String file : stylesheetFile) {
      String stylesheet = getClass().getResource(file).toExternalForm();
      getStylesheets().add(stylesheet);
    }
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy