JBoss Rich Faces SVN: r19894 - trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2010-11-02 11:35:52 -0400 (Tue, 02 Nov 2010)
New Revision: 19894
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java
Log:
RF-9544
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java 2010-11-02 15:12:58 UTC (rev 19893)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java 2010-11-02 15:35:52 UTC (rev 19894)
@@ -68,10 +68,9 @@
@JsfRenderer(type = "org.richfaces.ExtendedDataTableRenderer", family = AbstractExtendedDataTable.COMPONENT_FAMILY)
@ResourceDependencies({
- @ResourceDependency(name = "jquery.js"),
- @ResourceDependency(name = "richfaces.js"),
- @ResourceDependency(name = "jquery.position.js"),
@ResourceDependency(library="org.richfaces", name = "extendedDataTable.ecss"),
+ @ResourceDependency(library="org.richfaces", name = "ajax.reslib"),
+ @ResourceDependency(name = "jquery.position.js"),
@ResourceDependency(library="org.richfaces", name = "extendedDataTable.js")
})
public class ExtendedDataTableRenderer extends SelectionRenderer implements MetaComponentRenderer {
14 years, 2 months
JBoss Rich Faces SVN: r19893 - in trunk/ui/iteration/ui/src/main: templates and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-11-02 11:12:58 -0400 (Tue, 02 Nov 2010)
New Revision: 19893
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTreeNode.java
trunk/ui/iteration/ui/src/main/templates/treeNode.template.xml
Log:
Added styleClass attribute for rich:tree & rich:treeNode
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java 2010-11-02 14:43:10 UTC (rev 19892)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java 2010-11-02 15:12:58 UTC (rev 19893)
@@ -158,6 +158,9 @@
public abstract String getNodeType();
+ //TODO - move to template
+ public abstract String getStyleClass();
+
public Collection<Object> getSelection() {
@SuppressWarnings("unchecked")
Collection<Object> selection = (Collection<Object>) getStateHelper().eval(PropertyKeys.selection);
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTreeNode.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTreeNode.java 2010-11-02 14:43:10 UTC (rev 19892)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTreeNode.java 2010-11-02 15:12:58 UTC (rev 19893)
@@ -63,6 +63,9 @@
public abstract String getType();
+ //TODO - move to template
+ public abstract String getStyleClass();
+
protected AbstractTree findTreeComponent() {
UIComponent c = this;
while (c != null && !(c instanceof AbstractTree)) {
Modified: trunk/ui/iteration/ui/src/main/templates/treeNode.template.xml
===================================================================
--- trunk/ui/iteration/ui/src/main/templates/treeNode.template.xml 2010-11-02 14:43:10 UTC (rev 19892)
+++ trunk/ui/iteration/ui/src/main/templates/treeNode.template.xml 2010-11-02 15:12:58 UTC (rev 19893)
@@ -8,7 +8,7 @@
<cc:interface>
<cdk:class>org.richfaces.renderkit.html.TreeNodeRenderer
</cdk:class>
- <cdk:superclass>javax.faces.render.Renderer</cdk:superclass>
+ <cdk:superclass>org.richfaces.renderkit.RendererBase</cdk:superclass>
<cdk:component-family>org.richfaces.TreeNode
</cdk:component-family>
<cdk:renderer-type>org.richfaces.TreeNodeRenderer
@@ -16,7 +16,7 @@
</cc:interface>
<cc:implementation>
- <div class="rf-trn">
+ <div class="#{concatClasses('rf-trn', component.attributes['styleClass'])}">
<span class="rf-trn-hnd #{facesContext.attributes['__treeNodeHandleClass']}" />
<span class="rf-trn-cnt">
<span class="rf-trn-ico #{facesContext.attributes['__treeNodeIconClass']}" />
14 years, 2 months
JBoss Rich Faces SVN: r19892 - trunk/examples.
by richfaces-svn-commits@lists.jboss.org
Author: ilya_shaikovsky
Date: 2010-11-02 10:43:10 -0400 (Tue, 02 Nov 2010)
New Revision: 19892
Modified:
trunk/examples/pom.xml
Log:
build correction. template module required for samples build.
Modified: trunk/examples/pom.xml
===================================================================
--- trunk/examples/pom.xml 2010-11-02 14:29:37 UTC (rev 19891)
+++ trunk/examples/pom.xml 2010-11-02 14:43:10 UTC (rev 19892)
@@ -40,7 +40,8 @@
<modules>
<module>parent</module>
- <module>core-demo</module>
+ <module>template</module>
+ <module>core-demo</module>
<module>misc-demo</module>
<module>output-demo</module>
<module>input-demo</module>
14 years, 2 months
JBoss Rich Faces SVN: r19891 - trunk/ui/iteration/ui/src/main/templates.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-11-02 10:29:37 -0400 (Tue, 02 Nov 2010)
New Revision: 19891
Modified:
trunk/ui/iteration/ui/src/main/templates/tree.template.xml
Log:
https://jira.jboss.org/browse/RF-9614
Modified: trunk/ui/iteration/ui/src/main/templates/tree.template.xml
===================================================================
--- trunk/ui/iteration/ui/src/main/templates/tree.template.xml 2010-11-02 14:21:54 UTC (rev 19890)
+++ trunk/ui/iteration/ui/src/main/templates/tree.template.xml 2010-11-02 14:29:37 UTC (rev 19891)
@@ -12,6 +12,7 @@
<cdk:renders-children>true</cdk:renders-children>
<cdk:resource-dependency name="base-component.reslib" library="org.richfaces" />
+ <cdk:resource-dependency name="ajax.reslib" library="org.richfaces" />
<cdk:resource-dependency name="tree.js" library="org.richfaces" />
<cdk:resource-dependency name="tree.ecss" library="org.richfaces" />
14 years, 2 months
JBoss Rich Faces SVN: r19890 - in trunk: ui/output/ui/src/main/java/org/richfaces/component and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-11-02 10:21:54 -0400 (Tue, 02 Nov 2010)
New Revision: 19890
Modified:
trunk/examples/output-demo/src/main/webapp/examples/collapsiblePanel.xhtml
trunk/ui/output/ui/src/main/java/org/richfaces/component/UITogglePanel.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/UITogglePanelItem.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanel.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem.js
Log:
RF-9562 collapsiblePanel: expanded attribute problems
RF-9434 collapsiblePanel: seems no way to define initial state
Modified: trunk/examples/output-demo/src/main/webapp/examples/collapsiblePanel.xhtml
===================================================================
--- trunk/examples/output-demo/src/main/webapp/examples/collapsiblePanel.xhtml 2010-11-02 14:03:56 UTC (rev 19889)
+++ trunk/examples/output-demo/src/main/webapp/examples/collapsiblePanel.xhtml 2010-11-02 14:21:54 UTC (rev 19890)
@@ -15,7 +15,7 @@
<p>Page</p>
<h:form id="f">
- <pn:collapsiblePanel id="panel">
+ <pn:collapsiblePanel id="panel1" expanded="false" switchType="server">
<f:facet name="headerExpanded" >
header exanded
</f:facet>
@@ -23,10 +23,34 @@
header collapsed
</f:facet>
- Hello!!!
+ Hello Server!!!
</pn:collapsiblePanel>
+ <pn:collapsiblePanel id="panel2" expanded="false" switchType="ajax">
+ <f:facet name="headerExpanded" >
+ header exanded
+ </f:facet>
+ <f:facet name="headerCollapsed" >
+ header collapsed
+ </f:facet>
+
+ Hello Ajax!!!
+
+ </pn:collapsiblePanel>
+
+ <pn:collapsiblePanel id="panel3" expanded="false" switchType="client">
+ <f:facet name="headerExpanded" >
+ header exanded
+ </f:facet>
+ <f:facet name="headerCollapsed" >
+ header collapsed
+ </f:facet>
+
+ Hello client!!!
+
+ </pn:collapsiblePanel>
+
</h:form>
</ui:define>
</ui:composition>
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/UITogglePanel.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/UITogglePanel.java 2010-11-02 14:03:56 UTC (rev 19889)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/UITogglePanel.java 2010-11-02 14:21:54 UTC (rev 19890)
@@ -43,7 +43,8 @@
}
public SwitchType getSwitchType() {
- return (SwitchType) getStateHelper().eval(PropertyKeys.switchType, SwitchType.DEFAULT);
+ SwitchType type = (SwitchType) getStateHelper().eval(PropertyKeys.switchType, SwitchType.DEFAULT);
+ return type == null ? SwitchType.DEFAULT : type;
}
public void setSwitchType(SwitchType switchType) {
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/UITogglePanelItem.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/UITogglePanelItem.java 2010-11-02 14:03:56 UTC (rev 19889)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/UITogglePanelItem.java 2010-11-02 14:21:54 UTC (rev 19890)
@@ -44,7 +44,9 @@
}
public SwitchType getSwitchType() {
- return (SwitchType) getStateHelper().eval(PropertyKeys.switchType, getParent().getSwitchType());
+ SwitchType type = (SwitchType) getStateHelper().eval(PropertyKeys.switchType, getParent().getSwitchType());
+
+ return type == null ? SwitchType.DEFAULT : type;
}
public void setSwitchType(SwitchType switchType) {
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java 2010-11-02 14:03:56 UTC (rev 19889)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java 2010-11-02 14:21:54 UTC (rev 19890)
@@ -77,8 +77,7 @@
String compClientId = component.getClientId(context);
String clientId = requestMap.get(compClientId);
if (clientId != null && clientId.equals(compClientId)) {
- String itemClientId = clientId + (Boolean.parseBoolean(newValue) ? ":content" : ":empty");
- context.getPartialViewContext().getRenderIds().add(itemClientId);
+ context.getPartialViewContext().getRenderIds().add(clientId);
//TODO nick - this should be done on encode, not on decode
addOnCompleteParam(newValue, panel.getClientId());
@@ -191,7 +190,7 @@
break;
case ajax:
- context.getResponseWriter().write(getPlaceHolder(panel.getClientId() + ":empty"));
+ writer.write(getPlaceHolder(panel.getClientId() + ":empty"));
break;
case server:
@@ -212,7 +211,8 @@
writer.startElement("div", component);
writer.writeAttribute("id", component.getClientId() + ":content", null);
writer.writeAttribute("class", concatClasses("rf-cp-b", attributeAsString(component, "bodyClass")), null);
- writer.writeAttribute("style", concatStyles(visible ? "" : "none", attributeAsString(component, "style")), null);
+ writer.writeAttribute("style", concatStyles(styleElement("display", visible ? "block" : "none"),
+ attributeAsString(component, "style")), null);
renderChildren(context, component);
@@ -223,7 +223,7 @@
writer.startElement("div", component);
writer.writeAttribute("id", component.getClientId() + ":empty", null);
writer.writeAttribute("class", "rf-cp-empty", null);
- writer.writeAttribute("style", styleElement("display", visible ? "" : "none"), null);
+ writer.writeAttribute("style", styleElement("display", visible ? "block" : "none"), null);
writer.endElement("div");
}
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanel.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanel.js 2010-11-02 14:03:56 UTC (rev 19889)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/CollapsiblePanel.js 2010-11-02 14:21:54 UTC (rev 19890)
@@ -77,11 +77,6 @@
id: this.id,
isExpanded : newItem.getName()
});
- },
-
-
- destroy: function () {
- rf.ui.TogglePanel.destroy.call(this);
}
});
})(jQuery, RichFaces);
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel.js 2010-11-02 14:03:56 UTC (rev 19889)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel.js 2010-11-02 14:21:54 UTC (rev 19890)
@@ -424,7 +424,7 @@
},
destroy: function () {
- rf.BaseComponent.destroy.call(this);
+ rf.BaseComponent.prototype.destroy.call(this);
}
});
})(jQuery, RichFaces);
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem.js 2010-11-02 14:03:56 UTC (rev 19889)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem.js 2010-11-02 14:21:54 UTC (rev 19890)
@@ -111,7 +111,7 @@
// class stuff
destroy: function () {
- rf.ui.TogglePanelItem.$super.destroy.call(this);
+ rf.BaseComponent.prototype.destroy.call(this);
}
});
})(jQuery, RichFaces);
14 years, 2 months
JBoss Rich Faces SVN: r19889 - in trunk/examples/richfaces-showcase/src/main: resources/org/richfaces/demo/data/common and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: ilya_shaikovsky
Date: 2010-11-02 10:03:56 -0400 (Tue, 02 Nov 2010)
New Revision: 19889
Added:
trunk/examples/richfaces-showcase/src/main/webapp/images/tree/
trunk/examples/richfaces-showcase/src/main/webapp/images/tree/disc.gif
trunk/examples/richfaces-showcase/src/main/webapp/images/tree/song.gif
Removed:
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/push/
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/push/
Modified:
trunk/examples/richfaces-showcase/src/main/resources/org/richfaces/demo/data/common/navigation.xml
Log:
https://jira.jboss.org/browse/RF-9616
Modified: trunk/examples/richfaces-showcase/src/main/resources/org/richfaces/demo/data/common/navigation.xml
===================================================================
--- trunk/examples/richfaces-showcase/src/main/resources/org/richfaces/demo/data/common/navigation.xml 2010-11-02 11:33:20 UTC (rev 19888)
+++ trunk/examples/richfaces-showcase/src/main/resources/org/richfaces/demo/data/common/navigation.xml 2010-11-02 14:03:56 UTC (rev 19889)
@@ -62,16 +62,6 @@
</sample>
</samples>
</demo>
- <!-- demo>
- <id>push</id>
- <name>a4j:push</name>
- <samples>
- <sample>
- <id>push</id>
- <name>push Simple</name>
- </sample>
- </samples>
- </demo-->
<demo>
<id>param</id>
<name>a4j:param</name>
Added: trunk/examples/richfaces-showcase/src/main/webapp/images/tree/disc.gif
===================================================================
(Binary files differ)
Property changes on: trunk/examples/richfaces-showcase/src/main/webapp/images/tree/disc.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/examples/richfaces-showcase/src/main/webapp/images/tree/song.gif
===================================================================
(Binary files differ)
Property changes on: trunk/examples/richfaces-showcase/src/main/webapp/images/tree/song.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
14 years, 2 months
JBoss Rich Faces SVN: r19888 - in trunk: ui/output/ui/src/main/resources/META-INF/resources/org.richfaces and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2010-11-02 07:33:20 -0400 (Tue, 02 Nov 2010)
New Revision: 19888
Modified:
trunk/examples/output-demo/src/main/webapp/qunit/tooltip.xhtml
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tooltip.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/tooltip.ecss
Log:
Tooltip bug fixing
Modified: trunk/examples/output-demo/src/main/webapp/qunit/tooltip.xhtml
===================================================================
--- trunk/examples/output-demo/src/main/webapp/qunit/tooltip.xhtml 2010-11-02 11:17:32 UTC (rev 19887)
+++ trunk/examples/output-demo/src/main/webapp/qunit/tooltip.xhtml 2010-11-02 11:33:20 UTC (rev 19888)
@@ -49,7 +49,7 @@
<div id="myRectangle" style="border: 2px solid red; background-color: #adff2f; width:300px; height:300px">
Tooltip apeared under green rectangle.
- <pn:tooltip id="tooltip" target="myRectangle" mode="ajax">
+ <pn:tooltip id="tooltip" target="myRectangle" mode="ajax" showDelay="500">
New ToolTip Yo!!!
</pn:tooltip>
</div>
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tooltip.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tooltip.js 2010-11-02 11:17:32 UTC (rev 19887)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tooltip.js 2010-11-02 11:33:20 UTC (rev 19888)
@@ -186,6 +186,7 @@
var tooltip = this;
this.__delay(this.options.hideDelay, function () {
tooltip.popup.hide();
+ $(rf.getDomElement(tooltip.id)).hide();
});
},
@@ -219,8 +220,9 @@
*/
__show: function (event) {
var tooltip = this;
- this.__delay(this.options.hideDelay, function () {
+ this.__delay(this.options.showDelay, function () {
tooltip.popup.show(event);
+ $(rf.getDomElement(tooltip.id)).show();
});
},
@@ -231,7 +233,7 @@
action();
if (hidingTimerHandle) {
- window.clearTimeout(this.hidingTimerHandle);
+ window.clearTimeout(hidingTimerHandle);
hidingTimerHandle = undefined;
}
}, delay);
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/tooltip.ecss
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/tooltip.ecss 2010-11-02 11:17:32 UTC (rev 19887)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/tooltip.ecss 2010-11-02 11:33:20 UTC (rev 19888)
@@ -22,6 +22,7 @@
.rf-tt {
position: absolute;
+ display: none;
}
.rf-tt-loading {
@@ -33,6 +34,14 @@
}
.rf-tt-cntr {
+ background-color: white;
+ padding: 7px;
+ border: 1px solid;
+/* color: generalFontColor; */
+ border-color : '#{richSkin.tipBorderColor}';
+ font-family: '#{richSkin.generalFamilyFont}';
+ font-size: '#{richSkin.generalSizeFont}';
+ float: left;
position: absolute;
display: none;
}
\ No newline at end of file
14 years, 2 months
JBoss Rich Faces SVN: r19887 - in trunk/examples/core-demo/src/main: webapp and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-11-02 07:17:32 -0400 (Tue, 02 Nov 2010)
New Revision: 19887
Removed:
trunk/examples/core-demo/src/main/java/org/richfaces/demo/PushBean.java
trunk/examples/core-demo/src/main/webapp/push.xhtml
Modified:
trunk/examples/core-demo/src/main/webapp/welcome.xhtml
Log:
Removed push component from core-demo
Deleted: trunk/examples/core-demo/src/main/java/org/richfaces/demo/PushBean.java
===================================================================
--- trunk/examples/core-demo/src/main/java/org/richfaces/demo/PushBean.java 2010-11-02 11:02:21 UTC (rev 19886)
+++ trunk/examples/core-demo/src/main/java/org/richfaces/demo/PushBean.java 2010-11-02 11:17:32 UTC (rev 19887)
@@ -1,64 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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.richfaces.demo;
-
-import java.io.Serializable;
-import java.util.EventListener;
-import java.util.EventObject;
-
-import javax.faces.bean.ManagedBean;
-import javax.faces.bean.SessionScoped;
-
-import org.ajax4jsf.event.PushEventListener;
-
-/**
- * @author Nick Belaevski
- *
- */
-@ManagedBean(name = "pushBean")
-@SessionScoped
-public class PushBean implements Serializable {
-
- private static final long serialVersionUID = 4810889475400649809L;
-
- private int counter = 0;
-
- private transient volatile PushEventListener listener;
-
- public void setListener(EventListener listener) {
- this.listener = (PushEventListener) listener;
- }
-
- public void generateEvent() {
- listener.onEvent(new EventObject(this));
- }
-
- public int getCounter() {
- return counter;
- }
-
- public void increaseCounter() {
- counter++;
- }
-}
Deleted: trunk/examples/core-demo/src/main/webapp/push.xhtml
===================================================================
--- trunk/examples/core-demo/src/main/webapp/push.xhtml 2010-11-02 11:02:21 UTC (rev 19886)
+++ trunk/examples/core-demo/src/main/webapp/push.xhtml 2010-11-02 11:17:32 UTC (rev 19887)
@@ -1,29 +0,0 @@
-<?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: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">
-<f:view>
- <h:head>
- </h:head>
- <h:body>
- <h:panelGrid columns="2">
- Time: <h:panelGroup id="time">#{timeBean.dateString} - #{pushBean.counter}</h:panelGroup>
- </h:panelGrid>
-
- <h:form id="form">
- <a4j:push ondataavailable="return confirm('execute action?')" eventProducer="#{pushBean.setListener}" interval="1000" action="#{pushBean.increaseCounter}">
- <f:ajax render="#{':time'}" />
- <f:param name="testParam" value="testValue" />
- <f:param name="testParam1" value="testValue1" />
- </a4j:push>
-
- <h:commandLink value="Generate push event" action="#{pushBean.generateEvent}">
- <f:ajax render="@none" />
- </h:commandLink>
- </h:form>
- </h:body>
-</f:view>
-</html>
\ No newline at end of file
Modified: trunk/examples/core-demo/src/main/webapp/welcome.xhtml
===================================================================
--- trunk/examples/core-demo/src/main/webapp/welcome.xhtml 2010-11-02 11:02:21 UTC (rev 19886)
+++ trunk/examples/core-demo/src/main/webapp/welcome.xhtml 2010-11-02 11:17:32 UTC (rev 19887)
@@ -17,7 +17,6 @@
<li><h:link outcome="log">a4j:log</h:link></li>
<li><h:link outcome="mediaOutput">a4j:mediaOutput</h:link></li>
<li><h:link outcome="outputPanel">a4j:outputPanel</h:link></li>
- <li><h:link outcome="push">a4j:push</h:link></li>
<li><h:link outcome="function">a4j:jsFunction</h:link></li>
<li><h:link outcome="status">a4j:status</h:link></li>
<li><h:link outcome="dynamicExecute">Server side execute/render</h:link></li>
14 years, 2 months
JBoss Rich Faces SVN: r19886 - in trunk/examples/richfaces-showcase/src/main: resources/org/richfaces/demo/tree and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: ilya_shaikovsky
Date: 2010-11-02 07:02:21 -0400 (Tue, 02 Nov 2010)
New Revision: 19886
Added:
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/TreeBean.java
Removed:
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/SimpleTreeBean.java
Modified:
trunk/examples/richfaces-showcase/src/main/resources/org/richfaces/demo/tree/CDCatalog.xml
Log:
https://jira.jboss.org/browse/RF-9611
Deleted: trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/SimpleTreeBean.java
===================================================================
--- trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/SimpleTreeBean.java 2010-11-02 10:59:22 UTC (rev 19885)
+++ trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/SimpleTreeBean.java 2010-11-02 11:02:21 UTC (rev 19886)
@@ -1,106 +0,0 @@
-/*
- * 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.demo.tree;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.annotation.PostConstruct;
-import javax.faces.bean.ManagedBean;
-import javax.faces.bean.ManagedProperty;
-import javax.faces.bean.SessionScoped;
-import javax.swing.tree.TreeNode;
-
-import org.richfaces.demo.tree.model.CD;
-import org.richfaces.demo.tree.model.Company;
-import org.richfaces.demo.tree.model.Country;
-
-/**
- * @author Ilya Shaikovsky
- *
- */
-@ManagedBean(name = "treeBean")
-@SessionScoped
-public class SimpleTreeBean implements Serializable {
- @ManagedProperty(value = "#{cdsParser.cdsList}")
- private List<CDXmlDescriptor> cdXmlDescriptors;
- private List<TreeNode> rootNodes = new ArrayList<TreeNode>();
- private Map<String, Country> countriesCache = new HashMap<String, Country>();
- private Map<String, Company> companiesCache = new HashMap<String, Company>();
-
- @PostConstruct
- public void init() {
- for (CDXmlDescriptor current : cdXmlDescriptors) {
- String countryName = current.getCountry();
- String companyName = current.getCompany();
- Country country = getCountryByName(current);
- Company company = getCompanyByName(current, country);
- CD cd = new CD(current.getTitle(), current.getArtist(), company, current.getPrice(), current.getYear());
- company.getCds().add(cd);
- }
- }
-
- private Country getCountryByName(CDXmlDescriptor descriptor) {
- String countryName = descriptor.getCountry();
- Country country = countriesCache.get(countryName);
- if (country == null) {
- country = new Country();
- country.setName(countryName);
- countriesCache.put(countryName, country);
- rootNodes.add(country);
- }
- return country;
- }
-
- private Company getCompanyByName(CDXmlDescriptor descriptor, Country country) {
- String companyName = descriptor.getCompany();
- Company company = companiesCache.get(companyName);
- if (company == null) {
- company = new Company();
- company.setName(companyName);
- company.setParent(country);
- country.getCompanies().add(company);
- companiesCache.put(companyName, company);
- }
- return company;
- }
-
- public List<CDXmlDescriptor> getCdXmlDescriptors() {
- return cdXmlDescriptors;
- }
-
- public void setCdXmlDescriptors(List<CDXmlDescriptor> cdXmlDescriptors) {
- this.cdXmlDescriptors = cdXmlDescriptors;
- }
-
- public List<TreeNode> getRootNodes() {
- return rootNodes;
- }
-
- public void setRootNodes(List<TreeNode> rootNodes) {
- this.rootNodes = rootNodes;
- }
-
-}
Copied: trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/TreeBean.java (from rev 19885, trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/SimpleTreeBean.java)
===================================================================
--- trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/TreeBean.java (rev 0)
+++ trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/TreeBean.java 2010-11-02 11:02:21 UTC (rev 19886)
@@ -0,0 +1,106 @@
+/*
+ * 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.demo.tree;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.annotation.PostConstruct;
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.ManagedProperty;
+import javax.faces.bean.SessionScoped;
+import javax.swing.tree.TreeNode;
+
+import org.richfaces.demo.tree.model.CD;
+import org.richfaces.demo.tree.model.Company;
+import org.richfaces.demo.tree.model.Country;
+
+/**
+ * @author Ilya Shaikovsky
+ *
+ */
+@ManagedBean
+@SessionScoped
+public class TreeBean implements Serializable {
+ @ManagedProperty(value = "#{cdsParser.cdsList}")
+ private List<CDXmlDescriptor> cdXmlDescriptors;
+ private List<TreeNode> rootNodes = new ArrayList<TreeNode>();
+ private Map<String, Country> countriesCache = new HashMap<String, Country>();
+ private Map<String, Company> companiesCache = new HashMap<String, Company>();
+
+ @PostConstruct
+ public void init() {
+ for (CDXmlDescriptor current : cdXmlDescriptors) {
+ String countryName = current.getCountry();
+ String companyName = current.getCompany();
+ Country country = getCountryByName(current);
+ Company company = getCompanyByName(current, country);
+ CD cd = new CD(current.getTitle(), current.getArtist(), company, current.getPrice(), current.getYear());
+ company.getCds().add(cd);
+ }
+ }
+
+ private Country getCountryByName(CDXmlDescriptor descriptor) {
+ String countryName = descriptor.getCountry();
+ Country country = countriesCache.get(countryName);
+ if (country == null) {
+ country = new Country();
+ country.setName(countryName);
+ countriesCache.put(countryName, country);
+ rootNodes.add(country);
+ }
+ return country;
+ }
+
+ private Company getCompanyByName(CDXmlDescriptor descriptor, Country country) {
+ String companyName = descriptor.getCompany();
+ Company company = companiesCache.get(companyName);
+ if (company == null) {
+ company = new Company();
+ company.setName(companyName);
+ company.setParent(country);
+ country.getCompanies().add(company);
+ companiesCache.put(companyName, company);
+ }
+ return company;
+ }
+
+ public List<CDXmlDescriptor> getCdXmlDescriptors() {
+ return cdXmlDescriptors;
+ }
+
+ public void setCdXmlDescriptors(List<CDXmlDescriptor> cdXmlDescriptors) {
+ this.cdXmlDescriptors = cdXmlDescriptors;
+ }
+
+ public List<TreeNode> getRootNodes() {
+ return rootNodes;
+ }
+
+ public void setRootNodes(List<TreeNode> rootNodes) {
+ this.rootNodes = rootNodes;
+ }
+
+}
Modified: trunk/examples/richfaces-showcase/src/main/resources/org/richfaces/demo/tree/CDCatalog.xml
===================================================================
--- trunk/examples/richfaces-showcase/src/main/resources/org/richfaces/demo/tree/CDCatalog.xml 2010-11-02 10:59:22 UTC (rev 19885)
+++ trunk/examples/richfaces-showcase/src/main/resources/org/richfaces/demo/tree/CDCatalog.xml 2010-11-02 11:02:21 UTC (rev 19886)
@@ -11,7 +11,7 @@
<CD>
<TITLE>Hide your heart</TITLE>
<ARTIST>Bonnie Tylor</ARTIST>
- <COUNTRY>UK</COUNTRY>
+ <COUNTRY>United Kingdom</COUNTRY>
<COMPANY>CBS Records</COMPANY>
<PRICE>9.90</PRICE>
<YEAR>1988</YEAR>
@@ -27,7 +27,7 @@
<CD>
<TITLE>Still got the blues</TITLE>
<ARTIST>Gary More</ARTIST>
- <COUNTRY>UK</COUNTRY>
+ <COUNTRY>United Kingdom</COUNTRY>
<COMPANY>Virgin redords</COMPANY>
<PRICE>10.20</PRICE>
<YEAR>1990</YEAR>
@@ -35,7 +35,7 @@
<CD>
<TITLE>Eros</TITLE>
<ARTIST>Eros Ramazzotti</ARTIST>
- <COUNTRY>EU</COUNTRY>
+ <COUNTRY>Europe</COUNTRY>
<COMPANY>BMG</COMPANY>
<PRICE>9.90</PRICE>
<YEAR>1997</YEAR>
@@ -43,7 +43,7 @@
<CD>
<TITLE>One night only</TITLE>
<ARTIST>Bee Gees</ARTIST>
- <COUNTRY>UK</COUNTRY>
+ <COUNTRY>United Kingdom</COUNTRY>
<COMPANY>Polydor</COMPANY>
<PRICE>10.90</PRICE>
<YEAR>1998</YEAR>
@@ -51,7 +51,7 @@
<CD>
<TITLE>Sylvias Mother</TITLE>
<ARTIST>Dr.Hook</ARTIST>
- <COUNTRY>UK</COUNTRY>
+ <COUNTRY>United Kingdom</COUNTRY>
<COMPANY>CBS</COMPANY>
<PRICE>8.10</PRICE>
<YEAR>1973</YEAR>
@@ -59,7 +59,7 @@
<CD>
<TITLE>Maggie May</TITLE>
<ARTIST>Rod Stewart</ARTIST>
- <COUNTRY>UK</COUNTRY>
+ <COUNTRY>United Kingdom</COUNTRY>
<COMPANY>Pickwick</COMPANY>
<PRICE>8.50</PRICE>
<YEAR>1990</YEAR>
@@ -67,7 +67,7 @@
<CD>
<TITLE>Romanza</TITLE>
<ARTIST>Andrea Bocelli</ARTIST>
- <COUNTRY>EU</COUNTRY>
+ <COUNTRY>Europe</COUNTRY>
<COMPANY>Polydor</COMPANY>
<PRICE>10.80</PRICE>
<YEAR>1996</YEAR>
@@ -83,7 +83,7 @@
<CD>
<TITLE>Black angel</TITLE>
<ARTIST>Savage Rose</ARTIST>
- <COUNTRY>EU</COUNTRY>
+ <COUNTRY>Europe</COUNTRY>
<COMPANY>Mega</COMPANY>
<PRICE>10.90</PRICE>
<YEAR>1995</YEAR>
@@ -99,7 +99,7 @@
<CD>
<TITLE>For the good times</TITLE>
<ARTIST>Kenny Rogers</ARTIST>
- <COUNTRY>UK</COUNTRY>
+ <COUNTRY>United Kingdom</COUNTRY>
<COMPANY>Mucik Master</COMPANY>
<PRICE>8.70</PRICE>
<YEAR>1995</YEAR>
@@ -115,7 +115,7 @@
<CD>
<TITLE>Tupelo Honey</TITLE>
<ARTIST>Van Morrison</ARTIST>
- <COUNTRY>UK</COUNTRY>
+ <COUNTRY>United Kingdom</COUNTRY>
<COMPANY>Polydor</COMPANY>
<PRICE>8.20</PRICE>
<YEAR>1971</YEAR>
@@ -131,7 +131,7 @@
<CD>
<TITLE>The very best of</TITLE>
<ARTIST>Cat Stevens</ARTIST>
- <COUNTRY>UK</COUNTRY>
+ <COUNTRY>United Kingdom</COUNTRY>
<COMPANY>Island</COMPANY>
<PRICE>8.90</PRICE>
<YEAR>1990</YEAR>
@@ -139,7 +139,7 @@
<CD>
<TITLE>Stop</TITLE>
<ARTIST>Sam Brown</ARTIST>
- <COUNTRY>UK</COUNTRY>
+ <COUNTRY>United Kingdom</COUNTRY>
<COMPANY>A and M</COMPANY>
<PRICE>8.90</PRICE>
<YEAR>1988</YEAR>
@@ -147,7 +147,7 @@
<CD>
<TITLE>Bridge of Spies</TITLE>
<ARTIST>T`Pau</ARTIST>
- <COUNTRY>UK</COUNTRY>
+ <COUNTRY>United Kingdom</COUNTRY>
<COMPANY>Siren</COMPANY>
<PRICE>7.90</PRICE>
<YEAR>1987</YEAR>
@@ -155,7 +155,7 @@
<CD>
<TITLE>Private Dancer</TITLE>
<ARTIST>Tina Turner</ARTIST>
- <COUNTRY>UK</COUNTRY>
+ <COUNTRY>United Kingdom</COUNTRY>
<COMPANY>Capitol</COMPANY>
<PRICE>8.90</PRICE>
<YEAR>1983</YEAR>
@@ -163,7 +163,7 @@
<CD>
<TITLE>Midt om natten</TITLE>
<ARTIST>Kim Larsen</ARTIST>
- <COUNTRY>EU</COUNTRY>
+ <COUNTRY>Europe</COUNTRY>
<COMPANY>Medley</COMPANY>
<PRICE>7.80</PRICE>
<YEAR>1983</YEAR>
@@ -171,7 +171,7 @@
<CD>
<TITLE>Pavarotti Gala Concert</TITLE>
<ARTIST>Luciano Pavarotti</ARTIST>
- <COUNTRY>UK</COUNTRY>
+ <COUNTRY>United Kingdom</COUNTRY>
<COMPANY>DECCA</COMPANY>
<PRICE>9.90</PRICE>
<YEAR>1991</YEAR>
@@ -187,7 +187,7 @@
<CD>
<TITLE>Picture book</TITLE>
<ARTIST>Simply Red</ARTIST>
- <COUNTRY>EU</COUNTRY>
+ <COUNTRY>Europe</COUNTRY>
<COMPANY>Elektra</COMPANY>
<PRICE>7.20</PRICE>
<YEAR>1985</YEAR>
@@ -195,7 +195,7 @@
<CD>
<TITLE>Red</TITLE>
<ARTIST>The Communards</ARTIST>
- <COUNTRY>UK</COUNTRY>
+ <COUNTRY>United Kingdom</COUNTRY>
<COMPANY>London</COMPANY>
<PRICE>7.80</PRICE>
<YEAR>1987</YEAR>
14 years, 2 months
JBoss Rich Faces SVN: r19885 - in trunk/examples/richfaces-showcase/src/main: java/org/richfaces/demo/tree/model and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: ilya_shaikovsky
Date: 2010-11-02 06:59:22 -0400 (Tue, 02 Nov 2010)
New Revision: 19885
Added:
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/CDXmlDescriptor.java
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/model/NamedNode.java
Removed:
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/model/Artist.java
Modified:
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/CDParser.java
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/SimpleTreeBean.java
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/model/CD.java
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/model/Company.java
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/model/Country.java
trunk/examples/richfaces-showcase/src/main/resources/org/richfaces/demo/data/common/navigation.xml
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/tree/samples/tree-sample.xhtml
Log:
https://jira.jboss.org/browse/RF-9611
Modified: trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/CDParser.java
===================================================================
--- trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/CDParser.java 2010-11-02 09:53:35 UTC (rev 19884)
+++ trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/CDParser.java 2010-11-02 10:59:22 UTC (rev 19885)
@@ -11,31 +11,30 @@
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
-import org.richfaces.demo.tree.model.CD;
@ManagedBean(name="cdsParser")
@ApplicationScoped
public class CDParser {
- private List<CD> cdsList;
+ private List<CDXmlDescriptor> cdsList;
@XmlRootElement(name = "CATALOG")
private static final class CDsHolder {
- private List<CD> cds;
+ private List<CDXmlDescriptor> cds;
@XmlElement(name = "CD")
- public List<CD> getCds() {
+ public List<CDXmlDescriptor> getCds() {
return cds;
}
@SuppressWarnings("unused")
- public void setCds(List<CD> cds) {
+ public void setCds(List<CDXmlDescriptor> cds) {
this.cds = cds;
}
}
- public synchronized List<CD> getCdsList() {
+ public synchronized List<CDXmlDescriptor> getCdsList() {
if (cdsList == null) {
ClassLoader ccl = Thread.currentThread().getContextClassLoader();
URL resource = ccl.getResource("org/richfaces/demo/tree/CDCatalog.xml");
Copied: trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/CDXmlDescriptor.java (from rev 19883, trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/model/CD.java)
===================================================================
--- trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/CDXmlDescriptor.java (rev 0)
+++ trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/CDXmlDescriptor.java 2010-11-02 10:59:22 UTC (rev 19885)
@@ -0,0 +1,69 @@
+package org.richfaces.demo.tree;
+
+import java.io.Serializable;
+
+import javax.xml.bind.annotation.XmlElement;
+
+public class CDXmlDescriptor implements Serializable {
+ private String artist;
+ private String title;
+ private String country;
+ private String company;
+ private float price;
+ private int year;
+
+ @XmlElement(name = "ARTIST")
+ public String getArtist() {
+ return artist;
+ }
+
+ public void setArtist(String artist) {
+ this.artist = artist;
+ }
+
+ @XmlElement(name = "TITLE")
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ @XmlElement(name = "COUNTRY")
+ public String getCountry() {
+ return country;
+ }
+
+ public void setCountry(String country) {
+ this.country = country;
+ }
+
+ @XmlElement(name = "COMPANY")
+ public String getCompany() {
+ return company;
+ }
+
+ public void setCompany(String company) {
+ this.company = company;
+ }
+
+ @XmlElement(name = "PRICE")
+ public float getPrice() {
+ return price;
+ }
+
+ public void setPrice(float price) {
+ this.price = price;
+ }
+
+ @XmlElement(name = "YEAR")
+ public int getYear() {
+ return year;
+ }
+
+ public void setYear(int year) {
+ this.year = year;
+ }
+
+}
Modified: trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/SimpleTreeBean.java
===================================================================
--- trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/SimpleTreeBean.java 2010-11-02 09:53:35 UTC (rev 19884)
+++ trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/SimpleTreeBean.java 2010-11-02 10:59:22 UTC (rev 19885)
@@ -22,14 +22,20 @@
package org.richfaces.demo.tree;
import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.SessionScoped;
+import javax.swing.tree.TreeNode;
import org.richfaces.demo.tree.model.CD;
+import org.richfaces.demo.tree.model.Company;
+import org.richfaces.demo.tree.model.Country;
/**
* @author Ilya Shaikovsky
@@ -39,20 +45,62 @@
@SessionScoped
public class SimpleTreeBean implements Serializable {
@ManagedProperty(value = "#{cdsParser.cdsList}")
- private List<CD> cds;
+ private List<CDXmlDescriptor> cdXmlDescriptors;
+ private List<TreeNode> rootNodes = new ArrayList<TreeNode>();
+ private Map<String, Country> countriesCache = new HashMap<String, Country>();
+ private Map<String, Company> companiesCache = new HashMap<String, Company>();
+
@PostConstruct
public void init() {
-// for (CD cd : cds) {
-//
-// }
+ for (CDXmlDescriptor current : cdXmlDescriptors) {
+ String countryName = current.getCountry();
+ String companyName = current.getCompany();
+ Country country = getCountryByName(current);
+ Company company = getCompanyByName(current, country);
+ CD cd = new CD(current.getTitle(), current.getArtist(), company, current.getPrice(), current.getYear());
+ company.getCds().add(cd);
+ }
}
- public List<CD> getCds() {
- return cds;
+ private Country getCountryByName(CDXmlDescriptor descriptor) {
+ String countryName = descriptor.getCountry();
+ Country country = countriesCache.get(countryName);
+ if (country == null) {
+ country = new Country();
+ country.setName(countryName);
+ countriesCache.put(countryName, country);
+ rootNodes.add(country);
+ }
+ return country;
}
- public void setCds(List<CD> cds) {
- this.cds = cds;
+ private Company getCompanyByName(CDXmlDescriptor descriptor, Country country) {
+ String companyName = descriptor.getCompany();
+ Company company = companiesCache.get(companyName);
+ if (company == null) {
+ company = new Company();
+ company.setName(companyName);
+ company.setParent(country);
+ country.getCompanies().add(company);
+ companiesCache.put(companyName, company);
+ }
+ return company;
}
+ public List<CDXmlDescriptor> getCdXmlDescriptors() {
+ return cdXmlDescriptors;
+ }
+
+ public void setCdXmlDescriptors(List<CDXmlDescriptor> cdXmlDescriptors) {
+ this.cdXmlDescriptors = cdXmlDescriptors;
+ }
+
+ public List<TreeNode> getRootNodes() {
+ return rootNodes;
+ }
+
+ public void setRootNodes(List<TreeNode> rootNodes) {
+ this.rootNodes = rootNodes;
+ }
+
}
Deleted: trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/model/Artist.java
===================================================================
--- trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/model/Artist.java 2010-11-02 09:53:35 UTC (rev 19884)
+++ trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/model/Artist.java 2010-11-02 10:59:22 UTC (rev 19885)
@@ -1,44 +0,0 @@
-package org.richfaces.demo.tree.model;
-
-import java.util.Enumeration;
-
-import javax.swing.tree.TreeNode;
-
-public class Artist implements TreeNode{
-
- public TreeNode getChildAt(int childIndex) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public int getChildCount() {
- // TODO Auto-generated method stub
- return 0;
- }
-
- public TreeNode getParent() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public int getIndex(TreeNode node) {
- // TODO Auto-generated method stub
- return 0;
- }
-
- public boolean getAllowsChildren() {
- // TODO Auto-generated method stub
- return false;
- }
-
- public boolean isLeaf() {
- // TODO Auto-generated method stub
- return false;
- }
-
- public Enumeration children() {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
Modified: trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/model/CD.java
===================================================================
--- trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/model/CD.java 2010-11-02 09:53:35 UTC (rev 19884)
+++ trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/model/CD.java 2010-11-02 10:59:22 UTC (rev 19885)
@@ -1,18 +1,67 @@
package org.richfaces.demo.tree.model;
-import java.io.Serializable;
+import java.util.Enumeration;
-import javax.xml.bind.annotation.XmlElement;
+import javax.swing.tree.TreeNode;
-public class CD implements Serializable {
+public class CD extends NamedNode implements TreeNode {
+ private Company company;
private String artist;
private String title;
- private String country;
- private String company;
private float price;
private int year;
- @XmlElement(name = "ARTIST")
+ public CD() {
+ this.setType("cd");
+ }
+
+ public CD(String title, String artist, Company company, float price, int year) {
+ super();
+ this.setType("cd");
+ this.company = company;
+ this.artist = artist;
+ this.title = title;
+ this.price = price;
+ this.year = year;
+ }
+
+ public TreeNode getChildAt(int childIndex) {
+ return null;
+ }
+
+ public int getChildCount() {
+ return 0;
+ }
+
+ public TreeNode getParent() {
+ return company;
+ }
+
+ public int getIndex(TreeNode node) {
+ return 0;
+ }
+
+ public boolean getAllowsChildren() {
+ return false;
+ }
+
+ public boolean isLeaf() {
+ return true;
+ }
+
+ public Enumeration<TreeNode> children() {
+ return new Enumeration<TreeNode>() {
+
+ public boolean hasMoreElements() {
+ return false;
+ }
+
+ public TreeNode nextElement() {
+ return null;
+ }
+ };
+ }
+
public String getArtist() {
return artist;
}
@@ -21,7 +70,6 @@
this.artist = artist;
}
- @XmlElement(name = "TITLE")
public String getTitle() {
return title;
}
@@ -30,25 +78,6 @@
this.title = title;
}
- @XmlElement(name = "COUNTRY")
- public String getCountry() {
- return country;
- }
-
- public void setCountry(String country) {
- this.country = country;
- }
-
- @XmlElement(name = "COMPANY")
- public String getCompany() {
- return company;
- }
-
- public void setCompany(String company) {
- this.company = company;
- }
-
- @XmlElement(name = "PRICE")
public float getPrice() {
return price;
}
@@ -57,7 +86,6 @@
this.price = price;
}
- @XmlElement(name = "YEAR")
public int getYear() {
return year;
}
@@ -65,5 +93,4 @@
public void setYear(int year) {
this.year = year;
}
-
}
Modified: trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/model/Company.java
===================================================================
--- trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/model/Company.java 2010-11-02 09:53:35 UTC (rev 19884)
+++ trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/model/Company.java 2010-11-02 10:59:22 UTC (rev 19885)
@@ -1,44 +1,72 @@
package org.richfaces.demo.tree.model;
+import java.util.ArrayList;
import java.util.Enumeration;
+import java.util.List;
import javax.swing.tree.TreeNode;
-public class Company implements TreeNode{
+import com.google.common.collect.Iterators;
+public class Company extends NamedNode implements TreeNode {
+ private String name;
+ private List<CD> cds = new ArrayList<CD>();
+ private Country country;
+
+ public Company() {
+ this.setType("company");
+ }
+
public TreeNode getChildAt(int childIndex) {
- // TODO Auto-generated method stub
- return null;
+ return cds.get(childIndex);
}
public int getChildCount() {
- // TODO Auto-generated method stub
- return 0;
+ return cds.size();
}
public TreeNode getParent() {
- // TODO Auto-generated method stub
- return null;
+ return country;
}
+ public void setParent(Country country) {
+ this.country = country;
+ }
+
public int getIndex(TreeNode node) {
- // TODO Auto-generated method stub
- return 0;
+ return cds.indexOf(node);
}
public boolean getAllowsChildren() {
- // TODO Auto-generated method stub
- return false;
+ return true;
}
public boolean isLeaf() {
- // TODO Auto-generated method stub
- return false;
+ return cds.isEmpty();
}
public Enumeration children() {
- // TODO Auto-generated method stub
- return null;
+ return Iterators.asEnumeration(cds.iterator());
}
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Country getCountry() {
+ return country;
+ }
+
+ public void setCountry(Country country) {
+ this.country = country;
+ }
+
+ public List<CD> getCds() {
+ return cds;
+ }
+
}
Modified: trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/model/Country.java
===================================================================
--- trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/model/Country.java 2010-11-02 09:53:35 UTC (rev 19884)
+++ trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/model/Country.java 2010-11-02 10:59:22 UTC (rev 19885)
@@ -8,10 +8,15 @@
import com.google.common.collect.Iterators;
-public class Country implements TreeNode {
+public class Country extends NamedNode implements TreeNode {
+
private String name;
private List<Company> companies = new ArrayList<Company>();
+ public Country() {
+ this.setType("country");
+ }
+
public TreeNode getChildAt(int childIndex) {
return companies.get(childIndex);
}
@@ -40,4 +45,16 @@
return Iterators.asEnumeration(companies.iterator());
}
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public List<Company> getCompanies() {
+ return companies;
+ }
+
}
Added: trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/model/NamedNode.java
===================================================================
--- trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/model/NamedNode.java (rev 0)
+++ trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/model/NamedNode.java 2010-11-02 10:59:22 UTC (rev 19885)
@@ -0,0 +1,13 @@
+package org.richfaces.demo.tree.model;
+
+public class NamedNode {
+ private String type;
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+}
Modified: trunk/examples/richfaces-showcase/src/main/resources/org/richfaces/demo/data/common/navigation.xml
===================================================================
--- trunk/examples/richfaces-showcase/src/main/resources/org/richfaces/demo/data/common/navigation.xml 2010-11-02 09:53:35 UTC (rev 19884)
+++ trunk/examples/richfaces-showcase/src/main/resources/org/richfaces/demo/data/common/navigation.xml 2010-11-02 10:59:22 UTC (rev 19885)
@@ -290,7 +290,7 @@
</demo>
</demos>
</group>
- <!-- group>
+ <group>
<name>Trees</name>
<demos>
<demo new="true">
@@ -304,7 +304,7 @@
</samples>
</demo>
</demos>
- </group-->
+ </group>
<group>
<name>Output/Panels</name>
<demos>
Modified: trunk/examples/richfaces-showcase/src/main/webapp/richfaces/tree/samples/tree-sample.xhtml
===================================================================
--- trunk/examples/richfaces-showcase/src/main/webapp/richfaces/tree/samples/tree-sample.xhtml 2010-11-02 09:53:35 UTC (rev 19884)
+++ trunk/examples/richfaces-showcase/src/main/webapp/richfaces/tree/samples/tree-sample.xhtml 2010-11-02 10:59:22 UTC (rev 19885)
@@ -6,21 +6,21 @@
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
<h:form id="form">
- <a4j:repeat value="#{treeBean.cds}" var="cd">#{cd.artist}</a4j:repeat>
- <ui:remove>
- <rich:tree id="tree" nodeType="#{node.parent == null ? 'rootNode': 'childNode'}" var="node" value="#{treeBean.rootNodes}"
- selectionType="#{treeBean.selectionType}" toggleType="#{treeBean.toggleType}">
- <rich:treeNode type="rootNode">
- <h:panelGroup id="rootNodeGroup">
- Root node: #{node.data} -
- </h:panelGroup>
+ <rich:tree id="tree" nodeType="#{node.type}" var="node"
+ value="#{treeBean.rootNodes}" toggleType="client">
+ <rich:treeNode type="country">
+ #{node.name}
</rich:treeNode>
- <rich:treeNode type="childNode">
- <h:panelGroup id="childNodeGroup">
- #{node.data} -
- </h:panelGroup>
+ <rich:treeNode type="company">
+ #{node.name}
</rich:treeNode>
- </rich:tree>
- </ui:remove>
- </h:form>
+ <rich:treeNode type="cd">
+ #{node.artist}:#{node.title}
+ </rich:treeNode>
+ <rich:treeNode>
+ node not found for some reason
+ </rich:treeNode>
+ </rich:tree>
+
+ </h:form>
</ui:composition>
\ No newline at end of file
14 years, 2 months