JBoss Rich Faces SVN: r328 - in trunk/richfaces/modal-panel/src: test/java/org/richfaces/component and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: sergeyhalipov
Date: 2007-04-09 14:08:12 -0400 (Mon, 09 Apr 2007)
New Revision: 328
Added:
trunk/richfaces/modal-panel/src/test/java/org/richfaces/component/ModalPanelComponentTest.java
Removed:
trunk/richfaces/modal-panel/src/test/java/org/richfaces/component/JSFComponentTest.java
Modified:
trunk/richfaces/modal-panel/src/main/java/org/richfaces/component/UIModalPanel.java
Log:
JUnit tests for modal panel component.
Modified: trunk/richfaces/modal-panel/src/main/java/org/richfaces/component/UIModalPanel.java
===================================================================
--- trunk/richfaces/modal-panel/src/main/java/org/richfaces/component/UIModalPanel.java 2007-04-09 17:43:32 UTC (rev 327)
+++ trunk/richfaces/modal-panel/src/main/java/org/richfaces/component/UIModalPanel.java 2007-04-09 18:08:12 UTC (rev 328)
@@ -29,7 +29,7 @@
*/
public abstract class UIModalPanel extends UIComponentBase {
- private static final String COMPONENT_TYPE = "org.richfaces.ModalPanel";
+ public static final String COMPONENT_TYPE = "org.richfaces.ModalPanel";
private static final String COMPONENT_FAMILY = "org.richfaces.ModalPanel";
Deleted: trunk/richfaces/modal-panel/src/test/java/org/richfaces/component/JSFComponentTest.java
===================================================================
--- trunk/richfaces/modal-panel/src/test/java/org/richfaces/component/JSFComponentTest.java 2007-04-09 17:43:32 UTC (rev 327)
+++ trunk/richfaces/modal-panel/src/test/java/org/richfaces/component/JSFComponentTest.java 2007-04-09 18:08:12 UTC (rev 328)
@@ -1,53 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - 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.richfaces.component;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import javax.faces.component.UIComponent;
-
-/**
- * Unit test for simple Component.
- */
-public class JSFComponentTest
- extends TestCase
-{
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public JSFComponentTest( String testName )
- {
- super( testName );
- }
-
-
- /**
- * Rigourous Test :-)
- */
- public void testComponent()
- {
- assertTrue( true );
- }
-}
Copied: trunk/richfaces/modal-panel/src/test/java/org/richfaces/component/ModalPanelComponentTest.java (from rev 321, trunk/richfaces/modal-panel/src/test/java/org/richfaces/component/JSFComponentTest.java)
===================================================================
--- trunk/richfaces/modal-panel/src/test/java/org/richfaces/component/ModalPanelComponentTest.java (rev 0)
+++ trunk/richfaces/modal-panel/src/test/java/org/richfaces/component/ModalPanelComponentTest.java 2007-04-09 18:08:12 UTC (rev 328)
@@ -0,0 +1,175 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - 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.richfaces.component;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIOutput;
+import javax.faces.component.html.HtmlForm;
+import javax.faces.component.html.HtmlOutputText;
+
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+import org.apache.commons.lang.StringUtils;
+
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlScript;
+
+/**
+ * Unit test for simple Component.
+ */
+public class ModalPanelComponentTest extends AbstractAjax4JsfTestCase {
+ private static Set javaScripts = new HashSet();
+
+ static {
+ javaScripts.add("org.ajax4jsf.framework.ajax.AjaxScript");
+ javaScripts.add("prototype.js");
+ javaScripts.add("scripts/utils.js");
+ javaScripts.add("scripts/modalPanel.js");
+ javaScripts.add("scripts/modalPanelBorders.js");
+ javaScripts.add("scripts/browser_info.js");
+ }
+
+ private UIComponent modalPanel;
+ private UIComponent form;
+
+ /**
+ * Create the test case
+ *
+ * @param testName name of the test case
+ */
+ public ModalPanelComponentTest( String testName )
+ {
+ super( testName );
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#setUp()
+ */
+ public void setUp() throws Exception {
+ super.setUp();
+
+ form = new HtmlForm();
+ facesContext.getViewRoot().getChildren().add(form);
+
+ modalPanel = application.createComponent(UIModalPanel.COMPONENT_TYPE);
+ modalPanel.setId("modalPanel");
+
+ HtmlOutputText outputText = new HtmlOutputText();
+ outputText.setValue("test");
+ modalPanel.getFacets().put("header", outputText);
+
+ form.getChildren().add(modalPanel);
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#tearDown()
+ */
+ public void tearDown() throws Exception {
+ super.tearDown();
+ form = null;
+ modalPanel = null;
+ }
+
+ /**
+ * Test component renders correctly
+ *
+ * @throws Exception
+ */
+ public void testRender() throws Exception {
+ HtmlPage renderedView = renderView();
+
+ assertNotNull(renderedView);
+
+ HtmlElement htmlModalPanel = renderedView.getHtmlElementById(modalPanel.getClientId(facesContext));
+ assertNotNull(htmlModalPanel);
+ assertEquals("div", htmlModalPanel.getNodeName());
+
+ HtmlElement htmlModalPanelCDiv = renderedView.getHtmlElementById(modalPanel.getClientId(facesContext) + "CDiv");
+ assertNotNull(htmlModalPanelCDiv);
+ assertTrue(htmlModalPanelCDiv.getAttributeValue("class").contains("dr-mpnl-panel rich-mpnl_panel"));
+
+ HtmlElement htmlContentDiv = renderedView.getHtmlElementById(modalPanel.getClientId(facesContext) + "ContentDiv");
+ assertNotNull(htmlContentDiv);
+ assertTrue(htmlContentDiv.getAttributeValue("class").contains("dr-mpnl-pnl"));
+
+ HtmlElement header = renderedView.getHtmlElementById(modalPanel.getClientId(facesContext) + "Header");
+ assertNotNull(header);
+ System.out.println(header.getAttributeValue("class"));
+ assertTrue(header.getAttributeValue("class").contains("dr-mpnl-pnl-text dr-mpnl-pnl-h"));
+ assertTrue(header.getAttributeValue("class").contains("rich-mpnl-text"));
+ assertTrue(header.getAttributeValue("class").contains("rich-mpnl-header"));
+ }
+
+ /**
+ * Test style rendering
+ *
+ * @throws Exception
+ */
+ public void testRenderStyle() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ List links = page.getDocumentElement().getHtmlElementsByTagName("link");
+
+ assertEquals(1, links.size());
+ HtmlElement link = (HtmlElement) links.get(0);
+ assertTrue(link.getAttributeValue("href").contains("org/richfaces/renderkit/html/css/modalPanel.xcss"));
+ }
+
+ /**
+ * Test script rendering
+ *
+ * @throws Exception
+ */
+ public void testRenderScript() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ List scripts = page.getDocumentElement().getHtmlElementsByTagName("script");
+
+ for (Iterator it = scripts.iterator(); it.hasNext();) {
+ HtmlScript item = (HtmlScript) it.next();
+ String srcAttr = item.getSrcAttribute();
+
+ if (StringUtils.isNotBlank(srcAttr)) {
+ boolean found = false;
+ for (Iterator srcIt = javaScripts.iterator(); srcIt.hasNext();) {
+ String src = (String) srcIt.next();
+
+ found = srcAttr.contains(src);
+ if (found) {
+ break;
+ }
+ }
+
+ assertTrue(found);
+ }
+ }
+ }
+
+}
19 years
JBoss Rich Faces SVN: r327 - in trunk/richfaces-samples/richfaces-art-datatable: src and 10 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: SergeySmirnov
Date: 2007-04-09 13:43:32 -0400 (Mon, 09 Apr 2007)
New Revision: 327
Added:
trunk/richfaces-samples/richfaces-art-datatable/src/
trunk/richfaces-samples/richfaces-art-datatable/src/main/
trunk/richfaces-samples/richfaces-art-datatable/src/main/java/
trunk/richfaces-samples/richfaces-art-datatable/src/main/java/org/
trunk/richfaces-samples/richfaces-art-datatable/src/main/java/org/rf/
trunk/richfaces-samples/richfaces-art-datatable/src/main/java/org/rf/datatable/
trunk/richfaces-samples/richfaces-art-datatable/src/main/java/org/rf/datatable/ExpenseReport.java
trunk/richfaces-samples/richfaces-art-datatable/src/main/java/org/rf/datatable/ExpenseReportRecord.java
trunk/richfaces-samples/richfaces-art-datatable/src/main/java/org/rf/datatable/ExpenseReportRecordItem.java
trunk/richfaces-samples/richfaces-art-datatable/src/main/java/org/rf/datatable/SalesItem.java
trunk/richfaces-samples/richfaces-art-datatable/src/main/java/org/rf/datatable/SalesReport.java
trunk/richfaces-samples/richfaces-art-datatable/src/main/java/org/rf/skin/
trunk/richfaces-samples/richfaces-art-datatable/src/main/java/org/rf/skin/SkinBean.java
trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/
trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/META-INF/
trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/META-INF/MANIFEST.MF
trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/WEB-INF/
trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/WEB-INF/faces-config.xml
trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/WEB-INF/lib/
trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/WEB-INF/web.xml
trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/index.jsp
trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/pages/
trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/pages/example1.jsp
trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/pages/example10.jsp
trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/pages/example2.jsp
trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/pages/example3.jsp
trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/pages/example4.jsp
trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/pages/main.jsp
Log:
richfaces datatable article example appl
Added: trunk/richfaces-samples/richfaces-art-datatable/src/main/java/org/rf/datatable/ExpenseReport.java
===================================================================
--- trunk/richfaces-samples/richfaces-art-datatable/src/main/java/org/rf/datatable/ExpenseReport.java (rev 0)
+++ trunk/richfaces-samples/richfaces-art-datatable/src/main/java/org/rf/datatable/ExpenseReport.java 2007-04-09 17:43:32 UTC (rev 327)
@@ -0,0 +1,76 @@
+package org.rf.datatable;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+public class ExpenseReport {
+ private List records = null;
+
+ public List getRecords() {
+ if (records==null) {
+ initRecords();
+ }
+ return records;
+ }
+
+ public void setRecords(List records) {
+ this.records = records;
+ }
+
+ public double getTotalMeals() {
+ double ret = 0.0;
+ Iterator it = getRecords().iterator();
+ while (it.hasNext()) {
+ ExpenseReportRecord record = (ExpenseReportRecord) it.next();
+ ret+=record.getTotalMeals();
+ }
+ return ret;
+ }
+ public double getTotalHotels() {
+ double ret = 0.0;
+ Iterator it = getRecords().iterator();
+ while (it.hasNext()) {
+ ExpenseReportRecord record = (ExpenseReportRecord) it.next();
+ ret+=record.getTotalHotels();
+ }
+ return ret;
+ }
+ public double getTotalTransport() {
+ double ret = 0.0;
+ Iterator it = getRecords().iterator();
+ while (it.hasNext()) {
+ ExpenseReportRecord record = (ExpenseReportRecord) it.next();
+ ret+=record.getTotalTransport();
+ }
+ return ret;
+ }
+ public double getGrandTotal() {
+ return getTotalMeals()+getTotalHotels()+getTotalTransport();
+ }
+ public int getRecordsCount() {
+ return getRecords().size();
+ }
+
+ private void initRecords() {
+ records = new ArrayList();
+ ExpenseReportRecord rec;
+ rec = new ExpenseReportRecord();
+ rec.setCity("San Jose");
+ rec.getItems().add(new ExpenseReportRecordItem("25-Aug-97",37.74,112.0,45.0));
+ rec.getItems().add(new ExpenseReportRecordItem("26-Aug-97",27.28,112.0,45.0));
+ records.add(rec);
+ rec = new ExpenseReportRecord();
+ rec.setCity("Seattle");
+ rec.getItems().add(new ExpenseReportRecordItem("27-Aug-97",96.25,109.0,36.00));
+ rec.getItems().add(new ExpenseReportRecordItem("28-Aug-97",35.0,109.0,36.0));
+ records.add(rec);
+ rec = new ExpenseReportRecord();
+ rec.setCity("Las Vegas");
+ rec.getItems().add(new ExpenseReportRecordItem("29-Aug-97",215.40,80.0,32.00));
+ rec.getItems().add(new ExpenseReportRecordItem("30-Aug-97",100.50,80.0,32.0));
+ rec.getItems().add(new ExpenseReportRecordItem("31-Aug-97",180.00,80.0,32.0));
+ records.add(rec);
+ }
+
+}
Added: trunk/richfaces-samples/richfaces-art-datatable/src/main/java/org/rf/datatable/ExpenseReportRecord.java
===================================================================
--- trunk/richfaces-samples/richfaces-art-datatable/src/main/java/org/rf/datatable/ExpenseReportRecord.java (rev 0)
+++ trunk/richfaces-samples/richfaces-art-datatable/src/main/java/org/rf/datatable/ExpenseReportRecord.java 2007-04-09 17:43:32 UTC (rev 327)
@@ -0,0 +1,56 @@
+package org.rf.datatable;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+public class ExpenseReportRecord {
+ private String city;
+ private List items = new ArrayList();
+ public String getCity() {
+ return city;
+ }
+ public void setCity(String city) {
+ this.city = city;
+ }
+ public List getItems() {
+ return this.items;
+ }
+ public void setItems(List items) {
+ this.items = items;
+ }
+ public double getTotalMeals() {
+ double ret = 0.0;
+ Iterator it = items.iterator();
+ while (it.hasNext()) {
+ ExpenseReportRecordItem item = (ExpenseReportRecordItem) it.next();
+ ret+=item.getMeals();
+ }
+ return ret;
+ }
+ public double getTotalHotels() {
+ double ret = 0.0;
+ Iterator it = items.iterator();
+ while (it.hasNext()) {
+ ExpenseReportRecordItem item = (ExpenseReportRecordItem) it.next();
+ ret+=item.getHotels();
+ }
+ return ret;
+ }
+ public double getTotalTransport() {
+ double ret = 0.0;
+ Iterator it = items.iterator();
+ while (it.hasNext()) {
+ ExpenseReportRecordItem item = (ExpenseReportRecordItem) it.next();
+ ret+=item.getTransport();
+ }
+ return ret;
+ }
+ public double getTotal() {
+ return getTotalMeals() +getTotalHotels()+getTotalTransport();
+ }
+
+ public int getItemsCount() {
+ return getItems().size();
+ }
+}
Added: trunk/richfaces-samples/richfaces-art-datatable/src/main/java/org/rf/datatable/ExpenseReportRecordItem.java
===================================================================
--- trunk/richfaces-samples/richfaces-art-datatable/src/main/java/org/rf/datatable/ExpenseReportRecordItem.java (rev 0)
+++ trunk/richfaces-samples/richfaces-art-datatable/src/main/java/org/rf/datatable/ExpenseReportRecordItem.java 2007-04-09 17:43:32 UTC (rev 327)
@@ -0,0 +1,42 @@
+package org.rf.datatable;
+
+public class ExpenseReportRecordItem {
+ private String day;
+ private double meals;
+ private double hotels;
+ private double transport;
+
+ public ExpenseReportRecordItem(String day, double meals, double hotels, double transport) {
+ this.day = day;
+ this.meals = meals;
+ this.hotels = hotels;
+ this.transport = transport;
+ }
+ public String getDay() {
+ return day;
+ }
+ public void setDay(String day) {
+ this.day = day;
+ }
+ public double getHotels() {
+ return hotels;
+ }
+ public void setHotels(double hotels) {
+ this.hotels = hotels;
+ }
+ public double getMeals() {
+ return meals;
+ }
+ public void setMeals(double meals) {
+ this.meals = meals;
+ }
+ public double getTransport() {
+ return transport;
+ }
+ public void setTransport(double transport) {
+ this.transport = transport;
+ }
+ public double getTotal() {
+ return meals+hotels+transport;
+ }
+}
Added: trunk/richfaces-samples/richfaces-art-datatable/src/main/java/org/rf/datatable/SalesItem.java
===================================================================
--- trunk/richfaces-samples/richfaces-art-datatable/src/main/java/org/rf/datatable/SalesItem.java (rev 0)
+++ trunk/richfaces-samples/richfaces-art-datatable/src/main/java/org/rf/datatable/SalesItem.java 2007-04-09 17:43:32 UTC (rev 327)
@@ -0,0 +1,41 @@
+package org.rf.datatable;
+
+public class SalesItem {
+ private int productCode;
+ private double proposedPrice;
+ private double ProposedGrossMargin;
+ private double salesCost;
+ public SalesItem(int productCode, double salesCost) {
+ super();
+ this.productCode = productCode;
+ this.salesCost = salesCost;
+ }
+ public int getProductCode() {
+ return productCode;
+ }
+ public void setProductCode(int productCode) {
+ this.productCode = productCode;
+ }
+ public double getProposedGrossMargin() {
+ if (proposedPrice == 0)
+ return 0;
+ else {
+ return (proposedPrice-salesCost)/proposedPrice ;
+ }
+ }
+ public void setProposedGrossMargin(double proposedGrossMargin) {
+ ProposedGrossMargin = proposedGrossMargin;
+ }
+ public double getProposedPrice() {
+ return proposedPrice;
+ }
+ public void setProposedPrice(double proposedPrice) {
+ this.proposedPrice = proposedPrice;
+ }
+ public double getSalesCost() {
+ return salesCost;
+ }
+ public void setSalesCost(double salesCost) {
+ this.salesCost = salesCost;
+ }
+}
Added: trunk/richfaces-samples/richfaces-art-datatable/src/main/java/org/rf/datatable/SalesReport.java
===================================================================
--- trunk/richfaces-samples/richfaces-art-datatable/src/main/java/org/rf/datatable/SalesReport.java (rev 0)
+++ trunk/richfaces-samples/richfaces-art-datatable/src/main/java/org/rf/datatable/SalesReport.java 2007-04-09 17:43:32 UTC (rev 327)
@@ -0,0 +1,26 @@
+package org.rf.datatable;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class SalesReport {
+ List items = null;
+
+ public List getItems() {
+ if (items == null)
+ initData();
+ return items;
+ }
+
+ public void setItems(List items) {
+ this.items = items;
+ }
+
+ private void initData() {
+ items = new ArrayList();
+ items.add(new SalesItem(1, 20.00));
+ items.add(new SalesItem(2, 10.00));
+ items.add(new SalesItem(3, 20.00));
+ items.add(new SalesItem(4, 20.00));
+ }
+}
Added: trunk/richfaces-samples/richfaces-art-datatable/src/main/java/org/rf/skin/SkinBean.java
===================================================================
--- trunk/richfaces-samples/richfaces-art-datatable/src/main/java/org/rf/skin/SkinBean.java (rev 0)
+++ trunk/richfaces-samples/richfaces-art-datatable/src/main/java/org/rf/skin/SkinBean.java 2007-04-09 17:43:32 UTC (rev 327)
@@ -0,0 +1,13 @@
+package org.rf.skin;
+
+public class SkinBean {
+ private String name;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
Added: trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/META-INF/MANIFEST.MF
===================================================================
--- trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/META-INF/MANIFEST.MF (rev 0)
+++ trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/META-INF/MANIFEST.MF 2007-04-09 17:43:32 UTC (rev 327)
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path:
+
Added: trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/WEB-INF/faces-config.xml (rev 0)
+++ trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/WEB-INF/faces-config.xml 2007-04-09 17:43:32 UTC (rev 327)
@@ -0,0 +1,61 @@
+<?xml version="1.0"?>
+<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
+ "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
+<faces-config>
+ <managed-bean>
+ <managed-bean-name>expenseReport</managed-bean-name>
+ <managed-bean-class>org.rf.datatable.ExpenseReport</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+ <managed-bean>
+ <managed-bean-name>skinBean</managed-bean-name>
+ <managed-bean-class>org.rf.skin.SkinBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ <managed-property>
+ <property-name>name</property-name>
+ <property-class>java.lang.String</property-class>
+ <value>blueSky</value>
+ </managed-property>
+ </managed-bean>
+ <managed-bean>
+ <managed-bean-name>salesReport</managed-bean-name>
+ <managed-bean-class>org.rf.datatable.SalesReport</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+ <navigation-rule>
+ <from-view-id>/pages/main.jsp</from-view-id>
+ <navigation-case>
+ <from-outcome>example1</from-outcome>
+ <to-view-id>/pages/example1.jsp</to-view-id>
+ <redirect/>
+ </navigation-case>
+ <navigation-case>
+ <from-outcome>example2</from-outcome>
+ <to-view-id>/pages/example2.jsp</to-view-id>
+ <redirect/>
+ </navigation-case>
+ <navigation-case>
+ <from-outcome>example3</from-outcome>
+ <to-view-id>/pages/example3.jsp</to-view-id>
+ <redirect/>
+ </navigation-case>
+ <navigation-case>
+ <from-outcome>example4</from-outcome>
+ <to-view-id>/pages/example4.jsp</to-view-id>
+ <redirect/>
+ </navigation-case>
+ <navigation-case>
+ <from-outcome>example10</from-outcome>
+ <to-view-id>/pages/example10.jsp</to-view-id>
+ <redirect/>
+ </navigation-case>
+ </navigation-rule>
+ <navigation-rule>
+ <from-view-id>*</from-view-id>
+ <navigation-case>
+ <from-outcome>main</from-outcome>
+ <to-view-id>/pages/main.jsp</to-view-id>
+ <redirect/>
+ </navigation-case>
+ </navigation-rule>
+</faces-config>
Added: trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/WEB-INF/web.xml (rev 0)
+++ trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/WEB-INF/web.xml 2007-04-09 17:43:32 UTC (rev 327)
@@ -0,0 +1,42 @@
+<?xml version="1.0"?>
+<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+ <display-name>richfaces-dataTable</display-name>
+ <context-param>
+ <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
+ <param-value>server</param-value>
+ </context-param>
+ <listener>
+ <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
+ </listener>
+ <!-- Faces Servlet -->
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <context-param>
+ <param-name>org.ajax4jsf.SKIN</param-name>
+ <param-value>#{skinBean.name}</param-value>
+ </context-param>
+ <filter>
+ <display-name>Ajax4jsf Filter</display-name>
+ <filter-name>ajax4jsf</filter-name>
+ <filter-class>org.ajax4jsf.Filter</filter-class>
+ </filter>
+ <filter-mapping>
+ <filter-name>ajax4jsf</filter-name>
+ <servlet-name>Faces Servlet</servlet-name>
+ <dispatcher>REQUEST</dispatcher>
+ <dispatcher>FORWARD</dispatcher>
+ <dispatcher>INCLUDE</dispatcher>
+ </filter-mapping>
+ <!-- Faces Servlet Mapping -->
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.jsf</url-pattern>
+ </servlet-mapping>
+ <login-config>
+ <auth-method>BASIC</auth-method>
+ </login-config>
+</web-app>
Added: trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/index.jsp
===================================================================
--- trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/index.jsp (rev 0)
+++ trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/index.jsp 2007-04-09 17:43:32 UTC (rev 327)
@@ -0,0 +1,7 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head></head>
+ <body>
+ <jsp:forward page="/pages/main.jsf" />
+ </body>
+</html>
\ No newline at end of file
Added: trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/pages/example1.jsp
===================================================================
--- trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/pages/example1.jsp (rev 0)
+++ trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/pages/example1.jsp 2007-04-09 17:43:32 UTC (rev 327)
@@ -0,0 +1,60 @@
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
+<%@ taglib uri="http://richfaces.ajax4jsf.org/rich" prefix="rich"%>
+<%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%>
+
+<html>
+ <head>
+ <title>RichFaces dataTable Article. Example #1</title>
+ </head>
+ <body>
+ <f:view>
+ <h:outputText value="Example #1. Simple Table" />
+
+ <rich:dataTable value="#{expenseReport.records}" var="record">
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="City Name" />
+ </f:facet>
+ <h:outputText value="#{record.city}" />
+ </h:column>
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="Meals" />
+ </f:facet>
+ <h:outputText value="#{record.totalMeals}">
+ <f:convertNumber pattern="$####.00" />
+ </h:outputText>
+ </h:column>
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="Transport" />
+ </f:facet>
+ <h:outputText value="#{record.totalTransport}">
+ <f:convertNumber pattern="$####.00" />
+ </h:outputText>
+ </h:column>
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="Hotels" />
+ </f:facet>
+ <h:outputText value="#{record.totalHotels}">
+ <f:convertNumber pattern="$####.00" />
+ </h:outputText>
+ </h:column>
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="Total" />
+ </f:facet>
+ <h:outputText value="#{record.total}">
+ <f:convertNumber pattern="$####.00" />
+ </h:outputText>
+ </h:column>
+ </rich:dataTable>
+
+ <h:form>
+ <h:commandLink value="back to example list" action="main"></h:commandLink>
+ </h:form>
+ </f:view>
+ </body>
+</html>
Added: trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/pages/example10.jsp
===================================================================
--- trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/pages/example10.jsp (rev 0)
+++ trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/pages/example10.jsp 2007-04-09 17:43:32 UTC (rev 327)
@@ -0,0 +1,84 @@
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
+<%@ taglib uri="http://richfaces.ajax4jsf.org/rich" prefix="rich"%>
+<%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%>
+
+<html>
+ <head>
+ <title>RichFaces dataTable Article. Example #4</title>
+ <style>
+
+ </style>
+ </head>
+ <body>
+
+ <f:view>
+
+ <h:form id="form">
+ <rich:dataTable value="#{salesReport.items}" var="item">
+ <f:facet name="header">
+ <rich:columnGroup>
+ <h:column>
+ <h:outputText value="Product Code" />
+ </h:column>
+ <h:column>
+ <h:outputText value="Proposed Price" />
+ </h:column>
+ <h:column>
+ <h:outputText value="Sales Cost" />
+ </h:column>
+ <h:column>
+ <h:outputText value="Proposed Gross Margin" />
+ </h:column>
+ </rich:columnGroup>
+ </f:facet>
+ <h:column>
+ <h:outputText value="#{item.productCode}" />
+ </h:column>
+ <h:column>
+ <h:inputText value="#{item.proposedPrice}" size="7">
+ <a4j:support event="onchange" reRender="margin" />
+ </h:inputText>
+ </h:column>
+ <h:column>
+ <h:outputText value="#{item.salesCost}" />
+ </h:column>
+ <h:column>
+ <h:outputText id="margin" value="#{item.proposedGrossMargin}">
+ <f:convertNumber pattern="$###0.000" />
+ </h:outputText>
+ </h:column>
+ </rich:dataTable>
+
+
+ <a4j:outputPanel id="err" ajaxRendered="true">
+ <h:messages />
+ </a4j:outputPanel>
+
+ </h:form>
+ <h:form id="form1">
+ <f:verbatim><table></f:verbatim>
+ <a4j:repeat id="rep" value="#{salesReport.items}" var="item">
+ <f:verbatim><tr><td></f:verbatim>
+
+ <h:inputText value="#{item.proposedPrice}" size="7">
+ <a4j:support event="onchange" reRender="margin1" />
+ </h:inputText>
+ <f:verbatim></td><td></f:verbatim>
+ <h:outputText id="margin1" value="#{item.proposedGrossMargin}">
+ <f:convertNumber pattern="$###0.000" />
+ </h:outputText>
+ <f:verbatim></td></tr></f:verbatim>
+ </a4j:repeat>
+ <f:verbatim></table></f:verbatim>
+ </h:form>
+
+
+ <h:form>
+ <rich:separator lineType="dashed" height="1" style="padding-top:20px" />
+ <h:commandLink value="back to example list" action="main"></h:commandLink>
+ </h:form>
+ <a4j:log hotkey="M" />
+ </f:view>
+ </body>
+</html>
Added: trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/pages/example2.jsp
===================================================================
--- trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/pages/example2.jsp (rev 0)
+++ trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/pages/example2.jsp 2007-04-09 17:43:32 UTC (rev 327)
@@ -0,0 +1,117 @@
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
+<%@ taglib uri="http://richfaces.ajax4jsf.org/rich" prefix="rich"%>
+<%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%>
+
+<html>
+ <head>
+ <title>RichFaces dataTable Article. Example #2</title>
+ </head>
+ <body>
+ <f:view>
+
+
+ <rich:dataTable width="400" value="#{expenseReport.records}" var="record">
+ <f:facet name="caption">
+ <h:outputText value="Example #2. Using rich:column and rich:columnGroup" />
+ </f:facet>
+ <f:facet name="header">
+ <rich:columnGroup>
+ <rich:column rowspan="2">
+ <h:outputText value="City Name" />
+ </rich:column>
+
+ <rich:column colspan="3">
+ <h:outputText value="Expenses" />
+ </rich:column>
+
+ <rich:column rowspan="2">
+ <h:outputText value="Total" />
+ </rich:column>
+
+ <rich:column breakBefore="true">
+ <h:outputText value="Meals" />
+ </rich:column>
+
+ <rich:column>
+ <h:outputText value="Transport" />
+ </rich:column>
+
+ <rich:column>
+ <h:outputText value="Hotels" />
+ </rich:column>
+
+ </rich:columnGroup>
+ </f:facet>
+
+ <f:facet name="footer">
+ <rich:columnGroup>
+ <rich:column><h:outputText value="Grand Total" /></rich:column>
+ <rich:column>
+ <h:outputText value="#{expenseReport.totalMeals}" >
+ <f:convertNumber pattern="$####.00" />
+ </h:outputText>
+ </rich:column>
+ <rich:column>
+ <h:outputText value="#{expenseReport.totalTransport}" >
+ <f:convertNumber pattern="$####.00" />
+ </h:outputText>
+ </rich:column>
+ <rich:column>
+ <h:outputText value="#{expenseReport.totalHotels}" >
+ <f:convertNumber pattern="$####.00" />
+ </h:outputText>
+ </rich:column>
+ <rich:column><h:outputText value="#{expenseReport.grandTotal}" /></rich:column>
+ </rich:columnGroup>
+ </f:facet>
+
+ <h:column>
+ <h:outputText value="#{record.city}" />
+ </h:column>
+ <h:column>
+ <h:outputText value="#{record.totalMeals}">
+ <f:convertNumber pattern="$####.00" />
+ </h:outputText>
+ </h:column>
+ <h:column>
+ <h:outputText value="#{record.totalTransport}">
+ <f:convertNumber pattern="$####.00" />
+ </h:outputText>
+ </h:column>
+ <h:column>
+ <h:outputText value="#{record.totalHotels}">
+ <f:convertNumber pattern="$####.00" />
+ </h:outputText>
+ </h:column>
+ <h:column>
+ <h:outputText value="#{record.total}">
+ <f:convertNumber pattern="$####.00" />
+ </h:outputText>
+ </h:column>
+ </rich:dataTable>
+
+ <h:form>
+ <h:outputText value="Change Skin:" />
+ <h:commandLink action="changeSkin" value="Classic">
+ <a4j:actionparam name="skin" value="classic" assignTo="#{skinBean.name}" />
+ </h:commandLink>
+ <h:commandLink action="changeSkin" value="BlueSky">
+ <a4j:actionparam name="skin" value="blueSky" assignTo="#{skinBean.name}" />
+ </h:commandLink>
+ <h:commandLink action="changeSkin" value="DeepMarine">
+ <a4j:actionparam name="skin" value="deepMarine" assignTo="#{skinBean.name}" />
+ </h:commandLink>
+ <h:commandLink action="changeSkin" value="EmeraldTown">
+ <a4j:actionparam name="skin" value="emeraldTown" assignTo="#{skinBean.name}" />
+ </h:commandLink>
+ <h:commandLink action="changeSkin" value="Wine">
+ <a4j:actionparam name="skin" value="wine" assignTo="#{skinBean.name}" />
+ </h:commandLink>
+
+ <rich:separator lineType="dashed" height="1" />
+ <h:commandLink value="back to example list" action="main"></h:commandLink>
+ </h:form>
+ </f:view>
+ </body>
+</html>
Added: trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/pages/example3.jsp
===================================================================
--- trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/pages/example3.jsp (rev 0)
+++ trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/pages/example3.jsp 2007-04-09 17:43:32 UTC (rev 327)
@@ -0,0 +1,121 @@
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
+<%@ taglib uri="http://richfaces.ajax4jsf.org/rich" prefix="rich"%>
+<%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%>
+
+<html>
+ <head>
+ <title>RichFaces dataTable Article. Example #3</title>
+ <style>
+ .rich-table-caption {
+ color:#008894;
+ font-size:12px;
+ font-family:arial;
+ font-weight:bold;
+ }
+ .rich-table-header, .rich-table-header-continue {
+ background-image:none;
+ background-color:#A4DBE0;
+ }
+ .rich-table-headercell {
+ color: #7B3D3D;
+ }
+ .rich-table-firstrow{
+ background-color: #F3FEFF;
+ }
+ .rich-table-footer {
+ background-color: #F3FEFF;
+ }
+ .rich-table-footercell {
+ border-top: 2px solid #CCCCCC;
+ }
+ </style>
+ </head>
+ <body>
+ <f:view>
+ <rich:dataTable width="400"value="#{expenseReport.records}" var="record">
+ <f:facet name="caption">
+ <h:outputText value="Example #3. Look-n-Feel Customization with Predefined Classes" />
+ </f:facet>
+ <f:facet name="header">
+ <rich:columnGroup>
+ <rich:column rowspan="2">
+ <h:outputText value="City Name" />
+ </rich:column>
+
+ <rich:column colspan="3">
+ <h:outputText value="Expenses" />
+ </rich:column>
+
+ <rich:column rowspan="2">
+ <h:outputText value="Total" />
+ </rich:column>
+
+ <rich:column breakBefore="true">
+ <h:outputText value="Meals" />
+ </rich:column>
+
+ <rich:column>
+ <h:outputText value="Transport" />
+ </rich:column>
+
+ <rich:column>
+ <h:outputText value="Hotels" />
+ </rich:column>
+
+ </rich:columnGroup>
+ </f:facet>
+
+ <f:facet name="footer">
+ <rich:columnGroup>
+ <rich:column><h:outputText value="Grand Total" /></rich:column>
+ <rich:column>
+ <h:outputText value="#{expenseReport.totalMeals}" >
+ <f:convertNumber pattern="$####.00" />
+ </h:outputText>
+ </rich:column>
+ <rich:column>
+ <h:outputText value="#{expenseReport.totalTransport}" >
+ <f:convertNumber pattern="$####.00" />
+ </h:outputText>
+ </rich:column>
+ <rich:column>
+ <h:outputText value="#{expenseReport.totalHotels}" >
+ <f:convertNumber pattern="$####.00" />
+ </h:outputText>
+ </rich:column>
+ <rich:column><h:outputText value="#{expenseReport.grandTotal}" /></rich:column>
+ </rich:columnGroup>
+ </f:facet>
+ <h:column>
+ <h:outputText value="#{record.city}" />
+ </h:column>
+ <h:column>
+ <h:outputText value="#{record.totalMeals}">
+ <f:convertNumber pattern="$####.00" />
+ </h:outputText>
+ </h:column>
+ <h:column>
+ <h:outputText value="#{record.totalTransport}">
+ <f:convertNumber pattern="$####.00" />
+ </h:outputText>
+ </h:column>
+ <h:column>
+ <h:outputText value="#{record.totalHotels}">
+ <f:convertNumber pattern="$####.00" />
+ </h:outputText>
+ </h:column>
+ <rich:column>
+ <h:outputText value="#{record.total}">
+ <f:convertNumber pattern="$####.00" />
+ </h:outputText>
+ </rich:column>
+ </rich:dataTable>
+
+ <h:form>
+ <rich:separator lineType="dashed" height="1" style="padding-top:20px" />
+ <h:commandLink value="back to example list" action="main"></h:commandLink>
+ </h:form>
+ </f:view>
+ </body>
+</html>
Added: trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/pages/example4.jsp
===================================================================
--- trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/pages/example4.jsp (rev 0)
+++ trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/pages/example4.jsp 2007-04-09 17:43:32 UTC (rev 327)
@@ -0,0 +1,127 @@
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
+<%@ taglib uri="http://richfaces.ajax4jsf.org/rich" prefix="rich"%>
+<%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%>
+
+<html>
+ <head>
+ <title>RichFaces dataTable Article. Example #4</title>
+ <style>
+ .rich-table-caption {
+ color:#008894;
+ font-size:12px;
+ font-family:arial;
+ font-weight:bold;
+ }
+ .rich-table-header, .rich-table-header-continue {
+ background-image:none;
+ background-color:#A4DBE0;
+ }
+ .rich-table-headercell {
+ color: #7B3D3D;
+ }
+ .rich-table-firstrow{
+ background-color: #F3FEFF;
+ }
+ .rich-table-footer {
+ background-color: #F3FEFF;
+ }
+ .rich-table-footercell {
+ border-top: 2px solid #CCCCCC;
+ }
+ </style>
+ </head>
+ <body>
+ <f:view>
+ <h:form id="form">
+ <a4j:outputPanel ajaxRendered="false">
+ <rich:dataTable id="eTable" width="400" value="#{expenseReport.records}" var="record">
+ <f:facet name="caption">
+ <h:outputText value="Example #3. Look-n-Feel Customization. Using Classes and Styles" />
+ </f:facet>
+ <f:facet name="header">
+ <rich:columnGroup>
+ <rich:column rowspan="2">
+ <h:outputText value="City Name" />
+ </rich:column>
+
+ <rich:column colspan="3">
+ <h:outputText value="Expenses" />
+ </rich:column>
+
+ <rich:column rowspan="2">
+ <h:outputText value="Total" />
+ </rich:column>
+
+ <rich:column breakBefore="true">
+ <h:outputText value="Meals" />
+ </rich:column>
+
+ <rich:column>
+ <h:outputText value="Transport" />
+ </rich:column>
+
+ <rich:column>
+ <h:outputText value="Hotels" />
+ </rich:column>
+
+ </rich:columnGroup>
+ </f:facet>
+
+ <f:facet name="footer">
+ <rich:columnGroup>
+ <rich:column><h:outputText value="Grand Total" /></rich:column>
+ <rich:column>
+ <h:outputText value="#{expenseReport.totalMeals}" >
+ <f:convertNumber pattern="$####.00" />
+ </h:outputText>
+ </rich:column>
+ <rich:column>
+ <h:outputText value="#{expenseReport.totalTransport}" >
+ <f:convertNumber pattern="$####.00" />
+ </h:outputText>
+ </rich:column>
+ <rich:column>
+ <h:outputText value="#{expenseReport.totalHotels}" >
+ <f:convertNumber pattern="$####.00" />
+ </h:outputText>
+ </rich:column>
+ <rich:column><h:outputText value="#{expenseReport.grandTotal}" /></rich:column>
+ </rich:columnGroup>
+ </f:facet>
+ <h:column>
+ <h:outputText value="#{record.city}" />
+ </h:column>
+ <h:column>
+ <h:inputText size="7" value="#{record.totalMeals}">
+ <a4j:support event="onchange" reRender=":form:eTable" />
+ <f:convertNumber pattern="####.00" />
+ </h:inputText>
+ </h:column>
+ <h:column>
+ <h:outputText value="#{record.totalTransport}">
+ <f:convertNumber pattern="$####.00" />
+ </h:outputText>
+ </h:column>
+ <h:column>
+ <h:outputText value="#{record.totalHotels}">
+ <f:convertNumber pattern="$####.00" />
+ </h:outputText>
+ </h:column>
+ <rich:column>
+ <h:outputText value="#{record.total}">
+ <f:convertNumber pattern="$####.00" />
+ </h:outputText>
+ </rich:column>
+ </rich:dataTable>
+ </a4j:outputPanel>
+ </h:form>
+
+ <h:form>
+ <rich:separator lineType="dashed" height="1" style="padding-top:20px" />
+ <h:commandLink value="back to example list" action="main"></h:commandLink>
+ </h:form>
+ <a4j:log hotkey="M"/>
+ </f:view>
+ </body>
+</html>
Added: trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/pages/main.jsp
===================================================================
--- trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/pages/main.jsp (rev 0)
+++ trunk/richfaces-samples/richfaces-art-datatable/src/main/webapp/pages/main.jsp 2007-04-09 17:43:32 UTC (rev 327)
@@ -0,0 +1,20 @@
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
+<html>
+ <head>
+ <title>RichFaces dataTable. Article Examples</title>
+ </head>
+ <body>
+ <f:view>
+ <h:form>
+ <h:panelGrid columns="1">
+ <h:commandLink value="Example #1. Simple Table" action="example1" />
+ <h:commandLink value="Example #2. Using rich:column and rich:columnGroup" action="example2" />
+ <h:commandLink value="Example #3. Look-n-Feel Customization with Predefined Classes" action="example3" />
+ <h:commandLink value="Example #4. Look-n-Feel Customization. Using Classes and Styles" action="example4" />
+ <h:commandLink value="Example #10. Ajax Update" action="example10" />
+ </h:panelGrid>
+ </h:form>
+ </f:view>
+ </body>
+</html>
19 years
JBoss Rich Faces SVN: r326 - in trunk/richfaces-samples: richfaces-art-datatable and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: SergeySmirnov
Date: 2007-04-09 13:41:34 -0400 (Mon, 09 Apr 2007)
New Revision: 326
Added:
trunk/richfaces-samples/richfaces-art-datatable/
trunk/richfaces-samples/richfaces-art-datatable/pom.xml
Log:
richfaces datatable article example appl
Added: trunk/richfaces-samples/richfaces-art-datatable/pom.xml
===================================================================
--- trunk/richfaces-samples/richfaces-art-datatable/pom.xml (rev 0)
+++ trunk/richfaces-samples/richfaces-art-datatable/pom.xml 2007-04-09 17:41:34 UTC (rev 326)
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>richfaces-samples</artifactId>
+ <groupId>org.richfaces</groupId>
+ <version>3.0.1-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.richfaces</groupId>
+ <artifactId>richfaces-art-datatable</artifactId>
+ <packaging>war</packaging>
+ <name>richfaces-art-datatableDemo Maven Webapp</name>
+ <dependencies>
+ <dependency>
+ <groupId>org.richfaces</groupId>
+ <artifactId>richfaces</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.richfaces</groupId>
+ <artifactId>common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.4</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <finalName>richfaces-art-datatable</finalName>
+ </build>
+</project>
+
19 years
JBoss Rich Faces SVN: r325 - trunk/richfaces/simpleTogglePanel/src/test/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: A.Skokov
Date: 2007-04-09 10:59:34 -0400 (Mon, 09 Apr 2007)
New Revision: 325
Modified:
trunk/richfaces/simpleTogglePanel/src/test/java/org/richfaces/component/SimpleTogglePanelComponentTest.java
Log:
update test
Modified: trunk/richfaces/simpleTogglePanel/src/test/java/org/richfaces/component/SimpleTogglePanelComponentTest.java
===================================================================
--- trunk/richfaces/simpleTogglePanel/src/test/java/org/richfaces/component/SimpleTogglePanelComponentTest.java 2007-04-09 14:59:05 UTC (rev 324)
+++ trunk/richfaces/simpleTogglePanel/src/test/java/org/richfaces/component/SimpleTogglePanelComponentTest.java 2007-04-09 14:59:34 UTC (rev 325)
@@ -250,7 +250,6 @@
System.out.println(page.asXml());
externalContext.addRequestParameterMap(stp1.getClientId(facesContext), "");
- System.out.println(this.webConnection.getLastParameters());
stp1.processDecodes(facesContext);
stp1.processValidators(facesContext);
19 years
JBoss Rich Faces SVN: r324 - in trunk/richfaces/suggestionbox/src/main/java/org/richfaces: renderkit/html and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: A.Skokov
Date: 2007-04-09 10:59:05 -0400 (Mon, 09 Apr 2007)
New Revision: 324
Modified:
trunk/richfaces/suggestionbox/src/main/java/org/richfaces/component/AjaxSuggestionEvent.java
trunk/richfaces/suggestionbox/src/main/java/org/richfaces/component/SuggestionEvent.java
trunk/richfaces/suggestionbox/src/main/java/org/richfaces/component/UISuggestionBox.java
trunk/richfaces/suggestionbox/src/main/java/org/richfaces/renderkit/html/SuggestionBoxRenderer.java
trunk/richfaces/suggestionbox/src/main/java/org/richfaces/taglib/SuggestionBoxTagHandler.java
Log:
checkstyle refactoring
Modified: trunk/richfaces/suggestionbox/src/main/java/org/richfaces/component/AjaxSuggestionEvent.java
===================================================================
--- trunk/richfaces/suggestionbox/src/main/java/org/richfaces/component/AjaxSuggestionEvent.java 2007-04-09 14:42:34 UTC (rev 323)
+++ trunk/richfaces/suggestionbox/src/main/java/org/richfaces/component/AjaxSuggestionEvent.java 2007-04-09 14:59:05 UTC (rev 324)
@@ -21,51 +21,61 @@
package org.richfaces.component;
+import org.ajax4jsf.framework.ajax.AjaxEvent;
+
import javax.faces.component.UIComponent;
-import org.ajax4jsf.framework.ajax.AjaxEvent;
-
+/**
+ * Ajax event for SuggestionBox component.
+ */
public class AjaxSuggestionEvent extends AjaxEvent {
/**
- *
- */
- private static final long serialVersionUID = 9212067213575185754L;
- /**
- *
+ * Serial Version UID.
*/
- private Object _submittedValue;
+ private static final long serialVersionUID = 9212067213575185754L;
/**
- * @param component
- * @param submittedValie
+ * Submitted value.
*/
- public AjaxSuggestionEvent(UIComponent component, Object submittedValue) {
+ private Object submittedValue;
+
+ /**
+ * Constructor.
+ *
+ * @param component {@link javax.faces.component.UIComponent}
+ * @param value The submitted value to set
+ */
+ public AjaxSuggestionEvent(final UIComponent component,
+ final Object value) {
super(component);
- // TODO Auto-generated constructor stub
- this._submittedValue = submittedValue;
+ this.submittedValue = value;
}
/**
- * @param component
+ * Constructor.
+ *
+ * @param component {@link javax.faces.component.UIComponent}
*/
- public AjaxSuggestionEvent(UIComponent component) {
+ public AjaxSuggestionEvent(final UIComponent component) {
super(component);
- // TODO Auto-generated constructor stub
}
/**
+ * Gets submitted value.
+ *
* @return Returns the submittedValie.
*/
- public Object getSubmittedValue() {
- return this._submittedValue;
+ public final Object getSubmittedValue() {
+ return this.submittedValue;
}
/**
- * @param submittedValie The submittedValie to set.
+ * Sets submitted value.
+ *
+ * @param value The submitted value to set.
*/
- public void setSubmittedValue(Object submittedValue) {
- this._submittedValue = submittedValue;
+ public final void setSubmittedValue(final Object value) {
+ this.submittedValue = value;
}
-
-}
\ No newline at end of file
+}
Modified: trunk/richfaces/suggestionbox/src/main/java/org/richfaces/component/SuggestionEvent.java
===================================================================
--- trunk/richfaces/suggestionbox/src/main/java/org/richfaces/component/SuggestionEvent.java 2007-04-09 14:42:34 UTC (rev 323)
+++ trunk/richfaces/suggestionbox/src/main/java/org/richfaces/component/SuggestionEvent.java 2007-04-09 14:59:05 UTC (rev 324)
@@ -23,47 +23,52 @@
import javax.faces.component.UIComponent;
+/**
+ * Event implementation for SuggestionBox component.
+ */
public class SuggestionEvent extends javax.faces.event.ActionEvent {
/**
- *
+ * Serial Version UID.
*/
private static final long serialVersionUID = 3192468135298986660L;
+
/**
- *
+ * Submitted value.
*/
- private Object _submittedValue;
+ private Object submittedValue;
/**
- * @param component
- * @param submittedValie
+ * Constructor.
+ *
+ * @param component {@link javax.faces.component.UIComponent}
+ * @param value The submitted value to set
*/
- public SuggestionEvent(UIComponent component, Object submittedValue) {
+ public SuggestionEvent(final UIComponent component, final Object value) {
super(component);
- // TODO Auto-generated constructor stub
- this._submittedValue = submittedValue;
+ this.submittedValue = value;
}
/**
- * @param component
+ * Constructor.
+ *
+ * @param component {@link javax.faces.component.UIComponent}
*/
- public SuggestionEvent(UIComponent component) {
+ public SuggestionEvent(final UIComponent component) {
super(component);
- // TODO Auto-generated constructor stub
}
/**
* @return Returns the submittedValie.
*/
- public Object getSubmittedValue() {
- return this._submittedValue;
+ public final Object getSubmittedValue() {
+ return this.submittedValue;
}
/**
- * @param submittedValie The submittedValie to set.
+ * @param value The submittedValie to set.
*/
- public void setSubmittedValue(Object submittedValue) {
- this._submittedValue = submittedValue;
+ public final void setSubmittedValue(final Object value) {
+ this.submittedValue = value;
}
-
-}
\ No newline at end of file
+}
Modified: trunk/richfaces/suggestionbox/src/main/java/org/richfaces/component/UISuggestionBox.java
===================================================================
--- trunk/richfaces/suggestionbox/src/main/java/org/richfaces/component/UISuggestionBox.java 2007-04-09 14:42:34 UTC (rev 323)
+++ trunk/richfaces/suggestionbox/src/main/java/org/richfaces/component/UISuggestionBox.java 2007-04-09 14:59:05 UTC (rev 324)
@@ -40,85 +40,235 @@
/**
+ * UI implementation for SuggestionBox component.
+ *
* @author shura (latest modification by $Author: alexsmirnov $)
* @version $Revision: 1.5 $ $Date: 2007/03/01 22:37:50 $
*/
-public abstract class UISuggestionBox extends UIData implements AjaxComponent, AjaxSource {
+public abstract class UISuggestionBox extends UIData
+ implements AjaxComponent, AjaxSource {
+ /**
+ * Log for component.
+ */
private static Log log = LogFactory.getLog(UISuggestionBox.class);
+ /**
+ * Component type.
+ */
private static final String COMPONENT_TYPE = "org.richfaces.SuggestionBox";
- private static final String COMPONENT_FAMILY = "org.richfaces.SuggestionBox";
+ /**
+ * Component family.
+ */
+ private static final String COMPONENT_FAMILY =
+ "org.richfaces.SuggestionBox";
-
+ /**
+ * TRUE if submitted.
+ */
private transient boolean submitted = false;
+ /**
+ * Getter for for attribute.
+ *
+ * id (or full path of id's) of target components, for which this element
+ * must provide support.
+ * If a target component inside of the same <code>NamingContainer<code>
+ * (UIForm, UIData in base implementstions), can be simple value of the
+ * "id" attribute.
+ * For other cases must include id's of <code>NamingContainer<code>
+ * components, separated by ':'. For search from the root of components,
+ * must be started with ':'.
+ *
+ * @return for value from local variable or value bindings
+ */
public abstract String getFor();
- public abstract void setFor(String __for);
+ /**
+ * Setter for attribute.
+ *
+ * @param f identifier
+ */
+ public abstract void setFor(String f);
+ /**
+ * Getter for suggestionAction.
+ *
+ * Method calls an expression to get a collection of suggestion data
+ * on request. It must have one parameter with a type of Object with
+ * content of input component and must return any type allowed for
+ * <h:datatable>;
+ *
+ * @return suggestionAction value from local variable or value bindings
+ */
public abstract MethodBinding getSuggestionAction();
+ /**
+ * Setter for suggestionAction.
+ *
+ * @param action {@link javax.faces.el.MethodBinding}
+ */
public abstract void setSuggestionAction(MethodBinding action);
+ /**
+ * Getter for converter.
+ * Id of Converter to be used or reference to a Converter.
+ *
+ * @return converter value from local variable or value bindings
+ */
public abstract Converter getConverter();
+ /**
+ * Setter for converter.
+ *
+ * @param converter {@link javax.faces.convert.Converter}
+ */
public abstract void setConverter(Converter converter);
/**
- * @return
+ * Getter for rowClasses.
+ *
+ * @return rowClasses value from local variable or value bindings
*/
public abstract String getRowClasses();
+ /**
+ * Getter for rowClasses.
+ *
+ * @param rowClasses row classes
+ */
public abstract void setRowClasses(String rowClasses);
/**
- * @return
+ * Getter for selectValueClass.
+ *
+ * Name of the CSS class for a hidden suggestion entry
+ * element (table cell)
+ *
+ * @return selectValueClass value from local variable or value bindings
*/
public abstract String getSelectValueClass();
+ /**
+ * Setter for selectValueClass.
+ *
+ * @param value class
+ */
public abstract void setSelectValueClass(String value);
/**
- * @return
+ * Getter for border.
+ *
+ * This attributes specifies the width (in pixels only) of the frame around a table
+ *
+ * @return border value from local variable or value bindings
*/
public abstract String getBorder();
-//
- public abstract void setCellpadding(String value);
+ /**
+ * Setter for border.
+ *
+ * @param value of border
+ */
+ public abstract void setBorder(String value);
+ /**
+ * Getter for cellpadding.
+ *
+ * This attribute specifies the amount of space between the
+ * border of the cell and its contents. If the value of
+ * this attribute is a pixel length, all four margins
+ * should be this distance from the contents. If the value
+ * of the attribute is percentage length, the top and
+ * bottom margins should be equally separated from the
+ * content based on percentage of the available vertical
+ * space, and the left and right margins should be equally
+ * separated from the content based on percentage of the
+ * available horizontal space
+ */
public abstract String getCellpadding();
- public abstract void setBorder(String value);
+ /**
+ * Setter for cellpadding.
+ *
+ * @param value of cellpadding
+ */
+ public abstract void setCellpadding(String value);
+ /**
+ * Getter for immediate.
+ *
+ * @return immediate value from local variable or value bindings
+ */
public abstract boolean isImmediate();
+ /**
+ * Getter for immediate.
+ *
+ * @param value of immediate
+ */
public abstract void setImmediate(boolean value);
+ /**
+ * Getter for selfRendered.
+ *
+ * If true, forces active Ajax region render response
+ * directly from stored components tree, bypasses page
+ * processing. Can be used for increase performance. Also,
+ * must be set to 'true' inside iteration components, such
+ * as dataTable
+ *
+ * @return selfRendered value from local variable or value bindings
+ */
+
public abstract boolean isSelfRendered();
+ /**
+ * Getter for selfRendered.
+ *
+ * @param value for attribute
+ */
public abstract void setSelfRendered(boolean value);
/**
- * @return
+ * Getter for entryClass.
+ *
+ * Name of the CSS class for a suggestion entry element (table row)
+ *
+ * @return entryClass value from local variable or value bindings
*/
public abstract String getEntryClass();
+ /**
+ * Setter for entryClass.
+ *
+ * @param value of entry class
+ */
public abstract void setEntryClass(String value);
+ /**
+ * Getter for submitted.
+ *
+ * @return TRUE if submited
+ */
public boolean isSubmitted() {
return submitted;
}
- public void setSubmitted(boolean submitted) {
- this.submitted = submitted;
+ /**
+ * Setter for submitted.
+ *
+ * @param s of entry class
+ */
+ public void setSubmitted(boolean s) {
+ this.submitted = s;
}
/* (non-Javadoc)
* @see javax.faces.component.UIComponentBase#queueEvent(javax.faces.event.FacesEvent)
*/
- public void queueEvent(FacesEvent event) {
+ public final void queueEvent(final FacesEvent event) {
if (event instanceof SuggestionEvent) {
if (isImmediate()) {
event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
@@ -133,17 +283,19 @@
/* (non-Javadoc)
- * @see javax.faces.component.UIData#broadcast(javax.faces.event.FacesEvent)
- */
- public void broadcast(FacesEvent event) throws AbortProcessingException {
+ * @see javax.faces.component.UIData#broadcast(javax.faces.event.FacesEvent)
+ */
+ public final void broadcast(final FacesEvent event)
+ throws AbortProcessingException {
super.broadcast(event);
if (event instanceof SuggestionEvent) {
SuggestionEvent suggestionEvent = (SuggestionEvent) event;
- Object value = suggestionEvent.getSubmittedValue();
+ Object value = suggestionEvent.getSubmittedValue();
MethodBinding suggestingAction = getSuggestionAction();
- if (null != suggestingAction ) {
+ if (null != suggestingAction) {
// TODO - use converter
- setValue(suggestingAction.invoke(getFacesContext(), new Object[]{value}));
+ setValue(suggestingAction.invoke(
+ getFacesContext(), new Object[]{value}));
getFacesContext().renderResponse();
}
} else if (event instanceof AjaxEvent) {
@@ -152,22 +304,21 @@
AjaxRendererUtils.addRegionByName(context, this, this.getId());
setSubmitted(true);
if (isSelfRendered()) {
- AjaxContext.getCurrentInstance(context).renderSubmittedAjaxRegion(context, true);
+ AjaxContext.getCurrentInstance(context)
+ .renderSubmittedAjaxRegion(context, true);
}
}
}
- public void addAjaxListener(AjaxListener listener) {
- addFacesListener(listener);
- }
+ public void addAjaxListener(final AjaxListener listener) {
+ addFacesListener(listener);
+ }
- public AjaxListener[] getAjaxListeners() {
- return (AjaxListener[]) getFacesListeners(AjaxListener.class);
- }
+ public AjaxListener[] getAjaxListeners() {
+ return (AjaxListener[]) getFacesListeners(AjaxListener.class);
+ }
- public void removeAjaxListener(AjaxListener listener) {
- removeFacesListener(listener);
- }
-
-
+ public void removeAjaxListener(final AjaxListener listener) {
+ removeFacesListener(listener);
+ }
}
Modified: trunk/richfaces/suggestionbox/src/main/java/org/richfaces/renderkit/html/SuggestionBoxRenderer.java
===================================================================
--- trunk/richfaces/suggestionbox/src/main/java/org/richfaces/renderkit/html/SuggestionBoxRenderer.java 2007-04-09 14:42:34 UTC (rev 323)
+++ trunk/richfaces/suggestionbox/src/main/java/org/richfaces/renderkit/html/SuggestionBoxRenderer.java 2007-04-09 14:59:05 UTC (rev 324)
@@ -22,7 +22,6 @@
package org.richfaces.renderkit.html;
import org.ajax4jsf.framework.ajax.AjaxContext;
-import org.ajax4jsf.framework.ajax.AjaxEvent;
import org.ajax4jsf.framework.renderer.AjaxComponentRendererBase;
import org.ajax4jsf.framework.renderer.AjaxRendererUtils;
import org.ajax4jsf.framework.renderer.RendererBase;
@@ -55,49 +54,84 @@
import java.util.Map;
import java.util.regex.Pattern;
+/**
+ * Renderer for SuggestionBox component.
+ */
public class SuggestionBoxRenderer extends AjaxComponentRendererBase {
-
+ /**
+ * Component options.
+ */
private static final String[] OPTIONS = {"popupClass", "popupStyle",
"width", "height", "entryClass", "selectedClass", "param",
"frequency", "minChars", "tokens", "rows"};
+ /**
+ * Shadow depth.
+ */
public static final int SHADOW_DEPTH = 4;
+ /**
+ * Styles.
+ */
private InternetResource[] styles = {new TemplateCSSResource(
"org/richfaces/renderkit/html/css/suggestionbox.xcss")};
+ /**
+ * Additional scripts.
+ */
private final InternetResource[] additionalScripts = {
- new org.ajax4jsf.framework.resource.PrototypeScript(),
- new org.ajax4jsf.framework.resource.SmartPositionScript(),
- getResource("/org/richfaces/renderkit/html/scripts/browser_info.js"),
- getResource("scripts/scriptaculo.js"),
- getResource("scripts/suggestionbox.js")};
+ new org.ajax4jsf.framework.resource.PrototypeScript(),
+ new org.ajax4jsf.framework.resource.SmartPositionScript(),
+ getResource("/org/richfaces/renderkit/html/scripts/browser_info.js"),
+ getResource("scripts/scriptaculo.js"),
+ getResource("scripts/suggestionbox.js")};
+ /**
+ * Template for table.
+ */
private PreparedTemplate body = HtmlCompiler
- .compileResource("org/richfaces/renderkit/html/templates/table.jspx");
+ .compileResource("org/richfaces/renderkit/html/templates/table.jspx");
+ /**
+ * Template for popup.
+ */
private PreparedTemplate popup = HtmlCompiler
- .compileResource("org/richfaces/renderkit/html/templates/popup.jspx");
+ .compileResource("org/richfaces/renderkit/html/templates/popup.jspx");
- protected Class getComponentClass() {
+ /**
+ * Gets component class.
+ *
+ * @return component class
+ */
+ protected final Class getComponentClass() {
return UISuggestionBox.class;
}
- public boolean getRendersChildren() {
+ /**
+ * Is render children.
+ *
+ * @return boolean
+ */
+ public final boolean getRendersChildren() {
return true;
}
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.framework.renderer.RendererBase#doDecode(javax.faces.context.FacesContext,
- * javax.faces.component.UIComponent)
- */
- protected void doDecode(FacesContext context, UIComponent component) {
+ /**
+ * Decode.
+ *
+ * @param context {@link javax.faces.context.FacesContext}
+ * @param component {@link javax.faces.component.UIComponent}
+ *
+ * @see org.ajax4jsf.framework.renderer.RendererBase#doDecode(
+ * javax.faces.context.FacesContext,
+ * javax.faces.component.UIComponent)
+ */
+ protected final void doDecode(final FacesContext context,
+ final UIComponent component) {
String clientId = component.getClientId(context);
Map requestParameterMap = context.getExternalContext()
- .getRequestParameterMap();
- String reqValue = (String) requestParameterMap.get(clientId);
+ .getRequestParameterMap();
+ String reqValue = (String) requestParameterMap.get(clientId);
if (reqValue != null && reqValue.equals(clientId)) {
String paramName = (String) component.getAttributes().get("param");
if (null == paramName) {
@@ -106,17 +140,43 @@
Object elementValue = requestParameterMap.get(paramName);
FacesEvent event = new SuggestionEvent(component, elementValue);
component.queueEvent(event);
- component.queueEvent(new AjaxSuggestionEvent(component, elementValue));
+ component.queueEvent(
+ new AjaxSuggestionEvent(component, elementValue));
}
}
- protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
+ /**
+ * Encode begin.
+ *
+ * @param writer {@link javax.faces.context.ResponseWriter}
+ * @param context {@link javax.faces.context.FacesContext}
+ * @param component {@link javax.faces.component.UIComponent}
+ * @throws IOException
+ *
+ * @see {@link org.ajax4jsf.framework.renderer.RendererBase#doEncodeBegin}
+ */
+ protected final void doEncodeBegin(final ResponseWriter writer,
+ final FacesContext context,
+ final UIComponent component)
+ throws IOException {
super.doEncodeBegin(writer, context, component);
- org.richfaces.component.util.FormUtil.throwEnclFormReqExceptionIfNeed(context, component);
+ org.richfaces.component.util.FormUtil.throwEnclFormReqExceptionIfNeed(
+ context, component);
}
- protected void doEncodeEnd(ResponseWriter writer, FacesContext context,
- UIComponent component) throws IOException {
+ /**
+ * Encode end.
+ *
+ * @param writer {@link javax.faces.context.ResponseWriter}
+ * @param context {@link javax.faces.context.FacesContext}
+ * @param component {@link javax.faces.component.UIComponent}
+ * @throws IOException
+ *
+ * @see {@link org.ajax4jsf.framework.renderer.RendererBase#doEncodeEnd}
+ */
+ protected void doEncodeEnd(final ResponseWriter writer,
+ final FacesContext context,
+ final UIComponent component) throws IOException {
UISuggestionBox suggestionBox = (UISuggestionBox) component;
if (!suggestionBox.isSubmitted()) {
suggestionBox.setRowIndex(-1);
@@ -124,7 +184,8 @@
getUtils().encodeId(context, component);
Map attributes = component.getAttributes();
- StringBuffer clazz = new StringBuffer("dr-sb-common-container rich-sb-common-container");
+ StringBuffer clazz = new StringBuffer(
+ "dr-sb-common-container rich-sb-common-container");
Object popupClass = attributes.get("popupClass");
if (null != popupClass) {
clazz.append(" ").append(popupClass);
@@ -156,11 +217,12 @@
writer.endElement(HTML.DIV_ELEM);
writer.startElement("iframe", component);
writer.writeAttribute("src",
- getResource("/org/richfaces/renderkit/html/images/spacer.gif")
- .getUri(context, null), null);
+ getResource("/org/richfaces/renderkit/html/images/spacer.gif")
+ .getUri(context, null), null);
writer.writeAttribute("id", component.getClientId(context)
+ "_iframe", null);
- writer.writeAttribute("style", "position:absolute;display:none;z-index:0;", null);
+ writer.writeAttribute(
+ "style", "position:absolute;display:none;z-index:0;", null);
writer.endElement("iframe");
} else {
suggestionBox.setSubmitted(false);
@@ -170,13 +232,17 @@
((UISuggestionBox) component).setValue(null);
}
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.render.Renderer#encodeChildren(javax.faces.context.FacesContext,
- * javax.faces.component.UIComponent)
- */
- public void encodeChildren(FacesContext context, UIComponent component)
+ /**
+ * Encode children.
+ *
+ * @param context {@link javax.faces.context.FacesContext}
+ * @param component {@link javax.faces.component.UIComponent}
+ * @throws IOException
+ *
+ * @see javax.faces.render.Renderer#encodeChildren
+ */
+ public void encodeChildren(final FacesContext context,
+ final UIComponent component)
throws IOException {
UISuggestionBox suggestionBox = (UISuggestionBox) component;
if (suggestionBox.isSubmitted()) {
@@ -189,8 +255,13 @@
}
}
- private UIComponent getTarget(UIComponent component)
- throws FacesException {
+ /**
+ * Gets component.
+ *
+ * @param component {@link javax.faces.component.UIComponent}
+ * @return component
+ */
+ private UIComponent getTarget(final UIComponent component) {
String target = ((UISuggestionBox) component).getFor();
if (null != target) {
// Use parent since UIData - naming container
@@ -208,7 +279,15 @@
}
}
- private String getScript(FacesContext context, UIComponent component) {
+ /**
+ * Gets script.
+ *
+ * @param context {@link javax.faces.context.FacesContext}
+ * @param component {@link javax.faces.component.UIComponent}
+ * @return script
+ */
+ private String getScript(final FacesContext context,
+ final UIComponent component) {
Map attributes = component.getAttributes();
StringBuffer script = new StringBuffer(" new ");
// Build ajax function call
@@ -251,7 +330,15 @@
return script.toString();
}
- private TemplateContext getTemplateContext(FacesContext context, UIData data) {
+ /**
+ * Gets template.
+ *
+ * @param context {@link javax.faces.context.FacesContext}
+ * @param data
+ * @return {@link org.ajax4jsf.framework.renderer.compiler.TemplateContext}
+ */
+ private TemplateContext getTemplateContext(final FacesContext context,
+ final UIData data) {
data.setRowIndex(-1);
return new DataTemplateContext(this, context, data);
}
@@ -267,27 +354,30 @@
private List columns;
- private int _first;
+ private int first;
- private int _last;
+ private int last;
- private int _rows;
+ private int rows;
- private int _rowCount;
+ private int rowCount;
- private int _current;
+ private int current;
- private String[] _rowClasses = new String[0];
+ private String[] rowClasses = new String[0];
- private String _entryClass;
+ private String entryClass;
/**
- * @param renderer
- * @param facesContext
- * @param component
+ * Constructor.
+ *
+ * @param renderer {@link org.ajax4jsf.framework.renderer.RendererBase}
+ * @param facesContext {@link javax.faces.context.FacesContext}
+ * @param component {@link javax.faces.component.UIComponent}
*/
- public DataTemplateContext(RendererBase renderer,
- FacesContext facesContext, UIComponent component) {
+ public DataTemplateContext(final RendererBase renderer,
+ final FacesContext facesContext,
+ final UIComponent component) {
super(renderer, facesContext, component);
if (component.getFacet("head") != null) {
this.putParameter("hasHead", Boolean.TRUE);
@@ -314,49 +404,50 @@
}
// fill rows counters
UISuggestionBox box = (UISuggestionBox) component;
- this._first = box.getFirst();
- this._rows = box.getRows();
- this._rowCount = box.getRowCount();
+ this.first = box.getFirst();
+ this.rows = box.getRows();
+ this.rowCount = box.getRowCount();
// return all records; CH-1330
- if (_rows <= 0 || true) {
- _rows = _rowCount - _first;
+ if (rows <= 0 || true) {
+ rows = rowCount - first;
}
- _last = _first + _rows;
- if (_last > _rowCount) {
- _last = _rowCount;
+ last = first + rows;
+ if (last > rowCount) {
+ last = rowCount;
}
- _current = _first;
+ current = first;
// rows classes
- _entryClass = box.getEntryClass();
+ entryClass = box.getEntryClass();
String rowClasses = box.getRowClasses();
if (null != rowClasses && rowClasses.length() > 0) {
- _rowClasses = rowClasses.split("\\s+");
+ this.rowClasses = rowClasses.split("\\s+");
}
}
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.framework.renderer.compiler.TemplateContext#getParameter(java.lang.Object)
- */
+ /**
+ * Gets parameter.
+ *
+ * @param key parameter key
+ * @return parameter
+ */
public Object getParameter(Object key) {
if ("rows".equals(key)) {
// Iterate over rows in datatable
return new Iterator() {
public boolean hasNext() {
- if (_current >= _last) {
+ if (current >= last) {
return false;
}
UIData data = ((UIData) getComponent());
- data.setRowIndex(_current);
+ data.setRowIndex(current);
return data.isRowAvailable();
}
public Object next() {
// TODO reset rows and columns classes counters
- _current++;
+ current++;
return getComponent();
}
@@ -369,18 +460,19 @@
} else if ("rowClass".equals(key)) {
// Build row class string from entryClass and row classes
StringBuffer rowClass = new StringBuffer();
- if (null != _entryClass) {
- rowClass.append(_entryClass);
- if (_rowClasses.length > 0) {
+ if (null != entryClass) {
+ rowClass.append(entryClass);
+ if (rowClasses.length > 0) {
rowClass.append(" ");
}
}
- if (_rowClasses.length > 0) {
- int currentClass = (_current - _first - 1)
- % _rowClasses.length;
- if (currentClass < 0)
+ if (rowClasses.length > 0) {
+ int currentClass = (current - first - 1)
+ % rowClasses.length;
+ if (currentClass < 0) {
currentClass = 0;
- rowClass.append(_rowClasses[currentClass]);
+ }
+ rowClass.append(rowClasses[currentClass]);
}
// for iterate over columns
return rowClass.toString();
@@ -393,10 +485,17 @@
return super.getParameter(key);
}
}
-
}
- public String opacityStyle(FacesContext context, UIComponent component) {
+ /**
+ * Gets opacity style.
+ *
+ * @param context {@link javax.faces.context.FacesContext}
+ * @param component {@link javax.faces.component.UIComponent}
+ * @return style
+ */
+ public final String opacityStyle(final FacesContext context,
+ final UIComponent component) {
String opacity = (String) component.getAttributes().get("shadowOpacity");
String filterOpacity;
@@ -412,65 +511,89 @@
// illegal opacity
return ";";
}
- return "opacity:" + opacity + "; filter:alpha(opacity=" + filterOpacity + ");";
+ return "opacity:" + opacity
+ + "; filter:alpha(opacity=" + filterOpacity + ");";
}
- public String border(FacesContext context, UIComponent component) {
+ /**
+ * Gets border style.
+ *
+ * @param context {@link javax.faces.context.FacesContext}
+ * @param component {@link javax.faces.component.UIComponent}
+ * @return style
+ */
+ public final String border(final FacesContext context,
+ final UIComponent component) {
String border = (String) component.getAttributes().get("border");
String frame = (String) component.getAttributes().get("frame");
- if (null == frame)
+ if (null == frame) {
frame = "box";
+ }
StringBuffer stringBuffer = new StringBuffer();
- if (null != border && Pattern.matches("\\d*", border))
+ if (null != border && Pattern.matches("\\d*", border)) {
border += "px";
- /*
- * if (null == border || !Pattern.matches("\\d*px", border)) { Skin skin =
- * SkinFactory.getInstance().getSkin(context); border = (String)
- * skin.getParameter(context, "suggestionbox.borderWidth"); }
- */
+ }
boolean top = false, right = false, bottom = false, left = false;
- if (frame.equalsIgnoreCase("above"))
+ if (frame.equalsIgnoreCase("above")) {
top = true;
// else if (frame.equalsIgnoreCase("border") |
// frame.equalsIgnoreCase("box")) top=right=bottom=left=true;
- else if (frame.equalsIgnoreCase("below"))
+ } else if (frame.equalsIgnoreCase("below")) {
bottom = true;
- else if (frame.equalsIgnoreCase("hsides"))
- top = bottom = true;
- else if (frame.equalsIgnoreCase("lhs"))
+ } else if (frame.equalsIgnoreCase("hsides")) {
+ top = true;
+ bottom = true;
+ } else if (frame.equalsIgnoreCase("lhs")) {
left = true;
- else if (frame.equalsIgnoreCase("rhs"))
+ } else if (frame.equalsIgnoreCase("rhs")) {
right = true;
- else if (frame.equalsIgnoreCase("vsides"))
- right = left = true;
- else
- top = right = bottom = left = true;
+ } else if (frame.equalsIgnoreCase("vsides")) {
+ right = true;
+ left = true;
+ } else {
+ top = true;
+ right = true;
+ bottom = true;
+ left = true;
+ }
stringBuffer.append("; border-width:");
- if (top)
+ if (top) {
stringBuffer.append(" ").append(border).append(" ");
- else
+ } else {
stringBuffer.append(" 0px ");
- if (right)
+ }
+ if (right) {
stringBuffer.append(" ").append(border).append(" ");
- else
+ } else {
stringBuffer.append(" 0px ");
- if (bottom)
+ }
+ if (bottom) {
stringBuffer.append(" ").append(border).append(" ");
- else
+ } else {
stringBuffer.append(" 0px ");
- if (left)
+ }
+ if (left) {
stringBuffer.append(" ").append(border).append(" ");
- else
+ } else {
stringBuffer.append(" 0px ");
+ }
stringBuffer.append(";");
return stringBuffer.toString();
}
- public String bgcolor(FacesContext context, UIComponent component) {
+ /**
+ * Gets background-color style.
+ *
+ * @param context {@link javax.faces.context.FacesContext}
+ * @param component {@link javax.faces.component.UIComponent}
+ * @return background-color style
+ */
+ public final String bgcolor(final FacesContext context,
+ final UIComponent component) {
String bgcolor = (String) component.getAttributes().get("bgcolor");
if (bgcolor != null) {
return "background-color: " + bgcolor + ";";
@@ -478,20 +601,45 @@
return ";";
}
- public String cellPadding(FacesContext context, UIComponent component) {
- UISuggestionBox box = (UISuggestionBox)component;
- String cp = box.getCellpadding();
+ /**
+ * Gets cellpadding style.
+ *
+ * @param context {@link javax.faces.context.FacesContext}
+ * @param component {@link javax.faces.component.UIComponent}
+ * @return cellpadding style
+ */
+ public final String cellPadding(final FacesContext context,
+ final UIComponent component) {
+ UISuggestionBox box = (UISuggestionBox) component;
+ String cp = box.getCellpadding();
if (cp != null) {
return "padding: " + getUtils().encodePctOrPx(cp) + ";";
}
return ";";
}
- public String getContentId(FacesContext context, UIComponent component) {
- return component.getClientId(context) + NamingContainer.SEPARATOR_CHAR + "suggest";
+ /**
+ * Gets context identifier.
+ *
+ * @param context {@link javax.faces.context.FacesContext}
+ * @param component {@link javax.faces.component.UIComponent}
+ * @return context identifier
+ */
+ public final String getContentId(final FacesContext context,
+ final UIComponent component) {
+ return component.getClientId(context)
+ + NamingContainer.SEPARATOR_CHAR + "suggest";
}
- public String overflowSize(FacesContext context, UIComponent component) {
+ /**
+ * Gets overflow sizes.
+ *
+ * @param context {@link javax.faces.context.FacesContext}
+ * @param component {@link javax.faces.component.UIComponent}
+ * @return overflow style
+ */
+ public final String overflowSize(final FacesContext context,
+ final UIComponent component) {
StringBuffer style = new StringBuffer();
style.append(getSizeForStyle(component, "width", null, true));
@@ -500,8 +648,15 @@
return style.toString();
}
-
- public String shadowDepth(FacesContext context, UIComponent component) {
+ /**
+ * Gets shadow style.
+ *
+ * @param context {@link javax.faces.context.FacesContext}
+ * @param component {@link javax.faces.component.UIComponent}
+ * @return shadow style
+ */
+ public final String shadowDepth(final FacesContext context,
+ final UIComponent component) {
String shadow = (String) component.getAttributes().get("shadowDepth");
if (shadow == null) {
shadow = Integer.toString(SHADOW_DEPTH);
@@ -510,27 +665,38 @@
return "top: " + shadow + "; left: " + shadow;
}
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.framework.renderer.AjaxComponentRendererBase#getAdditionalScripts()
- */
- protected InternetResource[] getAdditionalScripts() {
- // TODO Auto-generated method stub
+ /**
+ * Gets additional scripts.
+ *
+ * @return array of resources
+ * {@link org.ajax4jsf.framework.resource.InternetResource}
+ */
+ protected final InternetResource[] getAdditionalScripts() {
return additionalScripts;
}
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.framework.renderer.HeaderResourcesRendererBase#getStyles()
- */
- protected InternetResource[] getStyles() {
- // TODO Auto-generated method stub
+ /**
+ * Gets styles.
+ *
+ * @return array of styles
+ * {@link org.ajax4jsf.framework.resource.InternetResource}
+ */
+ protected final InternetResource[] getStyles() {
return styles;
}
- private String getSizeForStyle(UIComponent component, String attr, String def, boolean isShadow) {
+ /**
+ * Gets style for width & height.
+ * @param component {@link javax.faces.component.UIComponent}
+ * @param attr attribute
+ * @param def default value
+ * @param isShadow TRUE if shadow exists
+ * @return style
+ */
+ private String getSizeForStyle(final UIComponent component,
+ final String attr,
+ final String def,
+ final boolean isShadow) {
Map attributes = component.getAttributes();
StringBuffer style = new StringBuffer();
@@ -541,7 +707,8 @@
if (attribute != null) {
if (isShadow) {
- attribute = String.valueOf(Integer.parseInt(attribute) - SHADOW_DEPTH);
+ attribute = String.valueOf(Integer.parseInt(attribute)
+ - SHADOW_DEPTH);
}
style.append(attr).append(":").append(attribute);
Modified: trunk/richfaces/suggestionbox/src/main/java/org/richfaces/taglib/SuggestionBoxTagHandler.java
===================================================================
--- trunk/richfaces/suggestionbox/src/main/java/org/richfaces/taglib/SuggestionBoxTagHandler.java 2007-04-09 14:42:34 UTC (rev 323)
+++ trunk/richfaces/suggestionbox/src/main/java/org/richfaces/taglib/SuggestionBoxTagHandler.java 2007-04-09 14:59:05 UTC (rev 324)
@@ -1,85 +1,143 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - 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.taglib;
-import java.lang.String;
-import javax.faces.convert.Converter;
-import java.lang.Object;
-import javax.faces.el.MethodBinding;
-import com.sun.facelets.tag.jsf.ComponentHandler;
-import javax.faces.component.UIComponent;
+import com.sun.facelets.FaceletContext;
+import com.sun.facelets.el.LegacyMethodBinding;
+import com.sun.facelets.tag.MetaRule;
+import com.sun.facelets.tag.MetaRuleset;
+import com.sun.facelets.tag.Metadata;
+import com.sun.facelets.tag.MetadataTarget;
+import com.sun.facelets.tag.TagAttribute;
+import com.sun.facelets.tag.jsf.ComponentConfig;
import org.richfaces.component.UISuggestionBox;
-import com.sun.facelets.tag.jsf.ComponentHandler;
-import com.sun.facelets.tag.jsf.ComponentConfig;
-import com.sun.facelets.*;
-import com.sun.facelets.el.*;
-import com.sun.facelets.tag.*;
-
/**
+ * Component tag handler for Facelets.
+ *
* @author shura (latest modification by $Author: ishabalov $)
* @version $Revision: 1.1.2.4 $ $Date: 2007/02/20 20:58:03 $
- *
*/
-public class SuggestionBoxTagHandler extends
- com.sun.facelets.tag.jsf.ComponentHandler {
+public class SuggestionBoxTagHandler
+ extends com.sun.facelets.tag.jsf.ComponentHandler {
- private static final SuggestionBoxTagHandlerMetaRule metaRule = new SuggestionBoxTagHandlerMetaRule();
+ /**
+ * Meta rule for tag handler.
+ */
+ private static final SuggestionBoxTagHandlerMetaRule metaRule =
+ new SuggestionBoxTagHandlerMetaRule();
- public SuggestionBoxTagHandler(ComponentConfig config) {
- super(config);
- }
+ /**
+ * Constructor.
+ *
+ * @param config {@link com.sun.facelets.tag.jsf.ComponentConfig}
+ */
+ public SuggestionBoxTagHandler(final ComponentConfig config) {
+ super(config);
+ }
- // Metarule
- protected MetaRuleset createMetaRuleset(Class type) {
- MetaRuleset m = super.createMetaRuleset(type);
- m.addRule(metaRule);
- return m;
- }
+ /**
+ * Creates metarules.
+ *
+ * @param type Class
+ * @return {@link com.sun.facelets.tag.MetaRuleset}
+ */
+ protected final MetaRuleset createMetaRuleset(final Class type) {
+ MetaRuleset m = super.createMetaRuleset(type);
+ m.addRule(metaRule);
+ return m;
+ }
- /**
- * @author shura (latest modification by $Author: ishabalov $)
- * @version $Revision: 1.1.2.4 $ $Date: 2007/02/20 20:58:03 $
- *
- */
- static class SuggestionBoxTagHandlerMetaRule extends MetaRule {
+ /**
+ * Meta rule implementation.
+ *
+ * @author shura (latest modification by $Author: ishabalov $)
+ * @version $Revision: 1.1.2.4 $ $Date: 2007/02/20 20:58:03 $
+ */
+ static class SuggestionBoxTagHandlerMetaRule extends MetaRule {
- /* (non-Javadoc)
- * @see com.sun.facelets.tag.MetaRule#applyRule(java.lang.String, com.sun.facelets.tag.TagAttribute, com.sun.facelets.tag.MetadataTarget)
- */
- public Metadata applyRule(String name, TagAttribute attribute,
- MetadataTarget meta) {
- if (meta.isTargetInstanceOf(UISuggestionBox.class)) {
- if ("suggestionAction".equals(name)) {
- return new suggestionActionMapper(attribute);
- }
+ /**
+ * Apply rule.
+ *
+ * @param name rule name
+ * @param attribute {@link com.sun.facelets.tag.TagAttribute}
+ * @param meta {@link com.sun.facelets.tag.TagAttribute}
+ * @return metadata {@link com.sun.facelets.tag.Metadata}
+ *
+ * @see {@link com.sun.facelets.tag.MetaRule#applyRule(String,
+ * com.sun.facelets.tag.TagAttribute,
+ * com.sun.facelets.tag.MetadataTarget)}
+ */
+ public Metadata applyRule(final String name,
+ final TagAttribute attribute,
+ final MetadataTarget meta) {
+ if (meta.isTargetInstanceOf(UISuggestionBox.class)) {
+ if ("suggestionAction".equals(name)) {
+ return new SuggestionActionMapper(attribute);
+ }
- }
- return null;
- }
+ }
+ return null;
+ }
+ }
- }
+ /**
+ * Meta data implementation.
+ */
+ static class SuggestionActionMapper extends Metadata {
+ /**
+ * Signature.
+ */
+ private static final Class[] SIGNATURE =
+ new Class[]{java.lang.Object.class};
- static class suggestionActionMapper extends Metadata {
+ /**
+ * Action attribute.
+ */
+ private final TagAttribute action;
- private static final Class[] SIGNATURE = new Class[] { java.lang.Object.class };
+ /**
+ * Sets attribute.
+ *
+ * @param attribute {@link com.sun.facelets.tag.TagAttribute}
+ */
+ public SuggestionActionMapper(final TagAttribute attribute) {
+ action = attribute;
+ }
- private final TagAttribute _action;
+ /**
+ * Apply metadata.
- /**
- * @param attribute
- */
- public suggestionActionMapper(TagAttribute attribute) {
- _action = attribute;
- }
-
- /* (non-Javadoc)
- * @see com.sun.facelets.tag.Metadata#applyMetadata(com.sun.facelets.FaceletContext, java.lang.Object)
- */
- public void applyMetadata(FaceletContext ctx, Object instance) {
- ((UISuggestionBox) instance)
- .setSuggestionAction(new LegacyMethodBinding(this._action
- .getMethodExpression(ctx, null, SIGNATURE)));
- }
-
- }
-
+ * @param context {@link javax.faces.context.FacesContext}
+ * @param instance {@link java.lang.Object}
+ *
+ * @see {@link com.sun.facelets.tag.Metadata#applyMetadata(
+ * com.sun.facelets.FaceletContext, Object)}
+ */
+ public void applyMetadata(final FaceletContext context,
+ final Object instance) {
+ ((UISuggestionBox) instance)
+ .setSuggestionAction(new LegacyMethodBinding(this.action
+ .getMethodExpression(context, null, SIGNATURE)));
+ }
+ }
}
19 years
JBoss Rich Faces SVN: r323 - trunk/richfaces/menu-components/src/test/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: F.antonov
Date: 2007-04-09 10:42:34 -0400 (Mon, 09 Apr 2007)
New Revision: 323
Modified:
trunk/richfaces/menu-components/src/test/java/org/richfaces/component/MenuGroupComponentTest.java
trunk/richfaces/menu-components/src/test/java/org/richfaces/component/MenuItemComponentTest.java
Log:
Menu components test cases development.
Modified: trunk/richfaces/menu-components/src/test/java/org/richfaces/component/MenuGroupComponentTest.java
===================================================================
--- trunk/richfaces/menu-components/src/test/java/org/richfaces/component/MenuGroupComponentTest.java 2007-04-09 13:57:10 UTC (rev 322)
+++ trunk/richfaces/menu-components/src/test/java/org/richfaces/component/MenuGroupComponentTest.java 2007-04-09 14:42:34 UTC (rev 323)
@@ -26,10 +26,6 @@
import java.util.List;
import java.util.Set;
-import junit.framework.Assert;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
import javax.faces.component.UIComponent;
import javax.faces.component.UIForm;
import javax.faces.component.html.HtmlForm;
@@ -37,7 +33,6 @@
import org.richfaces.component.html.HtmlMenuGroup;
import org.richfaces.component.html.HtmlMenuItem;
-import org.richfaces.renderkit.html.MenuItemRenderer;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlElement;
@@ -45,8 +40,7 @@
import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
-import org.ajax4jsf.framework.renderer.ComponentVariables;
-import org.ajax4jsf.framework.renderer.ComponentsVariableResolver;
+import org.apache.commons.lang.StringUtils;
/**
@@ -55,16 +49,17 @@
public class MenuGroupComponentTest
extends AbstractAjax4JsfTestCase
{
- private static Set javaScripts = new HashSet();
-/* static {
+/* private static Set javaScripts = new HashSet();
+
+ static {
javaScripts.add("org.ajax4jsf.framework.ajax.AjaxScript()");
javaScripts.add("org.ajax4jsf.framework.resource.PrototypeScript()");
javaScripts.add("org.ajax4jsf.framework.util.command.CommandScript()");
}
*/
private UIMenuGroup menuGroup;
- private UIForm form;
+ private UIForm form;
/**
* Create the test case
@@ -86,14 +81,14 @@
menuGroup = (HtmlMenuGroup) application.createComponent(HtmlMenuGroup.COMPONENT_TYPE);
menuGroup.setId("menuGroup");
menuGroup.setValue("Menu Group");
-
- form.getChildren().add(menuGroup);
+
+ form.getChildren().add(menuGroup);
}
public void tearDown() throws Exception {
super.tearDown();
menuGroup = null;
- form = null;
+ form = null;
}
/**
@@ -104,9 +99,112 @@
HtmlPage page = renderView();
assertNotNull(page);
System.out.println(page.asXml());
- HtmlElement div = page.getHtmlElementById(menuGroup.getClientId(facesContext));
+ HtmlElement div = page.getHtmlElementById("ref" + menuGroup.getClientId(facesContext));
assertNotNull(div);
assertEquals("div", div.getNodeName());
+
}
+
+ public void testMenuItemIconFacet() throws Exception
+ {
+ UIComponent facet = createComponent(HtmlOutputText.COMPONENT_TYPE, HtmlOutputText.class.getName(), null, null , null);
+ menuGroup.getFacets().put("icon", facet);
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ //System.out.println(page.asXml());
+ HtmlElement span = page.getHtmlElementById("ref" + menuGroup.getClientId(facesContext) + ":icon");
+ assertEquals("span", span.getNodeName());
+ assertNotNull(span);
+ }
+
+ public void testDisabledMenuItem() throws Exception
+ {
+ menuGroup.setDisabled(true);
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ //System.out.println(page.asXml());
+
+ HtmlElement span = page.getHtmlElementById("ref" + menuGroup.getClientId(facesContext) + ":icon");
+ assertNotNull(span);
+ assertEquals("span", span.getNodeName());
+ String classAttr = span.getAttributeValue("class");
+ assertTrue(classAttr.contains("dr-menu-icon rich-menu-item-icon-disabled"));
+
+ HtmlElement div = page.getHtmlElementById("ref" + menuGroup.getClientId(facesContext));
+ assertNotNull(div);
+ assertEquals("div", div.getNodeName());
+ classAttr = div.getAttributeValue("class");
+ assertTrue(classAttr.contains("dr-menu-item dr-menu-item-disabled rich-menu-group rich-menu-group-disabled"));
+
+ }
+
+ public void testEnabledMenuItem() throws Exception
+ {
+ assertEquals(false, menuGroup.isDisabled());
+ menuGroup.getAttributes().put("iconClass", "iconClass");
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ //System.out.println(page.asXml());
+
+ HtmlElement anchor = page.getHtmlElementById("ref" + menuGroup.getClientId(facesContext) + ":anchor");
+ assertNotNull(anchor);
+ assertEquals("a", anchor.getNodeName());
+ String classAttr = anchor.getAttributeValue("class");
+ assertTrue(classAttr.contains("dr-menu-label rich-menu-item-label"));
+
+ HtmlElement span = page.getHtmlElementById("ref" + menuGroup.getClientId(facesContext) + ":icon");
+ assertNotNull(span);
+ assertEquals("span", span.getNodeName());
+ classAttr = span.getAttributeValue("class");
+ assertTrue(classAttr.contains("dr-menu-icon rich-menu-item-icon"));
+ assertTrue(classAttr.contains((String) menuGroup.getAttributes().get("iconClass")));
+
+ HtmlElement div = page.getHtmlElementById("ref" + menuGroup.getClientId(facesContext));
+ assertNotNull(div);
+ assertEquals("div", div.getNodeName());
+ classAttr = div.getAttributeValue("class");
+ assertTrue(classAttr.contains("dr-menu-item dr-menu-item-enabled rich-menu-group"));
+
+ div = page.getHtmlElementById(menuGroup.getClientId(facesContext));
+ assertNotNull(div);
+ assertEquals("div", div.getNodeName());
+ classAttr = div.getAttributeValue("class");
+ assertTrue(classAttr.contains("dr-menu-node rich-menu-item-folder"));
+
+ }
+
+ public void testRenderStyle() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ List links = page.getDocumentElement().getHtmlElementsByTagName("link");
+ //Assert.assertEquals(1, links.size());
+ assertNotNull(links);
+ HtmlElement link = (HtmlElement) links.get(0);
+ assertTrue(link.getAttributeValue("href").contains("org/richfaces/renderkit/html/css/menucomponents.xcss"));
+ }
+
+/* public void testRenderScript() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ List scripts = page.getDocumentElement().getHtmlElementsByTagName("script");
+ for (Iterator it = scripts.iterator(); it.hasNext();) {
+ HtmlScript item = (HtmlScript) it.next();
+ String srcAttr = item.getSrcAttribute();
+ if (StringUtils.isNotBlank(srcAttr)) {
+ boolean found = false;
+ for (Iterator srcIt = javaScripts.iterator(); srcIt.hasNext();) {
+ String src = (String) srcIt.next();
+
+ found = srcAttr.contains(src);
+ if (found) {
+ break;
+ }
+ }
+
+ assertTrue(found);
+ }
+ }
+ }
+*/
}
Modified: trunk/richfaces/menu-components/src/test/java/org/richfaces/component/MenuItemComponentTest.java
===================================================================
--- trunk/richfaces/menu-components/src/test/java/org/richfaces/component/MenuItemComponentTest.java 2007-04-09 13:57:10 UTC (rev 322)
+++ trunk/richfaces/menu-components/src/test/java/org/richfaces/component/MenuItemComponentTest.java 2007-04-09 14:42:34 UTC (rev 323)
@@ -21,6 +21,7 @@
package org.richfaces.component;
+import java.io.Serializable;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
@@ -34,7 +35,6 @@
import javax.faces.component.UIForm;
import javax.faces.component.html.HtmlForm;
import javax.faces.component.html.HtmlOutputText;
-//import org.apache.commons.lang.StringUtils;
import org.richfaces.component.html.HtmlMenuItem;
import org.richfaces.renderkit.html.MenuItemRenderer;
@@ -47,6 +47,7 @@
import org.ajax4jsf.framework.renderer.ComponentVariables;
import org.ajax4jsf.framework.renderer.ComponentsVariableResolver;
+import org.apache.commons.lang.StringUtils;
/**
@@ -55,9 +56,9 @@
public class MenuItemComponentTest
extends AbstractAjax4JsfTestCase
{
- private static Set javaScripts = new HashSet();
+/* private static Set javaScripts = new HashSet();
-/* static {
+ static {
javaScripts.add("org.ajax4jsf.framework.ajax.AjaxScript()");
javaScripts.add("org.ajax4jsf.framework.resource.PrototypeScript()");
javaScripts.add("org.ajax4jsf.framework.util.command.CommandScript()");
@@ -103,7 +104,7 @@
{
HtmlPage page = renderView();
assertNotNull(page);
- System.out.println(page.asXml());
+ //System.out.println(page.asXml());
HtmlElement div = page.getHtmlElementById(menuItem.getClientId(facesContext));
assertNotNull(div);
assertEquals("div", div.getNodeName());
@@ -115,7 +116,7 @@
menuItem.getFacets().put("iconDisabled", text);
HtmlPage page = renderView();
assertNotNull(page);
- System.out.println(page.asXml());
+ //System.out.println(page.asXml());
HtmlElement span = page.getHtmlElementById(menuItem.getClientId(facesContext) + ":icon");
assertEquals("span", span.getNodeName());
assertNotNull(span);
@@ -126,25 +127,25 @@
menuItem.setDisabled(true);
HtmlPage page = renderView();
assertNotNull(page);
- System.out.println(page.asXml());
+ //System.out.println(page.asXml());
HtmlElement span = page.getHtmlElementById(menuItem.getClientId(facesContext) + ":disabled");
assertNotNull(span);
assertEquals("span", span.getNodeName());
String classAttr = span.getAttributeValue("class");
- Assert.assertTrue(classAttr.contains("dr-menu-label dr-menu-label-disabled rich-menu-item-label rich-menu-item-label-disabled"));
+ assertTrue(classAttr.contains("dr-menu-label dr-menu-label-disabled rich-menu-item-label rich-menu-item-label-disabled"));
span = page.getHtmlElementById(menuItem.getClientId(facesContext) + ":icon");
assertNotNull(span);
assertEquals("span", span.getNodeName());
classAttr = span.getAttributeValue("class");
- Assert.assertTrue(classAttr.contains("dr-menu-icon rich-menu-item-icon dr-menu-icon-disabled rich-menu-item-icon-disabled"));
+ assertTrue(classAttr.contains("dr-menu-icon rich-menu-item-icon dr-menu-icon-disabled rich-menu-item-icon-disabled"));
HtmlElement div = page.getHtmlElementById(menuItem.getClientId(facesContext));
assertNotNull(div);
assertEquals("div", div.getNodeName());
classAttr = div.getAttributeValue("class");
- Assert.assertTrue(classAttr.contains("dr-menu-item dr-menu-item-disabled rich-menu-item rich-menu-item-disabled"));
+ assertTrue(classAttr.contains("dr-menu-item dr-menu-item-disabled rich-menu-item rich-menu-item-disabled"));
}
public void testEnabledMenuItem() throws Exception
@@ -153,41 +154,41 @@
menuItem.getAttributes().put("iconClass", "iconClass");
HtmlPage page = renderView();
assertNotNull(page);
- System.out.println(page.asXml());
+ //System.out.println(page.asXml());
HtmlElement anchor = page.getHtmlElementById(menuItem.getClientId(facesContext) + ":anchor");
assertNotNull(anchor);
assertEquals("a", anchor.getNodeName());
String classAttr = anchor.getAttributeValue("class");
- Assert.assertTrue(classAttr.contains("dr-menu-label rich-menu-item-label"));
+ assertTrue(classAttr.contains("dr-menu-label rich-menu-item-label"));
HtmlElement span = page.getHtmlElementById(menuItem.getClientId(facesContext) + ":icon");
assertNotNull(span);
assertEquals("span", span.getNodeName());
classAttr = span.getAttributeValue("class");
- Assert.assertTrue(classAttr.contains("dr-menu-icon rich-menu-item-icon"));
- Assert.assertTrue(classAttr.contains((String) menuItem.getAttributes().get("iconClass")));
+ assertTrue(classAttr.contains("dr-menu-icon rich-menu-item-icon"));
+ assertTrue(classAttr.contains((String) menuItem.getAttributes().get("iconClass")));
HtmlElement div = page.getHtmlElementById(menuItem.getClientId(facesContext));
assertNotNull(div);
assertEquals("div", div.getNodeName());
classAttr = div.getAttributeValue("class");
- Assert.assertTrue(classAttr.contains("dr-menu-item dr-menu-item-enabled rich-menu-item rich-menu-item-enabled"));
+ assertTrue(classAttr.contains("dr-menu-item dr-menu-item-enabled rich-menu-item rich-menu-item-enabled"));
}
public void testRenderStyle() throws Exception {
HtmlPage page = renderView();
- Assert.assertNotNull(page);
+ assertNotNull(page);
List links = page.getDocumentElement().getHtmlElementsByTagName("link");
//Assert.assertEquals(1, links.size());
- Assert.assertNotNull(links);
+ assertNotNull(links);
HtmlElement link = (HtmlElement) links.get(0);
- Assert.assertTrue(link.getAttributeValue("href").contains("org/richfaces/renderkit/html/css/menucomponents.xcss"));
+ assertTrue(link.getAttributeValue("href").contains("org/richfaces/renderkit/html/css/menucomponents.xcss"));
}
/* public void testRenderScript() throws Exception {
HtmlPage page = renderView();
- Assert.assertNotNull(page);
+ assertNotNull(page);
List scripts = page.getDocumentElement().getHtmlElementsByTagName("script");
for (Iterator it = scripts.iterator(); it.hasNext();) {
HtmlScript item = (HtmlScript) it.next();
@@ -207,6 +208,7 @@
assertTrue(found);
}
}
- } */
-
+ }
+*/
+
}
19 years
JBoss Rich Faces SVN: r322 - trunk/richfaces/panelmenu/design/funcspec.
by richfaces-svn-commits@lists.jboss.org
Author: ilya_shaikovsky
Date: 2007-04-09 09:57:10 -0400 (Mon, 09 Apr 2007)
New Revision: 322
Modified:
trunk/richfaces/panelmenu/design/funcspec/FuncSpec - RF Panel Menu Component.doc
Log:
1.0 Revision after discussion with Sergey
Modified: trunk/richfaces/panelmenu/design/funcspec/FuncSpec - RF Panel Menu Component.doc
===================================================================
(Binary files differ)
19 years
JBoss Rich Faces SVN: r321 - in trunk/richfaces/tree/src/test/java/org/richfaces/component: events and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-04-08 18:19:52 -0400 (Sun, 08 Apr 2007)
New Revision: 321
Added:
trunk/richfaces/tree/src/test/java/org/richfaces/component/events/
trunk/richfaces/tree/src/test/java/org/richfaces/component/events/TreeEventsTest.java
Log:
Tests for TreeEvents class
Added: trunk/richfaces/tree/src/test/java/org/richfaces/component/events/TreeEventsTest.java
===================================================================
--- trunk/richfaces/tree/src/test/java/org/richfaces/component/events/TreeEventsTest.java (rev 0)
+++ trunk/richfaces/tree/src/test/java/org/richfaces/component/events/TreeEventsTest.java 2007-04-08 22:19:52 UTC (rev 321)
@@ -0,0 +1,167 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - 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.richfaces.component.events;
+
+import javax.faces.application.Application;
+import javax.faces.component.UIViewRoot;
+import javax.faces.event.FacesEvent;
+
+import org.ajax4jsf.dnd.event.DragEvent;
+import org.ajax4jsf.dnd.event.DropEvent;
+import org.ajax4jsf.framework.ajax.AjaxViewRoot;
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+import org.ajax4jsf.tests.MockMethodBinding;
+import org.ajax4jsf.tests.MockViewRoot;
+import org.apache.commons.collections.Buffer;
+import org.richfaces.component.UITree;
+import org.richfaces.component.UITreeNode;
+
+/**
+ * @author Nick - mailto:nbelaevski@exadel.com
+ * created 08.04.2007
+ *
+ */
+public class TreeEventsTest extends AbstractAjax4JsfTestCase {
+
+ private static final String NODE = "node";
+ private UITree tree;
+ private UITreeNode treeNode;
+
+ public TreeEventsTest(String name) {
+ super(name);
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+ UIViewRoot viewRoot = facesContext.getViewRoot();
+
+ tree = (UITree) application.createComponent(UITree.COMPONENT_TYPE);
+ tree.setNodeFace(NODE);
+ viewRoot.getChildren().add(tree);
+
+ treeNode = (UITreeNode) application.createComponent(UITreeNode.COMPONENT_TYPE);
+ treeNode.setType(NODE);
+
+ tree.getChildren().add(treeNode);
+ }
+
+ public void tearDown() throws Exception {
+ super.tearDown();
+
+ this.tree = null;
+ this.treeNode = null;
+ }
+
+ public void testAjaxSelectedEvent() {
+ MockViewRoot mockViewRoot = (MockViewRoot) facesContext.getViewRoot();
+ tree.setAjaxSubmitSelection(true);
+ treeNode.setAjaxSubmitSelection("inherit");
+
+ MockMethodBinding binding = new MockMethodBinding();
+ treeNode.setNodeSelectListener(binding);
+
+ Buffer events = mockViewRoot.getAjaxEventsQueue(facesContext);
+ assertNotNull(events);
+ assertEquals(0, events.size());
+
+ AjaxSelectedEvent event = new AjaxSelectedEvent(treeNode);
+ TreeEvents.invokeListenerBindings(treeNode, event, facesContext);
+
+ assertEquals(1, events.size());
+
+ Object[][] args = binding.getInvocationArgs();
+ assertEquals(1, args.length);
+ assertEquals(1, args[0].length);
+ assertSame(event, args[0][0]);
+
+ events.clear();
+ binding.clear();
+
+ //now ajax events switched off
+ tree.setAjaxSubmitSelection(false);
+ assertNotNull(events);
+ assertEquals(0, events.size());
+ assertEquals(0, binding.getInvocationArgs().length);
+
+ event = new AjaxSelectedEvent(treeNode);
+ TreeEvents.invokeListenerBindings(treeNode, event, facesContext);
+
+ assertEquals(0, events.size());
+
+ args = binding.getInvocationArgs();
+ assertEquals(0, args.length);
+
+ }
+
+ public void testNodeExpansionEvent() {
+ MockMethodBinding binding = new MockMethodBinding();
+ treeNode.setChangeExpandListener(binding);
+
+ NodeExpandedEvent event = new NodeExpandedEvent(treeNode);
+ TreeEvents.invokeListenerBindings(treeNode, event, facesContext);
+
+ Object[][] args = binding.getInvocationArgs();
+ assertEquals(1, args.length);
+ assertEquals(1, args[0].length);
+ assertSame(event, args[0][0]);
+ }
+
+ public void testNodeSelectionEvent() {
+ MockMethodBinding binding = new MockMethodBinding();
+ treeNode.setNodeSelectListener(binding);
+
+ NodeSelectedEvent event = new NodeSelectedEvent(treeNode);
+ TreeEvents.invokeListenerBindings(treeNode, event, facesContext);
+
+ Object[][] args = binding.getInvocationArgs();
+ assertEquals(1, args.length);
+ assertEquals(1, args[0].length);
+ assertSame(event, args[0][0]);
+ }
+
+ public void testDropEvent() {
+ MockMethodBinding binding = new MockMethodBinding();
+ treeNode.setDropListener(binding);
+
+ DropEvent event = new DropEvent(treeNode);
+ TreeEvents.invokeListenerBindings(treeNode, event, facesContext);
+
+ Object[][] args = binding.getInvocationArgs();
+ assertEquals(1, args.length);
+ assertEquals(1, args[0].length);
+ assertSame(event, args[0][0]);
+ }
+
+ public void testDragEvent() {
+ MockMethodBinding binding = new MockMethodBinding();
+ treeNode.setDragListener(binding);
+
+ DragEvent event = new DragEvent(treeNode);
+ TreeEvents.invokeListenerBindings(treeNode, event, facesContext);
+
+ Object[][] args = binding.getInvocationArgs();
+ assertEquals(1, args.length);
+ assertEquals(1, args[0].length);
+ assertSame(event, args[0][0]);
+ }
+}
+
19 years
JBoss Rich Faces SVN: r320 - trunk/richfaces-samples/tree-demo/src/main/java/org/richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-04-08 15:39:08 -0400 (Sun, 08 Apr 2007)
New Revision: 320
Modified:
trunk/richfaces-samples/tree-demo/src/main/java/org/richfaces/Bean.java
Log:
Drag/drop row data diagnostic output added
Modified: trunk/richfaces-samples/tree-demo/src/main/java/org/richfaces/Bean.java
===================================================================
--- trunk/richfaces-samples/tree-demo/src/main/java/org/richfaces/Bean.java 2007-04-06 19:44:09 UTC (rev 319)
+++ trunk/richfaces-samples/tree-demo/src/main/java/org/richfaces/Bean.java 2007-04-08 19:39:08 UTC (rev 320)
@@ -295,6 +295,8 @@
System.out.println(dropEvent);
System.out.println("DragValue: " + dropEvent.getDragValue());
System.out.println("DropValue: " + dropEvent.getDropValue());
+ System.out.println("Drag row data: " + getTree(dropEvent).getRowData(dropEvent.getDragValue()));
+ System.out.println("Drop row data: " + getTree(dropEvent).getRowData(dropEvent.getDropValue()));
System.out.println("+++++");
}
19 years
JBoss Rich Faces SVN: r319 - trunk/richfaces-samples.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2007-04-06 15:44:09 -0400 (Fri, 06 Apr 2007)
New Revision: 319
Removed:
trunk/richfaces-samples/richfaces-art-datatable/
Log:
Delete missed folder
19 years