• Home
  • Events
  • About
  • And Griffon beget Basilisk

    October 9th, 2015

    I’ve been keeping an eye on JavaFXports ever since Johan announced the project. From time to time I test the latest builds to see how the project grows. A few months ago we had a breakthrough with Griffon and the jfxmobile plugin; after a few tweaks (and some API changes from Griffon’s side) it was clear that running Griffon on an iOS device was no longer a wild dream, but rather a reality.

    So what about those API changes? There were actually not that widespread, actually they were concentrated to a particular set of common, standard APIs that every Java SE developer knows and encounters almost ever single day: the java.beans package. For historical and practical reasons RoboVM relies on the Android SDK to enable Java (and JavaFX) to run on Android and iOS devices. This brings along some of the restrictions Android users know by heart: black listed classes such as the ones contained in the aforementioned package. The only way to make things work was to replace the black listed API with something that’s functionally equivalent but with a different name, and so openbeans got into the picture. Funny thing, this package contains code from Apache Harmony, the alternate “Java” implementation that never was.

    Anyway, it was clear that a breakage in compatibility was needed in order to allow Griffon applications to reach out into the mobile space with JavaFXports’ help. We’re over a year now since Griffon 2.0.0 was released; the 2.x line broke compatibility with the previous series, and the team thinks we still have a few more releases before we decide to break compatibility again for 3.0.0, if needed be. But we don’t want to wait long in order to enjoy the benefits of Griffon on mobile, so we came up with a different plan: fork Griffon.

    Basilisk is a fork of the Griffon 2 codebase (2.5.0-SNAPSHOT as we speak) that aims to bring the Griffon experience to mobile/desktop application development. Basilisk targets Java8 and JavaFX8 specifically, any Java developer will be able to pick it up quite easily.

    For now, the differences between Griffon and Basilisk are minimal, besides the package renaming and the usage of openbeans almost everything else is the same. Migrating between one framework to the other can be done with a small set of steps:

    • s/org.codehaus.griffon/org.kordamp.basilik/
    • s/griffon/basilisk/i

    We expect Basilisk to grow on its own, sporting features that make sense for desktop and mobile environments. It will be possible to migrate features between Griffon and Basilisk, so that porting applications will remain an easy task. While Griffon remains as the preferred solution for building all kind of desktop applications, from the very small to the full fledged, enterprise ready ones, we foresee Basilisk taking its place as the choice for developers that need to build applications that cross between desktop and mobile spaces.

    There’s no release yet for Basilisk; there are still some migration aspects to be taken care of, such as the guide and documentation, however you can take Basilisk for a spin right now by simply cloning https://github.com/basilisk-fw/basilisk.git and building your own version. It’s as simple as

    $ curl -s http://get.sdkman.io | bash
    $ sdkman install gradle
    $ git clone https://github.com/basilisk-fw/basilisk.git
    $ cd basilisk
    $ gradle publishToMavenLocal
    $ gradle installAllTemplates

    After this you can use the provided templates to create and test an application

    $ sdkman install lazybones
    $ lazybones create basilisk-javafx-ios 0.1.0-SNAPSHOT sample
    $ cd sample
    $ gradle launchIPhoneSimulator

    Don’t be fooled by the low version number, Basilisk comes from a fine codebase lineage that includes Griffon (2008) and Grails (2005), it’s pretty mature as you will see.

    These are exciting times to be building Java(FX) applications for desktop and mobile.

    Keep on Groovying!

    Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
    • email
    • Print
    • Twitter
    • LinkedIn
    • XING
    • Facebook
    • Google Bookmarks

    Čaj – expect(yourTests).to.be(“simple”);

    October 6th, 2015

    Today, Michael Heinrichs release an initial version of Čaj, a Java library that allows you to formulate expectations about your code in your tests.

    Expectations formulated with Čaj are straightforward to read and simple to understand. Here are a few examples:

    You can find out more on Čaj’s GitHub page.

    Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
    • email
    • Print
    • Twitter
    • LinkedIn
    • XING
    • Facebook
    • Google Bookmarks

    Dolphin Platform: A Sneak Peek of the view API

    October 6th, 2015

    The last days, we blogged about the different APIs of the Dolphin Platform. The Dolphin Platform is a new Open Source Framework by Canoo that will be released the next weeks. But one part is still missing: the view. Therefore I will show how you can create JavaFX based clients by using the Dolphin Platform. As already mentioned the Dolphin Platform will provide support for several client platforms like JavaFX, AngularJS or Polymer.

    In this blog post, we will focus on the JavaFX support. Other client libraries and APIs will be described in future posts.

    The View API

    Last but not least we will show how a view will be coded based on the Dolphin Platform. The client specific APIs differ in some points because we want to support the core concepts of the underlying UI toolkit. One of the most important points is that a developer can use the concepts he already knows and therefore we decided to not provide the exact same API for all client types. But when having a deeper look at the Dolphin Platform client libraries you will realize that the core and low level APIs are the same on all platforms. In this first overview we will give a short sample how a view can be coded in JavaFX.

    When creating a JavaFX client you will normally use FXML to create your view. Next to the FXML file you will have a view controller to bind all the properties of the view and attach action handlers.

    When talking about the Dolphin Platform, this view controller is the perfect point to bind the view to the synchronized model and the server side controller. Thus, we call this class the “Binder”. There are several ways how you can define such a binding but the most easy one is to use extend the AbstractBinder class that is part of the Dolphin Platform JavaFX library. This class already implements the complete lifecycle of the view and you can simply bind the synchronized presentation model to your view properties. Here is a small example for a view that contains only one textfield and a button:

    Once the view binder is instantiated the server controller and the model will automatically be created on the server. Since the model will be synchronized all the time between client and server you don’t need to create it on the client. After this initialization is done the onInit() method of the binder will called. Here we bind the the name property that is part of the synchronized model to the text property of the textfield. In addition, we define an action handler for the button. When the button is pressed an action in the server side controller should be called. To do so the abstract binder provides the invoke(String name) method that triggers actions on the server controller. In this specific case the server controller might look like this:

    As you can see we never send any data to the server. Since the model will be automatically synchronized we can directly store the name string in the model to the database. The Dolphin Platform guarantees that the model will be the same as it’s on the client when pressing the button.

    Another nice benefit that you might notice is that even if we have communication between the server and the client we don’t need to handle several threads. The Dolphin Platform handles all the concurrency and handles all actions in the right thread. With this procedure, the binding between JavaFX properties and Dolphin properties will automatically be handled on the JavaFX application thread.

    We hope this post gives a first overview how a client can be created. As already said the Dolphin Platform will provide support for several client platforms like JavaFX, AngularJS or Polymer. I will blog about the specific client APIs in future posts.

    Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
    • email
    • Print
    • Twitter
    • LinkedIn
    • XING
    • Facebook
    • Google Bookmarks

    Dolphin Platform: A Sneak Peek of the model API

    October 5th, 2015

    Before we will talk the first time about the Dolphin Platform today at Java Forum Nord we will use the time to post the next preview. In this blog post, we will give a short overview about the model API of the Dolphin Platform. The last days we already gave a general overview and described how the controller API of Dolphin Platform is working.

    The Model API

    To describe the API that helps you to define presentation models in Dolphin Platform we will start with an example. Let’s say we have the following view that can be part of a photo library app:

    In this view we have several elements that need a data model. If the data of this app is stored on a server the data model must be shared between the client and the server. When having a look at the screen we can see 3 different elements that need data from the data model to visualize itself or provide user interaction:

    • The title of the screen needs a String as its content. Here we can display the title of a photo album or an internationalized string
    • The slider that defines a value. Let’s imagine that the interaction with the slider changes the size of the pictures in the main area. Maybe the last value of the slider should be stored on the server to automatically save user preferences
    • All pictures in the main area. As you can see each card in this area contains an image and maybe a badge in the top right corner. A badge element in the top right corner visualizes if the photo is flagged.

    Based on this definition we would create a presentation model that might look like this one:

    When defining such a model in JavaFX you can use the cool property API and the observable collections that are part of JavaFX. Modern javaScript frameworks like AngularJS or Polymer provide a similar behavior and therefore we decided to offer the same benefits when defining model with the Dolphin Platform. Since Michael Heinrichs was the project lead of the property and bindings APIs of JavaFX at Oracle we had a lot of knowledge in this area that helped us creating the model API: In Dolphin Platform you work with properties and observable collections, too. Therefore it really easy to define a hierarchical model for your view. A model for the shown view might look like this:

    All properties and collections in Dolphin Platform are observable and therefore it’s quite easy to observe them on the client and the server:

    For all client APIs we support first class support for the Dolphin Platform properties. When working with JavaFX for example it’s quite easy and intuitive to bind a synchronized Dolphin Platform property to a JavaFX property:

    On JavaScript clients the handling is even more elegant as you can bind the Dolphin Platform model directly in HTML.

    The main benefit of this concept is that you can use the same model classes on the server and the client. Because the model will automatically be synchronized between the view and the server controller it feels like you work with the same instance. By doing so you can simply bind a string property to a textfield in the view and observe it’s value on the server. The change events will automatically be fired on the server when you start typing in the textfield.

    There are a lot of more cool features in the model API. There are only a few weeks left till JavaOne where we will release a whole preview with the source, documentation and several samples. As the next step we will post a preview of the view API the next days.

    Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
    • email
    • Print
    • Twitter
    • LinkedIn
    • XING
    • Facebook
    • Google Bookmarks

    Dolphin Platform: A Sneak Peek of the controller API

    October 4th, 2015

    Today, we want to add the next sneak peek of the Dolphin Platform, a new open source project Michael Heinrich and Hendrik Ebbers are currently working on. Yesterday, we blogged about the general concept of the platform. This blog post will show how server side controllers can be defined using the Dolphin Platform.

    The Controller API

    As already said, the controllers are defined on the server. If you already used JSF you might know this concept. But don’t be afraid, we won’t compare Dolphin Platform with JSF.

    Each controller must be annotated with the @DolphinController annotation and therefore the most simple controller might look like this:

    Even if this class doesn’t make that much sense, we created a complete runnable Dolphin Platform server application here. Once this is deployed the underlying platform (currently JavaEE or Spring) will automatically find your container and manage its lifecycle. This is done by the architecture of Dolphin Platform that provides a public API and specific bootstrap implementations for JavaEE and Spring. As a developer you will always code against the public API and only need to add the needed bootrap module as a dependency to your server application.

    This means that the shown controller will work in any Spring or JavaEE 7 environment.

    Since the controllers are managed by the container you automatically get all the benefits that comes with it. This means that you can use @Inject or @PostContruct annotations, for example:

    Next to this Dolphin Platform provides additional features for the controller API. Any method that is annotated by @DolphinAction can be called from the client view to trigger some actions on user interaction, for example:

    Thus, it’s very easy to handle the business logic that will be triggered by a user action. Since the methods are defined on the server you benefit of security and transaction support, for example.

    Next to the actions a main concept of the Dolphin Platform is the presentation model (or view model). Each view-controller-pair can define it’s own model that can simply be injected in the controller by using the @DolphinModel annotation. We will see later how such a model can be defined. When injecting a model to the controller its lifecycle is bound to the lifecycle of the controller and will be automatically managed by the underlying platform.

    With this procedure, the model instance will automatically be created when a new controller instance will be created. If the controller will be destroyed by the container the model will be destroyed, too. In addition, the model will automatically be synchronized between the server controller and the view on the client side. How the model can be accessed and handled on the client will be part of a future post.

    I think the biggest benefit in the shown concept is the perfect integration in a web container like it is provided by Spring or JavaEE. All your controller (and model) instances will be managed by the container and it’s no problem to inject a spring service in your controller, for example. With this, you can use an API like Spring data and fill your view model directly with data from your persistence.

    In the next preview we will show how a view model can be defined by using Dolphin Platform and how you can simply observe any view model on the server and client.

    Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
    • email
    • Print
    • Twitter
    • LinkedIn
    • XING
    • Facebook
    • Google Bookmarks

    css.php