Uncategorized

What’s New in BootsFaces 0.9.0?

Fork me on GitHubAfter seven weeks of hard work, we’ve published BootsFaces 0.9.0. It’s a major improvement over BootsFaces 0.8.6. Unfortunately, a little error slipped through our QA gate: It seems we’ve involuntarily published a Java 8 version. If you are using Java 6 or 7, you’ll have to wait until 0.9.1 comes out in a few weeks, or you may use the developer snapshot on Maven Central. It was a small bug, easy enough to fix it within a day.

While BootsFaces 0.9.0 is more than a bug-fix version, it clearly concentrates on polishing BootsFaces, removing bugs and finishing things we had started in previous versions. That’s not a small achievement: Fork me on GitHub the number of commits on GitHub went from 856 (BootsFaces 0.8.6) to 1028. And that’s only the base library. The showcase has improved a lot, too. And we’ve managed to finish a component many developers desperately need: <b:dataTable />. What makes this component unique in the JSF world is that it is rendered on the client. That makes it feel a lot faster and much more responsive than traditional server-side data tables. We’ve already received a lot of bug reports and enhancement requests, even during the development phase. Thus I’m sure the data table will remain in our focus during the new few updates of BootsFaces.

A more liberal license

Probably the most important point of BootsFaces 0.9.0 is the license. Now, BootsFaces is available under an Apache V2 license being a lot more liberal than the old GPL V3 license. For example, you can use BootsFaces in commercial products without further ado.

Download coordinates

Before starting the long list of details, let me provide you with the download coordinates:

Add these lines to your project’s pom.xml:

<dependency>
    <groupId>net.bootsfaces</groupId>
    <artifactId>bootsfaces</artifactId>
    <version>0.9.0</version>
    <scope>compile</scope>
</dependency>

Add this line to your project’s .gradle build file:

compile 'net.bootsfaces:bootsfaces:0.9.0'

The BootsFaces project comes with both a Gradle build file and a Maven build file. The Maven pom.xml is the easy way to get started and should suffice for most purposes. Only if you want to tweak and optimize BootsFaces, you need the Gradle build. In particular, the Maven build doesn’t generate the CSS and JS files itself, but relies on the output of the Gradle build. By the way, that’s the reason why we keep the generated file in GitHub.

In any case, the URL of the repository is https://github.com/TheCoder4eu/BootsFaces-OSP.


Download coordinates of the developer snapshot

Like mentioned above, we’ve already provided a version of BootsFaces that’s compatible with both Java 6 and Java 7. It’s available on the “sneak preview” snapshot repository of Maven Central. Follow the link to learn how to get the sneap preview version.

<dependency>
    <groupId>net.bootsfaces</groupId>
    <artifactId>bootsfaces</artifactId>
    <version>0.9.1-SNAPSHOT</version>
    <scope>compile</scope>
</dependency>

Big tickets

There are a couple of big tickets:

  • We’ve finished the datatable and the tree widgets.
  • We’ve started to implement components explicitely addressing mobile devices. BootsFaces 0.9.0 offers <b:shake /> and <b:gyroscope />. The first component enables JSF applications to react to shake gestures, whereas the second component enables you to detect the rotation of your smartphone. Traditionally, both features are only accessible to JavaScript programmers. We are very curious how JSF developers are going to use these components.
  • We’ve added a lot of attributes to almost every component. Now, every visible component has a style and a style-class attribute. Complex components even have several sets of style attribute (e.g. for the header, the footer and the content area).
  • Most visible components now directly support the responsive attributes like col-md="12" or visible=">=md". That’s equivalent to wrapping the components in a <b:column />, but it’s less keystrokes for you, and in some cases it’s even more efficient HTML code.

JAAS

JAAS is a popular authorization standard requiring a very specific login form. Earlier versions of BootsFaces couldn’t be used with JAAS because BootsFaces rendered the wrong name attribute in the HTML code. We’ve added an option to support JAAS.

Relaxed, HTML5-like coding style

