Apr 03

FacesMessage Enhancements

PrimeFaces 3.3 brings handy features regarding displaying facesmessages. These features were already available in PrimeFaces Extensions Project with a different implementation and there was a popular community request to promote these ideas to PrimeFaces. Also during a team meeting last week, our consultants mentioned that they needed at least two of these during their work onsite for a client where they provide onsite assistance on PrimeFaces. Long story short, here are the 3 additions;

Targetable Messages

There maybe times where you need to target a FacesMessage to a specific component, for example suppose you have p:growl and p:messages on same page and you need to display some messages on growl, some on p:messages. We have added grouping defined via for attribute to implement these;

<p:messages for="somekey" />
<p:growl for="anotherkey" />
<p:growl globalOnly="true" />
context.addMessage("somekey", new FacesMessage(FacesMessage.SEVERITY_INFO,"Sample info message", "PrimeFaces Rocks"));
context.addMessage("somekey", new FacesMessage(FacesMessage.SEVERITY_INFO,"Sample info message", "Always bet on Prime"));

context.addMessage("anotherkey", new FacesMessage(FacesMessage.SEVERITY_INFO,"Sample info message", "PrimeFaces is developed by Chuck Norris"));

context.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO,"Sample warn message", "Optimus Prime will be back!"));

So first two messages will be displayed by messages, second one by first growl and last with second growl.

Severity Levels

Using severity attribute of messages components, you can defined which severities can be displayed by the component. So for instance, we are now able to display errors on messages and infos on a growl that fades out.

<p:messages severity="error" />
<p:growl severity="info, warn" />
<p:growl />  //default

Escaping

Until now message components, escape the html content in FacesMessage summary and detail, just set escape to false to display html inside messages.

context.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO,"Sample warn message", "PrimeFaces is developed by <strong>Chuck Norris!</strong>"));
<p:messages escape="false" />

That’s it! Hope you find these features handy, we’ve already started using targeting and severity levels in a project!

Posted in PrimeFaces | 13 Comments
Apr 02

PrimePartners

PrimeFaces is becoming a franchise with a huge user base world wide and to improve our commercial services all around the world, we are glad to announce the new partnership model.

A partner of Prime Teknoloji is a firm with proven JSF-PrimeFaces expertise who can provide the services below;

Training

Delivered by acknowledged trainers using official material created by Prime Teknoloji.

Certification

Provide official trainee certificates on behalf of Prime Teknoloji.

Consulting

Onsite consulting regarding application development with JSF and PrimeFaces.

Enterprise Support

Act as a reseller of PrimeFaces Enterprise Support Package, benefit from reseller fees.

Check out Partners Page on PrimeFaces.org to learn more about this and view the list of current partners.

Posted in PrimeFaces | 2 Comments
Mar 29

More DataTable Hooks

A good component should hide the complexity but keep the flexibility, this is one of the design goals of PrimeFaces.

This is a follow-up post to DataTable Hooks. To start with, see the pagination sample at the mentioned entry.

With each PrimeFaces iteration we are seeing more demand from the community regarding these hooks and for 3.3 we’ve added the following to the datatable;

- rowSelectRadio
- rowSelectCheckbox
- rowUnselectCheckbox
- rowDblselect

In addition to the already existing;

- page
- sort
- filter
- rowSelect
- rowUnselect
- toggleSelect
- colResize
- colReorder

A common request was seeing the row details with a single click and navigating to another page with double click on a row, this is now possible with rowSelect and rowDblselect.

Posted in PrimeFaces | 4 Comments
Mar 22

jQuery Selector API meets JSF

PrimeFaces 3.3 development has begun fast and furious! Starting with the new partial submit feature, we are glad to introduce another extension feature to Ajax Framework called PrimeFaces Selector API in short PFS.

PFS integrates jQuery Selector API with JSF component referencing model, so for partial update and process, referencing JSF components can be done using jQuery Selector API instead of regular JSF model which is based on UIComponent.findComponent.

So how does it work? Syntax is @(selector), here are a couple of examples;

Update all forms

update="@(form)"

Update first form

update="@(form:first)"

Update all components that has “mystyle” style class

update="@(.mystyle)"

Update and process all inputs

update="@(:input)" process="@(:input)"

Update all datatables

update="@(.ui-datatable)"

Process input components inside panel and update panel

