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>