JBoss Rich Faces SVN: r20984 - in modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest: richColumn and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2011-01-13 09:39:07 -0500 (Thu, 13 Jan 2011)
New Revision: 20984
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/ColumnAttributes.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/TestColumnSimple.java
Log:
rich:column - simple sample automated (RFPL-729)
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/ColumnAttributes.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/ColumnAttributes.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/ColumnAttributes.java 2011-01-13 14:39:07 UTC (rev 20984)
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.ftest.richColumn;
+
+import org.richfaces.component.SortOrder;
+import org.richfaces.tests.metamer.ftest.AbstractComponentAttributes;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public class ColumnAttributes extends AbstractComponentAttributes {
+ public void setBreakRowBefore(Boolean breakRowBefore) {
+ setProperty("breakRowBefore", breakRowBefore);
+ }
+
+ public void setColspan(Integer colspan) {
+ setProperty("colspan", colspan);
+ }
+
+ public void setRendered(Boolean rendered) {
+ setProperty("rendered", rendered);
+ }
+
+ public void setRowspan(Integer rowspan) {
+ setProperty("rowspan", rowspan);
+ }
+
+ public void setSortOrder(SortOrder sortOrder) {
+ setProperty("sortOrder", sortOrder);
+ }
+}
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/TestColumnSimple.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/TestColumnSimple.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/TestColumnSimple.java 2011-01-13 14:39:07 UTC (rev 20984)
@@ -0,0 +1,147 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.ftest.richColumn;
+
+import static org.jboss.test.selenium.locator.Attribute.COLSPAN;
+import static org.jboss.test.selenium.locator.Attribute.ROWSPAN;
+import static org.jboss.test.selenium.locator.LocatorFactory.jq;
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.testng.Assert.assertEquals;
+
+import java.net.URL;
+
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public class TestColumnSimple extends AbstractMetamerTest {
+
+ ColumnAttributes attributes = new ColumnAttributes();
+
+ JQueryLocator table = pjq("table.rf-dt[id$=richDataTable]");
+ JQueryLocator header = table.getChild(jq("thead.rf-dt-thd"));
+
+ JQueryLocator headerRow = header.getChild(jq("tr.rf-dt-hdr"));
+ JQueryLocator headerCell = jq("th.rf-dt-hdr-c");
+
+ JQueryLocator bodyRow = table.getChild(jq("tbody.rf-dt-b")).getChild(jq("tr.rf-dt-r"));
+ JQueryLocator bodyCell = jq("td.rf-dt-c");
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/richColumn/simple.xhtml");
+ }
+
+ @BeforeMethod
+ public void checkInitialState() {
+ assertEquals(headerCount(1), 1);
+ assertEquals(headerCount(2), 2);
+ assertEquals(headerCount(3), 1);
+ assertEquals(headerCount(4), 1);
+ assertEquals(bodyCount(1), 2);
+
+ assertEquals(selenium.getAttribute(headerCell(1, 1).getAttribute(COLSPAN)), "2");
+ assertEquals(selenium.getAttribute(headerCell(2, 2).getAttribute(ROWSPAN)), "2");
+ }
+
+ @Test
+ public void testBreakRowBefore() {
+ attributes.setBreakRowBefore(false);
+
+ assertEquals(headerCount(1), 3);
+ assertEquals(headerCount(2), 1);
+ assertEquals(headerCount(3), 1);
+
+ assertEquals(selenium.getAttribute(headerCell(1, 1).getAttribute(COLSPAN)), "2");
+ assertEquals(selenium.getAttribute(headerCell(1, 3).getAttribute(ROWSPAN)), "2");
+ }
+
+ @Test
+ public void testColspan() {
+ attributes.setColspan(1);
+
+ assertEquals(headerCount(1), 1);
+ assertEquals(headerCount(2), 2);
+ assertEquals(headerCount(3), 1);
+ assertEquals(headerCount(4), 1);
+
+ assertEquals(selenium.getAttribute(headerCell(1, 1).getAttribute(COLSPAN)), "1");
+ assertEquals(selenium.getAttribute(headerCell(2, 2).getAttribute(ROWSPAN)), "2");
+ }
+
+ @Test
+ public void testRowspanTo1() {
+ attributes.setRowspan(1);
+
+ assertEquals(headerCount(1), 1);
+ assertEquals(headerCount(2), 2);
+ assertEquals(headerCount(3), 2);
+
+ assertEquals(selenium.getAttribute(headerCell(1, 1).getAttribute(COLSPAN)), "2");
+ assertEquals(selenium.getAttribute(headerCell(2, 2).getAttribute(ROWSPAN)), "1");
+ }
+
+ @Test
+ public void testRowspanTo3() {
+ attributes.setRowspan(3);
+
+ assertEquals(headerCount(1), 1);
+ assertEquals(headerCount(2), 2);
+ assertEquals(headerCount(3), 1);
+ assertEquals(headerCount(4), 1);
+
+ assertEquals(selenium.getAttribute(headerCell(1, 1).getAttribute(COLSPAN)), "2");
+ assertEquals(selenium.getAttribute(headerCell(2, 2).getAttribute(ROWSPAN)), "3");
+ }
+
+ @Test
+ public void testRendered() {
+ attributes.setRendered(false);
+
+ assertEquals(headerCount(1), 1);
+ assertEquals(headerCount(2), 2);
+ assertEquals(headerCount(3), 1);
+ assertEquals(headerCount(4), 1);
+ assertEquals(bodyCount(1), 1);
+
+ assertEquals(selenium.getAttribute(headerCell(1, 1).getAttribute(COLSPAN)), "2");
+ assertEquals(selenium.getAttribute(headerCell(2, 2).getAttribute(ROWSPAN)), "2");
+ }
+
+ public JQueryLocator headerCell(int iRow, int iColumn) {
+ return headerRow.getNthChildElement(iRow).getChild(headerCell).getNthChildElement(iColumn);
+ }
+
+ public int headerCount(int iRow) {
+ return selenium.getCount(headerRow.getNthChildElement(iRow).getChild(headerCell));
+ }
+
+ public int bodyCount(int iRow) {
+ return selenium.getCount(bodyRow.getNthChildElement(iRow).getChild(bodyCell));
+ }
+
+}
13 years, 11 months
JBoss Rich Faces SVN: r20983 - trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2011-01-13 08:45:42 -0500 (Thu, 13 Jan 2011)
New Revision: 20983
Modified:
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/select.js
Log:
RF-9663 select: click to input field - should cause popup to be appeared.
Modified: trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/select.js
===================================================================
--- trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/select.js 2011-01-13 13:22:44 UTC (rev 20982)
+++ trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/select.js 2011-01-13 13:45:42 UTC (rev 20983)
@@ -117,6 +117,10 @@
this.btn = $(document.getElementById(id+"Button"));
this.btn.bind("mousedown", $.proxy(this.__onBtnMouseDown, this));
this.btn.bind("mouseup", $.proxy(this.__onMouseUp, this));
+
+ this.fld = $(document.getElementById(id+"Field"));
+ this.fld.bind("mousedown", $.proxy(this.__onBtnMouseDown, this));
+ this.fld.bind("mouseup", $.proxy(this.__onMouseUp, this));
}
this.selectFirst = mergedOptions.selectFirst;
13 years, 11 months
JBoss Rich Faces SVN: r20982 - in modules/tests/metamer/trunk: application/src/main/resources/org/richfaces/tests/metamer/bean and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2011-01-13 08:22:44 -0500 (Thu, 13 Jan 2011)
New Revision: 20982
Added:
modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichMenuItemBean.properties
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMenuItem/
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMenuItem/TestRichMenuItem.java
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichMenuItemBean.java
modules/tests/metamer/trunk/application/src/main/webapp/components/richMenuItem/simple.xhtml
modules/tests/metamer/trunk/ftest/src/test/resources/testng-core.xml
modules/tests/metamer/trunk/ftest/src/test/resources/testng-misc.xml
modules/tests/metamer/trunk/ftest/src/test/resources/testng-output.xml
Log:
https://issues.jboss.org/browse/RFPL-958
* added 30 tests for rich:menuItem
Modified: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichMenuItemBean.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichMenuItemBean.java 2011-01-13 11:50:08 UTC (rev 20981)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichMenuItemBean.java 2011-01-13 13:22:44 UTC (rev 20982)
@@ -1,6 +1,6 @@
/*******************************************************************************
* JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
+ * Copyright 2010-2011, Red Hat, Inc. and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
@@ -58,6 +58,9 @@
attributes.setAttribute("label", "New");
attributes.setAttribute("mode", "ajax");
attributes.setAttribute("rendered", true);
+
+ attributes.remove("action");
+ attributes.remove("actionListener");
}
public Attributes getAttributes() {
Added: modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichMenuItemBean.properties
===================================================================
--- modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichMenuItemBean.properties (rev 0)
+++ modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichMenuItemBean.properties 2011-01-13 13:22:44 UTC (rev 20982)
@@ -0,0 +1,15 @@
+attr.dir.ltr=ltr
+attr.dir.rtl=rtl
+attr.dir.null=
+
+attr.icon.createdoc=/resources/images/icons/create_doc.gif
+attr.icon.star=/resources/images/star.png
+attr.icon.heart=/resources/images/heart.png
+attr.icon.nonexisting=nonexisting
+attr.icon.null=
+
+attr.iconDisabled.createdoc=/resources/images/icons/create_doc.gif
+attr.iconDisabled.star=/resources/images/star.png
+attr.iconDisabled.heart=/resources/images/heart.png
+attr.iconDisabled.nonexisting=nonexisting
+attr.iconDisabled.null=
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/richMenuItem/simple.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richMenuItem/simple.xhtml 2011-01-13 11:50:08 UTC (rev 20981)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richMenuItem/simple.xhtml 2011-01-13 13:22:44 UTC (rev 20982)
@@ -6,7 +6,7 @@
<!--
JBoss, Home of Professional Open Source
-Copyright 2010, Red Hat, Inc. and individual contributors
+Copyright 2010-2011, Red Hat, Inc. and individual contributors
by the @authors tag. See the copyright.txt in the distribution for a
full listing of individual contributors.
@@ -62,9 +62,10 @@
</h:panelGroup>
</f:facet>
- <rich:menuItem id="menuItem"
+ <rich:menuItem id="menuItem1"
action="#{richBean.dummyAction}"
actionListener="#{richBean.dummyActionListener}"
+ bypassUpdates="#{richMenuItemBean.attributes['bypassUpdates'].value}"
data="#{richMenuItemBean.attributes['data'].value}"
dir="#{richMenuItemBean.attributes['dir'].value}"
disabled="#{richMenuItemBean.attributes['disabled'].value}"
@@ -98,11 +99,11 @@
value="#{richMenuItemBean.attributes['value'].value}"
/>
- <rich:menuItem label="Open" icon="/resources/images/icons/open.gif" />
+ <rich:menuItem id="menuItem2" label="Open" icon="/resources/images/icons/open.gif" />
- <rich:menuGroup label="Open Recent..." disabled="true">
- <rich:menuItem label="Save" icon="/resources/images/icons/save.gif" />
- <rich:menuItem label="Save All">
+ <rich:menuGroup id="menuGroup3" label="Open Recent..." disabled="true">
+ <rich:menuItem id="menuItem31" label="Save" icon="/resources/images/icons/save.gif" />
+ <rich:menuItem id="menuItem32" label="Save All">
<f:facet name="icon">
<h:graphicImage library="images/icons" name="save_all.gif" />
</f:facet>
@@ -111,23 +112,23 @@
<rich:menuSeparator id="menuSeparator11" />
- <rich:menuGroup id="menuGroup" label="Save As...">
- <rich:menuItem label="Save" icon="/resources/images/icons/save.gif" />
- <rich:menuItem label="Save All" >
+ <rich:menuGroup id="menuGroup4" label="Save As...">
+ <rich:menuItem id="menuItem41" label="Save" icon="/resources/images/icons/save.gif" />
+ <rich:menuItem id="menuItem42" label="Save All" >
<f:facet name="icon">
<h:graphicImage library="images/icons" name="save_all.gif" />
</f:facet>
</rich:menuItem>
- <rich:menuItem label="Send Online" icon="/resources/images/icons/save.gif" disabled="true" />
+ <rich:menuItem id="menuItem43" label="Send Online" icon="/resources/images/icons/save.gif" disabled="true" />
</rich:menuGroup>
- <rich:menuItem label="Print" disabled="true"/>
+ <rich:menuItem id="menuItem5" label="Print" disabled="true"/>
- <rich:menuItem label="Close" />
+ <rich:menuItem id="menuItem6" label="Close" />
<rich:menuSeparator id="menuSeparator12" />
- <rich:menuItem label="Exit" />
+ <rich:menuItem id="menuItem7" label="Exit" />
</rich:dropDownMenu>
Modified: modules/tests/metamer/trunk/ftest/src/test/resources/testng-core.xml
===================================================================
--- modules/tests/metamer/trunk/ftest/src/test/resources/testng-core.xml 2011-01-13 11:50:08 UTC (rev 20981)
+++ modules/tests/metamer/trunk/ftest/src/test/resources/testng-core.xml 2011-01-13 13:22:44 UTC (rev 20982)
@@ -10,7 +10,9 @@
<package name="org.richfaces.tests.metamer.ftest.a4jCommandLink" />
<package name="org.richfaces.tests.metamer.ftest.a4jJSFunction" />
<package name="org.richfaces.tests.metamer.ftest.a4jLog" />
+ <package name="org.richfaces.tests.metamer.ftest.a4jMediaOutput" />
<package name="org.richfaces.tests.metamer.ftest.a4jOutputPanel" />
+ <package name="org.richfaces.tests.metamer.ftest.a4jParam" />
<package name="org.richfaces.tests.metamer.ftest.a4jPoll" />
<package name="org.richfaces.tests.metamer.ftest.a4jQueue" />
<package name="org.richfaces.tests.metamer.ftest.a4jRegion" />
Modified: modules/tests/metamer/trunk/ftest/src/test/resources/testng-misc.xml
===================================================================
--- modules/tests/metamer/trunk/ftest/src/test/resources/testng-misc.xml 2011-01-13 11:50:08 UTC (rev 20981)
+++ modules/tests/metamer/trunk/ftest/src/test/resources/testng-misc.xml 2011-01-13 13:22:44 UTC (rev 20982)
@@ -8,6 +8,7 @@
<package name="org.richfaces.tests.metamer.ftest.richDataScroller" />
<package name="org.richfaces.tests.metamer.ftest.richFunctions" />
<package name="org.richfaces.tests.metamer.ftest.richJQuery" />
+ <package name="org.richfaces.tests.metamer.ftest.richMenuItem" />
<package name="org.richfaces.tests.metamer.ftest.richMenuSeparator" />
<package name="org.richfaces.tests.metamer.ftest.richToggleControl" />
</packages>
Modified: modules/tests/metamer/trunk/ftest/src/test/resources/testng-output.xml
===================================================================
--- modules/tests/metamer/trunk/ftest/src/test/resources/testng-output.xml 2011-01-13 11:50:08 UTC (rev 20981)
+++ modules/tests/metamer/trunk/ftest/src/test/resources/testng-output.xml 2011-01-13 13:22:44 UTC (rev 20982)
@@ -10,6 +10,8 @@
<package name="org.richfaces.tests.metamer.ftest.richTabPanel" />
<package name="org.richfaces.tests.metamer.ftest.richTogglePanel" />
<package name="org.richfaces.tests.metamer.ftest.richTogglePanelItem" />
+ <package name="org.richfaces.tests.metamer.ftest.richToolbar" />
+ <package name="org.richfaces.tests.metamer.ftest.richToolbarGroup" />
</packages>
</test>
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMenuItem/TestRichMenuItem.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMenuItem/TestRichMenuItem.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMenuItem/TestRichMenuItem.java 2011-01-13 13:22:44 UTC (rev 20982)
@@ -0,0 +1,400 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010-2011, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.ftest.richMenuItem;
+
+import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardHttp;
+import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardNoRequest;
+import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardXhr;
+import static org.jboss.test.selenium.locator.LocatorFactory.jq;
+import static org.jboss.test.selenium.locator.option.OptionLocatorFactory.optionLabel;
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNotSame;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+
+import java.net.URL;
+import javax.faces.event.PhaseId;
+
+import org.jboss.test.selenium.dom.Event;
+import org.jboss.test.selenium.encapsulated.JavaScript;
+import org.jboss.test.selenium.locator.Attribute;
+import org.jboss.test.selenium.locator.AttributeLocator;
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
+import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
+import org.testng.annotations.Test;
+
+/**
+ * Test case for page /faces/components/richMenuItem/simple.xhtml
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public class TestRichMenuItem extends AbstractMetamerTest {
+
+ private JQueryLocator fileMenu = pjq("div[id$=menu1]");
+ private JQueryLocator menuItem1 = pjq("div[id$=menuItem1]");
+ private JQueryLocator image = menuItem1.getDescendant(jq("img"));
+ private JQueryLocator label = menuItem1.getDescendant(jq("span.rf-ddm-itm-lbl"));
+ private JQueryLocator menuItem2 = pjq("div[id$=menuItem2]");
+ private JQueryLocator menuGroup3 = pjq("div[id$=menuGroup3]");
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/richMenuItem/simple.xhtml");
+ }
+
+ @Test
+ public void testInit() {
+ assertTrue(selenium.isElementPresent(fileMenu), "Drop down menu \"File\" should be present on the page.");
+ assertTrue(selenium.isVisible(fileMenu), "Drop down menu \"File\" should be visible on the page.");
+
+ assertTrue(selenium.isElementPresent(menuItem1), "Menu item \"New\" should be present on the page.");
+ assertFalse(selenium.isVisible(menuItem1), "Menu item \"New\" should not be visible on the page.");
+
+ guardNoRequest(selenium).click(fileMenu);
+
+ assertTrue(selenium.isElementPresent(menuItem1), "Menu item \"New\" should be present on the page.");
+ assertTrue(selenium.isVisible(menuItem1), "Menu item \"New\" should be visible on the page.");
+
+ assertTrue(selenium.isElementPresent(menuItem2), "Menu item \"Open\" should be present on the page.");
+ assertTrue(selenium.isVisible(menuItem2), "Menu item \"Open\" should be visible on the page.");
+
+ assertTrue(selenium.isElementPresent(menuGroup3), "Menu group \"Open Recent...\" should be present on the page.");
+ assertTrue(selenium.isVisible(menuGroup3), "Menu group \"Open Recent...\" should be visible on the page.");
+
+ assertTrue(selenium.isElementPresent(image), "Icon of menu item 1 should be present on the page.");
+ assertTrue(selenium.isVisible(image), "Icon of menu item 1 should be visible on the page.");
+
+ assertTrue(selenium.isElementPresent(label), "Label of menu item 1 should be present on the page.");
+ assertTrue(selenium.isVisible(label), "Label of menu item 1 should be visible on the page.");
+
+ assertEquals(selenium.getText(label), "New", "Label of first menu item.");
+ AttributeLocator attr = image.getAttribute(Attribute.SRC);
+ assertTrue(selenium.getAttribute(attr).contains("create_doc.gif"), "Image's src attribute should contain \"create_doc.gif\".");
+ }
+
+ @Test
+ public void testAction() {
+ String reqTime = selenium.getText(time);
+ selenium.click(fileMenu);
+ guardXhr(selenium).click(menuItem1);
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
+
+ String listenerOutput = selenium.getText(jq("div#phasesPanel li:eq(6)"));
+ assertEquals(listenerOutput, "* action invoked", "Action's output");
+ }
+
+ @Test
+ public void testActionListener() {
+ String reqTime = selenium.getText(time);
+ selenium.click(fileMenu);
+ guardXhr(selenium).click(menuItem1);
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
+
+ String listenerOutput = selenium.getText(jq("div#phasesPanel li:eq(5)"));
+ assertEquals(listenerOutput, "* action listener invoked", "Action listener's output");
+ }
+
+ @Test
+ public void testBypassUpdates() {
+ selenium.click(pjq("input[type=radio][name$=bypassUpdatesInput][value=true]"));
+ selenium.waitForPageToLoad();
+
+ String reqTime = selenium.getText(time);
+ selenium.click(fileMenu);
+ guardXhr(selenium).click(menuItem1);
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
+
+ assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS,
+ PhaseId.RENDER_RESPONSE);
+
+ String listenerOutput = selenium.getText(jq("div#phasesPanel li:eq(3)"));
+ assertEquals(listenerOutput, "* action listener invoked", "Action listener's output");
+ listenerOutput = selenium.getText(jq("div#phasesPanel li:eq(4)"));
+ assertEquals(listenerOutput, "* action invoked", "Action's output");
+ }
+
+ @Test
+ public void testData() {
+ selenium.type(pjq("input[type=text][id$=dataInput]"), "RichFaces 4");
+ selenium.waitForPageToLoad();
+
+ selenium.type(pjq("input[type=text][id$=oncompleteInput]"), "data = event.data");
+ selenium.waitForPageToLoad();
+
+ String reqTime = selenium.getText(time);
+ selenium.click(fileMenu);
+ guardXhr(selenium).click(menuItem1);
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
+
+ String data = selenium.getEval(new JavaScript("window.data"));
+ assertEquals(data, "RichFaces 4", "Data sent with ajax request");
+ }
+
+ @Test
+ public void testDir() {
+ testDir(menuItem1);
+ }
+
+ @Test
+ public void testDisabled() {
+ selenium.click(pjq("input[type=radio][name$=disabledInput][value=true]"));
+ selenium.waitForPageToLoad();
+
+ assertTrue(selenium.belongsClass(menuItem1, "rf-ddm-itm-dis"), "Menu item should have class \"rf-ddm-itm-dis\".");
+ assertTrue(selenium.isElementPresent(menuItem1.getDescendant(jq("div.rf-ddm-emptyIcon"))), "Empty icon should be present.");
+ assertFalse(selenium.isElementPresent(image), "Icon should not be present.");
+ }
+
+ @Test
+ public void testExecute() {
+ selenium.type(pjq("input[type=text][id$=executeInput]"), "@this executeChecker");
+ selenium.waitForPageToLoad();
+
+ String reqTime = selenium.getText(time);
+ selenium.click(fileMenu);
+ guardXhr(selenium).click(menuItem1);
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
+
+ JQueryLocator logItems = jq("ul.phases-list li:eq({0})");
+ for (int i = 0; i < 6; i++) {
+ if ("* executeChecker".equals(selenium.getText(logItems.format(i)))) {
+ return;
+ }
+ }
+
+ fail("Attribute execute does not work");
+ }
+
+ @Test
+ public void testIcon() {
+ AttributeLocator attr = image.getAttribute(Attribute.SRC);
+
+ selenium.select(pjq("select[id$=iconInput]"), optionLabel("star"));
+ selenium.waitForPageToLoad();
+ assertTrue(selenium.getAttribute(attr).contains("star.png"), "Image's src attribute should contain \"star.png\".");
+
+ selenium.select(pjq("select[id$=iconInput]"), optionLabel("nonexisting"));
+ selenium.waitForPageToLoad();
+ assertTrue(selenium.getAttribute(attr).contains("nonexisting"), "Image's src attribute should contain \"nonexisting\".");
+
+ selenium.select(pjq("select[id$=iconInput]"), optionLabel("null"));
+ selenium.waitForPageToLoad();
+ assertFalse(selenium.isElementPresent(image), "Icon should not be present.");
+ assertTrue(selenium.isElementPresent(menuItem1.getDescendant(jq("div.rf-ddm-emptyIcon"))), "Empty icon should be present.");
+ }
+
+ @Test
+ public void testIconDisabled() {
+ selenium.click(pjq("input[type=radio][name$=disabledInput][value=true]"));
+ selenium.waitForPageToLoad();
+
+ AttributeLocator attr = image.getAttribute(Attribute.SRC);
+
+ assertFalse(selenium.isElementPresent(image), "Icon should not be present.");
+ assertTrue(selenium.isElementPresent(menuItem1.getDescendant(jq("div.rf-ddm-emptyIcon"))), "Empty icon should be present.");
+
+ selenium.select(pjq("select[id$=iconDisabledInput]"), optionLabel("star"));
+ selenium.waitForPageToLoad();
+ assertTrue(selenium.getAttribute(attr).contains("star.png"), "Image's src attribute should contain \"star.png\".");
+
+ selenium.select(pjq("select[id$=iconDisabledInput]"), optionLabel("nonexisting"));
+ selenium.waitForPageToLoad();
+ assertTrue(selenium.getAttribute(attr).contains("nonexisting"), "Image's src attribute should contain \"nonexisting\".");
+ }
+
+ @Test
+ public void testImmediate() {
+ selenium.click(pjq("input[type=radio][name$=immediateInput][value=true]"));
+ selenium.waitForPageToLoad();
+
+ String reqTime = selenium.getText(time);
+ selenium.click(fileMenu);
+ guardXhr(selenium).click(menuItem1);
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
+
+ assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.RENDER_RESPONSE);
+
+ String listenerOutput = selenium.getText(jq("div#phasesPanel li:eq(2)"));
+ assertEquals(listenerOutput, "* action listener invoked", "Action listener's output");
+ listenerOutput = selenium.getText(jq("div#phasesPanel li:eq(3)"));
+ assertEquals(listenerOutput, "* action invoked", "Action's output");
+ }
+
+ @Test
+ public void testLabel() {
+ selenium.type(pjq("input[type=text][id$=labelInput]"), "new label");
+ selenium.waitForPageToLoad();
+
+ assertEquals(selenium.getText(label), "new label", "New label of first menu item.");
+ }
+
+ @Test
+ public void testLang() {
+ testLang(menuItem1);
+ }
+
+ @Test
+ public void testLimitRender() {
+ selenium.click(pjq("input[type=radio][name$=limitRenderInput][value=true]"));
+ selenium.waitForPageToLoad();
+
+ String timeValue = selenium.getText(time);
+
+ String reqTime = selenium.getText(time);
+ selenium.click(fileMenu);
+ guardXhr(selenium).click(menuItem1);
+ String newTime = selenium.getText(time);
+ assertNotSame(newTime, timeValue, "Panel with ajaxRendered=true should not be rerendered.");
+ }
+
+ @Test
+ @IssueTracking("https://issues.jboss.org/browse/RF-10200")
+ public void testMode() {
+ String reqTime = selenium.getText(time);
+ selenium.click(fileMenu);
+ guardXhr(selenium).click(menuItem1);
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
+
+ assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS,
+ PhaseId.UPDATE_MODEL_VALUES, PhaseId.INVOKE_APPLICATION, PhaseId.RENDER_RESPONSE);
+
+ String listenerOutput = selenium.getText(jq("div#phasesPanel li:eq(5)"));
+ assertEquals(listenerOutput, "* action listener invoked", "Action listener's output");
+ listenerOutput = selenium.getText(jq("div#phasesPanel li:eq(6)"));
+ assertEquals(listenerOutput, "* action invoked", "Action's output");
+
+ selenium.type(pjq("input[id$=modeInput]"), "server");
+ selenium.waitForPageToLoad();
+
+ selenium.click(fileMenu);
+ guardHttp(selenium).click(menuItem1);
+
+ assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS,
+ PhaseId.UPDATE_MODEL_VALUES, PhaseId.INVOKE_APPLICATION, PhaseId.RENDER_RESPONSE);
+
+ listenerOutput = selenium.getText(jq("div#phasesPanel li:eq(5)"));
+ assertEquals(listenerOutput, "* action listener invoked", "Action listener's output");
+ listenerOutput = selenium.getText(jq("div#phasesPanel li:eq(6)"));
+ assertEquals(listenerOutput, "* action invoked", "Action's output");
+ }
+
+ @Test
+ public void testEvents() {
+ selenium.type(pjq("input[type=text][id$=onbeginInput]"), "metamerEvents += \"begin \"");
+ selenium.waitForPageToLoad();
+ selenium.type(pjq("input[type=text][id$=onbeforedomupdateInput]"), "metamerEvents += \"beforedomupdate \"");
+ selenium.waitForPageToLoad();
+ selenium.type(pjq("input[type=text][id$=oncompleteInput]"), "metamerEvents += \"complete \"");
+ selenium.waitForPageToLoad();
+
+ selenium.getEval(new JavaScript("window.metamerEvents = \"\";"));
+
+ String reqTime = selenium.getText(time);
+ selenium.click(fileMenu);
+ guardXhr(selenium).click(menuItem1);
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
+
+ String[] events = selenium.getEval(new JavaScript("window.metamerEvents")).split(" ");
+
+ assertEquals(events[0], "begin", "Attribute onbegin doesn't work");
+ assertEquals(events[1], "beforedomupdate", "Attribute onbeforedomupdate doesn't work");
+ assertEquals(events[2], "complete", "Attribute oncomplete doesn't work");
+ }
+
+ @Test
+ public void testOnclick() {
+ testFireEvent(Event.CLICK, menuItem1);
+ }
+
+ @Test
+ public void testOndblclick() {
+ testFireEvent(Event.DBLCLICK, menuItem1);
+ }
+
+ @Test
+ public void testOnitemkeydown() {
+ testFireEvent(Event.KEYDOWN, menuItem1);
+ }
+
+ @Test
+ public void testOnitemkeypress() {
+ testFireEvent(Event.KEYPRESS, menuItem1);
+ }
+
+ @Test
+ public void testOnitemkeyup() {
+ testFireEvent(Event.KEYUP, menuItem1);
+ }
+
+ @Test
+ public void testOnmousedown() {
+ testFireEvent(Event.MOUSEDOWN, menuItem1);
+ }
+
+ @Test
+ public void testOnmousemove() {
+ testFireEvent(Event.MOUSEMOVE, menuItem1);
+ }
+
+ @Test
+ public void testOnmouseout() {
+ testFireEvent(Event.MOUSEOUT, menuItem1);
+ }
+
+ @Test
+ public void testOnmouseover() {
+ testFireEvent(Event.MOUSEOVER, menuItem1);
+ }
+
+ @Test
+ public void testOnmouseup() {
+ testFireEvent(Event.MOUSEUP, menuItem1);
+ }
+
+ @Test
+ public void testRendered() {
+ selenium.click(pjq("input[type=radio][name$=renderedInput][value=false]"));
+ selenium.waitForPageToLoad();
+
+ assertFalse(selenium.isElementPresent(menuItem1), "Menu item should not be rendered when rendered=false.");
+ assertTrue(selenium.isDisplayed(menuItem1), "Menu item should be displayed when item 1 is not rendered.");
+ }
+
+ @Test
+ public void testStyle() {
+ testStyle(menuItem1, "style");
+ }
+
+ @Test
+ public void testStyleClass() {
+ testStyleClass(menuItem1, "styleClass");
+ }
+
+ @Test
+ public void testTitle() {
+ testTitle(menuItem1);
+ }
+}
Property changes on: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMenuItem/TestRichMenuItem.java
___________________________________________________________________
Name: svn:keywords
+ Revision
13 years, 11 months
JBoss Rich Faces SVN: r20981 - trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2011-01-13 06:50:08 -0500 (Thu, 13 Jan 2011)
New Revision: 20981
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractRowsRenderer.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractTableBaseRenderer.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/RowHolder.java
Log:
RF-9777 rich:dataTable Attributes columnClasses and headerClass not working
-rowClasses and columnClasses attribute were applied to ExtendedDataTable.
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractRowsRenderer.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractRowsRenderer.java 2011-01-13 11:20:56 UTC (rev 20980)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractRowsRenderer.java 2011-01-13 11:50:08 UTC (rev 20981)
@@ -34,6 +34,7 @@
import org.ajax4jsf.model.DataVisitResult;
import org.ajax4jsf.model.DataVisitor;
import org.richfaces.component.Row;
+import org.richfaces.component.UIDataTableBase;
/**
* @author Anton Belevich
@@ -109,4 +110,46 @@
protected void put(FacesContext context, String key, String value) {
context.getAttributes().put(key, value);
}
+
+ protected String[] getRowClasses(RowHolderBase rowHolder) {
+ String[] rowClasses = new String[0];
+ if (rowHolder.getRow() instanceof UIDataTableBase) {
+ String classes = ((UIDataTableBase)rowHolder.getRow()).getRowClasses();
+ if(null != classes){
+ rowClasses=classes.split(",");
+ }
+ }
+ return rowClasses;
+ }
+
+ protected String[] getColumnClasses(RowHolderBase rowHolder) {
+ String[] columnClasses = new String[0];
+ if (rowHolder.getRow() instanceof UIDataTableBase) {
+ String classes = ((UIDataTableBase)rowHolder.getRow()).getColumnClasses();
+ if(null != classes){
+ columnClasses=classes.split(",");
+ }
+ }
+ return columnClasses;
+ }
+
+ protected String getColumnClass(RowHolderBase rowHolder, int columnNumber) {
+ String styleClass = "";
+ String[] columnClasses = getColumnClasses(rowHolder);
+ if (columnClasses.length > columnNumber) {
+ styleClass = columnClasses[columnNumber];
+ }
+
+ return styleClass;
+ }
+
+ protected String getRowClass(RowHolderBase rowHolder) {
+ String styleClass = "";
+ String[] rowClasses = getRowClasses(rowHolder);
+ if (rowClasses.length > 0) {
+ int styleIndex = rowHolder.getCurrentRow() % rowClasses.length;
+ styleClass = rowClasses[styleIndex];
+ }
+ return styleClass;
+ }
}
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractTableBaseRenderer.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractTableBaseRenderer.java 2011-01-13 11:20:56 UTC (rev 20980)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractTableBaseRenderer.java 2011-01-13 11:50:08 UTC (rev 20981)
@@ -54,15 +54,6 @@
protected static final String CELL_CLASS_KEY = "cellClass";
- public String getColumnClass(RowHolder rowHolder, int columnNumber) {
- String styleClass = "";
- if (rowHolder.getColumnClasses().length > columnNumber) {
- styleClass = rowHolder.getColumnClasses()[columnNumber];
- }
-
- return styleClass;
- }
-
public void encodeColumn(FacesContext context, ResponseWriter writer, UIColumn component, RowHolder rowHolder) throws IOException {
String parentId = rowHolder.getParentClientId();
@@ -77,9 +68,10 @@
if (rowHolder.isRowStart()) {
int currentRow = rowHolder.getCurrentRow();
- if (rowHolder.getRowClasses().length > 0) {
- int indeStyleClass = currentRow % rowHolder.getRowClasses().length;
- String rowClass = rowHolder.getRowClasses()[indeStyleClass];
+ String[] rowClasses = getRowClasses(rowHolder);
+ if (rowClasses.length > 0) {
+ int indeStyleClass = currentRow % rowClasses.length;
+ String rowClass = rowClasses[indeStyleClass];
component.getAttributes().put(ROW_CLASS, rowClass);
}
if (rowHolder.getCurrentRow() == 0) {
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java 2011-01-13 11:20:56 UTC (rev 20980)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java 2011-01-13 11:50:08 UTC (rev 20981)
@@ -759,6 +759,12 @@
RendererState state = (RendererState) rowHolder;
UIDataTableBase table = state.getRow();
writer.startElement(HtmlConstants.TR_ELEMENT, table);
+
+ String rowClass = getRowClass(rowHolder);
+ if (!"".equals(rowClass)) {
+ writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, rowClass, null);
+ }
+
StringBuilder builder = new StringBuilder();
Collection<Object> selection = table.getSelection();
if (selection != null && selection.contains(table.getRowKey())) {
@@ -784,10 +790,18 @@
writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE,
table.getClientId(facesContext) + ":" + part.getName().getId(), null);
columns = part.getColumns().iterator();
+ int columnNumber = 0;
while (columns.hasNext()) {
UIComponent column = (UIComponent) columns.next();
if (column.isRendered()) {
writer.startElement(HtmlConstants.TD_ELEM, table);
+
+ String columnClass = getColumnClass(rowHolder, columnNumber);
+ if (!"".equals(columnClass)) {
+ writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, columnClass, null);
+ }
+ columnNumber++;
+
writer.startElement(HtmlConstants.DIV_ELEM, table);
writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, "rf-edt-c rf-edt-c-"
+ column.getId(), null);
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/RowHolder.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/RowHolder.java 2011-01-13 11:20:56 UTC (rev 20980)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/RowHolder.java 2011-01-13 11:50:08 UTC (rev 20981)
@@ -25,7 +25,6 @@
import javax.faces.context.FacesContext;
import org.richfaces.component.Row;
-import org.richfaces.component.UIDataTableBase;
/**
* @author Anton Belevich
@@ -43,10 +42,6 @@
private boolean encodeParentTBody;
- private String[] rowClasses = new String[0];
-
- private String[] columnClasses = new String[0];
-
public RowHolder(FacesContext context, Row row) {
this(context, row, 0, true);
}
@@ -55,17 +50,6 @@
super(context);
this.row = row;
this.parentClientId = row.getClientId(context);
-
- if (row instanceof UIDataTableBase) {
- String classes = ((UIDataTableBase)row).getRowClasses();
- if(null != classes){
- rowClasses=classes.split(",");
- }
- classes = (String) ((UIDataTableBase)row).getColumnClasses();
- if(null != classes){
- columnClasses=classes.split(",");
- }
- }
}
public boolean isEncodeParentTBody() {
@@ -103,12 +87,4 @@
public void setRowStart(boolean isRowStart) {
this.isRowStart = isRowStart;
}
-
- public String[] getRowClasses() {
- return this.rowClasses;
- }
-
- public String[] getColumnClasses() {
- return this.columnClasses;
- }
}
13 years, 11 months
JBoss Rich Faces SVN: r20980 - modules/tests/metamer/trunk/application/src/main/webapp/resources/metamer.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2011-01-13 06:20:56 -0500 (Thu, 13 Jan 2011)
New Revision: 20980
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/resources/metamer/attributes.xhtml
Log:
* select styled
Modified: modules/tests/metamer/trunk/application/src/main/webapp/resources/metamer/attributes.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/resources/metamer/attributes.xhtml 2011-01-13 09:49:33 UTC (rev 20979)
+++ modules/tests/metamer/trunk/application/src/main/webapp/resources/metamer/attributes.xhtml 2011-01-13 11:20:56 UTC (rev 20980)
@@ -40,20 +40,23 @@
<f:selectItem itemValue="false" itemLabel="false"/>
</h:selectOneRadio>
</c:when>
-
+
<c:when test="#{entry.value.selectOptions != null}">
- <c:choose>
- <c:when test="#{fn:length(entry.value.selectOptions) > 4}">
- <h:selectOneMenu id="#{entry.key}Input" value="#{entry.value.value}" onchange="#{cc.attrs.type == 'server' ? 'submit()' : 'submitAjax()'}">
- <f:selectItems value="#{entry.value.selectOptions}" noSelectionValue="null" />
- </h:selectOneMenu>
- </c:when>
- <c:otherwise>
- <h:selectOneRadio id="#{entry.key}Input" value="#{entry.value.value}" onchange="#{cc.attrs.type == 'server' ? 'submit()' : 'submitAjax()'}"
- layout="pageDirection">
- <f:selectItems value="#{entry.value.selectOptions}" />
- </h:selectOneRadio>
- </c:otherwise>
+ <c:choose>
+ <c:when test="#{fn:length(entry.value.selectOptions) > 4}">
+ <h:selectOneMenu id="#{entry.key}Input" value="#{entry.value.value}"
+ onchange="#{cc.attrs.type == 'server' ? 'submit()' : 'submitAjax()'}"
+ style="width: 100%">
+ <f:selectItems value="#{entry.value.selectOptions}" noSelectionValue="null" />
+ </h:selectOneMenu>
+ </c:when>
+ <c:otherwise>
+ <h:selectOneRadio id="#{entry.key}Input" value="#{entry.value.value}"
+ onchange="#{cc.attrs.type == 'server' ? 'submit()' : 'submitAjax()'}"
+ layout="pageDirection">
+ <f:selectItems value="#{entry.value.selectOptions}" />
+ </h:selectOneRadio>
+ </c:otherwise>
</c:choose>
</c:when>
13 years, 11 months
JBoss Rich Faces SVN: r20979 - branches.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2011-01-13 04:49:33 -0500 (Thu, 13 Jan 2011)
New Revision: 20979
Added:
branches/RF-9797/
Log:
Copied: branches/RF-9797 (from rev 20978, trunk)
13 years, 11 months
JBoss Rich Faces SVN: r20978 - in trunk/ui/iteration/ui/src/main/java/org/richfaces: renderkit and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2011-01-13 04:33:20 -0500 (Thu, 13 Jan 2011)
New Revision: 20978
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataTableBase.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractTableBaseRenderer.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/CollapsibleSubTableRenderer.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ColumnGroupRenderer.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/RowHolder.java
Log:
RF-9777 rich:dataTable Attributes columnClasses and headerClass not working
-rowClasses and columnClasses attribute were applied.
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataTableBase.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataTableBase.java 2011-01-13 02:10:19 UTC (rev 20977)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataTableBase.java 2011-01-13 09:33:20 UTC (rev 20978)
@@ -112,6 +112,30 @@
@Attribute
public abstract String getFilterVar();
+
+ @Attribute
+ public abstract String getRowClass();
+
+ @Attribute
+ public abstract String getCaptionClass();
+
+ @Attribute
+ public abstract String getHeaderClass();
+
+ @Attribute
+ public abstract String getFooterClass();
+
+ @Attribute
+ public abstract String getColumnClasses();
+
+ @Attribute
+ public abstract String getRowClasses();
+
+ @Attribute
+ public abstract String getStyle();
+
+ @Attribute
+ public abstract String getStyleClass();
@Attribute
public abstract Collection<Object> getSelection();
@@ -121,7 +145,7 @@
@Attribute
public abstract SortMode getSortMode();
-
+
public Iterator<UIComponent> columns() {
return new DataTableColumnsIterator(this);
}
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractTableBaseRenderer.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractTableBaseRenderer.java 2011-01-13 02:10:19 UTC (rev 20977)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractTableBaseRenderer.java 2011-01-13 09:33:20 UTC (rev 20978)
@@ -42,14 +42,27 @@
public static final String ROW_CLASS_KEY = "rowClass";
- public static final String FIRST_ROW_CLASS_KEY = "firstRowClass";
-
- public static final String CELL_CLASS_KEY = "cellClass";
-
public static final String CELL_ELEMENT_KEY = "cellElement";
public static final String BREAK_ROW_BEFORE = "breakRowBefore";
+ public static final String COLUMN_CLASS = "userColumnClass";
+
+ public static final String ROW_CLASS = "userRowClass";
+
+ protected static final String FIRST_ROW_CLASS_KEY = "firstRowClass";
+
+ protected static final String CELL_CLASS_KEY = "cellClass";
+
+ public String getColumnClass(RowHolder rowHolder, int columnNumber) {
+ String styleClass = "";
+ if (rowHolder.getColumnClasses().length > columnNumber) {
+ styleClass = rowHolder.getColumnClasses()[columnNumber];
+ }
+
+ return styleClass;
+ }
+
public void encodeColumn(FacesContext context, ResponseWriter writer, UIColumn component, RowHolder rowHolder) throws IOException {
String parentId = rowHolder.getParentClientId();
@@ -64,7 +77,11 @@
if (rowHolder.isRowStart()) {
int currentRow = rowHolder.getCurrentRow();
-
+ if (rowHolder.getRowClasses().length > 0) {
+ int indeStyleClass = currentRow % rowHolder.getRowClasses().length;
+ String rowClass = rowHolder.getRowClasses()[indeStyleClass];
+ component.getAttributes().put(ROW_CLASS, rowClass);
+ }
if (rowHolder.getCurrentRow() == 0) {
encodeFirstRowStart(writer, context, parentId, currentRow, component);
} else {
@@ -86,6 +103,7 @@
writer.startElement(element, component);
getUtils().encodeId(context, component);
String cellClass = getCellClass(context, parentId);
+ cellClass = concatClasses(cellClass, component.getAttributes().get(COLUMN_CLASS));
encodeStyleClass(writer, context, component, HtmlConstants.STYLE_CLASS_ATTR, cellClass);
if (component instanceof org.richfaces.component.AbstractColumn) {
@@ -109,7 +127,7 @@
public void encodeFirstRowStart(ResponseWriter writer, FacesContext context, String parentId, int currentRow, UIComponent component) throws IOException {
writer.startElement(HtmlConstants.TR_ELEMENT, component);
- String styleClass = concatClasses(getRowClass(context, parentId), getFirstRowClass(context, parentId));
+ String styleClass = concatClasses(getRowClass(context, parentId), getFirstRowClass(context, parentId), component.getAttributes().get(ROW_CLASS));
encodeStyleClass(writer, context, component, HtmlConstants.STYLE_CLASS_ATTR, styleClass);
}
@@ -119,7 +137,7 @@
public void encodeRowStart(ResponseWriter writer, FacesContext context, String parentId, int currentRow, UIComponent component) throws IOException {
writer.startElement(HtmlConstants.TR_ELEMENT, component);
- String styleClass = getRowClass(context, parentId);
+ String styleClass = concatClasses(getRowClass(context, parentId), component.getAttributes().get(ROW_CLASS));
encodeStyleClass(writer, context, component, HtmlConstants.STYLE_CLASS_ATTR, styleClass);
}
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/CollapsibleSubTableRenderer.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/CollapsibleSubTableRenderer.java 2011-01-13 02:10:19 UTC (rev 20977)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/CollapsibleSubTableRenderer.java 2011-01-13 09:33:20 UTC (rev 20978)
@@ -121,7 +121,7 @@
public void encodeFirstRowStart(ResponseWriter writer, FacesContext context, String parentId, int currentRow, UIComponent component) throws IOException {
writer.startElement(HtmlConstants.TR_ELEMENT, component);
writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, parentId + ":" + currentRow + ":b", null);
- String styleClass = getFirstRowClass(context, parentId);
+ String styleClass = concatClasses(getFirstRowClass(context, parentId), component.getAttributes().get(ROW_CLASS));
encodeStyleClass(writer, context, component, HtmlConstants.STYLE_CLASS_ATTR, styleClass);
}
@@ -129,7 +129,7 @@
public void encodeRowStart(ResponseWriter writer, FacesContext context, String parentId, int currentRow, UIComponent component) throws IOException {
writer.startElement(HtmlConstants.TR_ELEMENT, component);
writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, parentId + ":" + currentRow + ":b", null);
- String styleClass = getRowClass(context, parentId);
+ String styleClass = concatClasses(getRowClass(context, parentId), component.getAttributes().get(ROW_CLASS));
encodeStyleClass(writer, context, component, HtmlConstants.STYLE_CLASS_ATTR, styleClass);
}
@@ -192,12 +192,14 @@
partialStart(facesContext,((AbstractCollapsibleSubTable) row).getRelativeClientId(facesContext) + ":b");
}
+ int columnNumber = 0;
while (components.hasNext()) {
UIComponent component = components.next();
if(component.isRendered()) {
if(component instanceof UIColumn ) {
+ component.getAttributes().put(COLUMN_CLASS, getColumnClass(rowHolder, columnNumber));
encodeColumn(facesContext, writer, (UIColumn)component , rowHolder);
-
+ columnNumber++;
} else if (component instanceof AbstractCollapsibleSubTable) {
if(component.isRendered()) {
encodeRowEnd(writer);
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ColumnGroupRenderer.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ColumnGroupRenderer.java 2011-01-13 02:10:19 UTC (rev 20977)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ColumnGroupRenderer.java 2011-01-13 09:33:20 UTC (rev 20978)
@@ -50,11 +50,13 @@
rowHolder.setRowStart(true);
Iterator<UIComponent> components = row.columns();
-
+ int columnNumber = 0;
while(components.hasNext()){
UIColumn column = (UIColumn)components.next();
if(column.isRendered()) {
- encodeColumn(facesContext, writer, column,rowHolder);
+ column.getAttributes().put(COLUMN_CLASS, getColumnClass(rowHolder, columnNumber));
+ encodeColumn(facesContext, writer, column, rowHolder);
+ columnNumber++;
}
}
encodeRowEnd(writer);
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java 2011-01-13 02:10:19 UTC (rev 20977)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java 2011-01-13 09:33:20 UTC (rev 20978)
@@ -154,6 +154,7 @@
rowHolder.setRowStart(true);
Iterator<UIComponent> components = row.columns();
+ int columnNumber = 0;
while (components.hasNext()) {
UIComponent child = components.next();
if (child.isRendered()) {
@@ -198,8 +199,10 @@
tbodyStart = true;
}
+ child.getAttributes().put(COLUMN_CLASS, getColumnClass(rowHolder, columnNumber));
encodeColumn(facesContext, writer, (UIColumn) child, rowHolder);
-
+ columnNumber++;
+
if (!components.hasNext()) {
encodeRowEnd(writer);
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/RowHolder.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/RowHolder.java 2011-01-13 02:10:19 UTC (rev 20977)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/RowHolder.java 2011-01-13 09:33:20 UTC (rev 20978)
@@ -25,6 +25,7 @@
import javax.faces.context.FacesContext;
import org.richfaces.component.Row;
+import org.richfaces.component.UIDataTableBase;
/**
* @author Anton Belevich
@@ -41,8 +42,11 @@
private boolean updatePartial;
private boolean encodeParentTBody;
-
-
+
+ private String[] rowClasses = new String[0];
+
+ private String[] columnClasses = new String[0];
+
public RowHolder(FacesContext context, Row row) {
this(context, row, 0, true);
}
@@ -51,6 +55,17 @@
super(context);
this.row = row;
this.parentClientId = row.getClientId(context);
+
+ if (row instanceof UIDataTableBase) {
+ String classes = ((UIDataTableBase)row).getRowClasses();
+ if(null != classes){
+ rowClasses=classes.split(",");
+ }
+ classes = (String) ((UIDataTableBase)row).getColumnClasses();
+ if(null != classes){
+ columnClasses=classes.split(",");
+ }
+ }
}
public boolean isEncodeParentTBody() {
@@ -88,4 +103,12 @@
public void setRowStart(boolean isRowStart) {
this.isRowStart = isRowStart;
}
+
+ public String[] getRowClasses() {
+ return this.rowClasses;
+ }
+
+ public String[] getColumnClasses() {
+ return this.columnClasses;
+ }
}
13 years, 11 months
JBoss Rich Faces SVN: r20977 - trunk/cdk/attributes/src/main/resources/META-INF/cdk/attributes.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2011-01-12 21:10:19 -0500 (Wed, 12 Jan 2011)
New Revision: 20977
Modified:
trunk/cdk/attributes/src/main/resources/META-INF/cdk/attributes/javax.faces.component.ActionSource2.xml
Log:
CODING IN PROGRESS - issue RF-9949: Faces-config: several components have attribute actionExpression
https://issues.jboss.org/browse/RF-9949
Modified: trunk/cdk/attributes/src/main/resources/META-INF/cdk/attributes/javax.faces.component.ActionSource2.xml
===================================================================
--- trunk/cdk/attributes/src/main/resources/META-INF/cdk/attributes/javax.faces.component.ActionSource2.xml 2011-01-13 01:47:03 UTC (rev 20976)
+++ trunk/cdk/attributes/src/main/resources/META-INF/cdk/attributes/javax.faces.component.ActionSource2.xml 2011-01-13 02:10:19 UTC (rev 20977)
@@ -35,6 +35,7 @@
<property-name>actionExpression</property-name>
<property-class>javax.el.MethodExpression</property-class>
<property-extension>
+ <cdk:hidden>true</cdk:hidden>
<cdk:signature />
</property-extension>
</property>
13 years, 11 months
JBoss Rich Faces SVN: r20976 - in trunk/cdk: generator/src/main/java/org/richfaces/cdk/apt/processors and 8 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2011-01-12 20:47:03 -0500 (Wed, 12 Jan 2011)
New Revision: 20976
Added:
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/DummyPropertyImpl.java
Removed:
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/PropertyImpl.java
Modified:
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/AptSourceUtils.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/ProcessorBase.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/RendererProcessor.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/validator/ValidatorImpl.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/Attribute.java
trunk/cdk/generator/src/test/java/org/richfaces/cdk/model/validator/ModelValidatorTest.java
trunk/cdk/generator/src/test/java/org/richfaces/cdk/templatecompiler/model/TemplateParserTest.java
trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/AbstractTestComponent.java
trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/templates/testComponent.xml
Log:
RESOLVED - issue RF-9798: CDK: template attributes are ignored
https://issues.jboss.org/browse/RF-9798
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/AptSourceUtils.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/AptSourceUtils.java 2011-01-12 20:37:01 UTC (rev 20975)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/AptSourceUtils.java 2011-01-13 01:47:03 UTC (rev 20976)
@@ -116,7 +116,7 @@
if (beanProperties.containsKey(name)) {
return beanProperties.get(name);
} else {
- return new PropertyImpl(name);
+ return new DummyPropertyImpl(name);
}
}
@@ -129,13 +129,15 @@
* @return
*/
Map<String, AptBeanProperty> getBeanProperties(TypeElement type) {
- List<? extends Element> members = this.processingEnv.getElementUtils().getAllMembers(type);
- // extract all getters/setters.
Map<String, AptBeanProperty> result = Maps.newHashMap();
- for (Element element : members) {
- if (ElementKind.METHOD.equals(element.getKind())) {
- ExecutableElement method = (ExecutableElement) element;
- processMethod(type, result, method);
+ if (null != type) {
+ List<? extends Element> members = this.processingEnv.getElementUtils().getAllMembers(type);
+ // extract all getters/setters.
+ for (Element element : members) {
+ if (ElementKind.METHOD.equals(element.getKind())) {
+ ExecutableElement method = (ExecutableElement) element;
+ processMethod(type, result, method);
+ }
}
}
return result;
@@ -155,15 +157,16 @@
ExecutableElement method, boolean setter) {
String propertyName = getPropertyName(method);
if (!HIDDEN_PROPERTIES.contains(propertyName)) {
- ClassName propertyType = asClassDescription(setter?method.getParameters().get(0).asType():method.getReturnType());
+ ClassName propertyType =
+ asClassDescription(setter ? method.getParameters().get(0).asType() : method.getReturnType());
if (result.containsKey(propertyName)) {
// Merge property with existed one.
AptBeanProperty beanProperty = result.get(propertyName);
checkPropertyType(type, propertyName, propertyType, beanProperty);
- if (null != (setter?beanProperty.setter:beanProperty.getter)) {
+ if (null != (setter ? beanProperty.setter : beanProperty.getter)) {
log.debug("Two " + (setter ? "setter" : "getter") + " methods for the same bean property "
+ propertyName + " in the class " + type.getQualifiedName());
- if(!method.getModifiers().contains(Modifier.ABSTRACT)){
+ if (!method.getModifiers().contains(Modifier.ABSTRACT)) {
beanProperty.setAccessMethod(method, setter);
}
} else {
@@ -395,10 +398,10 @@
return processingEnv.getElementUtils().getTypeElement(type.toString());
}
- public boolean isClassExists(ClassName type){
+ public boolean isClassExists(ClassName type) {
return null != asTypeElement(type);
}
-
+
@Override
public TypeElement asTypeElement(TypeMirror mirror) {
if (TypeKind.DECLARED.equals(mirror.getKind())) {
Copied: trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/DummyPropertyImpl.java (from rev 20968, trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/PropertyImpl.java)
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/DummyPropertyImpl.java (rev 0)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/DummyPropertyImpl.java 2011-01-13 01:47:03 UTC (rev 20976)
@@ -0,0 +1,57 @@
+package org.richfaces.cdk.apt;
+
+import java.lang.annotation.Annotation;
+
+import javax.lang.model.element.AnnotationMirror;
+
+import org.richfaces.cdk.apt.SourceUtils.ACCESS_TYPE;
+import org.richfaces.cdk.apt.SourceUtils.BeanProperty;
+import org.richfaces.cdk.model.ClassName;
+
+public final class DummyPropertyImpl implements BeanProperty {
+ private final String name;
+
+ public DummyPropertyImpl(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public boolean isExists() {
+ return false;
+ }
+
+ @Override
+ public boolean isAnnotationPresent(Class<? extends Annotation> annotationType) {
+ return false;
+ }
+
+ @Override
+ public ClassName getType() {
+ return ClassName.get(Object.class);
+ }
+
+ @Override
+ public String getName() {
+ return this.name;
+ }
+
+ @Override
+ public String getDocComment() {
+ return null;
+ }
+
+ @Override
+ public AnnotationMirror getAnnotationMirror(Class<? extends Annotation> annotationType) {
+ return null;
+ }
+
+ @Override
+ public <T extends Annotation> T getAnnotation(Class<T> annotationType) {
+ return null;
+ }
+
+ @Override
+ public ACCESS_TYPE getAccessType() {
+ return ACCESS_TYPE.readWrite;
+ }
+}
\ No newline at end of file
Property changes on: trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/DummyPropertyImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/PropertyImpl.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/PropertyImpl.java 2011-01-12 20:37:01 UTC (rev 20975)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/PropertyImpl.java 2011-01-13 01:47:03 UTC (rev 20976)
@@ -1,57 +0,0 @@
-package org.richfaces.cdk.apt;
-
-import java.lang.annotation.Annotation;
-
-import javax.lang.model.element.AnnotationMirror;
-
-import org.richfaces.cdk.apt.SourceUtils.ACCESS_TYPE;
-import org.richfaces.cdk.apt.SourceUtils.BeanProperty;
-import org.richfaces.cdk.model.ClassName;
-
-public final class PropertyImpl implements BeanProperty {
- private final String name;
-
- public PropertyImpl(String name) {
- this.name = name;
- }
-
- @Override
- public boolean isExists() {
- return false;
- }
-
- @Override
- public boolean isAnnotationPresent(Class<? extends Annotation> annotationType) {
- return false;
- }
-
- @Override
- public ClassName getType() {
- return ClassName.get(Object.class);
- }
-
- @Override
- public String getName() {
- return this.name;
- }
-
- @Override
- public String getDocComment() {
- return null;
- }
-
- @Override
- public AnnotationMirror getAnnotationMirror(Class<? extends Annotation> annotationType) {
- return null;
- }
-
- @Override
- public <T extends Annotation> T getAnnotation(Class<T> annotationType) {
- return null;
- }
-
- @Override
- public ACCESS_TYPE getAccessType() {
- return ACCESS_TYPE.readWrite;
- }
-}
\ No newline at end of file
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/ProcessorBase.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/ProcessorBase.java 2011-01-12 20:37:01 UTC (rev 20975)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/ProcessorBase.java 2011-01-13 01:47:03 UTC (rev 20976)
@@ -64,7 +64,8 @@
return tagModel;
}
- protected void setClassNames(TypeElement componentElement, GeneratedFacesComponent modelElement, AnnotationMirror behavior) {
+ protected void setClassNames(TypeElement componentElement, GeneratedFacesComponent modelElement,
+ AnnotationMirror behavior) {
SourceUtils sourceUtils = getSourceUtils();
if (componentElement.getModifiers().contains(Modifier.ABSTRACT)
|| !sourceUtils.isDefaultValue(behavior, "generate")) {
@@ -128,14 +129,17 @@
}
}
- protected String getAnnotationPropertyOrConstant(TypeElement element, AnnotationMirror annotation, String annotationAttribute, String fieldName) {
+ protected String getAnnotationPropertyOrConstant(TypeElement element, AnnotationMirror annotation,
+ String annotationAttribute, String fieldName) {
SourceUtils utils = getSourceUtils();
if (!utils.isDefaultValue(annotation, annotationAttribute)) {
- return utils.getAnnotationValue(annotation, annotationAttribute,String.class);
+ return utils.getAnnotationValue(annotation, annotationAttribute, String.class);
}
- Object value = utils.getConstant((TypeElement) element, fieldName);
- if (value != null) {
- return value.toString();
+ if (null != element) {
+ Object value = utils.getConstant((TypeElement) element, fieldName);
+ if (value != null) {
+ return value.toString();
+ }
}
return null;
}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/RendererProcessor.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/RendererProcessor.java 2011-01-12 20:37:01 UTC (rev 20975)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/RendererProcessor.java 2011-01-13 01:47:03 UTC (rev 20976)
@@ -34,20 +34,18 @@
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.FacesId;
import org.richfaces.cdk.model.RendererModel;
-import org.richfaces.cdk.util.Strings;
-
/**
* @author akolonitsky
* @since Dec 30, 2009
*/
-@SupportedAnnotationTypes({"javax.faces.component.FacesComponent", JsfRenderer.NAME})
+@SupportedAnnotationTypes({ "javax.faces.component.FacesComponent", JsfRenderer.NAME })
public class RendererProcessor extends ProcessorBase implements CdkAnnotationProcessor {
private static final String COMPONENT_FAMILY = "COMPONENT_FAMILY";
private static final String RENDERER_TYPE = "RENDERER_TYPE";
-
+
public void process(Element rendererElement, ComponentLibrary library) {
SourceUtils sourceUtils = getSourceUtils();
AnnotationMirror annotation = sourceUtils.getAnnotationMirror(rendererElement, JsfRenderer.class);
@@ -58,33 +56,26 @@
setClassNames(rendererTypeElement, rendererModel, annotation);
setRendererType(rendererTypeElement, rendererModel, annotation);
-
+
setComponentFamily(rendererTypeElement, rendererModel, annotation);
setDescription(rendererModel, annotation, getDocComment(rendererElement));
- sourceUtils.setModelProperty(rendererModel, annotation, "templatePath","template");
+ sourceUtils.setModelProperty(rendererModel, annotation, "templatePath", "template");
String renderKitId = sourceUtils.getAnnotationValue(annotation, "renderKitId", String.class);
library.addRenderer(renderKitId, rendererModel);
}
-
-
- private void setTemplate(RendererModel rendererModel, JsfRenderer annotation) {
- String template = annotation.template();
- if (!Strings.isEmpty(template)) {
- rendererModel.setTemplatePath(template);
- }
+ private void setComponentFamily(TypeElement rendererElement, RendererModel rendererModel,
+ AnnotationMirror annotation) {
+ rendererModel.setFamily(FacesId.parseId(getAnnotationPropertyOrConstant(rendererElement, annotation, "family",
+ COMPONENT_FAMILY)));
}
-
- private void setComponentFamily(TypeElement rendererElement, RendererModel rendererModel, AnnotationMirror annotation) {
- rendererModel.setFamily(FacesId.parseId(getAnnotationPropertyOrConstant(rendererElement, annotation,"family",COMPONENT_FAMILY)));
- }
-
private void setRendererType(TypeElement rendererElement, RendererModel rendererModel, AnnotationMirror annotation) {
- rendererModel.setId(FacesId.parseId(getAnnotationPropertyOrConstant(rendererElement, annotation,"type",RENDERER_TYPE)));
+ rendererModel.setId(FacesId.parseId(getAnnotationPropertyOrConstant(rendererElement, annotation, "type",
+ RENDERER_TYPE)));
}
protected String getComponentType(TypeElement componentElement) {
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java 2011-01-12 20:37:01 UTC (rev 20975)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java 2011-01-13 01:47:03 UTC (rev 20976)
@@ -37,6 +37,8 @@
private String rendererTemplate;
+ private ComponentModel parent;
+
public ComponentModel(FacesId key) {
this.setId(key);
}
@@ -175,4 +177,13 @@
public String toString() {
return "Component {type: " + getId() + ", family: " + getFamily() + "}";
}
+
+ public void setParent(ComponentModel parentComponent) {
+ this.parent = parentComponent;
+ }
+
+ @Merge
+ public ComponentModel getParent() {
+ return this.parent;
+ }
}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/validator/ValidatorImpl.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/validator/ValidatorImpl.java 2011-01-12 20:37:01 UTC (rev 20975)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/validator/ValidatorImpl.java 2011-01-13 01:47:03 UTC (rev 20976)
@@ -40,7 +40,9 @@
import org.richfaces.cdk.ModelValidator;
import org.richfaces.cdk.NamingConventions;
import org.richfaces.cdk.annotations.TagType;
+import org.richfaces.cdk.apt.DummyPropertyImpl;
import org.richfaces.cdk.apt.SourceUtils;
+import org.richfaces.cdk.apt.SourceUtils.BeanProperty;
import org.richfaces.cdk.model.BehaviorModel;
import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.ComponentLibrary;
@@ -48,10 +50,11 @@
import org.richfaces.cdk.model.ConverterModel;
import org.richfaces.cdk.model.DescriptionGroup;
import org.richfaces.cdk.model.EventModel;
-import org.richfaces.cdk.model.GeneratedFacesComponent;
import org.richfaces.cdk.model.FacesId;
import org.richfaces.cdk.model.FacetModel;
+import org.richfaces.cdk.model.GeneratedFacesComponent;
import org.richfaces.cdk.model.InvalidNameException;
+import org.richfaces.cdk.model.ModelElementBase;
import org.richfaces.cdk.model.PropertyBase;
import org.richfaces.cdk.model.RenderKitModel;
import org.richfaces.cdk.model.RendererModel;
@@ -135,7 +138,7 @@
throw new CallbackException("Cannot infer Java class name for behavior " + this.behavior);
}
}
-
+
private final class ConverterTypeCallback implements NamingConventionsCallback {
private final ConverterModel converter;
@@ -143,6 +146,7 @@
public ConverterTypeCallback(ConverterModel converter) {
this.converter = converter;
}
+
@Override
public FacesId inferType(ClassName targetClass) throws CallbackException {
// TODO use actual methods
@@ -168,7 +172,7 @@
public ClassName getDefaultClass() throws CallbackException {
return ClassName.get(Object.class);
}
-
+
}
private final class ValidatorTypeCallback implements NamingConventionsCallback {
@@ -204,7 +208,7 @@
public ClassName getDefaultClass() throws CallbackException {
return ClassName.get(Object.class);
}
-
+
}
private final class RendererTypeCallback implements NamingConventionsCallback {
@@ -296,9 +300,9 @@
public void verify(ComponentLibrary library) throws CdkException {
verifyComponents(library);
verifyEvents(library);
- verifyBehaviors(library);
verifyRenderers(library);
verifyTaglib(library);
+ verifyBehaviors(library);
verifyConverters(library);
verifyValidators(library);
}
@@ -307,7 +311,7 @@
for (ValidatorModel validator : library.getValidators()) {
verifyTypes(validator, new ValidatorTypeCallback(validator));
}
-
+
}
protected void verifyConverters(ComponentLibrary library) {
@@ -403,21 +407,50 @@
protected void vefifyRenderer(final ComponentLibrary library, final RendererModel renderer) {
+ for (ComponentModel component : library.getComponents()) {
+ if (isTheSameTemplate(renderer, component) && null == renderer.getId()) {
+ renderer.setId(component.getRendererType());
+ }
+ }
// Check type.
verifyTypes(renderer, new RendererTypeCallback(library, renderer));
// Check component type.
for (ComponentModel component : library.getComponents()) {
if (renderer.getId().equals(component.getRendererType())) {
- renderer.getAttributes().addAll(component.getAttributes());
- renderer.setFamily(component.getFamily());
+ copyRendererAttributes(renderer, component);
+ } else if (isTheSameTemplate(renderer, component)) {
+ copyRendererAttributes(renderer, component);
+ component.setRendererType(renderer.getId());
}
}
// Check family.
if (null == renderer.getFamily()) {
- // renderer.setFamily(namingConventions.inferRendererBaseName(renderer.getId()));
+ renderer.setFamily(namingConventions.inferRendererFamily(renderer.getId()));
}
}
+ private void copyRendererAttributes(final RendererModel renderer, ComponentModel component) {
+ for (PropertyBase property : renderer.getAttributes()) {
+ PropertyBase attribute = component.getOrCreateAttribute(property.getName());
+ attribute.merge(property);
+ verifyAttribute(attribute, component);
+ }
+ renderer.setFamily(component.getFamily());
+ }
+
+ private boolean isTheSameTemplate(final RendererModel renderer, ComponentModel component) {
+ String componentTemplatePath = component.getRendererTemplate();
+ if (null != componentTemplatePath) {
+ if (componentTemplatePath.equals(renderer.getTemplatePath())) {
+ return true;
+ } else if (null != renderer.getTemplate()
+ && renderer.getTemplate().getTemplatePath().endsWith(componentTemplatePath)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
protected void verifyComponents(ComponentLibrary library) throws CdkException {
// Verify types and classes. Do it first to be sure what all all values are set before second stage.
for (ComponentModel component : library.getComponents()) {
@@ -427,6 +460,9 @@
HashSet<ComponentModel> verified = Sets.newHashSet();
for (ComponentModel component : library.getComponents()) {
verifyComponentAttributes(library, component, verified);
+ if(null == component.getFamily()){
+ component.setFamily(namingConventions.inferUIComponentFamily(component.getId()));
+ }
}
}
@@ -449,6 +485,10 @@
try {
// Step one, lookup for parent.
ComponentModel parentComponent = findParent(library.getComponents(), component);
+ component.setParent(parentComponent);
+ if(null == component.getFamily()){
+ component.setFamily(parentComponent.getFamily());
+ }
// To be sure what all properties for parent component were propagated.
verifyComponentAttributes(library, parentComponent, verified);
for (PropertyBase parentAttribute : parentComponent.getAttributes()) {
@@ -484,7 +524,7 @@
@Override
public boolean apply(T input) {
- return component.getBaseClass().equals(input.getTargetClass());
+ return component.getBaseClass().equals(input.getTargetClass()) && component != input;
}
});
}
@@ -518,10 +558,7 @@
*/
protected void verifyComponentType(ComponentModel component) throws InvalidNameException {
// Check JsfComponent type.
- if (verifyTypes(component, new ComponentTypeCallback()) && null == component.getFamily()) {
- // Check family.
- component.setFamily(namingConventions.inferUIComponentFamily(component.getId()));
- }
+ verifyTypes(component, new ComponentTypeCallback()) ;
}
/**
@@ -554,7 +591,7 @@
component.setTargetClass(callback.inferClass(component.getId()));
}
component.setGenerate(!sourceUtilsProvider.get().isClassExists(component.getTargetClass()));
- }
+ }
if (component.getGenerate()) {
verifyGeneratedClasses(component, callback);
} else if (null == component.getTargetClass()) {
@@ -570,7 +607,8 @@
return true;
}
- private void verifyGeneratedClasses(GeneratedFacesComponent component, NamingConventionsCallback callback) throws CallbackException {
+ private void verifyGeneratedClasses(GeneratedFacesComponent component, NamingConventionsCallback callback)
+ throws CallbackException {
if (null == component.getBaseClass()) {
component.setBaseClass(callback.getDefaultBaseClass());
// return;
@@ -592,11 +630,12 @@
return;
}
// Check type
+ BeanProperty beanProperty = findBeanProperty(attribute, component);
if (null == attribute.getType()) {
- log.error("Unknown type of attribute [" + attribute.getName() + "]");
- return;
- }
- if(attribute.getType().isPrimitive() && null == attribute.getDefaultValue()){
+ log.warn("Unknown type of attribute [" + attribute.getName() + "]");
+ attribute.setType(beanProperty.getType());
+ }
+ if (attribute.getType().isPrimitive() && null == attribute.getDefaultValue()) {
// Set default value for primitive
attribute.setDefaultValue(attribute.getType().getDefaultValue());
}
@@ -614,16 +653,10 @@
if (Boolean.TRUE.equals(component.getGenerate())) {
// TODO Attribute should be only generated if it does not exist or abstract in the base class.
// Step one - check base class
- SourceUtils sourceUtils = sourceUtilsProvider.get();
if (SPECIAL_PROPERTIES.contains(attribute.getName())) {
attribute.setGenerate(false);
} else if (null == attribute.getGenerate()) {
- if (sourceUtils.isClassExists(component.getBaseClass())) {
- attribute.setGenerate(!sourceUtils.getBeanProperty(component.getBaseClass(), attribute.getName())
- .isExists());
- } else {
- attribute.setGenerate(true);
- }
+ attribute.setGenerate(!beanProperty.isExists());
}
} else {
attribute.setGenerate(false);
@@ -631,6 +664,27 @@
verifyDescription(attribute);
}
+ private BeanProperty findBeanProperty(PropertyBase attribute, GeneratedFacesComponent component) {
+ SourceUtils sourceUtils = sourceUtilsProvider.get();
+ BeanProperty beanProperty = sourceUtils.getBeanProperty(component.getBaseClass(), attribute.getName());
+ if (beanProperty instanceof DummyPropertyImpl && component instanceof ComponentModel) {
+ ComponentModel model = (ComponentModel) component;
+ if (null != model.getParent()) {
+ beanProperty = findBeanProperty(attribute, model.getParent());
+ }
+ }
+ if (beanProperty instanceof DummyPropertyImpl && component instanceof ModelElementBase) {
+ ModelElementBase model = (ModelElementBase) component;
+ for (ClassName interfaceName : model.getInterfaces()) {
+ beanProperty = sourceUtils.getBeanProperty(interfaceName, attribute.getName());
+ if (!(beanProperty instanceof DummyPropertyImpl)) {
+ break;
+ }
+ }
+ }
+ return beanProperty;
+ }
+
protected void verifyDescription(DescriptionGroup element) {
}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java 2011-01-12 20:37:01 UTC (rev 20975)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java 2011-01-13 01:47:03 UTC (rev 20976)
@@ -36,13 +36,12 @@
import org.richfaces.cdk.FileManager;
import org.richfaces.cdk.Logger;
import org.richfaces.cdk.ModelBuilder;
-import org.richfaces.cdk.NamingConventions;
-import org.richfaces.cdk.RichFacesConventions;
import org.richfaces.cdk.Source;
import org.richfaces.cdk.Sources;
import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.EventName;
+import org.richfaces.cdk.model.FacesId;
import org.richfaces.cdk.model.MethodSignature;
import org.richfaces.cdk.model.PropertyBase;
import org.richfaces.cdk.model.PropertyModel;
@@ -70,8 +69,8 @@
*/
public class RendererTemplateParser implements ModelBuilder {
- private static final Pattern PARAMETERS_STRING_PATTERN =
- Pattern.compile("^(\\S+)\\s+(\\S+)\\s*\\(([^\\)]*)\\)$", Pattern.COMMENTS);
+ private static final Pattern PARAMETERS_STRING_PATTERN = Pattern.compile("^(\\S+)\\s+(\\S+)\\s*\\(([^\\)]*)\\)$",
+ Pattern.COMMENTS);
private static final Pattern COMMA_SEPARATED_PATTERN = Pattern.compile("\\s*,\\s*", Pattern.COMMENTS);
@@ -85,9 +84,6 @@
private FragmentParser fragmentParser;
- // @Inject
- private NamingConventions namingConventions;
-
/**
* <p class="changed_added_4_0">
* </p>
@@ -107,48 +103,6 @@
this.fragmentParser = fragmentParser;
}
- private Set<EventName> convert(Collection<ClientBehavior> clientBehaviors) {
- if (clientBehaviors == null || clientBehaviors.isEmpty()) {
- return null;
- }
-
- Set<EventName> result = Sets.newLinkedHashSet();
- for (ClientBehavior clientBehavior : clientBehaviors) {
- EventName eventName = new EventName();
- eventName.setName(clientBehavior.getEvent());
- eventName.setDefaultEvent(clientBehavior.isDefaultEvent());
- result.add(eventName);
- }
-
- return result;
- }
-
- private MethodSignature parseSignature(String signatureString) {
-
- List<ClassName> parameters = Lists.newArrayList();
- MethodSignature signature = null;
- if (!Strings.isEmpty(signatureString)) {
- Matcher parametersStringMatcher = PARAMETERS_STRING_PATTERN.matcher(signatureString);
- if (!parametersStringMatcher.find()) {
- throw new IllegalArgumentException(MessageFormat.format("Signature string {0} cannot be parsed!",
- signatureString));
- }
- signature = new MethodSignature();
- signature.setReturnType(ClassName.parseName(parametersStringMatcher.group(1)));
- String parametersString = parametersStringMatcher.group(3);
- if (parametersString.trim().length() != 0) {
- String[] parameterStrings = COMMA_SEPARATED_PATTERN.split(parametersString);
- for (String parameter : parameterStrings) {
- String trimmedParameter = parameter.trim();
- parameters.add(ClassName.parseName(trimmedParameter));
- }
- signature.setParameters(parameters);
- }
-
- }
- return signature;
- }
-
/*
* (non-Javadoc)
*
@@ -188,7 +142,7 @@
return null;
}
}, absolutePath);
- Template template = parseTemplate(file);
+ Template template = parseTemplate(file);
mergeTemplateIntoModel(template, existedModel);
} catch (AlreadyProcessedException e) {
log.warn("Template " + absolutePath + "was already processed");
@@ -204,8 +158,8 @@
renderKit.getRenderers().add(renderer);
}
renderer.setTemplate(template);
- setRendererType(template, compositeInterface, renderer);
- setFamily(compositeInterface, renderer); // TODO set default values according to template name
+ setRendererType(compositeInterface, renderer);
+ setFamily(compositeInterface, renderer);
setRendererClass(compositeInterface, renderer);
setRendererBaseClass(compositeInterface, renderer);
@@ -215,26 +169,22 @@
}
List<ImportAttributes> attributesImports = compositeInterface.getAttributesImports();
- if (attributesImports != null) {
- for (ImportAttributes attributesImport : attributesImports) {
- String importURI = attributesImport.getSource();
- Collection<PropertyBase> properties;
- try {
- properties = fragmentParser.parseProperties(importURI);
- if (properties != null) {
- renderer.getAttributes().addAll(properties);
- }
- } catch (FileNotFoundException e) {
- throw new CdkException("File for import not found", e);
+ for (ImportAttributes attributesImport : attributesImports) {
+ String importURI = attributesImport.getSource();
+ Collection<PropertyBase> properties;
+ try {
+ properties = fragmentParser.parseProperties(importURI);
+ if (properties != null) {
+ renderer.getAttributes().addAll(properties);
}
+ } catch (FileNotFoundException e) {
+ throw new CdkException("File for import not found", e);
}
}
List<Attribute> templateAttributes = compositeInterface.getAttributes();
- if (templateAttributes != null) {
- for (Attribute templateAttribute : templateAttributes) {
- renderer.getAttributes().add(buildProperty(templateAttribute));
- }
+ for (Attribute templateAttribute : templateAttributes) {
+ renderer.getAttributes().add(buildProperty(templateAttribute));
}
return renderer;
}
@@ -244,27 +194,16 @@
rendererProperty.setName(templateAttribute.getName());
rendererProperty.setDefaultValue(templateAttribute.getDefaultValue());
- // TODO is it the right one?
rendererProperty.setDescription(templateAttribute.getShortDescription());
rendererProperty.setDisplayName(templateAttribute.getDisplayName());
- Set<EventName> eventNamesSet = convert(templateAttribute.getClientBehaviors());
- if (eventNamesSet != null) {
- rendererProperty.getEventNames().addAll(eventNamesSet);
- }
+ Set<EventName> eventNamesSet = convertBehaviorsToEvents(templateAttribute.getClientBehaviors());
+ rendererProperty.getEventNames().addAll(eventNamesSet);
- // rendererProperty.setAliases(aliases)
- // rendererProperty.setExtension(extension)
- // rendererProperty.setGenerate(exists)
- // rendererProperty.setHidden(hidden)
- // rendererProperty.setIcon(icon)
- // rendererProperty.setLiteral(literal)
- // rendererProperty.setPassThrough(passThrough)
- // rendererProperty.setReadOnly(readOnly)
- // rendererProperty.setSuggestedValue(suggestedValue)
-
- rendererProperty.setRequired(templateAttribute.isRequired());
-
+ Boolean required = templateAttribute.getRequired();
+ if (null != required) {
+ rendererProperty.setRequired(required);
+ }
MethodSignature parsedSignature = parseSignature(templateAttribute.getMethodSignature());
rendererProperty.setSignature(parsedSignature);
@@ -272,40 +211,81 @@
return rendererProperty;
}
+ private Set<EventName> convertBehaviorsToEvents(Collection<ClientBehavior> clientBehaviors) {
+ Set<EventName> result = Sets.newLinkedHashSet();
+ for (ClientBehavior clientBehavior : clientBehaviors) {
+ EventName eventName = new EventName();
+ eventName.setName(clientBehavior.getEvent());
+ eventName.setDefaultEvent(clientBehavior.isDefaultEvent());
+ result.add(eventName);
+ }
+
+ return result;
+ }
+
+ private MethodSignature parseSignature(String signatureString) {
+
+ List<ClassName> parameters = Lists.newArrayList();
+ MethodSignature signature = null;
+ if (!Strings.isEmpty(signatureString)) {
+ Matcher parametersStringMatcher = PARAMETERS_STRING_PATTERN.matcher(signatureString);
+ if (!parametersStringMatcher.find()) {
+ throw new IllegalArgumentException(MessageFormat.format("Signature string {0} cannot be parsed!",
+ signatureString));
+ }
+ signature = new MethodSignature();
+ signature.setReturnType(ClassName.parseName(parametersStringMatcher.group(1)));
+ String parametersString = parametersStringMatcher.group(3);
+ if (parametersString.trim().length() != 0) {
+ String[] parameterStrings = COMMA_SEPARATED_PATTERN.split(parametersString);
+ for (String parameter : parameterStrings) {
+ String trimmedParameter = parameter.trim();
+ parameters.add(ClassName.parseName(trimmedParameter));
+ }
+ signature.setParameters(parameters);
+ }
+
+ }
+ return signature;
+ }
+
private void setRendererClass(CompositeInterface compositeInterface, RendererModel renderer) {
- renderer.setRendererClass(compositeInterface.getJavaClass());
+ ClassName javaClass = compositeInterface.getJavaClass();
+ if (null != javaClass) {
+ renderer.setRendererClass(javaClass);
+ }
}
private void setRendererBaseClass(CompositeInterface compositeInterface, RendererModel renderer) {
- renderer.setBaseClass(compositeInterface.getBaseClass());
+ ClassName baseClass = compositeInterface.getBaseClass();
+ if (null != baseClass) {
+ renderer.setBaseClass(baseClass);
+ }
}
private void setFamily(CompositeInterface compositeInterface, RendererModel renderer) {
- renderer.setFamily(compositeInterface.getComponentFamily());
+ FacesId componentFamily = compositeInterface.getComponentFamily();
+ if (null != componentFamily) {
+ renderer.setFamily(componentFamily);
+ }
}
- private void setRendererType(Template template, CompositeInterface compositeInterface, RendererModel renderer) {
- renderer.setId(compositeInterface.getRendererType());
+
+ private void setRendererType(CompositeInterface compositeInterface, RendererModel renderer) {
+ FacesId rendererType = compositeInterface.getRendererType();
+ if (null != rendererType) {
+ renderer.setId(rendererType);
+ }
}
protected Template parseTemplate(File file) throws CdkException {
try {
- Template template = jaxbBinding.unmarshal(file, "http://jboss.org/schema/richfaces/cdk/cdk-template.xsd", Template.class);
+ Template template =
+ jaxbBinding.unmarshal(file, "http://jboss.org/schema/richfaces/cdk/cdk-template.xsd", Template.class);
template.setTemplatePath(file.getAbsolutePath());
return template;
} catch (FileNotFoundException e) {
throw new CdkException("Template file not found " + file.getAbsolutePath(), e);
}
}
-
- public NamingConventions getNamingConventions() {
- if (namingConventions == null) {
- namingConventions = new RichFacesConventions();
- }
- return namingConventions;
- }
-
- public void setNamingConventions(NamingConventions namingConventions) {
- this.namingConventions = namingConventions;
- }
}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/Attribute.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/Attribute.java 2011-01-12 20:37:01 UTC (rev 20975)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/Attribute.java 2011-01-13 01:47:03 UTC (rev 20976)
@@ -66,13 +66,13 @@
private String targets;
@XmlAttribute
- private boolean required;
+ private Boolean required;
@XmlAttribute
- private boolean preferred;
+ private Boolean preferred;
@XmlAttribute
- private boolean expert;
+ private Boolean expert;
@XmlAttribute
@XmlJavaTypeAdapter(ClassAdapter.class)
@@ -194,7 +194,7 @@
*
* @return the required
*/
- public boolean isRequired() {
+ public Boolean getRequired() {
return this.required;
}
@@ -203,7 +203,7 @@
*
* @param required the required to set
*/
- public void setRequired(boolean required) {
+ public void setRequired(Boolean required) {
this.required = required;
}
@@ -212,7 +212,7 @@
*
* @return the preffered
*/
- public boolean isPreferred() {
+ public Boolean getPreferred() {
return this.preferred;
}
@@ -221,7 +221,7 @@
*
* @param preffered the preffered to set
*/
- public void setPreferred(boolean preffered) {
+ public void setPreferred(Boolean preffered) {
this.preferred = preffered;
}
@@ -230,7 +230,7 @@
*
* @return the expert
*/
- public boolean isExpert() {
+ public Boolean getExpert() {
return this.expert;
}
@@ -239,7 +239,7 @@
*
* @param expert the expert to set
*/
- public void setExpert(boolean expert) {
+ public void setExpert(Boolean expert) {
this.expert = expert;
}
Modified: trunk/cdk/generator/src/test/java/org/richfaces/cdk/model/validator/ModelValidatorTest.java
===================================================================
--- trunk/cdk/generator/src/test/java/org/richfaces/cdk/model/validator/ModelValidatorTest.java 2011-01-12 20:37:01 UTC (rev 20975)
+++ trunk/cdk/generator/src/test/java/org/richfaces/cdk/model/validator/ModelValidatorTest.java 2011-01-13 01:47:03 UTC (rev 20976)
@@ -86,14 +86,12 @@
FacesId type = FacesId.parseId("foo.Bar");
component.setTargetClass(className);
expect(namiingConventions.inferComponentType(className)).andReturn(type);
- expect(namiingConventions.inferUIComponentFamily(type)).andReturn(FOO_BAZ);
expect(utils.isClassExists(className)).andReturn(true);
replay(log, utils, namiingConventions);
// Validator should set component type from base class.
validator.verifyComponentType(component);
verify(log, utils, namiingConventions);
assertEquals(type, component.getId());
- assertEquals(FOO_BAZ, component.getFamily());
}
}
Modified: trunk/cdk/generator/src/test/java/org/richfaces/cdk/templatecompiler/model/TemplateParserTest.java
===================================================================
--- trunk/cdk/generator/src/test/java/org/richfaces/cdk/templatecompiler/model/TemplateParserTest.java 2011-01-12 20:37:01 UTC (rev 20975)
+++ trunk/cdk/generator/src/test/java/org/richfaces/cdk/templatecompiler/model/TemplateParserTest.java 2011-01-13 01:47:03 UTC (rev 20976)
@@ -91,9 +91,9 @@
assertNull(attribute.getMethodSignature());
assertEquals(DEFAULT_ATTRIBUTE_TYPE, attribute.getType());
assertNull(attribute.getTargets());
- assertFalse(attribute.isRequired());
- assertFalse(attribute.isExpert());
- assertFalse(attribute.isPreferred());
+ assertNull(attribute.getRequired());
+ assertNull(attribute.getExpert());
+ assertNull(attribute.getPreferred());
attribute = attributes.get(1);
assertNotNull(attribute);
@@ -102,9 +102,9 @@
assertNull(attribute.getMethodSignature());
assertEquals(DEFAULT_ATTRIBUTE_TYPE, attribute.getType());
assertNull(attribute.getTargets());
- assertFalse(attribute.isRequired());
- assertFalse(attribute.isExpert());
- assertFalse(attribute.isPreferred());
+ assertNull(attribute.getRequired());
+ assertNull(attribute.getExpert());
+ assertNull(attribute.getPreferred());
attribute = attributes.get(2);
assertNotNull(attribute);
@@ -113,9 +113,9 @@
assertEquals("void action()", attribute.getMethodSignature());
assertEquals(DEFAULT_ATTRIBUTE_TYPE, attribute.getType());
assertNull(attribute.getTargets());
- assertFalse(attribute.isRequired());
- assertFalse(attribute.isExpert());
- assertFalse(attribute.isPreferred());
+ assertNull(attribute.getRequired());
+ assertNull(attribute.getExpert());
+ assertNull(attribute.getPreferred());
attribute = attributes.get(3);
assertNotNull(attribute);
@@ -124,9 +124,9 @@
assertEquals("void changeListener(ValueChangeEvent)", attribute.getMethodSignature());
assertEquals(DEFAULT_ATTRIBUTE_TYPE, attribute.getType());
assertEquals("changes changes1", attribute.getTargets());
- assertFalse(attribute.isRequired());
- assertFalse(attribute.isExpert());
- assertFalse(attribute.isPreferred());
+ assertNull(attribute.getRequired());
+ assertNull(attribute.getExpert());
+ assertNull(attribute.getPreferred());
attribute = attributes.get(4);
assertNotNull(attribute);
@@ -135,9 +135,9 @@
assertNull(attribute.getMethodSignature());
assertEquals(ClassName.parseName("boolean"), attribute.getType());
assertNull(attribute.getTargets());
- assertFalse(attribute.isRequired());
- assertFalse(attribute.isExpert());
- assertFalse(attribute.isPreferred());
+ assertNull(attribute.getRequired());
+ assertNull(attribute.getExpert());
+ assertNull(attribute.getPreferred());
attribute = attributes.get(5);
assertNotNull(attribute);
@@ -146,9 +146,9 @@
assertNull(attribute.getMethodSignature());
assertEquals(ClassName.parseName("java.lang.Integer"), attribute.getType());
assertNull(attribute.getTargets());
- assertFalse(attribute.isRequired());
- assertFalse(attribute.isExpert());
- assertFalse(attribute.isPreferred());
+ assertNull(attribute.getRequired());
+ assertNull(attribute.getExpert());
+ assertNull(attribute.getPreferred());
attribute = attributes.get(6);
assertNotNull(attribute);
@@ -157,13 +157,13 @@
assertNull(attribute.getMethodSignature());
assertEquals(DEFAULT_ATTRIBUTE_TYPE, attribute.getType());
assertNull(attribute.getTargets());
- assertTrue(attribute.isRequired());
- assertFalse(attribute.isExpert());
- assertFalse(attribute.isPreferred());
+ assertTrue(attribute.getRequired());
+ assertNull(attribute.getExpert());
+ assertNull(attribute.getPreferred());
attribute = attributes.get(7);
assertNotNull(attribute);
- assertFalse(attribute.isRequired());
+ assertNull(attribute.getRequired());
assertEquals("experts", attribute.getName());
assertNull(attribute.getDefaultValue());
assertNull(attribute.getMethodSignature());
@@ -171,20 +171,20 @@
assertNull(attribute.getTargets());
assertEquals("For use by experts", attribute.getShortDescription());
assertEquals("Expert attribute", attribute.getDisplayName());
- assertTrue(attribute.isExpert());
- assertFalse(attribute.isPreferred());
+ assertTrue(attribute.getExpert());
+ assertNull(attribute.getPreferred());
attribute = attributes.get(8);
assertNotNull(attribute);
- assertFalse(attribute.isRequired());
- assertFalse(attribute.isExpert());
+ assertNull(attribute.getRequired());
+ assertNull(attribute.getExpert());
assertEquals("preferred", attribute.getName());
assertNull(attribute.getDefaultValue());
assertNull(attribute.getMethodSignature());
assertEquals(DEFAULT_ATTRIBUTE_TYPE, attribute.getType());
assertEquals("It's a preferred attribute", attribute.getShortDescription());
assertEquals("Preferred attribute", attribute.getDisplayName());
- assertTrue(attribute.isPreferred());
+ assertTrue(attribute.getPreferred());
attribute = attributes.get(9);
assertNotNull(attribute);
Modified: trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/AbstractTestComponent.java
===================================================================
--- trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/AbstractTestComponent.java 2011-01-12 20:37:01 UTC (rev 20975)
+++ trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/AbstractTestComponent.java 2011-01-13 01:47:03 UTC (rev 20976)
@@ -72,6 +72,7 @@
@RendererSpecificComponent(type = "org.richfaces.cdk.test.TestHtmlDfn",
tag=@Tag(name="dfn"),
generate="org.richfaces.cdk.test.component.html.HtmlTestDfn",
+ renderer=@JsfRenderer(template="/testComponent.xml"),
attributes="html5.xml")
}
)
Modified: trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/templates/testComponent.xml
===================================================================
--- trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/templates/testComponent.xml 2011-01-12 20:37:01 UTC (rev 20975)
+++ trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/templates/testComponent.xml 2011-01-13 01:47:03 UTC (rev 20976)
@@ -18,7 +18,7 @@
<cc:attribute name="onlistclick" >
<cc:clientBehavior event="listclick"/>
</cc:attribute>
- <cc:attribute name="mode" default="ajax" />
+ <cc:attribute name="mode" default=""ajax"" />
<cc:attribute name="action" method-signature="void action()" />
<cc:attribute name="changeListener"
method-signature="void changeListener(ValueChangeEvent)" targets="changes changes1" />
13 years, 11 months
JBoss Rich Faces SVN: r20975 - trunk/examples/richfaces-showcase/src/main/webapp/images.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2011-01-12 15:37:01 -0500 (Wed, 12 Jan 2011)
New Revision: 20975
Modified:
trunk/examples/richfaces-showcase/src/main/webapp/images/ai.gif
Log:
Updated status image in richfaces-showcase
Modified: trunk/examples/richfaces-showcase/src/main/webapp/images/ai.gif
===================================================================
(Binary files differ)
13 years, 11 months