-
1. Re: dropdownmenu dinamically
cubrovic Oct 14, 2007 12:01 PM (in response to cubrovic)Nobody have a clue?!
-
2. Re: dropdownmenu dinamically
pmuir Oct 14, 2007 12:42 PM (in response to cubrovic)Why don't you post some code - just ranting doesn't normally produce a response.
-
3. Re: dropdownmenu dinamically
cubrovic Oct 14, 2007 1:10 PM (in response to cubrovic)Try too much combination to post it all there.
Here is the latest simple combination that I use while trying too resolve this isue.
in menu-adm.xhtml<rich:toolBar xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:s="http://jboss.com/products/seam/taglib" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.ajax4jsf.org/rich"> <rich:toolBarGroup> <h:outputText value="#{projectName}:" /> <s:link view="/adm.xhtml" value="Home" /> </rich:toolBarGroup> <rich:toolBarGroup binding="#{managerMenuBean.menu}"></rich:toolBarGroup> <rich:toolBarGroup location="right"> <h:outputText value="Welcome, #{identity.username}" rendered="#{identity.loggedIn}" /> <s:link view="/login.xhtml" value="Login" rendered="#{not identity.loggedIn}" /> <s:link view="/home.xhtml" action="#{identity.logout}" value="Logout" rendered="#{identity.loggedIn}" /> </rich:toolBarGroup> </rich:toolBar>
and in beanpublic HtmlToolBarGroup getMenu(){ return new HtmlToolBarGroup(); }
tried it with a lot of different combination.
Positioning jars in ear , WEB-INF/lib
changing Java2ClassLoadingCompliance and UseJBossWebLoader
and in every combination it neds up with deployment or runtime error classnotfound.
I intentionally doesn't provide any code at first cause i didn want to limit suggestions but to find out any valid way that you use for creating dinamically menu in seam (CR2) environment.
Currently code doesn;t create no meu as you see just empty Toolbargroup but it's the same problem with cleaner simpler code.
When I produce standard jsf component same way (HTMLOutputText) that works just fine. -
4. Re: dropdownmenu dinamically
cubrovic Oct 14, 2007 7:02 PM (in response to cubrovic)
I somehow make it work.
I use solution already posted somewhere
true
but I had to change
public HtmlToolBarGroup getMenu(){
return new HtmlToolBarGroup();
}
to
public UIComponent getMenu() {
return new HtmlToolBarGroup();
}
because if i dont classnotfound exception was thrown during deployment ?!
This seems more like a hack insted of legitible solution.
So question still stands.
How richfaces/seam constructors think those code should be designed and coded and is this a bug or my missunderstanding of valid use or what...
I really thrilled about seam/richfaces kind of creating webapps and anxious to use it but those little things that cause a lot of wasted time and influence productivity can be pretty frustrated.
I submit my "solution" to save some others guy time.
Furthermore I had to setId-s to menus in code to make it work which is kind of expected so my final (still only for testing) method looks like
public UIComponent getMenu() {
HtmlToolBarGroup htmlToolBarGroup = new HtmlToolBarGroup();
HtmlPanelMenu htmlPanelMenu = new HtmlPanelMenu();
htmlPanelMenu.setStyle("width:200px");
htmlPanelMenu.setMode("ajax");
htmlPanelMenu.setIconExpandedGroup("disc");
htmlPanelMenu.setIconCollapsedGroup("disc");
htmlPanelMenu.setIconExpandedTopGroup("chevronUp");
htmlPanelMenu.setIconGroupTopPosition("right");
htmlPanelMenu.setIconCollapsedTopGroup("chevronDown");
htmlPanelMenu.setId("menu1");
HtmlPanelMenuGroup htmlPanelMenuGroup = new HtmlPanelMenuGroup();
htmlPanelMenuGroup.setLabel("menugroup1");
htmlPanelMenuGroup.setId("menugroup1");
HtmlPanelMenuItem htmlPanelMenuItem = new HtmlPanelMenuItem();
htmlPanelMenuItem.setLabel("item1");
htmlPanelMenuItem.setId("menu1item1");
htmlToolBarGroup.getChildren().add(htmlPanelMenu);
htmlPanelMenu.getChildren().add(htmlPanelMenuGroup);
htmlPanelMenuGroup.getChildren().add(htmlPanelMenuItem);
return htmlToolBarGroup;
}