Releases: edvin/tornadofx
TornadoFX 1.7.0
Important version note
TornadoFX Version 1.7.0 requires Kotlin 1.1. Make sure you update your IDE plugins to minimum:
- Kotlin Plugin: 1.1.0-release
- TornadoFX Plugin: 1.6.2.2
After updating IntelliJ IDEA, make sure your Kotlin target version is 1.1 (Project Settings -> Modules -> Kotlin -> Language Version / API Version)
You also need a full rebuild of your code. If you run into trouble, try to clean caches and restart IDEA (File -> Invalidate caches / Restart).
Changes in this version
- EventTarget.bindComponents(sourceList, converter) syncs the child nodes of the event target to the given observable list of UIComponents via the converter
- EventTarget.bindChildren(sourceList, converter) syncs the child nodes of the event target to the given observable list via the converter
- ObservableList.bind(sourceList, converter) syncs two lists and converts from one type to another on the fly
- API Break: Removed Node.margin helper because it shadowed margin property on Nodes which had their own margin property
- ValidationContext.validate() has optional
decorateErrors
parameter - ValidationContext and ViewModel has
valid
observable boolean value - Kotlin 1.1 dependency
- Added MenuItem.visibleWhen
- Fixed:
workspace.dockInNewScope(params)
operates on current scope instead of the new buttonbar
builder inform
now creates and operates on aButtonBar
contextmenu
builder now works on any Node, not just Control- EventBus
subscribe(times = n)
parameter will unregister listener after it has firedn
times (http://stackoverflow.com/questions/42465786/how-to-unsubscribe-events-in-tornadofx) - TextInputControl
trimWhitespace()
,stripWhitespace()
,stripNonNumeric()
,stripNonInteger
continually strips or trims whitespace in inputs - JSON
datetime
function has optionalmillis
parameter to convert to/from milliseconds since epoch instead of seconds JsonConfig.DefaultDateTimeMillis = true
will causedatetime
to convert to/from milliseconds since epoch by default- Improved Form prefWidth calculations
- MenuItem.enableWhen function
- Custom tab support for Views. Views can be docked in tabs and even delegate to refreshable and savable for the surrounding View
- resources stream/url/get helpers are not non-nullable
- Added resources helper to App class
- Added TrayIcon support (https://gitallhub.com/edvin/tornadofx/issues/255)
- EventBus
fire()
function is now available from the App class ComboBox.makeAutocompletable()
TornadoFX 1.6.2
- resizeColumnsToFitContent takes nested columns into account
- SmartResize.POLICY takes nested columns into account
- scrollpane builder now has fitToWidth and fitToHeight params
- typesafe pojo column builders for TableView and TreeTableView eg. column( "Name", MyPojo::getName )
- spinner builders takes property param
include(fxmlFile)
builder supportfxml()
Views now supports nested includes / controllers injected viafxid()
(name of controller isfx:id
+ "Controler")- SqueezeBox.fillHeight property
- Added svgicon builder
- Removed Node.alignment helper, it was misleading
- Added collapsible parameter to titledpane builder
- Added Component.hostServices property to access a JavaFX HostServices instance
- Improved TableView.column builder so it finds mutable properties even when constructor params with same name is present (#247)
- Workspace.viewStack is public
- Workspace detects dynamic components anywhere inside the WorkspaceArea
- TableView.selectOnDrag() will select rows or columns depending on the current selection mode
- resources.text, resources.image and resources.imageview helpers
- Workspace has NavigationMode Stack (default) and Tabs
closeModal()
deprecated in favor ofclose()
since it will also close tabs and non-modal + internal windows- SqueezeBox has multiselect option (still defaults to true)
- ContextMenu.checkboxmenuitem builder
- UIComponent.icon property used by Workspace and Drawer
- Workspace Drawer support (workspace.leftDrawer/rightDrawer)
- Drawer component
- SqueezeBox panes are now
closeable
- Form buttonbar alignment is now working correctly
- UIComponent.currentWindow property
- openModal/openWindow defaults to currentWindow as owner (#246)
- Accordion.fold has
expanded
parameter - Fixed: ComboBox with cellFormat does not show bound element (#245)
TornadoFX 1.6.1
- whenSaved and whenRefreshed lambdas as alternative to overriding onSave and onRefresh
- Workspace onSave and onDock delegates to the docked View
- InputStream.toJSON and .toJSONArray + resources.json(key) and resources.jsonArray(key)
- Color.derive and Color.ladder
- Rest.Response implements Closeable so it can be
use
ed (#237) - UIComponent
disableSave()
anddisableRefresh()
- can now bind to a pojo by providing only a single getter ( eg. person.observable( JavaPerson::getId ) )
- API break: previously returned a PojoProperty - now returns an ObjectProperty
- uses javafx.beans.property.adapter.JavaBeanObjectPropertyBuilder and will now propogate PropertyChangeEvents from the pojo
- UIComponent.headingProperty is ObservableValue for easier binding
field
builder supportsorientation
parameter which will cause input container to be a VBox instead of an HBox (#190)- UIComponents can now be instantiated manually instead of via inject() and find()
- Input Control builders now support ObservableValue instead of just Property for automatic binding
- ListView.useCheckbox()
- ItemViewModel.asyncItem helper to reload the underlying item
- Corrected Workspace.dockInNewScope, docking was performed in the old scope (!)
TornadoFX 1.6.0
This is the most feature packed release we have ever done! It includes some major features like Workspaces, TableView EditModel and a large number of fixes and improvements.
We also made an API break, hence the 1.6.0 version number: View params are now map(property-ref, value) instead of vararg Pair(String, value) This is a pretty new feature that probably hasn't seen wide spread usage, so we found it best to clean up the API now.
We added a new MenuItem builder called item
which works like the other builders - the op
block operates on the MenuItem, so you can call setOnAction
to specify the action. This is in contrast to the old builder called menuitem
where the op
block represents the action. The new item
builder allows the menu text to bound to an observable string and introduces an easier way to dynamically disable the item via disableWhen
callback.
Here is the full list of changes. Please allow us some time to update the guide with all these new goodies :)
- Workspaces (https://edvin.gitbooks.io/tornadofx-guide/content/16.%20Workspaces.html)
- OpenXXX functions: Windows opens centered over owner if owner is passed in as parameter (#231)
- API break: View params are now map(property-ref, value) instead of vararg Pair(String, value)
- menu builder correctly supports sub-menus
- Introduced
item
menu item builder, should be used in favor ofmenuitem
, which took the onAction callback insteadof an operation on the MenuItem as the op block parameter (breaks with the other builders) - menu builder accepts graphic parameter
- ViewModel autocommit bindings doesn't affect dirty state any more
- buttonbar builder for forms
- ItemViewModel constructor takes optional initial value
ObservableList.asyncItems
andListProperty.asyncItems
confirm()
function that executes an action if the user confirms- di delegate overload to support injecting a dependency by name (in addition to type)
builderFragment
andbuilderWindow
builders - fragment and window by just supplying a title and builderObservableList<T>.onChange
to easy listening to change events from observable listssetInScope()
now uses correct KClass when entering the injectable into the components mapItemViewModel.isEmpty
boolean, complementsempty
propertysetStageIcon(icon)
will replace all existing icons with the supplied (#228)TableColumn.useCheckbox(editable = true)
now fires edit/commit events when value is changed- Create nested, observable, writable properties using the
observableValue.select()
function - ViewModel
bind
has optional parameterforceObjectProperty
to avoid creatingIntegerProperty
for ints etc, so you can have nullable values TableView.onEditCommit()
handler fires when a cell is edited. No need to manage domain object value, just add your business logic- Fixed scope support.
DefaultScope(MyController::class)
orMyController::class.scope(DefaultScope)
- TableColumn hasClass/addClass/removeClass/toggleClass supports type safe stylesheets
- Lots of functions that earlier accepted Double now accept Number
- TableView.enableCellEditing() makes table editable and enables cell selection
- TableView.regainFocusAfterEdit() - make sure TableView doesn't look focus after cell edit
- TableColumn.makeEditable(converter) - supply specific converter for editable fields
- TableColumn.converter(converter) - supply specific converter for read only text fields
- TableColumn.makeEditable() supports BigDecimal
- Added scope.set(injectable) as easier alternative to setInScope(injectable, scope)
- tableview builder that takes
ObservableValue<ObservableList<T>>
, supporting automatic rebind when items change - vbox and hbox builders supports any Number as spacing parameter, not just Double
runAsync
exposesTaskStatus
model for binding towards task states: running, message, title, progress, valuerunAsync
now run in the context ofTask
so you can accessupdateMessage()
etc- progressbar and progressindicator builders binds to
Property<Number>
instead ofProperty<Double>
to supportDoubleProperty
- Added
insets()
builder - Fixed a race condition in Slideshow with overlapping transitions (#225)
- Node
onHover { doSomething() }
helper, param is boolean indicating hover state - Node builder bindings: disableWhen, enableWhen, visibleWhen, hiddenWhen, removeWhen
- ObservableValue.toBinding() converts observable boolean to BooleanBinding
- TableCell.useCombobox now supports every kind of Property (bug)
- Observable padding properties for Region
paddingXXXProperty
(top/right/bottom/left/vertical/horizontal/all) - Padding vars for Region: `paddingXXX' (top/right/bottom/left/vertical/horizontal/all)
- Added
proxyprop
helper to create proxied properties - DataGrid
maxCellsInRow
property (also CSS styleable as-fx-max-cells-in-row
) - Added
DataGrid.asyncItems
to load items async with more concise syntax - Added
DataGrid.bindSelected
to bind selected item to another property or ViewModel - Fixed a ViewModel binding bug causing errors if external changes were made to a bound facade
- Added
squeezebox
builder. SqueezeBox is an accordion that allows multiple open titledpanes, added usingfold()
cellCache
supports builders. Earlier, builders would be appended to the ListView, creating undesirable resultsScene.reloadViews()
is removed from the public API, no need to call it manuallytitledpane
builder now accepts op parameter like every other builder. node parameter is now optional- Fieldset.wrapWidth is now Number instead of Double
TornadoFX 1.5.9
This release introduces the EventBus and lots of small improvements and bug fixes.
- UIComponent has
isdockedProperty
andisDocked
boolean telling you if the ui component is currently docked - Added CSS elements to type safe stylesheets so you can now target f.ex HBox even if it doesn't have a CSS class
- Pass parameters to ui components using inject/find. Inject params via
val myParam : Int by param()
in target view. - booleanBinding and stringBinding now adds observable receiver as dependency
- Eventbus:
FXEvent
class withsubscribe()
,unsubscribe
andfire
functions (https://edvin.gitbooks.io/tornadofx-guide/content/15.%20EventBus.html) - InternalWindow is public, closeModal() will also close InternalWindow
setInScope(value, scope)
allows you to preemptively configure an injectable property- Allow Labeled.bind() to work on ObservableValue instead of just Property
- HttpClientEngine now adds default json headers to request
- Fixed Bug: Unconsumed POST requests are not posted to the server completely
- Add Connection: Keep-Alive and User-Agent headers to the default rest client engine
TornadoFX 1.5.8
Lots of improvements and some new control additions in this release :)
- WritableValue.assignIfNull(creatorFn) assigns to the value by calling creator unless it is already non-null
- Button.accelerator(KeyCombination) adds shortcuts to buttons (#205)
- Slideshow component and slideshow builder
- openInternalWindow(SomeOtherView::class) opens a window ontop of the current scene graph
- bindStringProperty respects given format (#210)
- Proxy support for Rest client (Set
client.proxy = Proxy()
) - Pane builder (#208)
- Iterable.style will apply styles to all elements in collection
- Added
Node.alignment
property that knows how to apply alignment depending on the parent - Added
Node.margin
property that knows how to apply margin depending on the parent - canvas builder
- All constraint builders no longer set default values for properties that are not overridden
- Added canvas() builder
- Kotlin 1.0.5-2
- Added
stackpaneConstraints
builder (margin/alignment) (#206) - Added
Node.hgrow
andNode.vgrow
properties (#204) - ComboBox.cellFormat also formats button cell by default with option to override
- UIComponent.openWindow() opens a new modeless Window
- TreeView.bindSelected(itemProperty) and TreeView.bindSelected(itemViewModel)
- Rest POST supports InputStream (#200)
- Removed deprecated
findFragment
- usefind
instead - ViewModel.ignoreDirtyStateProperties list of properties that should not be considered when calculating dirty state
- Removed deprecated
replaceWith
overloads (#199) - Scope support
- ViewModel is now
Component
andInjectable
so it supports injection. - addClass/removeClass/toggleClass now also works for pseudo classes (#198)
- ItemViewModel().bindTo(listCellFragment)
- resources.stream("some-resource") locates InputStream for resource
- Added custom renderers to custom CSS Properties (#203)
TornadoFX 1.5.7
Another release with lots of small improvements and bug fixes.
- Fixed LayoutDebugger not showing debugged scene correctly (#192)
- App.shouldShowPrimaryStage() can be used to initially hide the primary stage
- Node.onDoubleClick handler
- chooseDirectory function
- ListView.bindSelected(itemProperty) and ListView.bindSelected(itemViewModel)
- TableView.bindSelected(itemProperty) and TableView.bindSelected(itemViewModel)
- Added ItemViewModel to reduce boiler plate for ViewModels with one source object
- SortedFilteredList now supports editing writeback to the underlying observable list
- View.replaceWith now updates scene property to support Live Views (#191)
- ViewModel bind return value is now optional to support eventually available items
- ViewModel detects changes to the source object and applies to the model counterpart automatically
- ViewModel
bind(autocommit = true) { .. }
option - Mnemonic in Field labels (form -> field -> input.mnemonicTarget())
- Added ItemFragment and ListCellFragment. Will add TableCellFragment etc shortly.
- Added TreeView.cellDecorator
- Node.hide and Node.show
- Node.toggleClass(class, observableBooleanValue)
- Removed cell as
this
forcellCache
. The cell could change, so taking it into account was a mistake. - App MainView parameter can now be a
Fragment
as well asView
- ListView
cellCache
provider to create a cached graphic node per item - Kotlin 1.0.4
- The
di()
delegate no longer calls out to theDIContainer
for every access, effectively caching the lookup - The
fxid()
delegate can now inject any type, not justEventTarget
subclasses - Added non-null
onChange
overrides for primitiveObservableValue
s - Fixed bug with
Node.fade
reversed animations (was also affectingViewTransitions
) - Deprecated confusing CSS
add
function if favor ofand
TornadoFX 1.5.6
This is another feature packed release with features like the DataGrid component, TableView Row Expander, TableView SmartResize Policy, and lots of all round improvements and fixes. Here is the complete changelog:
- ViewModel.onCommit() function that will be called after a successful commit
- TableView SmartResize Policy (https://github.com/edvin/tornadofx/wiki/TableView-SmartResize)
dynamicContent
builder that will replace content in a Node when an observable value changes- Alternative
TableView.column
builder with auto-conversion to observable value (column("Title", ReturnType::class) { value { it.value.somePropertyOrValue })
- DataGrid component
- TableColumn
cellCache
provider to create a cached graphic node per item - Padding shortcuts (paddingRight, paddingLeft, paddingTop, paddingBottom) to Region
- TableView support for Nested Columns (
nestedColumn(title) { // add child columns here }
) - TableView support for expanded row node (
rowExpander { // create node to show on expand here }
) (https://edvin.gitbooks.io/tornadofx-guide/content/5.%20Builders%20II%20-%20Data%20Controls.html#row-expanders) - Fixed bug where image URLs defined in CSS were rendered wrong
- Added support for skipping snake-casing in CSS rules (names still have to be valid css identifiers)
- Fixed bug where CSS selectors defined with strings would have their capitalization changed (
".testThing"
=>".test-thing"
,cssclass("testThing")
=>.test-thing
) - Updated the
ViewTransition
code to be more flexible (including now working with anyNode
, not justView
s andFragment
s).- Also added several new built in
ViewTransition
s
- Also added several new built in
- Added new
Node
animation helper functions for various transformations - FXML files can now contain
fx:controller
attribute to help with content assist, ifhasControllerAttribute = true
is passed to thefxml
delegate (#179) - Fix exception in chooseFile when user cancels in Multi mode
TornadoFX 1.5.5
- Stylesheets can be loaded via ServiceLoader (
META-INF/services/tornadofx.Stylesheet
with reference to the stylesheet class) - Default constructor was re-added to
tornadofx.App
to supportRun View
in IDEA Plugin resizeColumnsToFitContent
hasafterResize
callback parameter- SortedFilteredList.asyncItems function
- SortedFilteredList can now be assigned as items to tableview/listview builder without calling
bindTo
DefaultErrorHandler.filter
listens to uncaught errors and can consume them to avoid the default error dialog.json.add(key, JsonModel)
automatically converts to JSON- CSS DSL now supports imports through constructor parameters. e.g.
class DialogStyle : StyleSheet(BaseStyle::class) { ... }
- Fixed a bug in
View.replaceWith
which caused the whole scene to change even when for sub views
TornadoFX 1.5.4
This release only fixes an issue with type safe stylesheets in 1.5.3, namely that importStylesheet
would fail unless an OSGi runtime was available on the classpath. These were the changes in 1.5.3:
This release brings some great syntax changes that further reduces boiler plate. You can now define a View like this:
class CustomerEditor : View("Edit Customer") {
override val root = borderpane {
}
}
We finally have great OSGi support - a demo screencast will follow shortly.
Below is a complete list of all improvements and bug fixes.
Important note: This version not binary compatible, so make sure you do a full rebuild of your project. We've had reports some "sticky" IDEA cache, so try to restart your IDE if a rebuild doesn't do it.
Added
App.createPrimaryScene
overridable function to specify how the scene for the primary View is created- OSGI manifest metadata
- LayoutDebugger can edit new Node properties:
spacing
- Stylesheets can be dynamically added at runtime and will affect all active scenes
- Convenience methods for creating bindings on any object. e.g.
stringBinding(person, person.firstNameProperty, person.lastNameProperty) { "$firstName, #lastName" }
- View/Fragment takes optional title in constructor
Changed
- UIComponent.showModal now supports reopening even if modalStage was never removed
fieldset
block now operates on anHBox
instead ofPane
so you can writealignment = Pos.BASELINE_RIGHT
to right-align buttons etc- Set modalStage before showAndWait() (#151)
Parent.find
andUIComponent.find
renamed tolookup
for better alignment with JavaFXlookup
and to avoid confusion withfind(View::class)
- Improved
BorderPane
builders, they also now acceptUIComponent
references instead of instances - Builders now operate on
EventTarget
instead ofPane
and as a result, many builders have improved syntax and functionality - Reduced boilerplate for
App
creation (you can now useclass MyApp : App(MyView::class, Styles::class)
- ViewModel
commit
androllback
run on the UI thread because decorators might be invoked - ViewModel
commit
accepts a function that will be run if the commit is successful find
can now also findFragments
, sofindFragment
is deprecatedlookup
takes an optional op that operates on the UIComponent it foundTreeTableView/TableView.populate
accepts any kind ofIterable<T>
instead ofList