Hi!
Is there a way to get an editable tree?
I'm using code below to create an TreeNodeImpl to view an object hierarchy as a tree (where Transmission is the root class):
{code}
StringWriter writer = new StringWriter();
try {
// Generate XML representation of an transmission
JAXBContext context = JAXBContext.newInstance(Transmission.class);
Marshaller m = context.createMarshaller();
m.marshal(transmission, writer);
// Generate a tree
logTreeNode = XmlTreeDataBuilder.build(new InputSource(new StringReader(writer.toString())));
} catch (Exception e) {
log.log(Level.WARNING, "Could not create XML from transmission.", e);
}
{code}
{code:xml}
<rich:tree switchType="client" value="#{logTreeNode}" var="log"
stateAdvisor="#{treeDemoStateAdvisor}">
<rich:treeNode>
<h:outputText value="#{log}" />
</rich:treeNode>
</rich:tree>
{code}
// Generates XML representation of an trans
And that works as expected, but how can I get the end nodes as input fields (as h:inputText or checkbox..) and also get the xml or data model updated?
using treeNode you could customize the markup for tree nodes as you need. e.g. define input's or inplaceInputs for nodes instead of just plaing output.