/infxnity

JavaFX "to infinity and beyond"

Primary LanguageJavaMIT LicenseMIT

infxnity

JavaFX "to infinity and beyond"

GitHub license Build Status Quality Gate

Quality Gate Quality Gate Quality Gate

Features

Example to create a TextField allowing only french phone numbers:

final TextField textField = new TextField();
final MaskCharacter[] mask = MaskBuilder.newBuilder()
	.appendLiteral("+33 ")
	.appendDigit('6')
	.appendLiteral(" ")
	.appendDigit(2)
	.appendLiteral(" ")
	.appendDigit(2)
	.appendLiteral(" ")
	.appendDigit(2)
	.appendLiteral(" ")
	.appendDigit(2)
	.build();
textField.setTextFormatter(new TextFormatter<>(new MaskTextFilter(textField, false, mask)));

Default text will be "+33 6 00 00 00 00".
Caret will be placed in 4th position : "+33 |6 00 00 00 00".
Navigate to the right will do that:
"+33 6 |00 00 00 00"
"+33 6 0|0 00 00 00"
"+33 6 00 |00 00 00"
"+33 6 00 0|0 00 00"
"+33 6 00 00 |00 00"
"+33 6 00 00 0|0 00"
"+33 6 00 00 00 |00"
"+33 6 00 00 00 0|0"
"+33 6 00 00 00 00|"

An ObservableList(s) aggregation.
All events of aggregated ObservableList(s) are forwarded.
The list of aggregated ObservableList(s) can be modified to add, remove or replace one or more of the aggregated ObservableList(s). An appropriate event will be fired.
An instance of ObservableListAggregation is a read only list. Any attempt to modify the list will throw an UnsupportedOperationException.

Example:

final ObservableList<Integer> list1 = FXCollections.observableArrayList(0, 1, 2);
final ObservableList<Integer> list2 = FXCollections.observableArrayList(3, 4);
final ObservableList<Integer> list3 = FXCollections.observableArrayList(5, 6);

final ObservableListAggregation<Integer> aggregation = new ObservableListAggregation<>(list1, list2);
System.out.println(aggregation); // [0, 1, 2, 3, 4]

aggregation.getLists().add(list3);
System.out.println(aggregation); // [0, 1, 2, 3, 4, 5, 6]

list1.add(0, -1);
System.out.println(aggregation); // [-1, 0, 1, 2, 3, 4, 5, 6]

list3.remove(Integer.valueOf(6));
System.out.println(aggregation); // [-1, 0, 1, 2, 3, 4, 5]

aggregation.getLists().remove(list1);
System.out.println(aggregation); // [3, 4, 5]

Used to bind a list to an ObservableList with a type conversion.

Example:

ObservableList<Person> personList = FXCollections.observableArrayList(person -> new Observable[] { person.nameProperty() });
ObservableList<String> personNameList = FXCollections.observableArrayList();

IFXContentBinding.bind(personNameList, personList, Person::getName);

System.out.println(personNameList); // []

personList.add(new Person("Bob"));
System.out.println(personNameList); // [Bob]

personList.addAll(new Person("Fred"), new Person("John"));
System.out.println(personNameList); // [Bob, Fred, John]

personList.get(0).setName("George");
System.out.println(personNameList); // [George, Fred, John]