Yesterday, we released version 0.8 of Dolphin Platform. The version contains several bugfixes and some new features.
The biggest new feature is the support of Java Bean Validation (JSR-303). For this feature we introduce a new module to Dolphin Platform that you can easily be added to your application dependencies:
Once this is done you can use bean validation in the model layer. By doing so you can define your beans like this:
As you can see the @NotNull annotation is added to the property in the bean class. By doing so you can simply validate instances of the bean by using a Validator.
Currently not all validation annotations are supported but this is just an open todo. At the moment the following annotations are supported:
For more information about the bean validation support in Dolphin Platform you should have a look at the readme.
For version 0.8 we added a lot of functionality to the JavaFX binding layer. Based on this it’s now possible to simply bind a JavaFX list to an observable list of the Dolphin Platform model layer. Only one line if code is needed for this:
Plus, we added support for converters. You can bind properties of lists of a different type to each other. This is interesting if you want to bind UI specific classes to the model layer. When using the JavaFX chart API the data model of the charts is defined by JavaFX specific classes. Since you don’t want to have this classes in the model layer that is shared between client and server you can simply define a converter and bind the model of a chart to your custom bean type. Using such a converter is as easy as a normal binding:
Next to this we added some minor features like new convenience methods in the ObservableList and fixed some bugs. A complete list of the changes can be found here.
Comments Off on Dolphin Platform 0.8 has been released | RIA Blog | Permalink Posted by admin
When creating a new control or a complete application I often ask myself what colors I should use for visualization. When defining a control, the best solution is to provide properties for all colors so that a developer that uses the component can configure it to match the needed color scheme. But still when developing only a control you should provide a color scheme as a default configuration. In this case it’s important that the colors of the default configuration fit to each other. If you develop a complete application the selection of a specific color scheme is even more important. Sometimes you will get some defaults by your customer but in other projects it might be your part to define a nice selection of colors. If I need to do this I’m always happy about some help and inspiration. Today it’s quite easy to get this help for free since there are some good online resources that can be used to pick some colors or a complete scheme for your application or control. Today I want to introduce 2 of them.
Material Design Color Palette
For the Material Design style Google create a style guide with a lot of information how components, layouts, colors, and animation should look and behave. One part of this specification defines how colors should be used in the Material Design style and what colors should be used together. You can find the description here. In this documentation Google provides a color palette that should be used in Material Design. This color palette defines several basic colors ands adds several accents colors to each basic color. Here is an example:
If you now need to define a component or an application you can simply choose one of the base colors and create subparts or effects by using the accents colors. Lets say you create a special error button. As the base color of the button you choose the red color as it’s defined as a base color in the palette. But then you need several additional color definitions that define a pressed state of the button or a glow if the button is focused, for example. Here you can easily use the accents colors for red. If you are a JavaFX developer you can simply use a little tool by Gerrit Grundwald to pick the needed colors.
Next to the color palette the Material design specification defines general light and dark theme. The colors that are shown here are quite helpful to create basic parts of a control or application like panes and menus. The following picture shows an example of the dark theme:
Another very helpful tool to create a complete color scheme is the Coolors web application. This application let you simple create new color schemes or choose an scheme that was created by the community.
When creating your own scheme you start the generator that shows a random scheme with 5 colors. By pressing space a new scheme will be generated and appears on the screen.
Whenever a scheme contains one or more colors that look good you can lock them. By doing so they won’t change anymore and with the next scheme generation only the colors that are not locked will change. Since all the colors in a scheme always fit to each other it’s quite easy to create a custom color scheme by using this tool.
Starting with a new technology is often hard. Even if the technology is documented and follows the pattern and structures that you already know from other APIs or frameworks the initial start is always a problem. To simplify this start when working with the Dolphin Platform, we created a first Maven archetype that creates a simple client server application.
This application is an ideal starting point to play with the Dolphin Platform framework, learn the APIs or directly start your own application based on Dolphin Platform.
The Maven multi module project that is created by using this first archetype contains a Spring Boot based server and a JavaFX client. With this archetype you can create your own project directly in an IDE like IntelliJ or by using the shell. If you want to use the shell you need maven on your system. IDEs like IntelliJ contain a bundled Maven instance and you don’t need to install anything on your system (without the IDE).
The following video shows how you can create your first Dolphin Platform application in 1 minute by using IntelliJ:
We will post about other IDE and the commandline usage later.
In modern UI’s you can often find round avatar images like shown in this image:
Creating these special UI nodes with JavaFX isn’t that hard. The most important JavaFX features to create such a rounded image is clipping. By using clipping you can define the area in that a control can draw it’s content. A clip can be any shape and you only need to set the shape property of a JavaFX Node instance to define its clipping. You can find an additional clipping description here.
Let’s start creating the component. As a first step we will define a Circle shape as a clip and define it for an ImageView instance:
In addition a border should be added to the component. To do so we add one (or several) Circle shapes on top of the ImageView:
In the JavaFX code you can simply bind the bounds of the image to the bounds of the clip and the circle instances that are used as a border.