Hello
I found this piece of code works in that i can programmatically creates a richfaces dropdown menu. But some of the code is deprecated. Can anyone tell me what to put in instead of the deprecated calls?
Thanks
public HtmlDropDownMenu getMyMenu()
{
HtmlDropDownMenu menu = new HtmlDropDownMenu();
menu.setValue( "Node Select" );
HtmlMenuItem menuItem = new HtmlMenuItem();
// TODO programmatically pass from getNodes into a String[] rather than an ArrayList of SelectItems
String subOption = "myBox";
menuItem.setValue( subOption );
Application app = FacesContext.getCurrentInstance().getApplication();
javax.faces.el.MethodBinding mb = app.createMethodBinding( "#{PrismBacking.onItemClick}", new Class[] { ActionEvent.class } );
menuItem.setActionListener( mb );
menu.getChildren().add( menuItem );
return( menu );
}
public void onItemClick( ActionEvent event )
{
Object obj = event.getSource();
if( obj instanceof HtmlMenuItem )
{
HtmlMenuItem item = (HtmlMenuItem)obj;
if( item != null )
{
lastItem = item.getValue().toString();
}
}
}
deprecated code lines are:
javax.faces.el.MethodBinding mb = app.createMethodBinding( "#{PrismBacking.onItemClick}", new Class[] { ActionEvent.class } );
menuItem.setActionListener( mb );