com.dlsc.formsfx.model.structure.Field Java Examples
The following examples show how to use
com.dlsc.formsfx.model.structure.Field.
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 |
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: OptionsServerSettingsPanel.java From Quelea with GNU General Public License v3.0 | 6 votes |
/** * Create the server settings panel. * @param bindings HashMap of bindings to setup after the dialog has been created */ OptionsServerSettingsPanel(HashMap<Field, ObservableValue> bindings) { this.bindings = bindings; lyricsPreference = new MobileServerPreference(true); remotePreference = new MobileServerPreference(false); useMobileLyricsProperty = new SimpleBooleanProperty(QueleaProperties.get().getUseMobLyrics()); lyricsPortNumberProperty = new SimpleStringProperty(String.valueOf(QueleaProperties.get().getMobLyricsPort())); mobileLyricsField = Field.ofStringType(lyricsPortNumberProperty).render(lyricsPreference); bindings.put(mobileLyricsField, useMobileLyricsProperty.not()); useMobileRemoteProperty = new SimpleBooleanProperty(QueleaProperties.get().getUseRemoteControl()); remotePortNumberProperty = new SimpleStringProperty(String.valueOf(QueleaProperties.get().getRemoteControlPort())); remoteField = Field.ofStringType(remotePortNumberProperty).render(remotePreference); bindings.put(remoteField, useMobileRemoteProperty.not()); passwordProperty = new SimpleStringProperty(QueleaProperties.get().getRemoteControlPassword()); }
Example #3
Source File: Setting.java From PreferencesFX with Apache License 2.0 | 6 votes |
/** * Unmarks a setting. * Is used for the search, which marks and unmarks items depending on the match as a form of * visual feedback. */ public void unmark() { if (!hasDescription()) { throw new UnsupportedOperationException( "Only Fields can be unmarked, since they have a description." ); } // check if it's marked before removing the style class if (marked) { SimpleControl renderer = (SimpleControl) ((Field) getElement()).getRenderer(); Node markNode = renderer.getFieldLabel(); markNode.getStyleClass().remove(MARKED_STYLE_CLASS); markNode.removeEventHandler(MouseEvent.MOUSE_EXITED, unmarker); marked = !marked; } }
Example #4
Source File: Setting.java From PreferencesFX with Apache License 2.0 | 6 votes |
/** * Marks a setting. * Is used for the search, which marks and unmarks items depending on the match as a form of * visual feedback. */ public void mark() { if (!hasDescription()) { throw new UnsupportedOperationException( "Only Fields can be marked, since they have a description." ); } // ensure it's not marked yet - so a control doesn't contain the same styleClass multiple times if (!marked) { SimpleControl renderer = (SimpleControl) ((Field) getElement()).getRenderer(); Node markNode = renderer.getFieldLabel(); markNode.getStyleClass().add(MARKED_STYLE_CLASS); markNode.setOnMouseExited(unmarker); marked = !marked; } }
Example #5
Source File: Setting.java From PreferencesFX with Apache License 2.0 | 5 votes |
/** * Constructs a setting of {@link Boolean} type, which is represented by a {@link ToggleControl}. * * @param description the title of this setting * @param property to be bound, saved / loaded and used for undo / redo * @return the constructed setting */ public static Setting of(String description, BooleanProperty property) { return new Setting<>( description, Field.ofBooleanType(property) .label(description) .render(new ToggleControl()), property ); }
Example #6
Source File: OptionsBiblePanel.java From Quelea with GNU General Public License v3.0 | 5 votes |
/** * 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 #7
Source File: OptionsPresentationPanel.java From Quelea with GNU General Public License v3.0 | 5 votes |
/** * Create the options presentation panel. * * @param bindings HashMap of bindings to setup after the dialog has been created */ OptionsPresentationPanel(HashMap<Field, ObservableValue> bindings) { this.bindings = bindings; useOOProperty = new SimpleBooleanProperty(QueleaProperties.get().getUseOO()); directoryChooserOOProperty = new SimpleStringProperty(QueleaProperties.get().getOOPath()); usePPProperty = new SimpleBooleanProperty(QueleaProperties.get().getUsePP()); directoryChooserPPProperty = new SimpleStringProperty(QueleaProperties.get().getPPPath()); }
Example #8
Source File: OptionsStageViewPanel.java From Quelea with GNU General Public License v3.0 | 5 votes |
/** * Create the stage view options panel. * @param bindings HashMap of bindings to setup after the dialog has been created */ OptionsStageViewPanel(HashMap<Field, ObservableValue> bindings) { this.bindings = bindings; ArrayList<String> textAlignment = new ArrayList<>(); for (TextAlignment alignment : TextAlignment.values()) { textAlignment.add(alignment.toFriendlyString()); } lineAlignmentList = FXCollections.observableArrayList(textAlignment); alignmentSelectionProperty = new SimpleObjectProperty<>(QueleaProperties.get().getStageTextAlignment()); fontsList = FXCollections.observableArrayList(Utils.getAllFonts()); fontSelectionProperty = new SimpleObjectProperty<>(QueleaProperties.get().getStageTextFont()); }
Example #9
Source File: OptionsDisplaySetupPanel.java From Quelea with GNU General Public License v3.0 | 5 votes |
/** * Create a new display setup panel. * * @param bindings HashMap of bindings to setup after the dialog has been created */ OptionsDisplaySetupPanel(HashMap<Field, ObservableValue> bindings) { this.bindings = bindings; controlScreen = new DisplayGroup(LabelGrabber.INSTANCE.getLabel("control.screen.label"), false, bindings); projectorScreen = new DisplayGroup(LabelGrabber.INSTANCE.getLabel("projector.screen.label"), true, bindings); stageScreen = new DisplayGroup(LabelGrabber.INSTANCE.getLabel("stage.screen.label"), true, bindings); GraphicsDeviceWatcher.INSTANCE.addGraphicsDeviceListener(devices -> { QueleaApp.get().getMainWindow().getPreferencesDialog().updatePos(); }); }
Example #10
Source File: PreferencesDialog.java From Quelea with GNU General Public License v3.0 | 5 votes |
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: OptionsGeneralPanel.java From Quelea with GNU General Public License v3.0 | 5 votes |
/** * Create the options general panel. * * @param bindings HashMap of bindings to setup after the dialog has been created */ OptionsGeneralPanel(HashMap<Field, ObservableValue> bindings) { this.bindings = bindings; showSmallSongProperty = new SimpleBooleanProperty(QueleaProperties.get().getSmallSongTextShow()); smallSongSizeSpinnerProperty = new SimpleDoubleProperty(QueleaProperties.get().getSmallSongTextSize()); smallSongSizeControllerField = Field.ofDoubleType(smallSongSizeSpinnerProperty).render( new PercentSliderControl(0.01, 0.5, 10)); showSmallBibleProperty = new SimpleBooleanProperty(QueleaProperties.get().getSmallBibleTextShow()); smallBibleSizeSpinnerProperty = new SimpleDoubleProperty(QueleaProperties.get().getSmallBibleTextSize()); smallBibleSizeControllerField = Field.ofDoubleType(smallBibleSizeSpinnerProperty).render( new PercentSliderControl(0.01, 0.5, 10)); thumbnailSizeProperty = new SimpleIntegerProperty(QueleaProperties.get().getThumbnailSize()); maxFontSizeProperty = new SimpleIntegerProperty((int) QueleaProperties.get().getMaxFontSize()); additionalSpacingProperty = new SimpleIntegerProperty((int) QueleaProperties.get().getAdditionalLineSpacing()); maxCharsProperty = new SimpleIntegerProperty(QueleaProperties.get().getMaxChars()); languageItemsList = FXCollections.observableArrayList(LanguageFileManager.INSTANCE.languageFiles()); languageSelectionProperty = new SimpleObjectProperty<>(LanguageFileManager.INSTANCE.getCurrentFile()); applicationThemeList = FXCollections.observableArrayList(Arrays.asList( LabelGrabber.INSTANCE.getLabel("default.theme.label"), LabelGrabber.INSTANCE.getLabel("dark.theme.label")) ); applicationThemeProperty = new SimpleObjectProperty<>(LabelGrabber.INSTANCE.getLabel("default.theme.label")); dbSongPreviewList = FXCollections.observableArrayList(Arrays.asList( LabelGrabber.INSTANCE.getLabel("db.song.preview.label.control"), LabelGrabber.INSTANCE.getLabel("db.song.preview.label.databasepreview"), LabelGrabber.INSTANCE.getLabel("db.song.preview.label.previewpane")) ); dbSongPreviewProperty = new SimpleObjectProperty<>(LabelGrabber.INSTANCE.getLabel("db.song.preview.label.control")); }
Example #12
Source File: OptionsRecordingPanel.java From Quelea with GNU General Public License v3.0 | 5 votes |
/** * 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: PreferencesFxModel.java From PreferencesFX with Apache License 2.0 | 5 votes |
private void discardFieldChanges() { PreferencesFxUtils.categoriesToElements(getFlatCategoriesLst()) .stream() .filter(element -> element instanceof Field) // only Fields can be persisted .map(Field.class::cast) .forEach(FormElement::reset); }
Example #14
Source File: PreferencesFxModel.java From PreferencesFX with Apache License 2.0 | 5 votes |
private void applyFieldChanges() { PreferencesFxUtils.categoriesToElements(getFlatCategoriesLst()) .stream() .filter(element -> element instanceof Field) // only Fields can be persisted .map(Field.class::cast) .forEach(FormElement::persist); }
Example #15
Source File: Setting.java From PreferencesFX with Apache License 2.0 | 5 votes |
/** * Returns the description of this setting or if i18n is used, it will return the translated * description in the current locale. * * @return the description */ public String getDescription() { if (element != null) { if (!(element instanceof Field)) { throw new UnsupportedOperationException( "Cannot get description of an Element which is not a field" ); } return ((Field) element).getLabel(); } return description; }
Example #16
Source File: Setting.java From PreferencesFX with Apache License 2.0 | 5 votes |
/** * Creates a custom color picker control. * * @param description the title of this setting * @param colorProperty the current selected color value * @return the constructed setting */ public static Setting of(String description, ObjectProperty<Color> colorProperty) { StringProperty stringProperty = new SimpleStringProperty(); stringProperty.bindBidirectional( colorProperty, new StringConverter<Color>() { @Override public String toString(Color color) { return color.toString(); } @Override public Color fromString(String value) { return Color.valueOf(value); } } ); return new Setting<>( description, Field.ofStringType(stringProperty) .label(description) .render(new SimpleColorPickerControl( Objects.isNull(colorProperty.get()) ? Color.BLACK : colorProperty.get()) ), stringProperty ); }
Example #17
Source File: Setting.java From PreferencesFX with Apache License 2.0 | 5 votes |
/** * Creates a file/directory chooser control. * * @param description the title of this setting * @param fileProperty the property to which the chosen file / directory should be set to * @param buttonText text of the button to open the file / directory chooser * @param initialDirectory An optional initial path, can be null. If null, will use the path from * the previously chosen file if present. * @param directory true, if only directories are allowed * @return the constructed setting */ public static Setting of(String description, ObjectProperty<File> fileProperty, String buttonText, File initialDirectory, boolean directory) { StringProperty stringProperty = new SimpleStringProperty(); stringProperty.bindBidirectional( fileProperty, new StringConverter<File>() { @Override public String toString(File file) { if (Objects.isNull(file)) { return ""; } return file.getAbsolutePath(); } @Override public File fromString(String value) { return new File(value); } } ); return new Setting<>( description, Field.ofStringType(stringProperty) .label(description) .render(new SimpleChooserControl(buttonText, initialDirectory, directory) ), stringProperty ); }
Example #18
Source File: Setting.java From PreferencesFX with Apache License 2.0 | 5 votes |
/** * Constructs a setting of {@link Integer} type, which is represented by a {@link TextField}. * * @param description the title of this setting * @param property to be bound, saved / loaded and used for undo / redo * @return the constructed setting */ public static Setting of(String description, IntegerProperty property) { return new Setting<>( description, Field.ofIntegerType(property) .label(description) .render(new SimpleIntegerControl()), property); }
Example #19
Source File: Setting.java From PreferencesFX with Apache License 2.0 | 5 votes |
/** * Constructs a setting of {@link Double} type, which is represented by a {@link TextField}. * * @param description the title of this setting * @param property to be bound, saved / loaded and used for undo / redo * @return the constructed setting */ public static Setting of(String description, DoubleProperty property) { return new Setting<>( description, Field.ofDoubleType(property) .label(description) .render(new SimpleDoubleControl()), property); }
Example #20
Source File: Setting.java From PreferencesFX with Apache License 2.0 | 5 votes |
/** * Constructs a setting of {@link String} type, which is represented by a {@link TextField}. * * @param description the title of this setting * @param property to be bound, saved / loaded and used for undo / redo * @return the constructed setting */ public static Setting of(String description, StringProperty property) { return new Setting<>( description, Field.ofStringType(property) .label(description) .render(new SimpleTextControl()), property); }
Example #21
Source File: OptionsNoticePanel.java From Quelea with GNU General Public License v3.0 | 4 votes |
/** * Create the options bible panel. * * @param bindings HashMap of bindings to setup after the dialog has been created */ OptionsNoticePanel(HashMap<Field, ObservableValue> bindings) { this.bindings = bindings; noticeSpeed = new SimpleDoubleProperty(QueleaProperties.get().getNoticeSpeed()); noticeSize = new SimpleDoubleProperty(QueleaProperties.get().getNoticeFontSize()); }
Example #22
Source File: Preferences.java From WorkbenchFX with Apache License 2.0 | 4 votes |
private IntegerField setupCustomControl() { return Field.ofIntegerType(customControlProperty).render( new IntegerSliderControl(0, 42)); }
Example #23
Source File: PreferencesDialog.java From Quelea with GNU General Public License v3.0 | 4 votes |
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 #24
Source File: PreferencesDialog.java From Quelea with GNU General Public License v3.0 | 4 votes |
private void bind(Field field, ObservableValue<? extends Boolean> booleanProperty) { ((SimpleControl) field.getRenderer()).getNode().disableProperty().bind(booleanProperty); }
Example #25
Source File: InternationalizedExample.java From PreferencesFX with Apache License 2.0 | 4 votes |
private IntegerField setupCustomControl() { return Field.ofIntegerType(customControlProperty).render( new IntegerSliderControl(0, 42)); }
Example #26
Source File: NodeExample.java From PreferencesFX with Apache License 2.0 | 4 votes |
private IntegerField setupCustomControl() { return Field.ofIntegerType(customControlProperty).render( new IntegerSliderControl(0, 42)); }
Example #27
Source File: ExtendedExample.java From PreferencesFX with Apache License 2.0 | 4 votes |
private IntegerField setupCustomControl() { return Field.ofIntegerType(customControlProperty).render( new IntegerSliderControl(0, 42)); }
Example #28
Source File: StandardExample.java From PreferencesFX with Apache License 2.0 | 4 votes |
private IntegerField setupCustomControl() { return Field.ofIntegerType(customControlProperty).render( new IntegerSliderControl(0, 42)); }
Example #29
Source File: PreferencesFxGroupRenderer.java From PreferencesFX with Apache License 2.0 | 4 votes |
/** * Defines the layout of the rendered group. */ public void layoutParts() { StringBuilder styleClass = new StringBuilder("group"); // if there are no rows yet, getRowCount returns -1, in this case the next row is 0 int nextRow = PreferencesFxUtils.getRowCount(grid) + 1; // Only when the preferencesGroup has a title if (preferencesGroup.getTitle() != null) { grid.add(titleLabel, 0, nextRow++, 2, 1); styleClass.append("-title"); titleLabel.getStyleClass().add("group-title"); } List<Element> elements = preferencesGroup.getElements().stream() .map(Element.class::cast) .collect(Collectors.toList()); styleClass.append("-setting"); int rowAmount = nextRow; for (int i = 0; i < elements.size(); i++) { // add to GridPane Element element = elements.get(i); if (element instanceof Field) { SimpleControl c = (SimpleControl) ((Field)element).getRenderer(); c.setField((Field)element); grid.add(c.getFieldLabel(), 0, i + rowAmount, 1, 1); grid.add(c.getNode(), 1, i + rowAmount, 1, 1); // Styling GridPane.setHgrow(c.getNode(), Priority.SOMETIMES); GridPane.setValignment(c.getNode(), VPos.CENTER); GridPane.setValignment(c.getFieldLabel(), VPos.CENTER); // additional styling for the last setting if (i == elements.size() - 1) { styleClass.append("-last"); GridPane.setMargin( c.getNode(), new Insets(0, 0, PreferencesFxFormRenderer.SPACING * 4, 0) ); GridPane.setMargin( c.getFieldLabel(), new Insets(0, 0, PreferencesFxFormRenderer.SPACING * 4, 0) ); } c.getFieldLabel().getStyleClass().add(styleClass.toString() + "-label"); c.getNode().getStyleClass().add(styleClass.toString() + "-node"); } if (element instanceof NodeElement) { NodeElement nodeElement = (NodeElement) element; grid.add(nodeElement.getNode(), 0, i + rowAmount, GridPane.REMAINING, 1); } } }
Example #30
Source File: Setting.java From PreferencesFX with Apache License 2.0 | 3 votes |
/** * Creates a combobox with multiselection. * At least one element has to be selected at all times. * * @param description the title of this setting * @param items the items which are possible to choose in the combobox, which are shown * in their {@link #toString()} representation * @param selections the currently selected item(s) of the combobox to be bound, saved / loaded * and used for undo / redo * @param <P> the type of objects which should be displayed in the combobox * @return the constructed setting */ public static <P> Setting of( String description, ListProperty<P> items, ListProperty<P> selections) { return new Setting<>( description, Field.ofMultiSelectionType(items, selections) .label(description) .render(new SimpleListViewControl<>()), selections); }