com.dlsc.preferencesfx.model.Category Java Examples

The following examples show how to use com.dlsc.preferencesfx.model.Category. 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: SearchHandlerTest.java    From PreferencesFX with Apache License 2.0 6 votes vote down vote up
@Test
public void compareMatches() {
  Category setting = mock(Category.class);
  Category group = mock(Category.class);
  Category category = mock(Category.class);
  int[] matches1 = {0, 0, 0, 0, 0, 0, 2, 2, 2, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3};
  int[] matches2 = {0, 2, 3, 0, 3, 0, 0, 2, 3, 0, 2, 3, 0, 3, 1, 2, 3, 1, 1, 2, 1, 2, 3, 1, 1, 1, 1, 1, 2, 1, 1, 2, 1, 2, 0, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 2, 3, 0, 2, 3, 0, 2, 3, 0, 3, 0, 3};
  int[] matches3 = {1, 1, 1, 2, 2, 3, 1, 1, 1, 1, 1, 1, 2, 2, 0, 0, 0, 1, 2, 2, 3, 3, 3, 0, 1, 2, 3, 0, 0, 1, 2, 2, 3, 3, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 0, 0, 0, 2, 2, 2, 3, 3, 3, 0, 0, 3, 3};
  Object[] expected = {category, category, category, category, category, category, category, category, category, category, category, category, category, category, group, group, group, group, group, group, group, group, group, group, group, group, group, group, group, group, group, group, group, group, null, setting, setting, setting, setting, setting, setting, setting, setting, setting, setting, setting, setting, setting, setting, setting, setting, setting, setting, setting, setting, setting, setting, setting, setting, setting, setting, setting, setting, setting};
  for (int i = 0; i < matches1.length; i++) {
    assertSame(
        "match1: " + matches1[i] + ", match2: " + matches2[i] + ", match3: " + matches3[i],
        expected[i],
        searchHandler.compareMatches(setting, group, category, matches1[i], matches2[i], matches3[i])
    );
  }
}
 
Example #2
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 #3
Source File: BreadCrumbPresenter.java    From PreferencesFX with Apache License 2.0 6 votes vote down vote up
/**
 * Sets up the BreadcrumbBar depending on the displayed category.
 */
public void setupBreadCrumbBar() {
  String[] stringArr = model.getDisplayedCategory().getBreadcrumb().split(BREADCRUMB_DELIMITER);
  Category[] categories = new Category[stringArr.length];

  // Collecting all parent categories from the displayed category using the breadcrumb.
  // There will always be at least one category which will be added to the breadcrumb.
  categories[0] = searchCategory(stringArr[0]);

  // If there are more than one category in the stringArr[], they will be added. For this reason
  // the Integer in the loop starts with one, thus only the second element in the array is needed.
  for (int i = 1; i < stringArr.length; ++i) {
    stringArr[i] = stringArr[i - 1] + BREADCRUMB_DELIMITER + stringArr[i];
    categories[i] = searchCategory(stringArr[i]);
  }

  breadCrumbView.breadcrumbsItm = BreadCrumbBar.buildTreeModel(categories);
  breadCrumbView.breadCrumbBar.setSelectedCrumb(breadCrumbView.breadcrumbsItm);
}
 
Example #4
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 #5
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 #6
Source File: CategoryController.java    From PreferencesFX with Apache License 2.0 6 votes vote down vote up
/**
 * Sets the current view to the one of the respective category.
 * This method can be called in the presenter to switch to a different CategoryView.
 * Controls the way views are being transitioned from one to another.
 *
 * @param category of the categoryView that will be set
 * @return true if successfully loaded, false if view is nonexistent
 */
public boolean setView(final Category category) {
  LOGGER.trace("CategoryController, setView: " + category);
  CategoryView categoryView = views.get(category);
  if (categoryView != null) { // view is loaded
    setContent(categoryView);
    // Binding for ScrollPane
    categoryView.minWidthProperty().bind(widthProperty().subtract(SCROLLBAR_SUBTRACT));
    displayedCategoryView.setValue(categoryView);
    displayedCategoryPresenter.setValue(getPresenter(category));
    return true;
  } else {
    LOGGER.info("Category " + category.getDescription() + " hasn't been loaded!");
    return false;
  }
}
 
Example #7
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 #8
Source File: NavigationPresenter.java    From PreferencesFX with Apache License 2.0 6 votes vote down vote up
/**
 * Makes the TreeItems' text update when the description of a Category changes (due to i18n).
 */
