• Stars
    star
    108
  • Rank 309,990 (Top 7 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created over 8 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

CSS Stylable Controls for JavaFX

Tornado FXControls

CSS Stylable Controls for JavaFX

Maven Central

DatePickerTableCell

TableCell that supports editing of LocalDate properties with a DatePicker.

DateTimePicker

An extension to the JavaFX DatePicker control that lets you input the the time and date in with a configurable format and operate on a LocalDateTime value.

ListMenu

A menu that behaves and looks like a typical ul/li based HTML5 menu.

ListMenuDemo

NaviSelect

A chooser with a navigate-to button that lets you select an entry and also edit it. The select mechanism must be implemented manually, for example by opening a dialog with a search field and a list view.

Typical use case can be selecting a customer, but the complete customer list cannot be loaded into the dropdown, so you need to open a dialog to choose. The navigate-to button would take you to a customer edit screen.

Customer customer = customerService.getCustomer(42);
NaviSelect<Customer> navi = new NaviSelect<>();
navi.setValue(customer);
navi.setOnEdit(event -> {
    // Show dialog to search for customers, when done, set the new value into the navi
    navi.setValue(newlySelectedCustomer);
});

To override how the customer is rendered in the dropdown you can configure the visual converter:

navi.setVisualConverter(Customer::getName);

Create programatically

ListMenu menu = new ListMenu(
	new ListItem("Contacts", icon(FontAwesomeIcon.USER)),
	new ListItem("Projects", icon(FontAwesomeIcon.SUITCASE)),
	new ListItem("Settings", icon(FontAwesomeIcon.COG))
);

// Listen for selection
menu.activeProperty().addListener((observable, oldValue, newValue) -> {
	// Navigate based on ListItem 'newValue'
});

Create with FXML

<ListMenu orientation="VERTICAL" iconPosition="LEFT">
	<ListItem active="true" text="Contacts">
		<graphic>
			<FontAwesomeIconView glyphName="USER"/>
		</graphic>
	</ListItem>
	<ListItem text="Projects">
		<graphic>
			<FontAwesomeIconView glyphName="SUITCASE"/>
		</graphic>
	</ListItem>
	<ListItem text="Settings">
		<graphic>
			<FontAwesomeIconView glyphName="COG"/>
		</graphic>
	</ListItem>
</ListMenu>

Form layout

Form

A CSS stylable Form layout that is very convenient to use both with FXML and in code.

FXML Example

<Form>
    <Fieldset text="Contact Information" inputGrow="SOMETIMES">
        <Field text="Id">
            <TextField />
        </Field>
        <Field text="Username">
            <TextField />
        </Field>
        <Field text="Zip/City">
            <TextField minWidth="80" maxWidth="80" />
            <TextField />
        </Field>
        <Field>
            <Button text="Save"/>
        </Field>
    </Fieldset>
</Form> 

Java Example

Form form = new Form();

Fieldset contactInfo = form.fieldset("Contact Information");

contactInfo.field("Id", new TextField());
contactInfo.field("Username", new TextField());

TextField zipInput = new TextField();
zipInput.setMinWidth(80);
zipInput.setMaxWidth(80);
contactInfo.field("Zip/City", zipInput, new TextField());

contactInfo.field(new Button("Save"));

Responsive layout

A fieldset can lay out it's labels on the same line as the inputs (orientation=HORIZONTAL) or the labels can be laid out above the inputs (orientation=VERTICAL).

By changing the wrapWidth property on a fieldset you can make a fieldset switch from HORIZONTAL to VERTICAL automatically when the form is resized to a smaller width than wrapWidth.

Legends

A fieldset can have an optional icon specified for it's legend by setting the icon property to any node.

CSS

Use the default CSS Stylesheet as a starting point. The substructure of a Form is described below.

Substructure

  • form - VBox
    • fieldset - VBox
      • legend - Label
      • field - Field
        • label-container - HBox
          • label - Label
        • input-container - HBox
          • arbitrary input components

UnitConverter for TextField (kMGTPE)

Bind a Long property to a TextField with UnitConverter and you can write 2G instead of 2147483648.

TextField storageInput = new TextField()
storageInput.textProperty().bindBidirectional(product.sizeProperty(), new UnitConverter())

Optionally configure binary (true/false) and separator (default "").

DirtyState Tracker

Track dirty states for a collection of properties, with undo feature to rollback changes.

// Track all properties in customer
DirtyState dirtyState = new DirtyState(customer);

// Track only username and password
DirtyStateTracker dirtyState = new DirtyStateTracker(customer,
	customer.usernameProperty(), customer.passwordProperty());

// Disable save button until anything is changed
saveButton.disableProperty().bind(dirtyState.not())

// Undo changes
undoButton.setOnAction(event -> dirtyState.undo());

// Show undo button when changes are performed
undoButton.visibleProperty().bind(dirtyState);

See the JavaDoc for more information and options.

LeanPropertyValueFactory

Fancy having public fields for your JavaFX properties instead of public methods in your model objects? This PropertyValueFactory allows you to use these fields with a TableView:

public class Customer {
	public field idProperty = SimpleObjectProperty<Integer>();
	public field nameProperty = SimpleObjectProperty<String>();
	// Getters and setters if you want :)
}
<TableView>
	<columns>
		<TableColumn text="Id">
			<cellValueFactory>
				<LeanPropertyValueFactory property="id"/>
			</cellValueFactory>
		</TableColumn>
		<TableColumn text="Name">
			<cellValueFactory>
				<LeanPropertyValueFactory property="name"/>
			</cellValueFactory>
		</TableColumn>
	</columns>
</TableView>

Installation

Maven

<dependency>
	<groupId>no.tornado</groupId>
	<artifactId>tornadofx-controls</artifactId>
	<version>1.0.4</version>
</dependency>

Gradle

compile 'no.tornado:tornadofx-controls:1.0.4'

More Repositories

1

tornadofx

Lightweight JavaFX Framework for Kotlin
Kotlin
3,669
star
2

fxlauncher

Auto updating launcher for JavaFX Applications
Java
707
star
3

tornadofx-samples

Samples and best practices for TornadoFX
Kotlin
195
star
4

tornadofx2

TornadoFX 2.0
Kotlin
152
star
5

tornadofx-guide

TornadoFX Guide
133
star
6

tornadofx-controlsfx

ControlsFX Builder extensions and utilities for TornadoFX
Kotlin
72
star
7

tornadofx-idea-plugin

TornadoFX Plugin for IntelliJ IDEA
Kotlin
72
star
8

todomvc

TodoMVC with TornadoFX
Kotlin
51
star
9

kdbc

SQL DSL for Kotlin
Kotlin
44
star
10

fxldemo

FXLauncher demo application
Java
41
star
11

fxldemo-gradle

FXLauncher demo for Gradle
Java
22
star
12

fxlauncher-gradle-plugin

Gradle plugin for FXLauncher
Groovy
20
star
13

calculator

Calculator written in TornadoFX (JavaFX + Kotlin)
Kotlin
18
star
14

github-browser

TornadoFX GitHub Browser - demo/showcase app
Kotlin
14
star
15

tornadofx-kitchensink

TornadoFX Kitchensink Samples
Kotlin
8
star
16

tooldb

Cutting Tool Database - JDBC demo for TornadoFX
Kotlin
8
star
17

epp-verisign

Verisign EPP Bundle with modifications and bugfixes to support NORID and RRPProxy
Java
7
star
18

tornadofx-web

tornadofx.io web page
CSS
5
star
19

javafx-osgi

JavaFX 8.0 OSGi bundle to support JavaFX in an OSGi container
5
star
20

tornadofaces

Modern JSF Component Framework
Java
4
star
21

tornadofx-hibernate-demo

TornadoFX Hibernate Integration Demo
Kotlin
4
star
22

tornadofx-android-compat

Initial commit
Java
4
star
23

tornadofx-quickstart-archetype

Initial commit
Kotlin
3
star
24

libsass-filter

Compiles SASS to CSS on-the-fly
Java
3
star
25

fxlauncher-custom-ui

Demo project showing how to customize the FXLauncher update UI.
Java
3
star
26

tornadofx-charts

TornadoFX Bindings for Hansolo's excellent chart library
Kotlin
3
star
27

kdbc-examples

Examples for KDBC
Kotlin
2
star
28

tornadofx-controls-sampler

TornadoFX Controls Sampler Application
Java
2
star
29

interapp

Dynamic, Modular Microservices with Java EE
Java
2
star
30

dyndns

Tornado DynDNS Client uses the standard DNS protocol to perform dynamic DNS updates
Java
2
star
31

ahkpok3r

AutoHotKey Script to turn any keyboard into a POK3R (Arrow Keys, PgUp/PgDn/Home/End/Ins/Del)
AutoHotkey
2
star
32

edmacs

Edvin's Emacs configuration
Emacs Lisp
1
star
33

tornadofx-java

Deprecated, see tornadofx!
Java
1
star
34

tornadokeyboard-userstore

Kotlin
1
star