process="@(.ui-panel :input)" update="@(.ui-panel)"

Process input components but not select components

process="@(:input:not(select)))"

Process input components that are disabled

process="@(:input:disabled)"

Sky is the limit with this feature, see the jQuery Selector API docs for more information.

Please note that PFS is an additional feature, backward compatible and can be used with regular referencing, so following is also possible;

update="compId :form:compId @(:input)"

In summary, PFS provides an alternative, flexible, grouping based approach to reference components to partially process and update. There is less CPU server load compared to regular referencing because JSF component tree is not traversed on server side to find a component and figure out the client id as PFS is implemented on client side by looking at dom tree. Another advantage is avoiding naming container limitations, just remember the times you’ve faced with cannot find component exception since the component you are looking for is in a different naming container like a form or a datatable. PFS can help you out in tricky situations by following jQuery’s “write less do more” style.

Always Bet On Prime!

Posted in Uncategorized | 20 Comments
Mar 21

PrimeFaces Extensions 0.4.0 Released

PrimeFaces Extensions Team has released the 0.4.0 version of the Extensions project featuring new components, enhancements to existing components and maintenance. Most important feature though is the compatibility with the PrimeFaces 3.2.

See release notes for more information about what is new and check out the online showcase. Official announcement from PrimeFaces Extensions team is here.

Finally if you haven’t already heard about PrimeFaces Extensions, read the intro.

Posted in PrimeFaces | 3 Comments
Mar 20

PrimeFaces Mobile 0.9.2 Released

PrimeFaces Mobile is back with a new release!!! 0.9.2 brings bug fixes, enhancements and  new features.

  • Transition effects (e.g. pop, slide, flip, turn, flow …)
  • Major maintenance on ajax updates in mobile views
  • Various bug fixes
  • Extension points to jQuery Mobile
  • Mini form controls
  • Mobile renderers for selectManyCheckbox and selectOneRadio

Downloads

Please see downloads page for download instructions. Notice that artifact id has been changed to primefaces-mobile.

Documentation

Mobile User’s Guide is updated to cover 0.9.2 and reached 40+ pages.

Roadmap

Next planned release is 1.0. Major feature is loading views with ajax to increase page load for mobile devices, in addition we’ll implement feature requests from PrimeFaces Community.

Posted in PrimeFaces | 9 Comments
Mar 14

Lightweight Requests with PartialSubmit

Core JSF Ajax implementation and PrimeFaces serializes the whole form to build the post data in ajax requests so the same data is posted just like in a non-ajax request. This has a downside in large views where you only need to process/execute a minor part of the view. Assume you have a form with 100 input fields, there is an input field with ajaxbehavior attached processing only itself(@this) and then updates another field onblur. Although only a particular input field is processed, whole form data will be posted with the unnecessary information that would be ignored during server side processing but consume resources.

Upon request of an Enterprise PrimeFaces User who have large JSF pages and trying to reduce the network load, we’ve added partialSubmit feature to PrimeFaces Ajax extensions. This attribute is available in p:ajax and ajax enabled components like buttons, links and more. When enabled and partial processing is defined, only the partially processed components are added to the post data and rest in the same form are ignored. Here is an example;

<h:form id="form">

    <p:log />

    <h:panelGrid columns="5" cellpadding="5">
        <h:outputLabel for="name" value="Name:" style="font-weight:bold"/>

        <p:inputText id="name" value="#{pprBean.firstname}" />

        <p:commandButton value="Default" update="display" />

        <p:commandButton value="Partial" update="display" partialSubmit="true" process="name"/>

        <h:outputText value="#{pprBean.firstname}" id="display" />
    </h:panelGrid>

    <p:inputText />
    <br />
    <p:inputText />
    <br />
    <p:inputText />
    <br />
    <p:inputText />
    <br />
    <p:inputText />
    <br />
    <p:inputText />
    <br />
    <p:inputText />
    <br />
    <p:inputText />
    <br />
    <p:inputText />
    <br />
    <p:inputText />
    <br />
    <p:inputText />
    <br />
    <p:inputTextarea />
    <br />
    <p:inputTextarea />
    <br />
    <p:inputTextarea />
    <br />
    <p:inputTextarea />
    <br />
    <p:inputTextarea />
    <br />
    <p:inputTextarea />
    <br />
    <h:selectOneMenu />
    <br />
    <h:selectOneMenu />
    <br />
    <h:selectOneMenu />
    <br />
    <h:selectOneMenu />
    <br />
    <h:selectOneMenu />
    <br />
    <h:selectOneMenu />
    <br />
    <p:inputText />
    <br />
    <p:inputText />
    <br />
    <p:inputText />
    <br />
    <p:inputText />
    <br />
    <p:inputText />
    <br />
    <p:inputText />
    <br />
    <p:inputText />
    <br />
    <p:inputText />
    <br />
    <p:inputText />
    <br />
    <p:inputText />
    <br />
    <p:inputText />
    <br />
    <p:inputTextarea />
    <br />
    <p:inputTextarea />
    <br />
    <p:inputTextarea />
    <br />
    <p:inputTextarea />
    <br />
    <p:inputTextarea />
    <br />
    <p:inputTextarea />
    <br />
    <h:selectOneMenu />
    <br />
    <h:selectOneMenu />
    <br />
    <h:selectOneMenu />
    <br />
    <h:selectOneMenu />
    <br />
    <h:selectOneMenu />
    <br />
    <h:selectOneMenu />
    <br />

