com.dlsc.preferencesfx.model.Setting Java Examples

The following examples show how to use com.dlsc.preferencesfx.model.Setting. 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: OptionsPresentationPanel.java    From Quelea with GNU General Public License v3.0 6 votes vote down vote up
public Category getPresentationsTab() {
    StringField directoryFieldOOField = Field.ofStringType(directoryChooserOOProperty).render(
            new DirectorySelectorPreference(LabelGrabber.INSTANCE.getLabel("browse"), null));
    bindings.put(directoryFieldOOField, useOOProperty.not());

    if (!Utils.isLinux()) {
        StringField directoryFieldPPField = Field.ofStringType(directoryChooserPPProperty).render(
                new DirectorySelectorPreference(LabelGrabber.INSTANCE.getLabel("browse"), null));
        bindings.put(directoryFieldPPField, usePPProperty.not());

        return Category.of(LabelGrabber.INSTANCE.getLabel("presentation.options.heading"), new ImageView(new Image("file:icons/presentationssettingsicon.png")),
                Setting.of(LabelGrabber.INSTANCE.getLabel("use.oo.label"), useOOProperty).customKey(useOoKey),
                Setting.of(LabelGrabber.INSTANCE.getLabel("oo.path"), directoryFieldOOField, directoryChooserOOProperty).customKey(ooPathKey),
                Setting.of(LabelGrabber.INSTANCE.getLabel("use.pp.label"), usePPProperty).customKey(usePpKey),
                Setting.of(LabelGrabber.INSTANCE.getLabel("pp.path"), directoryFieldPPField, directoryChooserPPProperty).customKey(ppPathKey)
        );
    } else
        return Category.of(LabelGrabber.INSTANCE.getLabel("presentation.options.heading"), new ImageView(new Image("file:icons/presentationssettingsicon.png")),
                Setting.of(LabelGrabber.INSTANCE.getLabel("use.oo.label"), useOOProperty).customKey(useOoKey),
                Setting.of(LabelGrabber.INSTANCE.getLabel("oo.path"), directoryFieldOOField, directoryChooserOOProperty).customKey(ooPathKey)
        );
}
 
Example #2
Source File: PreferencesFxUtils.java    From PreferencesFX with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a map which links {@link Setting} to {@link Category} in a list of {@code categories}.
 *
 * @param categories the categories of which to create a map of
 * @return a {@link HashMap} containing {@link Setting}, mapped to their
 *         corresponding {@link Category}
 * @apiNote does not flatten the categories
 */
public static HashMap<Setting, Category> mapSettingsToCategories(List<Category> categories) {
  HashMap<Setting, Category> settingCategoryMap = new HashMap<>();
  for (Category category : categories) {
    if (category.getGroups() != null) {
      for (Group group : category.getGroups()) {
        if (group.getSettings() != null) {
          for (Setting setting : group.getSettings()) {
            settingCategoryMap.put(setting, category);
          }
        }
      }
    }
  }
  return settingCategoryMap;
}
 
Example #3
Source File: OptionsServerSettingsPanel.java    From Quelea with GNU General Public License v3.0 6 votes vote down vote up
public Category getServerTab() {
    return Category.of(LabelGrabber.INSTANCE.getLabel("server.settings.heading"),
            new ImageView(new Image("file:icons/serversettingsicon.png")),
            Group.of(LabelGrabber.INSTANCE.getLabel("mobile.lyrics.heading"),
                    Setting.of(LabelGrabber.INSTANCE.getLabel("use.mobile.lyrics.label"), useMobileLyricsProperty)
                            .customKey(useMobLyricsKey),
                    Setting.of(LabelGrabber.INSTANCE.getLabel("port.number.label"), mobileLyricsField, lyricsPortNumberProperty)
                            .customKey(mobLyricsPortKey)
            ),
            Group.of(LabelGrabber.INSTANCE.getLabel("mobile.remote.heading"),
                    Setting.of(LabelGrabber.INSTANCE.getLabel("use.remote.control.label"), useMobileRemoteProperty)
                            .customKey(useRemoteControlKey),
                    Setting.of(LabelGrabber.INSTANCE.getLabel("port.number.label"), remoteField, remotePortNumberProperty)
                            .customKey(remoteControlPortKey),
                    Setting.of(LabelGrabber.INSTANCE.getLabel("remote.control.password"), passwordProperty)
                            .customKey(remoteControlPasswordKey)
            )
    );
}
 
