com.dlsc.preferencesfx.PreferencesFx Java Examples

The following examples show how to use com.dlsc.preferencesfx.PreferencesFx. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OneCategoryExample.java    From PreferencesFX with Apache License 2.0 6 votes vote down vote up
private PreferencesFx createPreferences() {
  return PreferencesFx.of(OneCategoryExample.class,
      Category.of("General",
          Group.of("Greeting",
              Setting.of("Welcome Text", welcomeText)
          ),
          Group.of("Display",
              Setting.of("Brightness", brightness),
              Setting.of("Night mode", nightMode),
              Setting.of("Scaling", scaling)
                  .validate(DoubleRangeValidator.atLeast(1, "Scaling needs to be at least 1"))
          )
      )
  ).persistWindowState(false)
   .saveSettings(true)
   .debugHistoryMode(false)
   .buttonsVisibility(true)
   .instantPersistent(false);
}
 
Example #2
Source File: Preferences.java    From WorkbenchFX with Apache License 2.0 5 votes vote down vote up
private PreferencesFx createPreferences() {
  return PreferencesFx.of(PreferencesModule.class,
      Category.of("General",
          Group.of("Greeting",
              Setting.of("Welcome Text", welcomeText)
          ),
          Group.of("Display",
              Setting.of("Brightness", brightness),
              Setting.of("Night mode", nightMode)
          )
      ),
      Category.of("Screen")
          .subCategories(
              Category.of("Scaling & Ordering",
                  Group.of(
                      Setting.of("Scaling", scaling)
                          .validate(DoubleRangeValidator
                              .atLeast(1, "Scaling needs to be at least 1")
                          ),
                      Setting.of("Screen name", screenName),
                      Setting.of("Resolution", resolutionItems, resolutionSelection),
                      Setting.of("Orientation", orientationItems, orientationSelection)
                  ).description("Screen Options"),
                  Group.of(
                      Setting.of("Font Size", fontSize, 6, 36),
                      Setting.of("Line Spacing", lineSpacing, 0, 3, 1)
                  )
              )
          ),
      Category.of("Favorites",
          Setting.of("Favorites", favoritesItems, favoritesSelection),
          Setting.of("Favorite Number", customControl, customControlProperty)
      )
  ).persistWindowState(false).saveSettings(true).debugHistoryMode(false).buttonsVisibility(true);
}
 
Example #3
Source File: DemoView.java    From PreferencesFX with Apache License 2.0 5 votes vote down vote up
public DemoView(PreferencesFx preferencesFx, OneCategoryExample rootPane) {
  this.preferencesFx = preferencesFx;
  this.rootPane = rootPane;

  initializeParts();
  layoutParts();
  setupBindings();
  setupEventHandlers();
  setupListeners();
}
 
Example #4
Source File: StandardExample.java    From PreferencesFX with Apache License 2.0 5 votes vote down vote up
private PreferencesFx createPreferences() {
  // asciidoctor Documentation - tag::setupPreferences[]
  return PreferencesFx.of(StandardExample.class,
      Category.of("General",
          Group.of("Greeting",
              Setting.of("Welcome Text", welcomeText)
          ),
          Group.of("Display",
              Setting.of("Brightness", brightness),
              Setting.of("Night mode", nightMode)
          )
      ),
      Category.of("Screen")
          .expand()
          .subCategories(
              Category.of("Scaling & Ordering",
                  Group.of(
                      Setting.of("Scaling", scaling)
                          .validate(DoubleRangeValidator
                              .atLeast(1, "Scaling needs to be at least 1")
                          ),
                      Setting.of("Screen name", screenName),
                      Setting.of("Resolution", resolutionItems, resolutionSelection),
                      Setting.of("Orientation", orientationItems, orientationSelection)
                  ).description("Screen Options"),
                  Group.of(
                      Setting.of("Font Size", fontSize, 6, 36),
                      Setting.of("Line Spacing", lineSpacing, 0, 3, 1)
                  )
              )
          ),
      Category.of("Favorites",
          Setting.of("Favorites", favoritesItems, favoritesSelection),
          Setting.of("Favorite Number", customControl, customControlProperty)
      )
  ).persistWindowState(false).saveSettings(true).debugHistoryMode(false).buttonsVisibility(true);
  // asciidoctor Documentation - end::setupPreferences[]
}
 
