I'm using JSF Mojarra 2.0.3 implementation along with Apache Trinidad 2.0.0 beta framework, so that I can use tree component.
I've followed developers guide regarding tree component, as well as the Oracle ADF tutorial, but I haven't succeded in reproducing the Oracle example.
Tree component gets rendered, but it doesn't expand/collapse. I only can see the root elements.
Playing with the apache demo tree component, I've noticed that the page is not reloaded. It seems to be ajax managed.
So I think my problem is that I have my tree component into a form JSF tag. Anyway, if I don't place the tree component into a h:form tag, the tree component is not rendered.
Having the tree component embeded into a form, I have also noticed that when I try to expand a node from the tree, the whole page reloads. It may explain why the tree is not expanding.
Anyone has a clue about Trinidad tree component?
By the way, tree component is the only Trinidad component I'm using. I don't know if it is some sort of incompatibility with JSF Mojarra's implementation default components.
Still doesn't work. Tree rendered with root elements, but they don't expand when clicking with mouse. Now only one and tags in the final html document. Here my xhtml's:
header.xhtml:
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets">
<div id="header" class="header">
<div id="header_title">
<p>#{msg.app_title}</p>
</div>
<div id="clear"/>
</div>
</ui:composition>
footer.xhtml:
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets">
<div id="footer" class="footer">#{msg.app_footer}</div>
</ui:composition>
template.xhtml:
<tr:document xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:tr="http://myfaces.apache.org/trinidad"
title="#{msg.app_title}">
<div id="header">
<ui:include src="/WEB-INF/templates/header.xhtml"/>
</div>
<center>
<div id="content">
<ui:insert name="content">
</ui:insert>
</div>
</center>
<div id="footer">
<ui:include src="/WEB-INF/templates/footer.xhtml"/>
</div>
</tr:document>
login.xhtml:
<ui:composition template="/WEB-INF/templates/template.xhtml"
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:tr="http://myfaces.apache.org/trinidad">
<ui:define name="content">
<tr:form id="login_form">
<h:panelGrid columns="3">
<h:outputText value="#{msg.username}"></h:outputText>
<h:inputText id="username" value="#{loginBean.username}" required="true"/>
<h:message for="username" class="error_message"/>
<h:outputText value="#{msg.password}"></h:outputText>
<h:inputSecret id="password" value="#{loginBean.password}" required="true">
<f:validator validatorId="checkUserValidator"/>
<f:attribute name="usernameId" value="username"/>
</h:inputSecret>
<h:message for="password" class="error_message"/>
</h:panelGrid>
<h:commandButton value="#{msg.login}" action="#{loginBean.checkUser}"/>
<tr:panelBox background="transparent">
<tr:tree var="menu" value="#{testTree.tree}">
<f:facet name="nodeStamp">
<tr:goLink text="#{menu.name}"/>
</f:facet>
</tr:tree>
</tr:panelBox>
</tr:form>
<h:outputLink value="/MyApp/faces/newAccount.xhtml">
<h:outputText value="#{msg.create_account}"></h:outputText>
</h:outputLink>
</ui:define>
</ui:composition>
TestTree.java:
public class TestTree{
private TreeModel tree;
public TestTree(){
Person john = new Person("John Smith");
Person kim = new Person("Kim Smith");
Person tom = new Person("Tom Smith");
Person ira = new Person("Ira Wickrememsinghe");
Person mallika = new Person("Mallika Wickremesinghe");
john.getKids().add(kim);
john.getKids().add(tom);
ira.getKids().add(mallika);
// create the list of root nodes:
List people = new ArrayList();
people.add(john);
people.add(ira);
tree = new ChildPropertyTreeModel(people, "kids");
}
public TreeModel getTree(){
return tree;
}
public void setTree(TreeModel tree){
this.tree = tree;
}
}
Another question by using this case, where should I specify my css file? I haven't found any attribute for document tag. How can I access and tags generated by Trinidad?