A detail making JSF a bit clumsy is the need to precede every JSF component with a prefix. JSF 2.2 adds a new, HTML5-like coding style using pass-through elements. BootsFaces 0.9.0 optionally takes this to another level. You can omit the b: prefix of every BootsFaces element, and some standard HTML elements are automatically converted to their BootsFaces counterparts. In particular, the <b:selectOneMenu /> benefits from that. If you’re like me, you can’t remember the name of the component. If you activate the optional relaxed coding style of BootsFaces, you don’t have to remember the name. A simple HTML <select /> element is automatically converted to a BootsFaces JSF element:

<well>
  <form id="loginForm">
    <row>
        <inputText id="usernameDiv" small-screen="half"
                     value=""
                     label="Username"/>
        <message for="@previous" small-screen="half"/>
    </row>
    <row>
        <inputSecret id="passwordDiv" small-screen="half"
                       value=""
                       label="Password"/>
        <message for="passwordDiv" small-screen="half"/>
     </row>
    <row>
       <select small-screen="half" label="Login as">
            <option itemLabel="(Please select)" itemValue="" />
            <option value="1" label="admin"/>
            <option value="2" label="customer" />
            <option value="3" label="user" />
       </select>
    </row>
    <row>
        <column small-screen="full-width">
        <button update="@form:loginForm" value="Login" onclick="ajax:loginBean.login2()" look="primary"/>
        </column>
    </row> 
  </form>
</well>

However, there’s a catch: Probably your IDE will complain about the source code. For instance, NetBeans checks the HTML very strict. You have to deactivate this syntax check (which is too strict anyway, given that you can define custom HTML elements since a couple of years). Eclipse presents another nuisance: the HTML formatter usually scrambles your source code beyond recognition, so you can use it with the relaxed coding style.

New search expressions

We’ve added three search expressions:

  • @id is a synonym for **:id. We’ve added the synonym in order to improve the compatibility to PrimeFaces, which introduced @id with version 6.0.
  • @before and @after allow to to update several components in the same row of the screen at once. More precisely, @after adresses every component following the current component in the same level of the JSF tree. Depending on your JSF code, that’s often the rest of the row (if you use <b:row /> or the rest of the panel grid (if you use <b:panelGrid/>). @after comes in handy to activate or deactivate input fields depending on a checkbox.

Typeahead and tags

We’ve integrated an important feature after crossing the official deadline. <b:inputText /> now supports both an autocompletion feature and tags. This is a very recent addition, so it’s neither bug-free nor finished, but even so, it’s already useful enough to be included.

Under the hood

The internal component structure was refactored in BootsFaces 0.9.0 in order to make development more flexible. Most of the component classes now are split into a fully generated class containing the attribute list, and a small class containing manual customizations of the standard classes. Most likely you won’t notice this unless you start developing BootsFaces components yourself. An astonishing number of developers do so. We’ve received (and integrated) quite a few pull requests recently. Thanks to everyone who contributed to the project by asking questions, reporting bugs, proposing idea, or even contributing code! Without your valuable help BootsFaces wouldn’t be where it is today!

By the way: if you read these announcements regularly, you probably remember similar statements from earlier blog posts. BootsFaces has become a lot of code, including 66 components, so each refactoring or restructuration usually takes a long time.

Another important improvement is the optimized Gradle build. Having to support 13 BootsWatch themes forced us to modify the Gradle build. Now it’s faster, can compile the library with the Java language level you need (i.e. Java 6, 7, or 8) and it supports different versions of jQuery. The Maven build of BootsFaces still only contains jQuery 1.x. The Gradle build can replace it with jQuery 2 and even the brand-new alpha version jQuery 3.

Wrapping it up

BootsFaces 0.9.0 may be more evolution than revolution, but it’s an interesting release nonetheless. We’ve closed 57 issues since 0.8.6 within the last seven weeks only. Unfortunately, the number of open issues doesn’t seem to decline. We’re a victim of our own success. The more popular BootsFaces gets, the more developers use it for their daily work. This, in turn, means more bugs found and more suggestions how to improve the library. Almost every second open issue on our bug tracker is not a bug, but a request to add a new feature.

Talking of success: the number of download rises every month. In May, it crossed the 2.000 mark, totaling 2157 downloads of BootsFaces.


Dig deeper

BootsFaces project page
BootsFaces showcase (aka know as manual)
BootsFaces on GitHub
BootsFaces bugtracker
Sourcecode of the showcase
BootsFaces example projects

Leave a Reply

Your email address will not be published.