-
1. Re: Richfaces adviseNodeOpened ClassNotFoundException
ilya_shaikovsky Jun 8, 2010 4:20 AM (in response to barbaraboie)1 of 1 people found this helpfulseems you trying to use UI components classes inside EJB beans. It's not good design. Use controller classes in web application.
-
2. Re: Richfaces adviseNodeOpened ClassNotFoundException
barbaraboie Jun 8, 2010 5:29 AM (in response to ilya_shaikovsky)Thanks you Ilya for your quick response.
When I remove UITree out of the method
public Boolean adviseNodeOpened() {
return Boolean.TRUE;
}I get the error
/layout/navigatie.xhtml @6,118 adviseNodeOpened="#{menuTree.adviseNodeOpened}": Method not found: Proxy to jboss.j2ee:ear=ccinc-ear.ear,jar=ccinc-ejb.jar,name=MenuTreeBean,service=EJB3 implementing [interface vo.cjsm.ccinc.util.MenuTree].adviseNodeOpened(org.richfaces.component.UITree)
And when I try <rich:tree switchType="client" selectedClass="navigatieTree" adviseNodeOpened="true"> I get java.lang.String cannot be cast to java.lang.Boolean
What I want to do is to keep the tree open, because when I click on a link in the tree, the tree is collapsing when I go to a different page. Do you know another way to keep de tree expanded?
Thanks
barbara
-
3. Re: Richfaces adviseNodeOpened ClassNotFoundException
ilya_shaikovsky Jun 8, 2010 6:42 AM (in response to barbaraboie)1 of 1 people found this helpfulWhen I remove UITree out of the method
public Boolean adviseNodeOpened() {
return Boolean.TRUE;
}I meant not to remove UITree from signature - advisor expectes methodExpression of predefined signature so it will not works. I mean move out the advisor (which is actually some kind of UI controller) - to webapp module.
And when I try <rich:tree switchType="client" selectedClass="navigatieTree" adviseNodeOpened="true"> I getjava.lang.String cannot be cast to java.lang.Boolean
could also try to use adviseNodeOpened="#{true}"
-
4. Re: Richfaces adviseNodeOpened ClassNotFoundException
barbaraboie Jun 8, 2010 9:10 AM (in response to ilya_shaikovsky)One step further but not yet there...
I created a TreeAdvisorBean in the webapp module
import javax.ejb.Remove;
import javax.ejb.Stateful;import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.AutoCreate;
import org.jboss.seam.annotations.Destroy;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.richfaces.component.UITree;
import org.richfaces.component.state.TreeStateAdvisor;@Stateful
@Name("treeAdvisor")
@Scope(ScopeType.SESSION)
@AutoCreate
public class TreeAdvisorBean implements TreeStateAdvisor {
public Boolean adviseNodeOpened(UITree tree) {
return Boolean.TRUE;
}public Boolean adviseNodeSelected(UITree tree) {
return null;
}
@Remove
@Destroy
public void destroy() {
// TODO Auto-generated method stub
}
}and in the page:
<rich:tree switchType="client" selectedClass="navigatieTree" adviseNodeOpened="#{treeAdvisor.adviseNodeOpened}">
No more problem with the imports, but I get the error
/layout/navigatie.xhtml @6,121 adviseNodeOpened="#{treeAdvisor.adviseNodeOpened}": Target Unreachable, identifier 'treeAdvisor' resolved to null
although I added @AutoCreate ... Has it something to do with the fact that the bean is in the webmodule?
-
5. Re: Richfaces adviseNodeOpened ClassNotFoundException
ilya_shaikovsky Jun 8, 2010 10:09 AM (in response to barbaraboie)check in server log during server starting - there should be Seam log entries related to components instantiations. there should be treeAdvisor.
-
6. Re: Richfaces adviseNodeOpened ClassNotFoundException
barbaraboie Jun 8, 2010 10:58 AM (in response to ilya_shaikovsky)Great! I added seam.properties in war/src, I removed @Stateful and I made the bean Serializable and it works! Thanks for the advice, Ilya!!