Tuesday, May 5, 2015

Loop every components in a ViewRoot recursively

1. Writing the recursive method.
private void loopComponentsRecursively(List<UIComponent> childrenList) {
  for(UIComponent component : childrenList) {
   if(component.getChildCount() > 0) {
    loopComponentsRecursively(component.getChildren());
   } else {
    // no more children for this component
    System.out.println("child: " + component.getId() + "  " + component.getClientId());
   }
  }
}

2. Invoking the recursive method
// some code
loopComponentsRecursively(viewRoot.getChildren());
//some other code


Done!!

Wednesday, April 29, 2015

How to handle localized resources with resource bundle

Generally, there are 2 ways to handle localized resources.
1. Append the locale name to the end of the file name. eg, logo_en_US.jpg, flag_zh_CN.png
2. Save the resources of the locale to individual resource bundle.

Solution 1 is kind of straight forward,
thus, in this post, we will be focusing on Solution 2. 

Normally, in java development, we have different resource bundle to handle localized messages, labels for different locales. 
eg, system-messages_en_US.properties, system-messages_ms_MY.properties, etc

Wednesday, March 4, 2015

Remote Deployment via the JBoss Admin Console

1. Login as JBoss admin or any management user

2. In the Runtime tab, click on Manage Deployments

Sunday, March 1, 2015

How to run Linux shell command in Windows

To run shell command in windows platforms, one of the option is to use Cygwin.

1. Download and install Cygwin at this url.
2. Start Cygwin command prompt.
3. Start entering shell command into Cygwin command prompt.


Done!!

Saturday, February 28, 2015

p:tabMenu model does not work with JSF 2.1.x

According to PrimeFaces demo page, <p:tabMenu /> is working with <p:menuItem /> to display tab content.
<p:tabMenu /> also works with model to display tab content.

<p:tabMenu activeIndex="#{backingBean.tabActiveIndex}"
    model="#{backingBean.tabModel}" />

But <p:tabMenu /> not working with some of the JSF2.1 distribution.
eg, JSF2.1.19, JSF2.1.22, JSF2.1.29, etc

When tabMenu with model running with JSF2.1.29. some of the tabs are not able to click.

The only solution to resolve this problem, is to use <p:menuItem /> instead of model.


Done!!

LinkWithin

Related Posts Plugin for WordPress, Blogger...