Category: components

Android ResizeAnimation with a starting height

Posted by – December 13, 2011

I recently found a a way to resize a view in a way to make it open/collaspse in a Android activity, this kind of animation gives some charm when showing some interface elements like a toolbar or a navigator to the user, you can make it show on screen completelly or have a small piece visible and disclose all the hidden portion.

This animation is based on some code that can be found on stackoverlow, but I made few changes to add extra features to it like start the animation from specific height instead of 0.

Here’s the full code:

More

Share

bodyguard – Facelets EL functions for Spring Security

Posted by – November 9, 2008

Yesterday I wrote a small set of EL functions to use with spring security, now I can get easy access to spring security roles and authentication info as well.

Here’s an example of how bodyguard can be used in your facelets code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<html xmlns="http://www.w3.org/1999/xhtml"
   xmlns:bg="http://faces.eti.br/bodyguard">
 <body>
   <!-- Display logged message if the user is authenticated -->
   <t:div rendered="#{bg:isAuthenticated()}">
       <h:outputText rendered="#{bg:remoteUser()}" value="Logged!"/>
   </t:div>

   <!-- Display a message indicating if the user is a user or admin -->
   <t:div rendered="#{bg:isUserInAnyRoles('ROLE_USER,ROLE_ADMIN')}">
       <h:outputText
         value="The user #{bg:remoteUser()} is a user or admin."/>
   </t:div>

   <!-- Display a message indicating if the user isn't a user or admin -->
   <t:div rendered="#{bg:isUserNotInRoles('ROLE_USER,ROLE_ADMIN')}">
       <h:outputText
         value="The user #{bg:remoteUser()} isn't a user or admin."/>
   </t:div>

   <!-- Display a message indicating if the user is a user and admin -->
   <t:div rendered="#{bg:isUserInAllRoles('ROLE_USER,ROLE_ADMIN')}">
       <h:outputText
          value="The user #{bg:remoteUser()} is a user and admin."/>
   </t:div>
 </body>
</html>

You can download the bodyguard by clicking here and sources here.

Share

Facelets EL Functions can save your day

Posted by – November 2, 2008

In the last week I had several issues during the development of a jsf application that could be solved by creating few custom Facelets EL functions, let’s take a look on which scenarios Facelets EL functions helped me.

1. Simple loop over a range of numbers

JSF has a lot of components that can be used to iterate over a model and repeat its own child components several times, some of them are Tomahawk’s dataList and Richfaces repeat.

But in all of these components I couldn’t find a way to do a simple iteration on a range of numbers, like repeat all child components starting from 1 and stopping at n number of times.

Maybe you will say: “What about c:forEach? It can do this kind of iteration!”, oh yes, it can, and I tried to use it but it crashes when I pass EL expressions to both begin and end attributes, it only accepts hardcoded values.
More

Share

New jars added to jsf-comp repository

Posted by – September 4, 2008

If you use Maven and your project requires tagHandlers and chartcreator libraries from jsf-comp you can now find then in jsf-comp maven repository, the path for this repository is:

http://jsf-comp.sourceforge.net/maven2/repository/

Right now we have tagHandlers 0.0.1 and chartcreator 1.2.0 there, I’ll try to keep this repository updated.

Share

How to add an JSF action for event handling to Chartcreator charts

Posted by – June 24, 2008

Chartcreator is a very cool charting component for JSF, it uses JFreeChart as rendering engine, chartcreator can render many kinds of charts, including 3D charts, but there are some circunstances where just render charts isn’t enougth and you need some interaction too, I’ll show in this article how can you and some user interaction with Chartcreator generated charts.

Our example is a small piece of JSF code where we have a chart, a script block and a form with a inputText and a commandLink, our idea is simple, the user clicks on any portion of chart image, a imagemap click event is triggered and in javascript code we collect the information about the imagemap portion that we clicked and then pass this data to our inputText, a click is fired on commandLink and the data stored on inputText is set on managedbean property, the managedbean action is called performing some aplication navigation of something else.

More

Share