Example #4
Source File: History.java    From PreferencesFX with Apache License 2.0 6 votes vote down vote up
/**
 * Adds a listener to the {@code setting}, so every time the value of the {@code setting} changes,
 * a new {@link Change} will be created and added to the list of changes.
 *
 * @param setting the setting to observe for changes
 */
public void attachChangeListener(Setting setting) {
  ChangeListener changeEvent = (observable, oldValue, newValue) -> {
    if (isListenerActive() && oldValue != newValue) {
      LOGGER.trace("Change detected, old: " + oldValue + " new: " + newValue);
      addChange(new Change(setting, oldValue, newValue));
    }
  };
  ChangeListener listChangeEvent = (observable, oldValue, newValue) -> {
    if (isListenerActive()) {
      LOGGER.trace("List Change detected: " + oldValue);
      addChange(new Change(setting, (ObservableList) oldValue, (ObservableList) newValue));
    }
  };

  if (setting.valueProperty() instanceof SimpleListProperty) {
    setting.valueProperty().addListener(listChangeEvent);
  } else {
    setting.valueProperty().addListener(changeEvent);
  }
}
 
Example #5
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 #6
Source File: HistoryTest.java    From PreferencesFX with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
  history = new History();
  property = new SimpleStringProperty("");
  mockProperty = mock(SimpleStringProperty.class);
  mockSetting = mock(Setting.class);
  setupProperty();
  setupMockProperty();
}
 
Example #7
Source File: OptionsNoticePanel.java    From Quelea with GNU General Public License v3.0 5 votes vote down vote up
public Category getNoticesTab() {
    return Category.of(LabelGrabber.INSTANCE.getLabel("notice.options.heading"), new ImageView(new Image("file:icons/noticessettingsicon.png")),
            getPositionSelector(LabelGrabber.INSTANCE.getLabel("notice.position.text"), false, QueleaProperties.get().getNoticePosition().getText(), null, bindings).customKey(noticePositionKey),
            getColorPicker(LabelGrabber.INSTANCE.getLabel("notice.background.colour.text"), QueleaProperties.get().getNoticeBackgroundColour()).customKey(noticeBackgroundColourKey),
            Setting.of(LabelGrabber.INSTANCE.getLabel("notice.speed.text"), noticeSpeed, 2, 20, 1).customKey(noticeSpeedKey),
            Setting.of(LabelGrabber.INSTANCE.getLabel("notice.font.size"), noticeSize, 20, 100, 1).customKey(noticeFontSizeKey)
    );
}
 
Example #8
Source File: OptionsBiblePanel.java    From Quelea with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Create the options bible panel.
 *
 * @param bindings HashMap of bindings to setup after the dialog has been created
 */
OptionsBiblePanel(HashMap<Field, ObservableValue> bindings) {
    this.bindings = bindings;
    showVerseNumProperty = new SimpleBooleanProperty(QueleaProperties.get().getShowVerseNumbers());
    splitVersesProperty = new SimpleBooleanProperty(QueleaProperties.get().getBibleSplitVerses());
    useMaxVersesProperty = new SimpleBooleanProperty(QueleaProperties.get().getBibleUsingMaxChars());
    maxVersesProperty = new SimpleIntegerProperty(QueleaProperties.get().getMaxBibleVerses());

    ArrayList<String> bibles = new ArrayList<>();
    for (Bible b : BibleManager.get().getBibles()) {
        bibles.add(b.getName());
    }

    ObjectProperty<String> bibleSelection = new SimpleObjectProperty<>(QueleaProperties.get().getDefaultBible());
    SingleSelectionField<String> bibleField = Field.ofSingleSelectionType(bibles).render(new DefaultBibleSelector());
    defaultBibleSetting = Setting.of(LabelGrabber.INSTANCE.getLabel("default.bible.label"), bibleField, bibleSelection).customKey(defaultBibleKey);
    bibleField.selectionProperty().bindBidirectional(bibleSelection);

    showVerseNumSetting = Setting.of(LabelGrabber.INSTANCE.getLabel("show.verse.numbers"),
            showVerseNumProperty).customKey(showVerseNumbersKey);

    splitVersesSetting = Setting.of(LabelGrabber.INSTANCE.getLabel("split.bible.verses"),
            splitVersesProperty).customKey(splitBibleVersesKey);

    useMaxVersesSetting = Setting.of(LabelGrabber.INSTANCE.getLabel("max.items.per.slide").replace("%", LabelGrabber.INSTANCE.getLabel("verses")),
            useMaxVersesProperty).customKey(useMaxBibleCharsKey);

    maxVersesSetting = Setting.of("",
            maxVersesProperty).customKey(maxBibleVersesKey);
}
 