Example #5
Source File: DemoView.java    From PreferencesFX with Apache License 2.0 5 votes vote down vote up
public DemoView(PreferencesFx preferencesFx, StandardExample rootPane) {
  this.preferencesFx = preferencesFx;
  this.rootPane = rootPane;

  initializeParts();
  layoutParts();
  setupBindings();
  setupEventHandlers();
  setupListeners();
}
 
Example #6
Source File: DemoView.java    From PreferencesFX with Apache License 2.0 5 votes vote down vote up
public DemoView(PreferencesFx preferencesFx, ExtendedExample rootPane) {
  this.preferencesFx = preferencesFx;
  this.rootPane = rootPane;

  initializeParts();
  layoutParts();
  setupBindings();
  setupEventHandlers();
  setupListeners();
}
 
Example #7
Source File: NodeExample.java    From PreferencesFX with Apache License 2.0 5 votes vote down vote up
private PreferencesFx createPreferences() {
  // asciidoctor Documentation - tag::setupPreferences[]
  return PreferencesFx.of(NodeExample.class,
      Category.of("General",
          Group.of("Greeting",
              Setting.of("Welcome Text", welcomeText)
          ),
          Group.of("Display",
              Setting.of("Brightness", brightness),
              Setting.of("Night mode", nightMode)
          )
      ),
      Category.of("Screen", screenIcon)
          .expand()
          .subCategories(
              Category.of("Scaling & Ordering",
                  Group.of(
                      Setting.of("Scaling", scaling)
                          .validate(DoubleRangeValidator
                              .atLeast(1, "Scaling needs to be at least 1")
                          ),
                      Setting.of("Screen name", screenName),
                      Setting.of("Resolution", resolutionItems, resolutionSelection),
                      Setting.of("Orientation", orientationItems, orientationSelection)
                  ).description("Screen Options"),
                  Group.of(
                      Setting.of("Font Size", fontSize, 6, 36),
                      Setting.of("Line Spacing", lineSpacing, 0, 3, 1)
                  )
              )
          ),
      Category.of("Favorites",
          Setting.of("Favorites", favoritesItems, favoritesSelection),
          Setting.of("Favorite Number", customControl, customControlProperty)
      )
  ).persistWindowState(false).saveSettings(true).debugHistoryMode(false).buttonsVisibility(true);
  // asciidoctor Documentation - end::setupPreferences[]
}
 
Example #8
Source File: NodeView.java    From PreferencesFX with Apache License 2.0 5 votes vote down vote up
public NodeView(PreferencesFx preferencesFx, NodeExample rootPane) {
  this.preferencesFx = preferencesFx;
  this.rootPane = rootPane;

  initializeParts();
  layoutParts();
  setupBindings();
  setupListeners();
}
 
Example #9
Source File: InternationalizedExample.java    From PreferencesFX with Apache License 2.0 5 votes vote down vote up
private PreferencesFx createPreferences() {
  return PreferencesFx.of(InternationalizedExample.class,
      Category.of("general",
          Group.of("greeting",
              Setting.of("welcome", welcomeText)
          ),
          Group.of("display",
              Setting.of("brightness", brightness),
              Setting.of("night_mode", nightMode)
          )
      ),
      Category.of("screen")
          .expand()
          .subCategories(
              Category.of("scaling_ordering",
                  Group.of(
                      Setting.of("scaling", scaling)
                          .validate(DoubleRangeValidator.atLeast(1, "scaling_validate")),
                      Setting.of("screen_name", screenName),
                      Setting.of("resolution", resolutionItems, resolutionSelection),
                      Setting.of("orientation", orientationItems, orientationSelection)
                  ).description("screen_options"),
                  Group.of(
                      Setting.of("font_size", fontSize, 6, 36),
                      Setting.of("line_spacing", lineSpacing, 0, 3, 1)
                  )
              )
          ),
      Category.of("favorites",
          Setting.of("favorites", favoritesItems, favoritesSelection),
          Setting.of("favorite_number", customControl, customControlProperty)
      )
  ).i18n(rbs).persistWindowState(false)
   .saveSettings(true).debugHistoryMode(false).buttonsVisibility(true);
}
 
