FormsFX
1
FormsFX
2
FX Problems
● Manual Bindings
● Verbosity
● Repetition
● Code Organisation
3
Value Label Placeholder
Errors State (3x) Tooltip
4
Efficient API
Different Use Cases Simple Extensions
Sensible Defaults
5
Agenda
1. API
2. Architecture
3. View Model
4. Model
5. View
6. Extensions
7. Demo
6
Fluent API
● Natural Language
● Factory Pattern
● Chaining
● Builder Pattern
7
1 Field.ofStringType(model.nameProperty())
2 .label("name_key")
3 .validate(StringLengthValidator.between(5, 10))
Fluent API
8
M
Model
V
View
VM
View Model
9
M
Model
V
View
VM
View Model
Data Binding
10
FormsFX
VM
11
FormsFX
VM
12
● Properties as Models
● Persisted, Temporary, User Value
● Binding Modes: continuous vs persistent
M
Model: Data Binding
13
V
View
VM
View Model
M
M
Model
Temporary Value User ValuePersisted Value
persist() change
14
V
View
VM
View Model
M
M
Model
Temporary Value User ValuePersisted Value
change
15
Model: Data Binding
1 Field.ofStringType(model.nameProperty())
2 Field.ofStringType("test")
3 .bind(anotherModel.someProperty())
1 form.persist();
2 form.reset();
M
16
View: Components
● Renderer
● Grid System
● Simple Controls
V
17
FormsFX
V
18
V
19
View: Simple Controls
● Default Controls
● Data Types
● State Information
● Styling Hooks
V
20
V
View: Control Anatomy
21
V
View: Control Anatomy
22
1 Field.ofStringType(model.nameProperty())
2 .render(new CustomTextControl())
View: Custom Controls
V
23
1 Form formInstance = Form.of(…);
2 rootPane.add(new FormRenderer(formInstance))
View: Displaying a Form
V
24
Validation
● Type Validation
● Range Validators
● RegEx Validators
● Custom Validators
25
Validation
1 Field.ofStringType(model.nameProperty())
2 .validate(
3 StringLengthValidator.between(5, 10),
4 CustomValidator.forPredicate(s -> s.charAt(0).equals(’S’)),
5 RegExValidator.forPattern("[DEINSTY]")
6 )
26
Internationalisation
● Translation Service
● Resource Bundle Implementation
● Locale Change Listeners
27
Internationalisation
1 Form.of(
2 Field.ofStringType(model.nameProperty())
3 .label("name_key")
4 ).i18n(translationService)
28
Wrap Up: Components
29
M
Model
V
View
VM
View Model
Fluent API
Structural Semantics
Field Types
Validation
Internationalisation
Renderer
Simple Controls
Grid Logic
Bindings
Binding Modes
Properties
Wrap Up: Sensible Defaults
● Single Locale
● Simple Controls
● Pre-Defined Validators
30
Wrap Up: Extensions
● Custom Validation
● Internationalisation
● Custom Controls
● Custom Styling
31
Demo
32

Introduction to FormsFX

Editor's Notes