Example #9
Source File: OptionsStageViewPanel.java    From Quelea with GNU General Public License v3.0 5 votes vote down vote up
public Category getStageViewTab() {
    return Category.of(LabelGrabber.INSTANCE.getLabel("stage.options.heading"), new ImageView(new Image("file:icons/stageviewsettingsicon.png")),
            Setting.of(LabelGrabber.INSTANCE.getLabel("stage.show.chords"), new SimpleBooleanProperty(QueleaProperties.get().getShowChords())).customKey(stageShowChordsKey),
            Setting.of(LabelGrabber.INSTANCE.getLabel("stage.line.alignment"), lineAlignmentList, alignmentSelectionProperty).customKey(stageTextAlignmentKey),
            Setting.of(LabelGrabber.INSTANCE.getLabel("stage.font.selection"), fontsList, fontSelectionProperty).customKey(stageFontKey),
            getColorPicker(LabelGrabber.INSTANCE.getLabel("stage.background.colour"), QueleaProperties.get().getStageBackgroundColor()).customKey(stageBackgroundColorKey),
            getColorPicker(LabelGrabber.INSTANCE.getLabel("stage.lyrics.colour"), QueleaProperties.get().getStageLyricsColor()).customKey(stageLyricsColorKey),
            getColorPicker(LabelGrabber.INSTANCE.getLabel("stage.chord.colour"), QueleaProperties.get().getStageChordColor()).customKey(stageChordColorKey),
            Setting.of(LabelGrabber.INSTANCE.getLabel("clear.stage.view"), new SimpleBooleanProperty(QueleaProperties.get().getClearStageWithMain())).customKey(clearStageviewWithMainKey),
            Setting.of(LabelGrabber.INSTANCE.getLabel("use.24h.clock"), new SimpleBooleanProperty(QueleaProperties.get().getUse24HourClock())).customKey(use24hClockKey)
    );
}
 
Example #10
Source File: PreferencesDialog.java    From Quelea with GNU General Public License v3.0 5 votes vote down vote up
public static Setting getPositionSelector(String label, boolean horizontal, String selectedValue, BooleanProperty booleanBind, HashMap<Field, ObservableValue> bindings) {
    Setting setting;
    if (horizontal)
        setting = Setting.of(label, FXCollections.observableArrayList(LabelGrabber.INSTANCE.getLabel("left"), LabelGrabber.INSTANCE.getLabel("right")), new SimpleObjectProperty<>(LabelGrabber.INSTANCE.getLabel(selectedValue.toLowerCase())));
    else
        setting = Setting.of(label, FXCollections.observableArrayList(LabelGrabber.INSTANCE.getLabel("top.text.position"), LabelGrabber.INSTANCE.getLabel("bottom.text.position")), new SimpleObjectProperty<>(LabelGrabber.INSTANCE.getLabel(selectedValue.toLowerCase())));
    if (booleanBind != null)
        bindings.put(setting.getField(), booleanBind.not());
    return setting;
}
 
Example #11
Source File: OptionsRecordingPanel.java    From Quelea with GNU General Public License v3.0 5 votes vote down vote up
public Category getRecordingsTab() {
    bindings.put(useConvertSetting.getField(), new SimpleBooleanProperty(hasVLC));

    return Category.of(LabelGrabber.INSTANCE.getLabel("recordings.options.heading"), new ImageView(new Image("file:icons/recordingssettingsicon.png")),
            Setting.of(LabelGrabber.INSTANCE.getLabel("recordings.path"), recordingsDirectoryField, recordingsDirectoryChooserProperty).customKey(recPathKey),
            useConvertSetting
    );
}
 