Example #10
Source File: DemoView.java    From PreferencesFX with Apache License 2.0 5 votes vote down vote up
public DemoView(PreferencesFx preferencesFx, InternationalizedExample rootPane) {
  this.preferencesFx = preferencesFx;
  this.rootPane = rootPane;

  initializeParts();
  layoutParts();
  setupBindings();
  setupEventHandlers();
  setupListeners();
}
 
Example #11
Source File: PreferencesDialog.java    From Quelea with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Create a new preference dialog.
 *
 * @author Arvid
 */
public PreferencesDialog(Class parent, boolean hasVLC) {
    setTitle(LabelGrabber.INSTANCE.getLabel("options.title"));
    initModality(Modality.APPLICATION_MODAL);
    initOwner(QueleaApp.get().getMainWindow());
    getIcons().add(new Image("file:icons/options.png", 16, 16, false, true));
    mainPane = new BorderPane();

    generalPanel = new OptionsGeneralPanel(bindings);
    displayPanel = new OptionsDisplaySetupPanel(bindings);
    stageViewPanel = new OptionsStageViewPanel(bindings);
    noticePanel = new OptionsNoticePanel(bindings);
    presentationPanel = new OptionsPresentationPanel(bindings);
    biblePanel = new OptionsBiblePanel(bindings);
    optionsServerSettingsPanel = new OptionsServerSettingsPanel(bindings);
    recordingPanel = new OptionsRecordingPanel(bindings, hasVLC);

    preferencesFx =
            PreferencesFx.of(new PreferenceStorageHandler(parent),
                    generalPanel.getGeneralTab(),
                    displayPanel.getDisplaySetupTab(),
                    stageViewPanel.getStageViewTab(),
                    noticePanel.getNoticesTab(),
                    presentationPanel.getPresentationsTab(),
                    biblePanel.getBiblesTab(),
                    optionsServerSettingsPanel.getServerTab(),
                    recordingPanel.getRecordingsTab()
            );

    okButton = new Button(LabelGrabber.INSTANCE.getLabel("ok.button"), new ImageView(new Image("file:icons/tick.png")));
    BorderPane.setMargin(okButton, new Insets(5));
    okButton.setOnAction((ActionEvent t) -> {
        preferencesFx.saveSettings();
        if (displayPanel.isDisplayChange()) {
            updatePos();
        }
        displayPanel.setDisplayChange(false);
        QueleaApp.get().getMainWindow().getMainPanel().getSchedulePanel().getThemeNode().refresh();
        hide();
    });
    BorderPane.setAlignment(okButton, Pos.CENTER);

    mainPane.setBottom(okButton);
    mainPane.setMinWidth(1005);
    mainPane.setMinHeight(600);
    mainPane.setCenter(preferencesFx.getView().getCenter());

    Scene scene = new Scene(mainPane);
    if (QueleaProperties.get().getUseDarkTheme()) {
        scene.getStylesheets().add("org/modena_dark.css");
    }
    setScene(scene);

    getScene().getWindow().addEventFilter(WindowEvent.WINDOW_SHOWN, e -> callBeforeShowing());
    getScene().getWindow().addEventFilter(WindowEvent.WINDOW_CLOSE_REQUEST, e -> callBeforeHiding());

    bindings.forEach(this::bind);
}