Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ben12/infxnity
JavaFX "to infinity and beyond"
https://github.com/ben12/infxnity
binding java java-8 java8 javafx javafx-8 javafx-library mask maskededittext maskedinput maskedtextfield textfield-mask
Last synced: 17 days ago
JSON representation
JavaFX "to infinity and beyond"
- Host: GitHub
- URL: https://github.com/ben12/infxnity
- Owner: ben12
- License: mit
- Created: 2017-10-21T18:02:23.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-09-30T19:09:38.000Z (over 1 year ago)
- Last Synced: 2024-11-19T21:33:10.958Z (3 months ago)
- Topics: binding, java, java-8, java8, javafx, javafx-8, javafx-library, mask, maskededittext, maskedinput, maskedtextfield, textfield-mask
- Language: Java
- Homepage: https://infxnity.ben12.eu
- Size: 578 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# infxnity
JavaFX "to infinity and beyond"[![GitHub license](https://img.shields.io/github/license/ben12/infxnity.svg)](https://github.com/ben12/infxnity/blob/master/LICENSE)
[![Build Status](https://travis-ci.org/ben12/infxnity.svg?branch=master)](https://travis-ci.org/ben12/infxnity)
[![Quality Gate](https://sonarcloud.io/api/project_badges/measure?project=ben12_infxnity&metric=alert_status)](https://sonarcloud.io/dashboard?id=ben12_infxnity)[![Quality Gate](https://sonarcloud.io/api/project_badges/measure?project=ben12_infxnity&metric=ncloc)](https://sonarcloud.io/dashboard?id=ben12_infxnity)
[![Quality Gate](https://sonarcloud.io/api/project_badges/measure?project=ben12_infxnity&metric=code_smells)](https://sonarcloud.io/dashboard?id=ben12_infxnity)
[![Quality Gate](https://sonarcloud.io/api/project_badges/measure?project=ben12_infxnity&metric=vulnerabilities)](https://sonarcloud.io/dashboard?id=ben12_infxnity)## Features
### [MaskTextFilter](http://infxnity.ben12.eu/apidocs/com/ben12/infxnity/control/text/MaskTextFilter.html)
Example to create a [`TextField`](https://docs.oracle.com/javase/8/javafx/api/javafx/scene/control/TextField.html) allowing only french phone numbers:
```java
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|"### [ObservableListAggregation](http://infxnity.ben12.eu/apidocs/com/ben12/infxnity/collections/ObservableListAggregation.html)
An [`ObservableList`](https://docs.oracle.com/javase/8/javafx/api/javafx/collections/ObservableList.html)(s) aggregation.
All events of aggregated [`ObservableList`](https://docs.oracle.com/javase/8/javafx/api/javafx/collections/ObservableList.html)(s) are forwarded.
The list of aggregated [`ObservableList`](https://docs.oracle.com/javase/8/javafx/api/javafx/collections/ObservableList.html)(s) can be modified to add, remove or replace one or more of the aggregated [`ObservableList`](https://docs.oracle.com/javase/8/javafx/api/javafx/collections/ObservableList.html)(s). An appropriate event will be fired.
An instance of [`ObservableListAggregation`](http://infxnity.ben12.eu/apidocs/com/ben12/infxnity/collections/ObservableListAggregation.html) is a read only list. Any attempt to modify the list will throw an [`UnsupportedOperationException`](https://docs.oracle.com/javase/8/docs/api/java/lang/UnsupportedOperationException.html).Example:
```java
final ObservableList list1 = FXCollections.observableArrayList(0, 1, 2);
final ObservableList list2 = FXCollections.observableArrayList(3, 4);
final ObservableList list3 = FXCollections.observableArrayList(5, 6);final ObservableListAggregation 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]
```### [IFXContentBinding](http://infxnity.ben12.eu/apidocs/com/ben12/infxnity/binding/IFXContentBinding.html)
Used to bind a list to an [`ObservableList`](https://docs.oracle.com/javase/8/javafx/api/javafx/collections/ObservableList.html) with a type conversion.
Example:
```java
ObservableList personList = FXCollections.observableArrayList(person -> new Observable[] { person.nameProperty() });
ObservableList 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]```