Example #12
Source File: OptionsRecordingPanel.java    From Quelea with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Create the options bible panel.
 *
 * @param bindings HashMap of bindings to setup after the dialog has been created
 * @param hasVLC   true if VLC is installed
 */
OptionsRecordingPanel(HashMap<Field, ObservableValue> bindings, boolean hasVLC) {
    this.bindings = bindings;
    this.hasVLC = hasVLC;
    recordingsDirectoryChooserProperty = new SimpleStringProperty(QueleaProperties.get().getRecordingsPath());
    recordingsDirectoryField = Field.ofStringType(recordingsDirectoryChooserProperty).render(
            new DirectorySelectorPreference(LabelGrabber.INSTANCE.getLabel("browse"), null));

    useConvertProperty = new SimpleBooleanProperty(QueleaProperties.get().getConvertRecordings());
    useConvertSetting = Setting.of(LabelGrabber.INSTANCE.getLabel("convert.mp3"), useConvertProperty).customKey(convertMp3Key);
}
 
Example #13
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 #14
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 #15
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 #16
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 #17
Source File: History.java    From PreferencesFX with Apache License 2.0 5 votes vote down vote up
/**
 * Enables to perform an action, without firing the attached ChangeListener of a Setting.
 * This is used by undo and redo, since those shouldn't cause a new change to be added.
 *
 * @param setting the setting, whose ChangeListener should be ignored
 * @param action  the action to be performed
 */
public void doWithoutListeners(Setting setting, Runnable action) {
  LOGGER.trace(String.format("doWithoutListeners: setting: %s", setting));
  setListenerActive(false);
  LOGGER.trace("removed listener");
  action.run();
  LOGGER.trace("performed action");
  setListenerActive(true);
  LOGGER.trace("add listener back");
}
 
Example #18
Source File: Change.java    From PreferencesFX with Apache License 2.0 5 votes vote down vote up
/**
 * Constructs a generalized change.
 *
 * @param setting    the setting that was changed
 * @param listChange true if this is a list change
 */
protected Change(Setting setting, boolean listChange) {
  this.setting = setting;
  this.listChange.set(listChange);
  timestamp = LocalDateTime.now();
  setupBindings();
}
 
Example #19
Source File: SearchHandler.java    From PreferencesFX with Apache License 2.0 5 votes vote down vote up
private void markMatches() {
  if (settingMatches >= 1) {
    filteredSettingsLst.forEach(Setting::mark);
  }
  if (groupMatches >= 1) {
    filteredGroupsLst.forEach(Group::mark);
  }
}
 
Example #20
Source File: PreferencesFxUtils.java    From PreferencesFX with Apache License 2.0 5 votes vote down vote up
/**
 * Filters a list of {@code settings} by a given {@code description}.
 *
 * @param settings    the list of settings to be filtered
 * @param description to be searched for
 * @return a list of {@code settings}, containing (ignoring case) the given {@code description}
 */
public static List<Setting> filterSettingsByDescription(List<Setting> settings,
                                                        String description) {
  return settings.stream()
      .filter(Setting::hasDescription)
      .filter(setting -> containsIgnoreCase(setting.getDescription(), description))
      .collect(Collectors.toList());
}
 
Example #21
Source File: PreferencesFxUtils.java    From PreferencesFX with Apache License 2.0 5 votes vote down vote up
/**
 * Returns a list of all the settings which are contained in a list of {@code categories}
 * recursively.
 *
 * @param categories the categories to fetch the elements from
 * @return all elements of the categories
 */
public static List<Element> categoriesToElements(List<Category> categories) {
  return categories.stream()
      .map(Category::getGroups)     // get groups from categories
      .filter(Objects::nonNull)     // remove all null
      .flatMap(Collection::stream)  // recursively flatten all categories
      .map(Group::getSettings)      // get settings from groups
      .filter(Objects::nonNull)     // remove all null
      .flatMap(Collection::stream)  // recursively flatten all settings
      .map(Setting::getElement)
      .map(Element.class::cast)
      .collect(Collectors.toList());
}
 
