Friday, August 23, 2013

Blossom 3 alpha 1 released

I have just released the first alpha of Blossom 3.

Blossom 3 is a major update that brings support for Magnolia 5. In particular the new dialogs introduced as part of the brand new user interface.

Blossom 3 builds on Magnolia 5.1, which is also in development and both will be released this September in time for this years Magnolia conference.

The new user interface is built using Vaadin. A component based UI toolkit where the components run on the server and renders on the client using Google web toolkit. This makes it much easier than before to develop custom fields for your projects.

In previous versions of Blossom you would create and configure controls, now instead you build an object model that defines how the dialog and its fields should appear and behave. This definition
model is then used as a blueprint to create and configure Vaadin components.

For composing the definition model Blossom 3 uses a builder style API that creates a more fluent programming style. A new set of classes replaces the previous API. These classes include a new TabBuilder and DialogBuilder and provides builders for each of the built-in fields, making it easier to configure properties on the fields.

@TabFactory("Content")
public void contentTab(UiConfig cfg, TabBuilder tab) {
    tab.fields(
            cfg.fields.text("title").label("Title"),
            cfg.fields.checkbox("hideInNavigation").label("Hide in navigation").description("Check this box to hide this page in navigation")
    );
}


The fields now have much better support for validation which is why @TabValidator and @DialogValidator have been removed in this version.

@TabFactory("Content")
public void contentTab(UiConfig cfg, TabBuilder tab) {

    tab.fields(
            cfg.fields.text("title").label("Title").validator(
                    cfg.validators.email().errorMessage("A title is required")
            ),
            cfg.fields.checkbox("hideInNavigation").label("Hide in navigation").description("Check this box to hide this page in navigation")
    );
}


Using Springs freemarker macros for forms is now straight forward. When rendering freemarker views Blossom will expose a RequestContext object which these macros require, it will also expose everything in the model as request attributes. This feature is enabled by default but can be switched off on the FreemarkerTemplateViewRenderer..

The multipart support that bridges Springs multipart handling to the multipart support in Magnolia has been updated for API changes in Spring 3.1.

The sample has also been updated and as always, this is the best place to start.

Get the source and start it up with these commands:

git clone http://git.magnolia-cms.com/git/modules/blossom/samples.git
cd samples
git checkout magnolia-blossom-samples-3.0-alpha1
mvn install
cd magnolia-blossom-sample-webapp
mvn jetty:run-war

UPDATE: When running it like this from the command line you might run into issues where the application does not have enough memory, especially in the perm gen pool. To get around that do this first:

export MAVEN_OPTS="-XX:+CMSClassUnloadingEnabled -XX:PermSize=256M -XX:MaxPermSize=512M -Xmx512m"

UPDATE 2: The alpha1 release of Blossom builds on the alpha1 release of Magnolia 5.1. If you need to use a more recent build of Magnolia 5.1 you should use the corresponding Blossom release or use the latest SNAPSHOT.


Stay tuned!

No comments:

Post a Comment