@Test public void singleSelectionTest() { SingleSelectionField<String> s = Field.ofSingleSelectionType(Arrays.asList("Test", "Test 1", "Test 2"), 0); Assert.assertEquals("Test", s.getSelection()); s.select(2); Assert.assertEquals("Test 2", s.getSelection()); s.select(4); Assert.assertEquals("Test 2", s.getSelection()); s.deselect(); Assert.assertEquals(null, s.getSelection()); s.select(2); Assert.assertEquals("Test 2", s.getSelection()); s.select(-1); Assert.assertEquals(null, s.getSelection()); }
public static <T> SingleSelectionField<T> ofSingleSelectionType(List<T> items, int selection) { return new SingleSelectionField<>(new SimpleListProperty<>(FXCollections.observableArrayList(items)), selection); }
Field extends Element<F> implements FormElement { public static <T> SingleSelectionField<T> ofSingleSelectionType(List<T> items, int selection) { return new SingleSelectionField<>(new SimpleListProperty<>(FXCollections.observableArrayList(items)), selection); } }
Field extends Element<F> implements FormElement { public static <T> SingleSelectionField<T> ofSingleSelectionType(List<T> items, int selection) { return new SingleSelectionField<>(new SimpleListProperty<>(FXCollections.observableArrayList(items)), selection); } protected  Field(); }
Field extends Element<F> implements FormElement { public static <T> SingleSelectionField<T> ofSingleSelectionType(List<T> items, int selection) { return new SingleSelectionField<>(new SimpleListProperty<>(FXCollections.observableArrayList(items)), selection); } protected  Field(); static PasswordField ofPasswordType(String defaultValue); static PasswordField ofPasswordType(StringProperty binding); static StringField ofStringType(String defaultValue); static StringField ofStringType(StringProperty binding); static DoubleField ofDoubleType(double defaultValue); static DoubleField ofDoubleType(DoubleProperty binding); static IntegerField ofIntegerType(int defaultValue); static IntegerField ofIntegerType(IntegerProperty binding); static BooleanField ofBooleanType(boolean defaultValue); static BooleanField ofBooleanType(BooleanProperty binding); static MultiSelectionField<T> ofMultiSelectionType(List<T> items, List<Integer> selection); static MultiSelectionField<T> ofMultiSelectionType(List<T> items); static MultiSelectionField<T> ofMultiSelectionType(ListProperty<T> itemsBinding, ListProperty<T> selectionBinding); static SingleSelectionField<T> ofSingleSelectionType(List<T> items, int selection); static SingleSelectionField<T> ofSingleSelectionType(List<T> items); static SingleSelectionField<T> ofSingleSelectionType(ListProperty<T> itemsBinding, ObjectProperty<T> selectionBinding); static DateField ofDate(LocalDate defaultValue); static DateField ofDate(ObjectProperty<LocalDate> binding); F required(boolean newValue); F required(String errorMessage); F editable(boolean newValue); F label(String newValue); F labelDescription(Node newValue); F labelDescription(String newValue); F valueDescription(Node newValue); F valueDescription(String newValue); F tooltip(String newValue); F placeholder(String newValue); F render(SimpleControl<F> newValue); abstract void setBindingMode(BindingMode newValue); void translate(TranslationService newValue); String getPlaceholder(); StringProperty placeholderProperty(); String getLabel(); StringProperty labelProperty(); String getTooltip(); StringProperty tooltipProperty(); boolean isValid(); BooleanProperty validProperty(); boolean hasChanged(); BooleanProperty changedProperty(); boolean isRequired(); BooleanProperty requiredProperty(); boolean isEditable(); BooleanProperty editableProperty(); boolean isI18N(); SimpleControl<F> getRenderer(); List<String> getErrorMessages(); ListProperty<String> errorMessagesProperty(); Field addEventHandler(EventType<FieldEvent> eventType, EventHandler<? super FieldEvent> eventHandler); Field removeEventHandler(EventType<FieldEvent> eventType, EventHandler<? super FieldEvent> eventHandler); Node getLabelDescription(); Node getValueDescription(); }
Field extends Element<F> implements FormElement { public static <T> SingleSelectionField<T> ofSingleSelectionType(List<T> items, int selection) { return new SingleSelectionField<>(new SimpleListProperty<>(FXCollections.observableArrayList(items)), selection); } protected  Field(); static PasswordField ofPasswordType(String defaultValue); static PasswordField ofPasswordType(StringProperty binding); static StringField ofStringType(String defaultValue); static StringField ofStringType(StringProperty binding); static DoubleField ofDoubleType(double defaultValue); static DoubleField ofDoubleType(DoubleProperty binding); static IntegerField ofIntegerType(int defaultValue); static IntegerField ofIntegerType(IntegerProperty binding); static BooleanField ofBooleanType(boolean defaultValue); static BooleanField ofBooleanType(BooleanProperty binding); static MultiSelectionField<T> ofMultiSelectionType(List<T> items, List<Integer> selection); static MultiSelectionField<T> ofMultiSelectionType(List<T> items); static MultiSelectionField<T> ofMultiSelectionType(ListProperty<T> itemsBinding, ListProperty<T> selectionBinding); static SingleSelectionField<T> ofSingleSelectionType(List<T> items, int selection); static SingleSelectionField<T> ofSingleSelectionType(List<T> items); static SingleSelectionField<T> ofSingleSelectionType(ListProperty<T> itemsBinding, ObjectProperty<T> selectionBinding); static DateField ofDate(LocalDate defaultValue); static DateField ofDate(ObjectProperty<LocalDate> binding); F required(boolean newValue); F required(String errorMessage); F editable(boolean newValue); F label(String newValue); F labelDescription(Node newValue); F labelDescription(String newValue); F valueDescription(Node newValue); F valueDescription(String newValue); F tooltip(String newValue); F placeholder(String newValue); F render(SimpleControl<F> newValue); abstract void setBindingMode(BindingMode newValue); void translate(TranslationService newValue); String getPlaceholder(); StringProperty placeholderProperty(); String getLabel(); StringProperty labelProperty(); String getTooltip(); StringProperty tooltipProperty(); boolean isValid(); BooleanProperty validProperty(); boolean hasChanged(); BooleanProperty changedProperty(); boolean isRequired(); BooleanProperty requiredProperty(); boolean isEditable(); BooleanProperty editableProperty(); boolean isI18N(); SimpleControl<F> getRenderer(); List<String> getErrorMessages(); ListProperty<String> errorMessagesProperty(); Field addEventHandler(EventType<FieldEvent> eventType, EventHandler<? super FieldEvent> eventHandler); Field removeEventHandler(EventType<FieldEvent> eventType, EventHandler<? super FieldEvent> eventHandler); Node getLabelDescription(); Node getValueDescription();  }