Example #22
Source File: PreferencesFxUtils.java    From PreferencesFX with Apache License 2.0 5 votes vote down vote up
/**
 * Returns a list of all the settings which are contained in a list of {@code categories}
 * recursively.
 *
 * @param categories the categories to fetch the settings from
 * @return all settings of the categories
 */
public static List<Setting> categoriesToSettings(List<Category> categories) {
  return categories.stream()
      .map(Category::getGroups)     // get groups from categories
      .filter(Objects::nonNull)     // remove all null
      .flatMap(Collection::stream)  // recursively flatten all categories
      .map(Group::getSettings)      // get settings from groups
      .filter(Objects::nonNull)     // remove all null
      .flatMap(Collection::stream)  // recursively flatten all settings
      .collect(Collectors.toList());
}
 
Example #23
Source File: CategoryPresenter.java    From PreferencesFX with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a {@link Form} with {@link Group} and {@link Setting} of this {@link Category}.
 *
 * @return the created form.
 */
private Form createForm() {
  Form form = Form.of();
  // assign groups from this category
  List<Group> groups = categoryModel.getGroups();
  // if there are no groups, initialize them anyways as a list
  if (groups == null) {
    groups = new ArrayList<>();
  }

  // get groups of this form
  List<com.dlsc.formsfx.model.structure.Group> formGroups = form.getGroups();

  // create PreferenceGroups from Groups
  for (int i = 0; i < groups.size(); i++) {
    PreferencesFxGroup preferencesGroup =
        (PreferencesFxGroup) PreferencesFxGroup.of().title(groups.get(i).getDescription());
    groups.get(i).setPreferencesGroup(preferencesGroup);
    formGroups.add(preferencesGroup);
    // fill groups with settings (as FormsFX fields)
    for (Setting setting : groups.get(i).getSettings()) {
      formGroups.get(i).getElements().add(setting.getElement());
    }
  }

  applyInstantPersistence(model.isInstantPersistent(), form);

  return form;
}
 
Example #24
Source File: Change.java    From PreferencesFX with Apache License 2.0 4 votes vote down vote up
public Setting getSetting() {
  return setting;
}
 
