Author: lfryc(a)redhat.com
Date: 2010-12-10 11:41:15 -0500 (Fri, 10 Dec 2010)
New Revision: 20503
Added:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichTreeModelAdaptorBean.java
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichTreeModelRecursiveAdaptorBean.java
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichTreeNodeBean.java
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/model/treeAdaptor/
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/model/treeAdaptor/ModelNode.java
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/model/treeAdaptor/Node.java
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/model/treeAdaptor/RecursiveNode.java
modules/tests/metamer/trunk/application/src/main/webapp/components/richTree/treeAdaptors.xhtml
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichTreeBean.java
modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichTreeBean.properties
modules/tests/metamer/trunk/application/src/main/webapp/components/richTree/list.xhtml
Log:
added initial sample of rich:tree adaptors (RF-9698)
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichTreeBean.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichTreeBean.java 2010-12-10
16:39:36 UTC (rev 20502)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichTreeBean.java 2010-12-10
16:41:15 UTC (rev 20503)
@@ -23,6 +23,7 @@
import java.io.Serializable;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -30,7 +31,7 @@
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
-import javax.faces.bean.SessionScoped;
+import javax.faces.bean.ViewScoped;
import javax.swing.tree.TreeNode;
import org.richfaces.component.UITree;
@@ -43,20 +44,18 @@
import org.slf4j.LoggerFactory;
/**
- * Managed bean for rich:list.
- *
* @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
* @version $Revision$
*/
@ManagedBean(name = "richTreeBean")
-// cannot be view-scoped (see
https://jira.jboss.org/browse/RF-9287)
-@SessionScoped
+@ViewScoped
public class RichTreeBean implements Serializable {
private static final long serialVersionUID = 4008175400649809L;
private static Logger logger;
private Attributes attributes;
private List<TreeNode> root = new ArrayList<TreeNode>();
+ private Collection<Object> selection;
@ManagedProperty(value = "#{model}")
private Model model;
@@ -77,6 +76,10 @@
attributes.get("toggleType").setValue("ajax");
attributes.get("selectionType").setValue("ajax");
+ // hidden attributes
+ attributes.remove("selectionChangeListener");
+ attributes.remove("toggleListener");
+
for (CompactDiscXmlDescriptor descriptor : model.getCompactDiscs()) {
createCompactDisc(descriptor);
}
@@ -125,12 +128,20 @@
}
return country;
}
-
+
public void setModel(Model model) {
this.model = model;
}
-
+
public List<TreeNode> getRoot() {
return root;
}
+
+ public Collection<Object> getSelection() {
+ return selection;
+ }
+
+ public void setSelection(Collection<Object> selection) {
+ this.selection = selection;
+ }
}
Added:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichTreeModelAdaptorBean.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichTreeModelAdaptorBean.java
(rev 0)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichTreeModelAdaptorBean.java 2010-12-10
16:41:15 UTC (rev 20503)
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.bean;
+
+import java.io.Serializable;
+
+import javax.annotation.PostConstruct;
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.ViewScoped;
+
+import org.richfaces.component.UITreeModelAdaptor;
+import org.richfaces.tests.metamer.Attributes;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+@ManagedBean(name = "richTreeModelAdaptorBean")
+@ViewScoped
+public class RichTreeModelAdaptorBean implements Serializable {
+
+ private static final long serialVersionUID = 4008175400649809L;
+ private static Logger logger;
+ private Attributes attributes;
+
+ /**
+ * Initializes the managed bean.
+ */
+ @PostConstruct
+ public void init() {
+ logger = LoggerFactory.getLogger(getClass());
+ logger.debug("initializing bean " + getClass().getName());
+
+ attributes = Attributes.getUIComponentAttributes(UITreeModelAdaptor.class,
getClass(), false);
+ }
+
+ public Attributes getAttributes() {
+ return attributes;
+ }
+
+ public void setAttributes(Attributes attributes) {
+ this.attributes = attributes;
+ }
+}
Added:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichTreeModelRecursiveAdaptorBean.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichTreeModelRecursiveAdaptorBean.java
(rev 0)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichTreeModelRecursiveAdaptorBean.java 2010-12-10
16:41:15 UTC (rev 20503)
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.bean;
+
+import java.io.Serializable;
+import java.util.List;
+
+import javax.annotation.PostConstruct;
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.ViewScoped;
+
+import org.richfaces.component.UITreeModelRecursiveAdaptor;
+import org.richfaces.tests.metamer.Attributes;
+import org.richfaces.tests.metamer.model.treeAdaptor.RecursiveNode;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+@ManagedBean(name = "richTreeModelRecursiveAdaptorBean")
+@ViewScoped
+public class RichTreeModelRecursiveAdaptorBean implements Serializable {
+
+ private static final long serialVersionUID = 4008175400649809L;
+ private static Logger logger;
+ private Attributes attributes;
+ private boolean leafChildrenNullable = true;
+ private transient List<RecursiveNode> rootNodes;
+
+ /**
+ * Initializes the managed bean.
+ */
+ @PostConstruct
+ public void init() {
+ logger = LoggerFactory.getLogger(getClass());
+ logger.debug("initializing bean " + getClass().getName());
+
+ attributes =
Attributes.getUIComponentAttributes(UITreeModelRecursiveAdaptor.class, getClass(),
false);
+
+ attributes.get("rendered").setValue(true);
+ }
+
+ public Attributes getAttributes() {
+ return attributes;
+ }
+
+ public void setAttributes(Attributes attributes) {
+ this.attributes = attributes;
+ }
+
+ public List<RecursiveNode> getRootNodes() {
+ if (rootNodes == null) {
+ rootNodes = RecursiveNode.createChildren(null, leafChildrenNullable);
+ }
+ return rootNodes;
+ }
+
+ public boolean isLeafChildrenNullable() {
+ return leafChildrenNullable;
+ }
+
+ public void setLeafChildrenNullable(boolean leafChildrenNullable) {
+ this.leafChildrenNullable = leafChildrenNullable;
+ }
+}
Added:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichTreeNodeBean.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichTreeNodeBean.java
(rev 0)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichTreeNodeBean.java 2010-12-10
16:41:15 UTC (rev 20503)
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.bean;
+
+import java.io.Serializable;
+
+import javax.annotation.PostConstruct;
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.ViewScoped;
+
+import org.richfaces.component.UITreeModelAdaptor;
+import org.richfaces.tests.metamer.Attributes;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+@ManagedBean(name = "richTreeNodeBean")
+@ViewScoped
+public class RichTreeNodeBean implements Serializable {
+
+ private static final long serialVersionUID = 4008175400649809L;
+ private static Logger logger;
+ private Attributes attributes;
+
+ /**
+ * Initializes the managed bean.
+ */
+ @PostConstruct
+ public void init() {
+ logger = LoggerFactory.getLogger(getClass());
+ logger.debug("initializing bean " + getClass().getName());
+
+ attributes = Attributes.getUIComponentAttributes(UITreeModelAdaptor.class,
getClass(), false);
+
+ attributes.get("rendered").setValue(true);
+ }
+
+ public Attributes getAttributes() {
+ return attributes;
+ }
+
+ public void setAttributes(Attributes attributes) {
+ this.attributes = attributes;
+ }
+}
Added:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/model/treeAdaptor/ModelNode.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/model/treeAdaptor/ModelNode.java
(rev 0)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/model/treeAdaptor/ModelNode.java 2010-12-10
16:41:15 UTC (rev 20503)
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.model.treeAdaptor;
+
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public class ModelNode extends Node {
+
+ private static final int BS = 3;
+ List<B> bs;
+ List<RecursiveNode> rs;
+
+ public ModelNode(Node parent, boolean nullable) {
+ super(parent, nullable);
+ }
+
+ public String getLabel() {
+ return isRoot() ? "M" : parent.getLabel() + "-M";
+ }
+
+ public A getValue() {
+ return new A();
+ }
+
+ public List<B> getList() {
+ if (bs == null) {
+ bs = new LinkedList<B>();
+ for (int i = 0; i < BS; i++) {
+ bs.add(new B(i));
+ }
+ }
+ return bs;
+ }
+
+ public List<RecursiveNode> getRecursive() {
+ if (rs == null) {
+ rs = RecursiveNode.createChildren(this, nullable);
+ }
+ return rs;
+ }
+
+ public class A {
+ public String getLabel() {
+ return ModelNode.this.getLabel() + "-A";
+ }
+ }
+
+ public class B {
+ int number;
+
+ public B(int number) {
+ this.number = number;
+ }
+
+ public String getLabel() {
+ return ModelNode.this.getLabel() + "-B-" + number;
+ }
+ }
+
+ private RecursiveNode getParentRecursive() {
+ for (Node predecessor : getPredecessorsFromRoot()) {
+ if (predecessor instanceof RecursiveNode) {
+ return (RecursiveNode) predecessor;
+ }
+ }
+ return null;
+ }
+}
\ No newline at end of file
Added:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/model/treeAdaptor/Node.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/model/treeAdaptor/Node.java
(rev 0)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/model/treeAdaptor/Node.java 2010-12-10
16:41:15 UTC (rev 20503)
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.model.treeAdaptor;
+
+import java.util.Deque;
+import java.util.LinkedList;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public abstract class Node {
+ Node parent;
+ boolean nullable;
+
+ public Node(Node parent, boolean nullable) {
+ super();
+ this.parent = parent;
+ this.nullable = nullable;
+ }
+
+ public Node getParent() {
+ return parent;
+ }
+
+ public boolean isRoot() {
+ return parent == null;
+ }
+
+ public int getLevel() {
+ return isRoot() ? 1 : parent.getLevel() + 1;
+ }
+
+ public Node getRoot() {
+ return isRoot() ? this : parent.getRoot();
+ }
+
+ public Iterable<Node> getPredecessorsFromRoot() {
+ Deque<Node> list = new LinkedList<Node>();
+ list.addFirst(this);
+
+ while (list.getFirst().parent != null) {
+ list.addFirst(list.getFirst().parent);
+ }
+
+ return list;
+ }
+
+ public abstract String getLabel();
+}
Added:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/model/treeAdaptor/RecursiveNode.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/model/treeAdaptor/RecursiveNode.java
(rev 0)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/model/treeAdaptor/RecursiveNode.java 2010-12-10
16:41:15 UTC (rev 20503)
@@ -0,0 +1,120 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.model.treeAdaptor;
+
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public class RecursiveNode extends Node {
+ private static final int CHILDREN = 4;
+ private static final int LEVELS = 2;
+ private static final List<RecursiveNode> EMPTY_LIST = new
LinkedList<RecursiveNode>();
+
+ int number;
+ List<RecursiveNode> children = null;
+ ModelNode model;
+
+ public RecursiveNode(Node parent, boolean nullable, int number) {
+ super(parent, nullable);
+ this.number = number;
+ }
+
+ public int getNumber() {
+ return number;
+ }
+
+ public boolean isLeaf() {
+ return getRecursionLevel() >= LEVELS + (isOddBranch() ? 0 : 1);
+ }
+
+ public List<RecursiveNode> getRecursive() {
+ if (isLeaf()) {
+ return getEmpty();
+ }
+ if (children == null) {
+ children = createChildren(this, nullable);
+ }
+ return children;
+ }
+
+ private List<RecursiveNode> getEmpty() {
+ return nullable ? null : EMPTY_LIST;
+ }
+
+ public String getLabel() {
+ String parentLabel = (isRoot() ? "" : parent.getLabel() +
"-") + "R-";
+ String recursionLabel = (isRecursionRoot() ? parentLabel : parent.getLabel() +
".") + number;
+ return recursionLabel;
+ }
+
+ public ModelNode getModel() {
+ if (isLeaf() && !isPreceededByModel()) {
+ if (model == null) {
+ model = new ModelNode(this, nullable);
+ }
+ return model;
+ }
+ return null;
+ }
+
+ public int getRecursionLevel() {
+ return isRecursionRoot() ? 1 : 1 + ((RecursiveNode)
getParent()).getRecursionLevel();
+ }
+
+ private boolean isRecursionRoot() {
+ if (isRoot()) {
+ return true;
+ } else {
+ return !(parent instanceof RecursiveNode);
+ }
+ }
+
+ public static List<RecursiveNode> createChildren(Node parent, boolean nullable)
{
+ List<RecursiveNode> children = new LinkedList<RecursiveNode>();
+ for (int i = 0; i < CHILDREN; i++) {
+ children.add(new RecursiveNode(parent, nullable, i));
+ }
+ return children;
+ }
+
+ private boolean isPreceededByModel() {
+ for (Node predecessor : getPredecessorsFromRoot()) {
+ if (predecessor instanceof ModelNode) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private boolean isOddBranch() {
+ for (Node predecessor : getPredecessorsFromRoot()) {
+ if (predecessor instanceof RecursiveNode) {
+ return ((RecursiveNode) predecessor).number % 2 == 1;
+ }
+ }
+ return this.number % 2 == 1;
+ }
+}
\ No newline at end of file
Modified:
modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichTreeBean.properties
===================================================================
---
modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichTreeBean.properties 2010-12-10
16:39:36 UTC (rev 20502)
+++
modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichTreeBean.properties 2010-12-10
16:41:15 UTC (rev 20503)
@@ -1,3 +1,9 @@
+attr.dir.rtl=RTL
+attr.dir.ltr=LTR
+attr.dir.null=
+attr.selectionType.client=client
+attr.selectionType.ajax=ajax
+attr.selectionType.null=
attr.toggleType.ajax=ajax
attr.toggleType.client=client
attr.toggleType.server=server
@@ -2,4 +8 @@
attr.toggleType.null=
-attr.selectionType.client=client
-attr.selectionType.ajax=ajax
-attr.selectionType.null=
\ No newline at end of file
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richTree/list.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richTree/list.xhtml 2010-12-10
16:39:36 UTC (rev 20502)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richTree/list.xhtml 2010-12-10
16:41:15 UTC (rev 20503)
@@ -34,6 +34,10 @@
<metamer:testPageLink id="simple" outcome="simple"
value="Simple">
The simple sample of <b>rich:tree</b> usage including all its
attributes.
</metamer:testPageLink>
+
+ <metamer:testPageLink id="treeAdaptors"
outcome="treeAdaptors" value="Tree Adaptors">
+ The <b>rich:tree</b> with declarative model using
<b>rich:treeModelRecursiveAdaptor</b> and
<b>rich:treeModelAdaptor</b>.
+ </metamer:testPageLink>
</ui:define>
Added:
modules/tests/metamer/trunk/application/src/main/webapp/components/richTree/treeAdaptors.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richTree/treeAdaptors.xhtml
(rev 0)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richTree/treeAdaptors.xhtml 2010-12-10
16:41:15 UTC (rev 20503)
@@ -0,0 +1,135 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:metamer="http://java.sun.com/jsf/composite/metamer"
+
xmlns:rich="http://richfaces.org/rich"
xmlns:a4j="http://richfaces.org/a4j">
+
+ <!--
+JBoss, Home of Professional Open Source
+Copyright 2010, Red Hat, Inc. and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+This software is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ -->
+
+ <ui:composition template="/templates/template.xhtml">
+
+ <ui:define name="head">
+ <f:metadata>
+ <f:viewParam name="templates"
value="#{templateBean.templates}">
+ <f:converter converterId="templatesListConverter" />
+ </f:viewParam>
+ </f:metadata>
+
+ </ui:define>
+
+ <ui:define name="outOfTemplateBefore">
+ </ui:define>
+
+ <ui:define name="component">
+
+ <rich:tree id="richTree" var="node"
+ dir="#{richTreeBean.attributes['dir'].value}"
+ lang="#{richTreeBean.attributes['lang'].value}"
+
onbeforedomupdate="#{richTreeBean.attributes['onbeforedomupdate'].value}"
+
onbeforenodetoggle="#{richTreeBean.attributes['onbeforenodetoggle'].value}"
+
onbeforeselectionchange="#{richTreeBean.attributes['onbeforeselectionchange'].value}"
+ onbegin="#{richTreeBean.attributes['onbegin'].value}"
+ onclick="#{richTreeBean.attributes['onclick'].value}"
+
oncomplete="#{richTreeBean.attributes['oncomplete'].value}"
+
ondblclick="#{richTreeBean.attributes['ondblclick'].value}"
+ onkeydown="#{richTreeBean.attributes['onkeydown'].value}"
+
onkeypress="#{richTreeBean.attributes['onkeypress'].value}"
+ onkeyup="#{richTreeBean.attributes['onkeyup'].value}"
+
onmousedown="#{richTreeBean.attributes['onmousedown'].value}"
+
onmousemove="#{richTreeBean.attributes['onmousemove'].value}"
+ onmouseup="#{richTreeBean.attributes['onmouseup'].value}"
+
onmouseout="#{richTreeBean.attributes['onmouseout'].value}"
+
onmouseover="#{richTreeBean.attributes['onmouseover'].value}"
+
onnodetoggle="#{richTreeBean.attributes['onnodetoggle'].value}"
+
onselectionchange="#{richTreeBean.attributes['onselectionchange'].value}"
+ rendered="#{richTreeBean.attributes['rendered'].value}"
+ selection="#{richTreeBean.selection}"
+
selectionType="#{richTreeBean.attributes['selectionType'].value}"
+ style="#{richTreeBean.attributes['style'].value}"
+
styleClass="#{richTreeBean.attributes['styleClass'].value}"
+ title="#{richTreeBean.attributes['title'].value}"
+
toggleType="#{richTreeBean.attributes['toggleType'].value}"
+ >
+
+ <a4j:ajax event="selectionchange"
render="selectionOutput" />
+
+ <rich:treeModelRecursiveAdaptor
+ roots="#{richTreeModelRecursiveAdaptorBean.rootNodes}"
+ nodes="#{node.recursive}"
+
recursionOrder="#{richTreeModelRecursiveAdaptorBean.attributes['recursionOrder'].value}"
+
rendered="#{richTreeModelRecursiveAdaptorBean.attributes['rendered'].value}"
+ >
+
+ <rich:treeNode>
+ <a4j:outputPanel id="panel">
+ #{node.label}
+ </a4j:outputPanel>
+ </rich:treeNode>
+
+ <!-- <rich:treeModelAdaptor nodes="{node.model.value}"
rendered="{not empty node.model}">
+ <rich:treeNode>
+ {node}
+ </rich:treeNode>
+ </rich:treeModelAdaptor>-->
+
+ <rich:treeModelAdaptor nodes="#{node.model.list}">
+ <rich:treeNode>
+ #{node.label}
+ </rich:treeNode>
+ </rich:treeModelAdaptor>
+
+ <rich:treeModelRecursiveAdaptor
roots="#{node.model.recursive}" nodes="#{node.recursive}">
+ <rich:treeNode
rendered="#{richTreeNodeBean.attributes['rendered'].value || node.number !=
1}">
+ #{node.label}
+ </rich:treeNode>
+ </rich:treeModelRecursiveAdaptor>
+
+ </rich:treeModelRecursiveAdaptor>
+ </rich:tree>
+ </ui:define>
+
+ <ui:define name="outOfTemplateAfter">
+
+ <a4j:outputPanel id="selectionOutput">
+ <h:outputLabel value="Selection: " />
+ <h:outputText value="#{richTreeBean.selection}" />
+ </a4j:outputPanel>
+
+ <fieldset>
+ <legend>rich:tree</legend>
+ <metamer:attributes value="#{richTreeBean.attributes}"
id="treeAttributes" />
+ </fieldset>
+
+ <fieldset>
+ <legend>rich:treeModelRecursiveAdaptor</legend>
+ <metamer:attributes
value="#{richTreeModelRecursiveAdaptorBean.attributes}"
id="nodeAttributes" />
+ </fieldset>
+
+ <fieldset>
+ <legend>rich:treeNode</legend>
+ <metamer:attributes value="#{richTreeNodeBean.attributes}"
id="recursiveAttributes" />
+ </fieldset>
+ </ui:define>
+
+ </ui:composition>
+</html>
\ No newline at end of file