public void setupCellValueFactory() {
  navigationView.treeView.setCellFactory(param -> new TreeCell<Category>() {
    @Override
    protected void updateItem(Category category, boolean empty) {
      super.updateItem(category, empty);
      textProperty().unbind();
      if (empty || category == null) {
        setText(null);
        setGraphic(null);
      } else {
        textProperty().bind(category.descriptionProperty());
        setGraphic(category.getItemIcon());
      }
    }
  });
}
 
Example #9
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 #10
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 #11
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 #12
Source File: PreferencesFxUtils.java    From PreferencesFX with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a map which links {@link Group} 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 Group}, mapped to their
 *         corresponding {@link Category}
 * @apiNote does not flatten the categories
 */
public static HashMap<Group, Category> mapGroupsToCategories(List<Category> categories) {
  HashMap<Group, Category> groupCategoryMap = new HashMap<>();
  for (Category category : categories) {
    if (category.getGroups() != null) {
      for (Group group : category.getGroups()) {
        groupCategoryMap.put(group, category);
      }
    }
  }
  return groupCategoryMap;
}
 
Example #13
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 #14
Source File: PreferencesFxUtils.java    From PreferencesFX with Apache License 2.0 5 votes vote down vote up
/**
 * Returns a list of all the groups which are contained in a list of {@code categories}
 * recursively.
 *
 * @param categories the categories to fetch the groups from
 * @return all groups of the categories
 */
public static List<Group> categoriesToGroups(List<Category> categories) {
  return categories.stream()
      .map(Category::getGroups)     // get groups from categories
      .filter(Objects::nonNull)     // remove all null
      .flatMap(Collection::stream)
      .collect(Collectors.toList());
}
 
Example #15
Source File: PreferencesFxUtils.java    From PreferencesFX with Apache License 2.0 5 votes vote down vote up
/**
 * Puts all categories and their respective children recursively flattened into a list.
 *
 * @param categoryLst list of parent categories
 * @return list of all parent categories and respective recursive children categories
 */
public static List<Category> flattenCategories(List<Category> categoryLst) {
  if (categoryLst == null) {
    return null;
  }
  List<Category> flatCategoryLst = new ArrayList<>();
  flattenCategories(flatCategoryLst, categoryLst);
  return flatCategoryLst;
}
 
Example #16
Source File: PreferencesFxUtils.java    From PreferencesFX with Apache License 2.0 5 votes vote down vote up
/**
 * Goes through the list of parent categories and adds each category it visists to the flatList.
 *
 * @param flatList   list to which the categories for the flattened list should be added
 * @param categories list of parent categories to go through recursively
 * @implNote Internal helper method for {@link PreferencesFxUtils#flattenCategories(List)}.
 */
private static void flattenCategories(List<Category> flatList, List<Category> categories) {
  categories.forEach(category -> {
    flatList.add(category);
    List<Category> children = category.getChildren();
    if (children != null) {
      flattenCategories(flatList, children);
    }
  });
}
 
Example #17
Source File: SearchHandler.java    From PreferencesFX with Apache License 2.0 5 votes vote down vote up
/**
 * Initializes the SearchHandler by initially creating all necessary lists
 * for filtering and setting up the bindings.
 *
 * @param model             the model of PreferencesFx
 * @param searchText        textProperty of a TextField where the search string is being input
 * @param predicateProperty of the rootItem of a {@link FilterableTreeItem}
 * @apiNote Must be called to make the filtering work.
 */
public void init(
    PreferencesFxModel model,
    StringProperty searchText,
    ObjectProperty<Predicate<Category>> predicateProperty
) {
  this.model = model;
  initializeSearch();
  initializeSearchText(searchText);
  bindFilterPredicate(predicateProperty);
}
 
Example #18
Source File: SearchHandler.java    From PreferencesFX with Apache License 2.0 5 votes vote down vote up
/**
 * Binds the predicateProperty to ensure filtering according to the searchText.
 *
 * @param predicateProperty of the rootItem of a {@link FilterableTreeItem}
 */
public void bindFilterPredicate(ObjectProperty<Predicate<Category>> predicateProperty) {
  predicateProperty.bind(Bindings.createObjectBinding(() -> {
    if (searchText.get() == null || searchText.get().isEmpty()) {
      return null;
    }
    return filterPredicate;
  }, searchText));
}
 
Example #19
Source File: SearchHandler.java    From PreferencesFX with Apache License 2.0 5 votes vote down vote up
private Category getSelectedCategoryByMatch() {
  // Strategy: Go from most specific match to most unspecific match
  Category firstFilteredSetting =
      filteredSettingsLst.size() == 0 ? null : settingCategoryMap.get(filteredSettingsLst.get(0));
  Category firstFilteredGroup =
      filteredGroupsLst.size() == 0 ? null : groupCategoryMap.get(filteredGroupsLst.get(0));
  Category firstFilteredCategory =
      filteredCategoriesLst.size() == 0 ? null : filteredCategoriesLst.get(0);
  return compareMatches(
      firstFilteredSetting, firstFilteredGroup, firstFilteredCategory,
      settingMatches, groupMatches, categoryMatches
  );
}
 