Example #25
Source File: OptionsGeneralPanel.java    From Quelea with GNU General Public License v3.0 4 votes vote down vote up
public Category getGeneralTab() {
    bindings.put(smallSongSizeControllerField, showSmallSongProperty.not());
    bindings.put(smallBibleSizeControllerField, showSmallBibleProperty.not());

    return Category.of(LabelGrabber.INSTANCE.getLabel("general.options.heading"), new ImageView(new Image("file:icons/generalsettingsicon.png")))
            .subCategories(
                    Category.of(LabelGrabber.INSTANCE.getLabel("interface.options.options"),
                            Group.of(LabelGrabber.INSTANCE.getLabel("general.interface.options"),
                                    Setting.of(LabelGrabber.INSTANCE.getLabel("interface.language.label"), languageItemsList, languageSelectionProperty).customKey(languageFileKey),
                                    Setting.of(LabelGrabber.INSTANCE.getLabel("interface.theme.label"), applicationThemeList, applicationThemeProperty).customKey(darkThemeKey),
                                    Setting.of(LabelGrabber.INSTANCE.getLabel("db.song.preview.label"), dbSongPreviewList, dbSongPreviewProperty).customKey(dbSongPreviewKey),
                                    Setting.of(LabelGrabber.INSTANCE.getLabel("show.video.library.panel"), new SimpleBooleanProperty(QueleaProperties.get().getDisplayVideoTab())).customKey(videoTabKey),
                                    Setting.of(LabelGrabber.INSTANCE.getLabel("show.extra.live.panel.toolbar.options.label"), new SimpleBooleanProperty(QueleaProperties.get().getShowExtraLivePanelToolbarOptions())).customKey(showExtraLivePanelToolbarOptionsKey),
                                    Setting.of(LabelGrabber.INSTANCE.getLabel("thumbnail.size.label"), thumbnailSizeProperty, 100, 1000).customKey(thumbnailSizeKey)
                            ),
                            Group.of(LabelGrabber.INSTANCE.getLabel("small.song.text.options"),
                                    Setting.of(LabelGrabber.INSTANCE.getLabel("show.small.song.text.label"), showSmallSongProperty).customKey(showSmallSongTextKey),
                                    getPositionSelector(LabelGrabber.INSTANCE.getLabel("small.song.position.label"), false, QueleaProperties.get().getSmallSongTextPositionV(), showSmallSongProperty, bindings).customKey(smallSongTextVPositionKey),
                                    getPositionSelector(LabelGrabber.INSTANCE.getLabel("small.song.position.label"), true, QueleaProperties.get().getSmallSongTextPositionH(), showSmallSongProperty, bindings).customKey(smallSongTextHPositionKey),
                                    Setting.of(LabelGrabber.INSTANCE.getLabel("small.song.size.label"), smallSongSizeControllerField, smallSongSizeSpinnerProperty).customKey(smallSongTextSizeKey)
                            ),
                            Group.of(LabelGrabber.INSTANCE.getLabel("small.bible.text.options"),
                                    Setting.of(LabelGrabber.INSTANCE.getLabel("show.small.bible.text.label"), showSmallBibleProperty).customKey(showSmallBibleTextKey),
                                    getPositionSelector(LabelGrabber.INSTANCE.getLabel("small.bible.position.label"), false, QueleaProperties.get().getSmallBibleTextPositionV(), showSmallBibleProperty, bindings).customKey(smallBibleTextVPositionKey),
                                    getPositionSelector(LabelGrabber.INSTANCE.getLabel("small.bible.position.label"), true, QueleaProperties.get().getSmallBibleTextPositionH(), showSmallBibleProperty, bindings).customKey(smallBibleTextHPositionKey),
                                    Setting.of(LabelGrabber.INSTANCE.getLabel("small.bible.size.label"), smallBibleSizeControllerField, smallBibleSizeSpinnerProperty).customKey(smallBibleTextSizeKey)
                            )
                    ),
                    Category.of(LabelGrabber.INSTANCE.getLabel("user.options.options"),
                            Group.of(LabelGrabber.INSTANCE.getLabel("general.user.options"),
                                    Setting.of(LabelGrabber.INSTANCE.getLabel("check.for.update.label"), new SimpleBooleanProperty(QueleaProperties.get().checkUpdate())).customKey(checkUpdateKey),
                                    Setting.of(LabelGrabber.INSTANCE.getLabel("1.monitor.warn.label"), new SimpleBooleanProperty(QueleaProperties.get().showSingleMonitorWarning())).customKey(singleMonitorWarningKey),
                                    Setting.of(LabelGrabber.INSTANCE.getLabel("auto.translate.label"), new SimpleBooleanProperty(QueleaProperties.get().getAutoTranslate())).customKey(autoTranslateKey)
                            ),
                            Group.of(LabelGrabber.INSTANCE.getLabel("theme.options"),
                                    Setting.of(LabelGrabber.INSTANCE.getLabel("allow.item.theme.override.global"), new SimpleBooleanProperty(QueleaProperties.get().getItemThemeOverride())).customKey(itemThemeOverrideKey),
                                    Setting.of(LabelGrabber.INSTANCE.getLabel("preview.on.image.change.label"), new SimpleBooleanProperty(QueleaProperties.get().getPreviewOnImageUpdate())).customKey(previewOnImageChangeKey)
                            ),
                            Group.of(LabelGrabber.INSTANCE.getLabel("schedule.options"),
                                    Setting.of(LabelGrabber.INSTANCE.getLabel("one.line.mode.label"), new SimpleBooleanProperty(QueleaProperties.get().getOneLineMode())).customKey(oneLineModeKey),
                                    Setting.of(LabelGrabber.INSTANCE.getLabel("autoplay.vid.label"), new SimpleBooleanProperty(QueleaProperties.get().getAutoPlayVideo())).customKey(autoplayVidKey),
                                    Setting.of(LabelGrabber.INSTANCE.getLabel("advance.on.live.label"), new SimpleBooleanProperty(QueleaProperties.get().getAdvanceOnLive())).customKey(advanceOnLiveKey),
                                    Setting.of(LabelGrabber.INSTANCE.getLabel("overflow.song.label"), new SimpleBooleanProperty(QueleaProperties.get().getSongOverflow())).customKey(songOverflowKey),
                                    Setting.of(LabelGrabber.INSTANCE.getLabel("copy.song.db.default"), new SimpleBooleanProperty(QueleaProperties.get().getDefaultSongDBUpdate())).customKey(defaultSongDbUpdateKey),
                                    Setting.of(LabelGrabber.INSTANCE.getLabel("clear.live.on.remove.schedule"), new SimpleBooleanProperty(QueleaProperties.get().getClearLiveOnRemove())).customKey(clearLiveOnRemoveKey),
                                    Setting.of(LabelGrabber.INSTANCE.getLabel("embed.media.in.schedule"), new SimpleBooleanProperty(QueleaProperties.get().getEmbedMediaInScheduleFile())).customKey(scheduleEmbedMediaKey),
                                    Setting.of(LabelGrabber.INSTANCE.getLabel("slide.transition.label"), new SimpleBooleanProperty(QueleaProperties.get().getUseSlideTransition())).customKey(useSlideTransitionKey)
                            )

                    ),
                    Category.of(LabelGrabber.INSTANCE.getLabel("text.options.options"),
                            Group.of(
                                    Setting.of(LabelGrabber.INSTANCE.getLabel("capitalise.start.line.label"), new SimpleBooleanProperty(QueleaProperties.get().checkCapitalFirst())).customKey(capitalFirstKey),
                                    Setting.of(LabelGrabber.INSTANCE.getLabel("uniform.font.size.label"), new SimpleBooleanProperty(QueleaProperties.get().getUseUniformFontSize())).customKey(uniformFontSizeKey),
                                    Setting.of(LabelGrabber.INSTANCE.getLabel("max.font.size.label"), maxFontSizeProperty, 12, 300).customKey(maxFontSizeKey),
                                    Setting.of(LabelGrabber.INSTANCE.getLabel("additional.line.spacing.label"), additionalSpacingProperty, 0, 50).customKey(additionalLineSpacingKey),
                                    Setting.of(LabelGrabber.INSTANCE.getLabel("max.chars.line.label"), maxCharsProperty, 10, 160).customKey(maxCharsKey)
                            )
                    )
            ).expand();
}
 