</h:form>

Compare the post data;

Default

javax.faces.partial.ajax=true&javax.faces.source=form%3Aj_idt17&javax.faces.partial.execute=%40all
&javax.faces.partial.render=form%3Adisplay&form%3Aj_idt17=form%3Aj_idt17&form=form&form%3Aname=
&form%3Aj_idt18=&form%3Aj_idt125=&form%3Aj_idt19=&form%3Aj_idt21=&form%3Aj_idt23=&form%3Aj_idt25=
&form%3Aj_idt27=&form%3Aj_idt29=&form%3Aj_idt31=&form%3Aj_idt33=&form%3Aj_idt35=&form%3Aj_idt37=
&form%3Aj_idt39=&form%3Aj_idt41=&form%3Aj_idt43=&form%3Aj_idt45=&form%3Aj_idt47=&form%3Aj_idt61=
&form%3Aj_idt63=&form%3Aj_idt65=&form%3Aj_idt67=&form%3Aj_idt69=&form%3Aj_idt71=&form%3Aj_idt73=
&form%3Aj_idt75=&form%3Aj_idt77=&form%3Aj_idt79=&form%3Aj_idt81=&form%3Aj_idt83=&form%3Aj_idt85=
&form%3Aj_idt87=&form%3Aj_idt89=&form%3Aj_idt91=&form%3Aj_idt93=
&javax.faces.ViewState=140664906657838629%3A-6619052145563305617

Partial

javax.faces.partial.ajax=true&javax.faces.source=form%3Aj_idt124&javax.faces.partial.execute=form%3Aname
&javax.faces.partial.render=form%3Adisplay&form%3Aj_idt124=form%3Aj_idt124&form%3Aname=
&javax.faces.ViewState=140664906657838629%3A-6619052145563305617

End result is same however partialSubmit is significantly more lightweight and difference becomes larger as the form grows with more components. Check out the live demo of partialSubmit and compare the post data displayed in Log components. Once our implementation is solid and stable we have plans to enable partialSubmit by default.

This is one of the 2 new ajax features of 3.3 we’ve mentioned before, stay tuned for the second one. It’s really cool!

Update: partialSubmit will be true by default if there are partially processed components defined.

Posted in PrimeFaces | 16 Comments
Mar 12

PrimeFaces 3.2 Final Released

One week after the release candidate, PrimeFaces 3.2 Final is released. In total there are 9 filed improvements over the RC that are mostly minor defect fixes. See the full changelog for more information and 3.2.RC1 announcement for the detailed coverage of changes between 3.1 and 3.2.

Downloads

To try out the new release check out downloads section.

Documentation

PrimeFaces User’s Guide is updated to cover 3.2 Edition and reached 460 pages. See documentation page to download the new guide.

RoadMap

PrimeFaces RoadMap is crystal clear, we are now focused on PrimeFaces Mobile 0.9.2 release that will bring new features, enhancements and bug fixes. After 0.9.2 development which is planned to be 2 weeks we’ll get back to PrimeFaces 3.3. Major features of 3.3 would be the enhanced PrimeFaces Push, implementation of popular feature requests and two cool features to ajax framework.

Always Bet on Prime!

Optimus Prime

Posted in Uncategorized | 19 Comments