myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sebastian Menge <s.me...@gmx.de>
Subject Re: Problems with panelNavigation2 again
Date Tue, 31 Oct 2006 12:17:27 GMT
Ok, I try again and write short, concise questions ;-)

1) How can I save the state of a dynamically filled panelNavigation2
across requests when using <redirect/> in faces-config?

If I get it right, NavigationMenuItem is the model, while
UINavigationMenuItem is the controller that reacts to events. 

2) Can someone give an example howto build a dynamic NavigationMenu
using UINavigationMenuItems. 

3) How can I dynamically register an actionlistener at an
UINavigationMenuItem?

TIA, Sebastian.

PS: My JSF code:


----------------------------

<h:panelGroup>
	<t:div id="subnavigation_outer" styleClass="subnavigation_outer">
		<t:div id="subnavigation" styleClass="subnavigation_inner">
			<h:form id="vico_form_nav">
				<t:panelNavigation2 id="nav_panel" layout="list" binding="#{jsfnavigation.panelbinding}"
					itemClass="mypage"
					activeItemClass="selected"
					disabledStyle="color:red;padding: 2px 20px 2px 25px">
		
					<t:navigationMenuItems id="navitems" value="#{jsfnavigation.panelNavigationItems}"/>
	
				</t:panelNavigation2>
			</h:form>
		</t:div>
	</t:div>
</h:panelGroup>



My Backingbean:

----------------------------

// $Id: JSFNavigation.java 444 2006-10-30 00:54:53Z xxxxxx $
package xxxxxxxx;

imports ...

/**
 * Used to save the state of the panelNavigation2 when using redirects.
 * In the navigation use binding="#{jsfnavigation.navPanel}"
 * 
 * @author menge
 * @see http://tinyurl.com/rwnrz
 *
 */

// see http://www.irian.at/myfaces/panelnavigation_2.jsf
public class JSFNavigation implements Serializable {

	private static final long serialVersionUID = 1L;
	private HtmlPanelNavigationMenu panelbinding;

	public JSFNavigation() {
	}

	//  Example howto manipulaite an item        
	//  NavigationMenuItem item = getMenuNavigationItem("#{example_messages['panelnav_search_adv']}",
"#{navigationMenu.getAction2}");
	//  item.setActive(true);
	//  item.setOpen(true);
	//  item.setTarget("_blank");
	//	  item.setIcon("images/arrow-first.gif");
	//	  item.setDisabled(true);
	//  all.add(item);

	public List getPanelNavigationItems() {
		List menu = new ArrayList();
		// All menu
		NavigationMenuItem all = getMenuNavigationItem("#{bundle.nav_all}", "");
		menu.add(all);

		// All items
		NavigationMenuItem search = getMenuNavigationItem("#{bundle.nav_search}", "search", "#{jsfsearch.reset}");
		all.add(search);

		all.add(getMenuNavigationItem("#{bundle.nav_associate}", "associate"));

		// User menu
		NavigationMenuItem user = getMenuNavigationItem("#{bundle.nav_user}","");
		menu.add(user);

		... more items ...

		return menu;
	}

	private static NavigationMenuItem getMenuNavigationItem(String label,String action) {
		NavigationMenuItem item = new NavigationMenuItem(label, action);
		return item;
	}

	private static NavigationMenuItem getMenuNavigationItem(String label,String action, String
actionlistener) {
		NavigationMenuItem item = new NavigationMenuItem(label, action);
		item.setActionListener(actionlistener);
		return item;
	}

	public HtmlPanelNavigationMenu getPanelbinding() {
		return panelbinding;
	}

	public void setPanelbinding(HtmlPanelNavigationMenu panelbinding) {
		this.panelbinding = panelbinding;
	}

}
				



Mime
View raw message