Author: alexsmirnov
Date: 2009-10-14 17:14:07 -0400 (Wed, 14 Oct 2009)
New Revision: 15716
Added:
root/examples-sandbox/trunk/backwardCompatibility/src/main/java/org/ajax4jsf/SimpleTreeBean.java
root/examples-sandbox/trunk/backwardCompatibility/src/main/java/org/ajax4jsf/TreeBeansCollection.java
root/examples-sandbox/trunk/backwardCompatibility/src/main/webapp/WEB-INF/simple-tree-data.properties
root/examples-sandbox/trunk/backwardCompatibility/src/main/webapp/pages/simpleTree.xhtml
Removed:
root/examples-sandbox/trunk/backwardCompatibility/src/main/webapp/pages/AJSF86.xhtml
root/examples-sandbox/trunk/backwardCompatibility/src/main/webapp/pages/trinidad.xhtml
Modified:
root/examples-sandbox/trunk/backwardCompatibility/src/main/webapp/WEB-INF/jboss-web.xml
Log:
Simple tree component test added
Added:
root/examples-sandbox/trunk/backwardCompatibility/src/main/java/org/ajax4jsf/SimpleTreeBean.java
===================================================================
---
root/examples-sandbox/trunk/backwardCompatibility/src/main/java/org/ajax4jsf/SimpleTreeBean.java
(rev 0)
+++
root/examples-sandbox/trunk/backwardCompatibility/src/main/java/org/ajax4jsf/SimpleTreeBean.java 2009-10-14
21:14:07 UTC (rev 15716)
@@ -0,0 +1,112 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.ajax4jsf;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+import javax.faces.FacesException;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+
+import org.richfaces.component.UITree;
+import org.richfaces.event.NodeSelectedEvent;
+import org.richfaces.model.TreeNode;
+import org.richfaces.model.TreeNodeImpl;
+
+public class SimpleTreeBean {
+
+ private TreeNode rootNode = null;
+
+ private String nodeTitle;
+
+ private static final String DATA_PATH =
"/WEB-INF/simple-tree-data.properties";
+
+ private void addNodes(String path, TreeNode node, Properties properties) {
+ boolean end = false;
+ int counter = 1;
+
+ while (!end) {
+ String key = path != null ? path + '.' + counter : String.valueOf(counter);
+
+ String value = properties.getProperty(key);
+ if (value != null) {
+ TreeNodeImpl nodeImpl = new TreeNodeImpl();
+ nodeImpl.setData(value);
+ node.addChild(new Integer(counter), nodeImpl);
+
+ addNodes(key, nodeImpl, properties);
+
+ counter++;
+ } else {
+ end = true;
+ }
+ }
+ }
+
+ private void loadTree() {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ ExternalContext externalContext = facesContext.getExternalContext();
+ InputStream dataStream = externalContext.getResourceAsStream(DATA_PATH);
+ try {
+ Properties properties = new Properties();
+ properties.load(dataStream);
+
+ rootNode = new TreeNodeImpl();
+ addNodes(null, rootNode, properties);
+
+ } catch (IOException e) {
+ throw new FacesException(e.getMessage(), e);
+ } finally {
+ if (dataStream != null) {
+ try {
+ dataStream.close();
+ } catch (IOException e) {
+ externalContext.log(e.getMessage(), e);
+ }
+ }
+ }
+ }
+
+ public TreeNode getTreeNode() {
+ if (rootNode == null) {
+ loadTree();
+ }
+
+ return rootNode;
+ }
+
+ public void processSelection(NodeSelectedEvent event) {
+ UITree tree = (UITree) event.getComponent();
+ nodeTitle = (String) tree.getRowData();
+ }
+
+ public String getNodeTitle() {
+ return nodeTitle;
+ }
+
+ public void setNodeTitle(String nodeTitle) {
+ this.nodeTitle = nodeTitle;
+ }
+
+}
Property changes on:
root/examples-sandbox/trunk/backwardCompatibility/src/main/java/org/ajax4jsf/SimpleTreeBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
root/examples-sandbox/trunk/backwardCompatibility/src/main/java/org/ajax4jsf/TreeBeansCollection.java
===================================================================
---
root/examples-sandbox/trunk/backwardCompatibility/src/main/java/org/ajax4jsf/TreeBeansCollection.java
(rev 0)
+++
root/examples-sandbox/trunk/backwardCompatibility/src/main/java/org/ajax4jsf/TreeBeansCollection.java 2009-10-14
21:14:07 UTC (rev 15716)
@@ -0,0 +1,44 @@
+/**
+ *
+ */
+package org.ajax4jsf;
+
+import java.util.AbstractList;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+
+/**
+ * @author asmirnov
+ *
+ */
+@Name("treeBeansCollection")
+(a)Scope(ScopeType.SESSION)
+public class TreeBeansCollection extends AbstractList<SimpleTreeBean> {
+
+ private final SimpleTreeBean[] beans;
+
+ public TreeBeansCollection() {
+ beans = new SimpleTreeBean[3];
+ for (int i = 0; i < beans.length; i++) {
+ beans[i]=new SimpleTreeBean();
+ }
+ }
+ /* (non-Javadoc)
+ * @see java.util.AbstractList#get(int)
+ */
+ @Override
+ public SimpleTreeBean get(int index) {
+ return beans[index];
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.AbstractCollection#size()
+ */
+ @Override
+ public int size() {
+ return beans.length;
+ }
+
+}
Property changes on:
root/examples-sandbox/trunk/backwardCompatibility/src/main/java/org/ajax4jsf/TreeBeansCollection.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
root/examples-sandbox/trunk/backwardCompatibility/src/main/webapp/WEB-INF/jboss-web.xml
===================================================================
---
root/examples-sandbox/trunk/backwardCompatibility/src/main/webapp/WEB-INF/jboss-web.xml 2009-10-13
18:41:36 UTC (rev 15715)
+++
root/examples-sandbox/trunk/backwardCompatibility/src/main/webapp/WEB-INF/jboss-web.xml 2009-10-14
21:14:07 UTC (rev 15716)
@@ -5,7 +5,7 @@
<jboss-web>
<class-loading java2ClassLoadingCompliance="false">
<loader-repository>
- seam.jboss.org:loader=seamIntegration
+ richfaces.org:loader=richFaces3
<loader-repository-config>java2ParentDelegation=false</loader-repository-config>
</loader-repository>
</class-loading>
Added:
root/examples-sandbox/trunk/backwardCompatibility/src/main/webapp/WEB-INF/simple-tree-data.properties
===================================================================
---
root/examples-sandbox/trunk/backwardCompatibility/src/main/webapp/WEB-INF/simple-tree-data.properties
(rev 0)
+++
root/examples-sandbox/trunk/backwardCompatibility/src/main/webapp/WEB-INF/simple-tree-data.properties 2009-10-14
21:14:07 UTC (rev 15716)
@@ -0,0 +1,67 @@
+1=Daniel Defo
+1.1=Robinson Crusoe
+1.1.1=Start In Life
+1.1.2=Slavery And Escape
+1.1.3=Wrecked On A Desert Island
+1.1.4=First Weeks On The Island
+1.1.5=Builds A House - The Journal
+1.1.6=Ill And Conscience-Stricken
+1.1.7=Agricultural Experience
+1.1.8=Surveys His Position
+1.1.9=A Boat
+1.1.10=Tames Goats
+1.1.11=Finds Print Of Man's Foot On The Sand
+1.1.12=A Cave Retreat
+1.1.13=Wreck Of A Spanish Ship
+1.1.14=A Dream Realised
+1.1.15=Friday's Education
+1.1.16=Rescue Of Prisoners From Cannibals
+1.1.17=Visit Of Mutineers
+1.1.18=The Ship Recovered
+1.1.19=Return To England
+1.1.20=Fight Between Friday And A Bear
+2=Edgar Allan Poe
+2.1=Plays
+2.1.1=Politian
+2.2=Short stories
+2.2.1=The Assignation
+2.2.2=Berenice
+2.2.3=The Black Cat
+2.2.4=The Cask of Amontillado
+2.2.5=A Descent into the Maelstrom
+2.3=Poetry
+2.3.1=Alone
+2.3.2=An Enigma
+2.3.3=Annabel Lee
+2.3.4=Bridal Ballad
+3=Henry Wadsworth Longfellow
+3.1=The Song of Hiawatha
+3.1.1=Introduction
+3.1.2=I. The Peace-Pipe
+3.1.3=II. The Four Winds
+3.1.4=III. Hiawatha's Childhood
+3.1.5=IV. Hiawatha and Mudjekeewis
+3.1.6=V. Hiawatha's Fasting
+3.1.7=VI. Hiawatha's Friends
+3.1.8=VII. Hiawatha's Sailing
+3.1.9=VIII. Hiawatha's Fishing
+3.1.10=IX. Hiawatha and the Pearl-Feather
+3.1.11=X. Hiawatha's Wooing
+3.1.12=XI. Hiawatha's Wedding-Feast
+3.1.13=XII. The Son of the Evening Star
+3.1.14=XIII. Blessing the Cornfields
+3.1.15=XIV. Picture-Writing
+3.1.16=XV. Hiawatha's Lamentation
+3.1.17=XVI. Pau-Puk-Keewis
+3.1.18=XVII. The Hunting of Pau-Puk-Keewis
+3.1.19=XVIII. The Death of Kwasind
+3.1.20=XIX. The Ghosts
+3.1.21=XX. The Famine
+3.1.22=XXI. The White Man's Foot
+3.1.23=XXII. Hiawatha's Departure
+3.2=Poetry
+3.2.1=A Psalm Of Life
+3.2.2=Birds Of Passage
+3.2.3=Hiawatha's Childhood
+3.2.4=Hymn To The Night
+
Property changes on:
root/examples-sandbox/trunk/backwardCompatibility/src/main/webapp/WEB-INF/simple-tree-data.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted:
root/examples-sandbox/trunk/backwardCompatibility/src/main/webapp/pages/AJSF86.xhtml
===================================================================
---
root/examples-sandbox/trunk/backwardCompatibility/src/main/webapp/pages/AJSF86.xhtml 2009-10-13
18:41:36 UTC (rev 15715)
+++
root/examples-sandbox/trunk/backwardCompatibility/src/main/webapp/pages/AJSF86.xhtml 2009-10-14
21:14:07 UTC (rev 15716)
@@ -1,20 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<html
xmlns="http://www.w3.org/1999/xhtml"
-
xmlns:f="http://java.sun.com/jsf/core"
-
xmlns:h="http://java.sun.com/jsf/html"
-
xmlns:a4j="http://richfaces.org/a4j">
-<head><title>Seam + ajax4jsf + binding</title></head>
-<body>
-<h:form>
- Input:
- <h:inputText binding="#{testController.input}"
- value="#{testController.value}">
- <a4j:support event="onkeyup" reRender="repeater"/>
- </h:inputText>
- <h:commandButton value="Ok" />
- <br/>
- Repeat:
- <h:outputText id="repeater"
value="#{testController.value}"/>
-</h:form>
-</body>
-</html>
Added:
root/examples-sandbox/trunk/backwardCompatibility/src/main/webapp/pages/simpleTree.xhtml
===================================================================
---
root/examples-sandbox/trunk/backwardCompatibility/src/main/webapp/pages/simpleTree.xhtml
(rev 0)
+++
root/examples-sandbox/trunk/backwardCompatibility/src/main/webapp/pages/simpleTree.xhtml 2009-10-14
21:14:07 UTC (rev 15716)
@@ -0,0 +1,36 @@
+<!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:f="http://java.sun.com/jsf/core"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:rich="http://richfaces.org/rich"
+
xmlns:c="http://java.sun.com/jsp/jstl/core">
+<head>
+<title>AJAX Simple Tree</title>
+<style>
+.col,.col2 {
+ width: 50%;
+ vertical-align: top;
+}
+</style>
+</head>
+<body>
+<h:form>
+ <a4j:repeat value="#{treeBeansCollection}" var="tree">
+ <h:panelGrid columns="2" width="100%"
columnClasses="col1,col2">
+ <rich:tree style="width:300px"
+ nodeSelectListener="#{tree.processSelection}"
+ reRender="selectedNode" ajaxSubmitSelection="true"
switchType="ajax"
+ value="#{tree.treeNode}" var="item">
+ </rich:tree>
+ <a4j:outputPanel ajaxRendered="true">
+ <h:outputText escape="false" value="Selected Node:
#{tree.nodeTitle}"
+ id="selectedNode" />
+ </a4j:outputPanel>
+ </h:panelGrid>
+ </a4j:repeat>
+
+</h:form>
+</body>
+</html>
\ No newline at end of file
Property changes on:
root/examples-sandbox/trunk/backwardCompatibility/src/main/webapp/pages/simpleTree.xhtml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted:
root/examples-sandbox/trunk/backwardCompatibility/src/main/webapp/pages/trinidad.xhtml
===================================================================
---
root/examples-sandbox/trunk/backwardCompatibility/src/main/webapp/pages/trinidad.xhtml 2009-10-13
18:41:36 UTC (rev 15715)
+++
root/examples-sandbox/trunk/backwardCompatibility/src/main/webapp/pages/trinidad.xhtml 2009-10-14
21:14:07 UTC (rev 15716)
@@ -1,43 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<f:view
xmlns="http://www.w3.org/1999/xhtml"
-
xmlns:a4j="http://richfaces.org/a4j"
-
xmlns:f="http://java.sun.com/jsf/core"
-
xmlns:h="http://java.sun.com/jsf/html"
-
xmlns:tr="http://myfaces.apache.org/trinidad">
- <tr:document title="InputText Demo">
- <tr:form>
- <tr:panelGroupLayout layout="vertical">
- <f:facet name="separator">
- <tr:separator/>
- </f:facet>
- <tr:panelGroupLayout layout="horizontal">
- <tr:commandLink immediate="true" text="Component
Guide" action="guide"/>
- <tr:spacer width="10"/>
- <tr:goLink
destination="http://myfaces.apache.org/trinidad/trinidad-api/tagdoc/...
- text="Tag Documentation"/>
- <tr:spacer width="10"/>
- <tr:goLink
destination="http://myfaces.apache.org/trinidad/skin-selectors.html#...
- text="Skinning Key Documentation"/>
- </tr:panelGroupLayout>
- <tr:outputFormatted styleUsage="instruction"
value="<b>inputText</b>"/>
- <tr:inputText label="Label" value="Some text"/>
- <tr:commandButton text="Submit"/>
- <tr:outputFormatted styleUsage="instruction"
- value="<b>InputText Bound To
Date</b>"/>
- <tr:inputText label="Label2" value="#{seamBean.date1}"
autoSubmit="true">
- <f:convertDateTime dateStyle="long"/>
- </tr:inputText>
- <a4j:commandButton value="RichFaces AJAX Submit"
reRender="output"/>
- <tr:outputText styleClass="AFInstructionText" value="The
submitted value was: "/>
- <tr:outputText id="output"
value="#{seamBean.date1}"/>
- <tr:outputFormatted styleUsage="instruction"
- value="<b>InputText with help
facet</b>"/>
- <tr:inputText label="Label3">
- <f:facet name="help">
- <tr:outputText value="Help facet text"/>
- </f:facet>
- </tr:inputText>
- </tr:panelGroupLayout>
- </tr:form>
- </tr:document>
-</f:view>
\ No newline at end of file