Example #26
Source File: PreferencesDialog.java    From Quelea with GNU General Public License v3.0 4 votes vote down vote up
public static Setting getColorPicker(String label, Color color) {
    StringProperty property = new SimpleStringProperty(QueleaProperties.get().getStr(color));
    StringField field = Field.ofStringType(property).render(
            new ColorPickerPreference(color));
    return Setting.of(label, field, property);
}
 
Example #27
Source File: PreferencesFxUtils.java    From PreferencesFX with Apache License 2.0 3 votes vote down vote up
/**
 * Returns a list of all the settings which are contained in a list of {@code groups}
 * recursively.
 *
 * @param groups the groups to fetch the settings from
 * @return all settings of the groups
 */
public static List<Setting> groupsToSettings(List<Group> groups) {
  return groups.stream()
      .map(Group::getSettings)
      .flatMap(Collection::stream)
      .collect(Collectors.toList());
}
 
Example #28
Source File: Change.java    From PreferencesFX with Apache License 2.0 2 votes vote down vote up
/**
 * Constructs a regular object change.
 *
 * @param setting  the setting that was changed
 * @param oldValue the "before" value of the change
 * @param newValue the "after" value of the change
 */
public Change(Setting setting, P oldValue, P newValue) {
  this(setting, false);
  this.oldList.set(FXCollections.observableArrayList(Arrays.asList(oldValue)));
  this.newList.set(FXCollections.observableArrayList(Arrays.asList(newValue)));
}
 
Example #29
Source File: Change.java    From PreferencesFX with Apache License 2.0 2 votes vote down vote up
/**
 * Constructs a list change.
 *
 * @param setting the setting that was changed
 * @param oldList the "before" value(s) of the change
 * @param newList the "after" value(s) of the change
 */
public Change(Setting setting, ObservableList<P> oldList, ObservableList<P> newList) {
  this(setting, true);
  this.oldList.set(FXCollections.observableArrayList(oldList));
  this.newList.set(FXCollections.observableArrayList(newList));
}