Example #20
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 #21
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 #22
Source File: PreferencesFx.java    From PreferencesFX with Apache License 2.0 5 votes vote down vote up
private PreferencesFx(StorageHandler storageHandler, Category... categories) {
  // asciidoctor Documentation - tag::testMock[]
  preferencesFxModel = new PreferencesFxModel(
      storageHandler, new SearchHandler(), new History(), categories
  );
  // asciidoctor Documentation - end::testMock[]
  init();
}
 
Example #23
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 #24
Source File: NavigationPresenter.java    From PreferencesFX with Apache License 2.0 5 votes vote down vote up
/**
 * Retrieves the currently selected category in the TreeSearchView.
 *
 * @return the currently selected category
 */
public Category getSelectedCategory() {
  TreeItem<Category> selectedTreeItem =
      navigationView.treeView.getSelectionModel().getSelectedItem();
  if (selectedTreeItem != null) {
    return navigationView.treeView.getSelectionModel().getSelectedItem().getValue();
  }
  return null;
}
 
Example #25
Source File: NavigationPresenter.java    From PreferencesFX with Apache License 2.0 5 votes vote down vote up
private void addRecursive(FilterableTreeItem<Category> treeItem, List<Category> categories) {
  for (Category category : categories) {
    FilterableTreeItem<Category> item = new FilterableTreeItem<>(category);
    if (category.isExpand()) {
      item.setExpanded(true);
    }
    // If there are subcategories, add them recursively.
    if (category.getChildren() != null) {
      addRecursive(item, category.getChildren());
    }
    treeItem.add(item);
    categoryTreeItemMap.put(category, item);
  }
}
 
Example #26
Source File: OptionsDisplaySetupPanel.java    From Quelea with GNU General Public License v3.0 5 votes vote down vote up
Category getDisplaySetupTab() {
    return Category.of(LabelGrabber.INSTANCE.getLabel("display.options.heading"), new ImageView(new Image("file:icons/monitorsettingsicon.png")), //, new ImageView(new Image("file:icons/monitorsettingsicon.png")),
            controlScreen.getGroup(),
            projectorScreen.getGroup(),
            stageScreen.getGroup()
    );
}
 
Example #27
Source File: CategoryPresenter.java    From PreferencesFX with Apache License 2.0 5 votes vote down vote up
/**
 * Constructs a new presenter for the {@link CategoryView}.
 *
 * @param model               the model of PreferencesFX
 * @param categoryModel       the category which is being represented in the view
 * @param categoryView        corresponding view to this presenter
 * @param breadCrumbPresenter the presenter of the corresponding {@link BreadCrumbView} as found
 *                            in the corresponding view to this presenter
 */
public CategoryPresenter(
    PreferencesFxModel model,
    Category categoryModel,
    CategoryView categoryView,
    BreadCrumbPresenter breadCrumbPresenter
) {
  this.model = model;
  this.categoryModel = categoryModel;
  this.categoryView = categoryView;
  this.breadCrumbPresenter = breadCrumbPresenter;
  init();
}
 
Example #28
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 #29
Source File: CategoryController.java    From PreferencesFX with Apache License 2.0 5 votes vote down vote up
/**
 * Unloads a view / presenter pair from the HashMaps.
 * This method can be used in case a view / presenter pair needs to be reloaded.
 *
 * @param category of the view / presenter pair to be unloaded.
 * @return true if the view and presenter were unloaded and false if view doesn't exist.
 */
public boolean unloadView(Category category) {
  if (views.remove(category) == null | presenters.remove(category) == null) {
    LOGGER.info("Category " + category.getDescription() + " doesn't exist!");
    return false;
  } else {
    return true;
  }
}
 
Example #30
Source File: OptionsBiblePanel.java    From Quelea with GNU General Public License v3.0 5 votes vote down vote up
public Category getBiblesTab() {
    bindings.put(maxVersesSetting.getField(), useMaxVersesProperty.not());

    return Category.of(LabelGrabber.INSTANCE.getLabel("bible.options.heading"), new ImageView(new Image("file:icons/biblesettingsicon.png")),
            defaultBibleSetting,
            showVerseNumSetting,
            splitVersesSetting,
            useMaxVersesSetting,
            maxVersesSetting
    );
}