JBoss Rich Faces SVN: r20963 - in trunk: ui/output/ui/src/main/java/org/richfaces/component and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2011-01-12 07:53:23 -0500 (Wed, 12 Jan 2011)
New Revision: 20963
Modified:
trunk/examples/output-demo/src/main/webapp/qunit/panelMenu.xhtml
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenu.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenuGroup.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenuItem.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuGroup.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuItem.js
Log:
RF-9928: panelMenu: "selectable" groups problems
Modified: trunk/examples/output-demo/src/main/webapp/qunit/panelMenu.xhtml
===================================================================
--- trunk/examples/output-demo/src/main/webapp/qunit/panelMenu.xhtml 2011-01-12 12:35:17 UTC (rev 20962)
+++ trunk/examples/output-demo/src/main/webapp/qunit/panelMenu.xhtml 2011-01-12 12:53:23 UTC (rev 20963)
@@ -59,7 +59,7 @@
itemChangeListener="#{modalPanel.itemChangeEventListener}"
>
- <pn:panelMenuGroup label="Group 1">
+ <pn:panelMenuGroup label="Group 1" selectable="true">
<pn:panelMenuItem>Item 1.1</pn:panelMenuItem>
<pn:panelMenuItem>Item 1.2</pn:panelMenuItem>
<pn:panelMenuItem>Item 1.3</pn:panelMenuItem>
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenu.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenu.java 2011-01-12 12:35:17 UTC (rev 20962)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenu.java 2011-01-12 12:53:23 UTC (rev 20963)
@@ -197,8 +197,8 @@
return getItem(itemName, this);
}
- private static AbstractPanelMenuItem getItem(String itemName, UIComponent comp) {
- if (comp instanceof AbstractPanelMenu) {
+ private AbstractPanelMenuItem getItem(String itemName, UIComponent comp) {
+ if (this != comp && comp instanceof AbstractPanelMenu) {
return null;
}
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenuGroup.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenuGroup.java 2011-01-12 12:35:17 UTC (rev 20962)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenuGroup.java 2011-01-12 12:53:23 UTC (rev 20963)
@@ -43,6 +43,11 @@
}
@Override
+ public Boolean isSelectable() {
+ return (Boolean) getStateHelper().eval(UIPanelMenuItem.PropertyKeys.selectable, Boolean.FALSE);
+ }
+
+ @Override
public PanelMenuMode getMode() {
return (PanelMenuMode) getStateHelper().eval(UIPanelMenuItem.PropertyKeys.mode, getPanelMenu().getGroupMode());
}
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenuItem.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenuItem.java 2011-01-12 12:35:17 UTC (rev 20962)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/UIPanelMenuItem.java 2011-01-12 12:53:23 UTC (rev 20963)
@@ -32,6 +32,9 @@
public class UIPanelMenuItem extends AbstractPanelMenuItem {
public enum PropertyKeys {
+ selectable,
+ unselectable,
+
mode,
label,
name,
@@ -44,6 +47,22 @@
render
}
+ public Boolean isSelectable() {
+ return (Boolean) getStateHelper().eval(PropertyKeys.selectable, Boolean.TRUE);
+ }
+
+ public void setSelectable(Boolean selectable) {
+ getStateHelper().put(PropertyKeys.selectable, selectable);
+ }
+
+ public Boolean isUnselectable() {
+ return (Boolean) getStateHelper().eval(PropertyKeys.unselectable, Boolean.FALSE);
+ }
+
+ public void setUnselectable(Boolean unselectable) {
+ getStateHelper().put(PropertyKeys.unselectable, unselectable);
+ }
+
public PanelMenuMode getMode() {
return (PanelMenuMode) getStateHelper().eval(PropertyKeys.mode, getPanelMenu().getItemMode());
}
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java 2011-01-12 12:35:17 UTC (rev 20962)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java 2011-01-12 12:53:23 UTC (rev 20963)
@@ -160,6 +160,8 @@
options.put("expandSingle", panelMenuGroup.isExpandSingle());
options.put("bubbleSelection", panelMenuGroup.isBubbleSelection());
options.put("expanded", panelMenuGroup.isExpanded());
+ options.put("selectable", panelMenuGroup.isSelectable());
+ options.put("unselectable", panelMenuGroup.isUnselectable());
addEventOption(context, panelMenuGroup, options, COLLAPSE);
addEventOption(context, panelMenuGroup, options, EXPAND);
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java 2011-01-12 12:35:17 UTC (rev 20962)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuItemRenderer.java 2011-01-12 12:53:23 UTC (rev 20963)
@@ -152,6 +152,8 @@
options.put("disabled", panelMenuItem.isDisabled());
options.put("mode", panelMenuItem.getMode());
options.put("name", panelMenuItem.getName());
+ options.put("selectable", panelMenuItem.isSelectable());
+ options.put("unselectable", panelMenuItem.isUnselectable());
addEventOption(context, panelMenuItem, options, UNSELECT);
addEventOption(context, panelMenuItem, options, SELECT);
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuGroup.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuGroup.js 2011-01-12 12:35:17 UTC (rev 20962)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuGroup.js 2011-01-12 12:53:23 UTC (rev 20963)
@@ -120,14 +120,13 @@
* @param {Hash} options - params
* */
init : function (componentId, options) {
- $super.constructor.call(this, componentId);
- this.options = $.extend(this.options, __DEFAULT_OPTIONS, options || {});
+ $super.constructor.call(this, componentId, $.extend({}, __DEFAULT_OPTIONS, options || {}));
if (!this.options.disabled) {
var menuGroup = this;
if (!this.options.selectable) {
- //TODO nick - this can be replaced by jQuery.delegate on menu itself
+ //TODO nick - this can be replaced by jQuery.delegate on menu itself
this.__header().bind("click", function () {
return menuGroup.switchExpantion();
});
@@ -248,6 +247,10 @@
*
* */
onCompleteHandler : function () {
+ if (this.options.selectable) {
+ $super.onCompleteHandler.call(this);
+ }
+
EXPAND_ITEM.execClient(this, this.expanded());
},
@@ -341,14 +344,14 @@
},
__fireCollapse : function () {
- //TODO nick - 'new' should be removed
+ //TODO nick - 'new' should be removed
return new rf.Event.fireById(this.id, "collapse", {
id: this.id
});
},
__fireExpand : function () {
- //TODO nick - 'new' should be removed
+ //TODO nick - 'new' should be removed
return new rf.Event.fireById(this.id, "expand", {
id: this.id
});
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuItem.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuItem.js 2011-01-12 12:35:17 UTC (rev 20962)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/panelMenuItem.js 2011-01-12 12:53:23 UTC (rev 20963)
@@ -28,9 +28,9 @@
var __DEFAULT_OPTIONS = {
disabled : false,
selectable: true,
- mode: "client",
unselectable: false,
highlight: true,
+ mode: "client",
stylePrefix: "rf-pm-itm",
itemStep: 20
};
13 years, 3 months
JBoss Rich Faces SVN: r20962 - in modules/tests/metamer/trunk: application/src/main/webapp/components/a4jParam and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2011-01-12 07:35:17 -0500 (Wed, 12 Jan 2011)
New Revision: 20962
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jParam/
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jParam/TestA4JParam.java
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/A4JParamBean.java
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jParam/simple.xhtml
Log:
https://issues.jboss.org/browse/RFPL-1047
* added 4 tests for a4j:param
* a4j:param's sample improved
Modified: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/A4JParamBean.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/A4JParamBean.java 2011-01-12 09:55:56 UTC (rev 20961)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/A4JParamBean.java 2011-01-12 12:35:17 UTC (rev 20962)
@@ -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.
*
@@ -22,12 +22,14 @@
package org.richfaces.tests.metamer.bean;
import java.io.Serializable;
+import java.util.Map;
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
+import javax.faces.context.FacesContext;
-import org.ajax4jsf.component.UIActionParameter;
+import org.richfaces.component.UIParameter;
import org.richfaces.tests.metamer.Attributes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -55,10 +57,11 @@
logger = LoggerFactory.getLogger(getClass());
logger.debug("initializing bean " + getClass().getName());
- attributes = Attributes.getComponentAttributesFromClass(UIActionParameter.class, getClass());
+ attributes = Attributes.getComponentAttributesFromFacesConfig(UIParameter.class, getClass());
attributes.setAttribute("name", "param");
attributes.setAttribute("noEscape", true);
+ attributes.get("noEscape").setType(Boolean.class);
attributes.setAttribute("value", "screen.width");
}
@@ -89,6 +92,11 @@
this.parameter = parameter;
}
+ public String getRequestParameter() {
+ Map<String, String> requestParameterMap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
+ return requestParameterMap.get(attributes.get("name").getValue().toString());
+ }
+
public String reset() {
parameter = null;
return null;
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/a4jParam/simple.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/a4jParam/simple.xhtml 2011-01-12 09:55:56 UTC (rev 20961)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/a4jParam/simple.xhtml 2011-01-12 12:35:17 UTC (rev 20962)
@@ -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.
@@ -43,13 +43,9 @@
<ui:define name="component">
- <a4j:commandButton id="button" value="Parametrized Button" render="output" >
- <a4j:param id="a4jParam"
- actionListener="#{a4jParamBean.attributes.actionListener}"
+ <a4j:commandButton id="button1" value="A4J Command Button" render="output1,output2" >
+ <a4j:param id="a4jParam1"
assignTo="#{a4jParamBean.parameter}"
- assignToBinding="#{a4jParamBean.attributes['assignToBinding'].value}"
- converter="#{a4jParamBean.attributes['converter'].value}"
- disable="#{a4jParamBean.attributes['disable'].value}"
name="#{a4jParamBean.attributes['name'].value}"
noEscape="#{a4jParamBean.attributes['noEscape'].value}"
rendered="#{a4jParamBean.attributes['rendered'].value}"
@@ -57,13 +53,24 @@
/>
</a4j:commandButton>
- <a4j:commandButton id="resetButton" value="Reset" action="#{a4jParamBean.reset}" render="output"/>
+ <h:commandButton id="button2" value="H Command Button">
+ <a4j:param id="a4jParam2"
+ assignTo="#{a4jParamBean.parameter}"
+ name="#{a4jParamBean.attributes['name'].value}"
+ noEscape="#{a4jParamBean.attributes['noEscape'].value}"
+ rendered="#{a4jParamBean.attributes['rendered'].value}"
+ value="#{a4jParamBean.attributes['value'].value}"
+ />
+ </h:commandButton>
+ <a4j:commandButton id="resetButton" value="Reset" action="#{a4jParamBean.reset}" render="output1,output2"/>
+
+ <br/><br/>
+
+ output1: <a4j:outputPanel id="output1" layout="inline">#{a4jParamBean.parameter}</a4j:outputPanel>
<br/>
+ output2: <a4j:outputPanel id="output2" layout="inline">#{a4jParamBean.requestParameter}</a4j:outputPanel>
- <h:panelGroup id="output">
- Your parameter's value is #{a4jParamBean.parameter}
- </h:panelGroup>
</ui:define>
<ui:define name="outOfTemplateAfter">
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jParam/TestA4JParam.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jParam/TestA4JParam.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jParam/TestA4JParam.java 2011-01-12 12:35:17 UTC (rev 20962)
@@ -0,0 +1,136 @@
+/*******************************************************************************
+ * 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.a4jParam;
+
+import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardHttp;
+import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardXhr;
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.testng.Assert.assertEquals;
+
+import java.net.URL;
+
+import org.jboss.test.selenium.encapsulated.JavaScript;
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
+import org.testng.annotations.Test;
+
+/**
+ * Test case for page /faces/components/a4jParam/simple.xhtml
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public class TestA4JParam extends AbstractMetamerTest {
+
+ private JQueryLocator button1 = pjq("input[id$=button1]");
+ private JQueryLocator button2 = pjq("input[id$=button2]");
+ private JQueryLocator resetButton = pjq("input[id$=resetButton]");
+ private JQueryLocator output1 = pjq("span[id$=output1]");
+ private JQueryLocator output2 = pjq("span[id$=output2]");
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/a4jParam/simple.xhtml");
+ }
+
+ @Test
+ public void testParameter() {
+ String reqTime = selenium.getText(time);
+ guardXhr(selenium).click(button1);
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
+
+ String screenWidth = selenium.getEval(new JavaScript("window.screen.width"));
+
+ assertEquals(selenium.getText(output1), screenWidth, "Output 1 after clicking on first button.");
+ assertEquals(selenium.getText(output2), screenWidth, "Output 2 after clicking on first button.");
+
+ reqTime = selenium.getText(time);
+ guardXhr(selenium).click(resetButton);
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
+
+ assertEquals(selenium.getText(output1), "", "Output 1 after clicking on reset button.");
+ assertEquals(selenium.getText(output2), "", "Output 2 after clicking on reset button.");
+
+ reqTime = selenium.getText(time);
+ guardHttp(selenium).click(button2);
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
+
+ assertEquals(selenium.getText(output1), "screen.width", "Output 1 after clicking on second button.");
+ assertEquals(selenium.getText(output2), "screen.width", "Output 2 after clicking on second button.");
+ }
+
+ @Test
+ public void testName() {
+ selenium.type(pjq("input[id$=nameInput]"), "metamer");
+ selenium.waitForPageToLoad();
+
+ String reqTime = selenium.getText(time);
+ guardXhr(selenium).click(button1);
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
+
+ String screenWidth = selenium.getEval(new JavaScript("window.screen.width"));
+
+ assertEquals(selenium.getText(output1), screenWidth, "Output 1 after clicking on first button.");
+ assertEquals(selenium.getText(output2), screenWidth, "Output 2 after clicking on first button.");
+ }
+
+ @Test
+ public void testNoEscape() {
+ JQueryLocator renderedInput = pjq("input[type=radio][name$=noEscapeInput][value=false]");
+ selenium.click(renderedInput);
+ selenium.waitForPageToLoad();
+
+ String reqTime = selenium.getText(time);
+ guardXhr(selenium).click(button1);
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
+
+ assertEquals(selenium.getText(output1), "screen.width", "Output 1 after clicking on first button.");
+ assertEquals(selenium.getText(output2), "screen.width", "Output 2 after clicking on first button.");
+ }
+
+ @Test
+ public void testValue() {
+ selenium.type(pjq("input[id$=valueInput]"), "4+5");
+ selenium.waitForPageToLoad();
+
+ String reqTime = selenium.getText(time);
+ guardXhr(selenium).click(button1);
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
+
+ assertEquals(selenium.getText(output1), "9", "Output 1 after clicking on first button.");
+ assertEquals(selenium.getText(output2), "9", "Output 2 after clicking on first button.");
+
+ reqTime = selenium.getText(time);
+ guardXhr(selenium).click(resetButton);
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
+
+ assertEquals(selenium.getText(output1), "", "Output 1 after clicking on reset button.");
+ assertEquals(selenium.getText(output2), "", "Output 2 after clicking on reset button.");
+
+ reqTime = selenium.getText(time);
+ guardHttp(selenium).click(button2);
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
+
+ assertEquals(selenium.getText(output1), "4+5", "Output 1 after clicking on second button.");
+ assertEquals(selenium.getText(output2), "4+5", "Output 2 after clicking on second button.");
+ }
+}
Property changes on: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jParam/TestA4JParam.java
___________________________________________________________________
Name: svn:keywords
+ Revision
13 years, 3 months
JBoss Rich Faces SVN: r20961 - modules/tests/metamer/trunk/application/src/main/webapp/components/richColumnGroup.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2011-01-12 04:55:56 -0500 (Wed, 12 Jan 2011)
New Revision: 20961
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richColumnGroup/headerFooter.xhtml
Log:
rich:columnGroup - tweaked naming of footer (RFPL-730)
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/richColumnGroup/headerFooter.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richColumnGroup/headerFooter.xhtml 2011-01-12 09:52:28 UTC (rev 20960)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richColumnGroup/headerFooter.xhtml 2011-01-12 09:55:56 UTC (rev 20961)
@@ -46,7 +46,7 @@
<f:facet name="header">
- <rich:columnGroup id="columnGroup"
+ <rich:columnGroup id="columnGroupHeader"
rendered="#{richColumnGroupBean.attributes['rendered'].value}">
<rich:column id="colHeaderName" rowspan="2">
<h:outputText id="colHeaderNameText" value="Name" />
@@ -97,28 +97,28 @@
<f:facet name="footer">
- <rich:columnGroup id="columnGroup1"
+ <rich:columnGroup id="columnGroupFooter"
rendered="#{richColumnGroupBean.attributes['rendered'].value}">
<rich:column colspan="5">
<rich:dataScroller />
</rich:column>
- <rich:column id="colHeaderName1" rowspan="2" breakRowBefore="true">
- <h:outputText id="colHeaderNameText1" value="Name" />
+ <rich:column id="colFooterName" rowspan="2" breakRowBefore="true">
+ <h:outputText id="colFooterNameText" value="Name" />
</rich:column>
- <rich:column id="colHeaderTitle1" >
- <h:outputText id="colHeaderTitleText1" value="Title" />
+ <rich:column id="colFooterTitle" >
+ <h:outputText id="colFooterTitleText" value="Title" />
</rich:column>
- <rich:column id="colHeaderSmoker1">
- <h:outputText id="colHeaderSmokerText1" value="Smoker" />
+ <rich:column id="colFooterSmoker">
+ <h:outputText id="colFooterSmokerText" value="Smoker" />
</rich:column>
- <rich:column id="colHeaderColor1">
- <h:outputText id="colHeaderColorText1" value="Favorite Color" />
+ <rich:column id="colFooterColor">
+ <h:outputText id="colFooterColorText" value="Favorite Color" />
</rich:column>
- <rich:column id="colHeaderNumberOfKids1">
- <h:outputText id="colHeaderNumberOfKidsText1" value="Number of Kids" />
+ <rich:column id="colFooterNumberOfKids">
+ <h:outputText id="colFooterNumberOfKidsText" value="Number of Kids" />
</rich:column>
- <rich:column id="colHeaderInfo1" colspan="4" breakRowBefore="true">
- <h:outputText id="colHeaderInfoText1" value="Information" />
+ <rich:column id="colFooterInfo" colspan="4" breakRowBefore="true">
+ <h:outputText id="colFooterInfoText" value="Information" />
</rich:column>
</rich:columnGroup>
13 years, 3 months
JBoss Rich Faces SVN: r20960 - in modules/tests/metamer/trunk/application/src/main: webapp/components/richColumnGroup and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2011-01-12 04:52:28 -0500 (Wed, 12 Jan 2011)
New Revision: 20960
Added:
modules/tests/metamer/trunk/application/src/main/webapp/components/richColumnGroup/body.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/richColumnGroup/headerFooter.xhtml
Removed:
modules/tests/metamer/trunk/application/src/main/webapp/components/richColumnGroup/header.xhtml
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichColumnGroupBean.java
modules/tests/metamer/trunk/application/src/main/webapp/components/richColumnGroup/list.xhtml
Log:
rich:columnGroup - initial samples (RF-730)
Modified: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichColumnGroupBean.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichColumnGroupBean.java 2011-01-12 09:18:00 UTC (rev 20959)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichColumnGroupBean.java 2011-01-12 09:52:28 UTC (rev 20960)
@@ -55,7 +55,7 @@
logger = LoggerFactory.getLogger(getClass());
logger.debug("initializing bean " + getClass().getName());
- attributes = Attributes.getComponentAttributesFromClass(UIColumnGroup.class, getClass());
+ attributes = Attributes.getComponentAttributesFromFacesConfig(UIColumnGroup.class, getClass());
attributes.setAttribute("rendered", true);
}
Added: modules/tests/metamer/trunk/application/src/main/webapp/components/richColumnGroup/body.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richColumnGroup/body.xhtml (rev 0)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richColumnGroup/body.xhtml 2011-01-12 09:52:28 UTC (rev 20960)
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:metamer="http://java.sun.com/jsf/composite/metamer"
+ xmlns:rich="http://richfaces.org/rich" xmlns:a4j="http://richfaces.org/a4j">
+
+ <!--
+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.
+ -->
+
+ <ui:composition template="/templates/template.xhtml">
+
+ <ui:define name="head">
+ <f:metadata>
+ <f:viewParam name="templates" value="#{templateBean.templates}">
+ <f:converter converterId="templatesListConverter" />
+ </f:viewParam>
+ </f:metadata>
+ </ui:define>
+
+ <ui:define name="outOfTemplateBefore">
+ </ui:define>
+
+ <ui:define name="component">
+
+ <rich:dataTable id="richDataTable" rows="10" value="#{model.employees}" var="record">
+
+ <rich:column colspan="3">
+ <h:outputText value="#{record.name}" />
+ </rich:column>
+
+ <rich:columnGroup>
+ <rich:column>
+ <h:outputText value="#{record.title}" />
+ </rich:column>
+
+ <rich:column id="columnFavoriteColor">
+ <h:outputText value="#{record.favoriteColor}" />
+ </rich:column>
+ </rich:columnGroup>
+
+ </rich:dataTable>
+ </ui:define>
+
+ <ui:define name="outOfTemplateAfter">
+ <metamer:attributes value="#{richColumnGroupBean.attributes}" id="attributes" />
+ </ui:define>
+
+ </ui:composition>
+</html>
\ No newline at end of file
Deleted: modules/tests/metamer/trunk/application/src/main/webapp/components/richColumnGroup/header.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richColumnGroup/header.xhtml 2011-01-12 09:18:00 UTC (rev 20959)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richColumnGroup/header.xhtml 2011-01-12 09:52:28 UTC (rev 20960)
@@ -1,107 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
- xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:metamer="http://java.sun.com/jsf/composite/metamer"
- xmlns:rich="http://richfaces.org/rich" xmlns:a4j="http://richfaces.org/a4j">
-
- <!--
-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.
- -->
-
- <ui:composition template="/templates/template.xhtml">
-
- <ui:define name="head">
- <f:metadata>
- <f:viewParam name="templates" value="#{templateBean.templates}">
- <f:converter converterId="templatesListConverter" />
- </f:viewParam>
- </f:metadata>
- </ui:define>
-
- <ui:define name="outOfTemplateBefore">
- </ui:define>
-
- <ui:define name="component">
-
- <rich:dataTable id="richDataTable" rows="10" value="#{model.employees}" var="record">
-
- <f:facet name="header">
- <rich:columnGroup id="columnGroup"
- breakBefore="#{richColumnGroupBean.attributes['breakBefore'].value}"
- rendered="#{richColumnGroupBean.attributes['rendered'].value}">
- <rich:column id="colHeaderName" rowspan="2">
- <h:outputText id="colHeaderNameText" value="Name" />
- </rich:column>
- <rich:column id="colHeaderInfo" colspan="4">
- <h:outputText id="colHeaderInfoText" value="Information" />
- </rich:column>
- <rich:column id="colHeaderTitle" breakRowBefore="true">
- <h:outputText id="colHeaderTitleText" value="Title" />
- </rich:column>
- <rich:column id="colHeaderSmoker">
- <h:outputText id="colHeaderSmokerText" value="Smoker" />
- </rich:column>
- <rich:column id="colHeaderColor">
- <h:outputText id="colHeaderColorText" value="Favorite Color" />
- </rich:column>
- <rich:column id="colHeaderNumberOfKids">
- <h:outputText id="colHeaderNumberOfKidsText" value="Number of Kids" />
- </rich:column>
- </rich:columnGroup>
- </f:facet>
-
- <rich:column id="columnName">
- <h:outputText value="#{record.name}" />
- </rich:column>
-
- <rich:column id="columnTitle">
- <h:outputText value="#{record.title}" />
- </rich:column>
-
- <rich:column id="columnSmoker">
- <h:selectBooleanCheckbox id="smokerCheckbox" value="#{record.smoker}">
- <a4j:ajax/>
- </h:selectBooleanCheckbox>
- </rich:column>
-
- <rich:column id="columnFavoriteColor">
- <h:outputText value="#{record.favoriteColor}" />
- </rich:column>
-
- <rich:column id="columnNumberOfKids">
- <rich:inputNumberSpinner id="numberOfKidsSpinner" value="#{record.numberOfKids}">
- <a4j:ajax/>
- </rich:inputNumberSpinner>
- </rich:column>
-
- <f:facet name="footer">
- <rich:dataScroller id="scroller2" for="richDataTable" page="#{richColumnGroupBean.page}" maxPages="7" render="richDataTable" />
- </f:facet>
-
- </rich:dataTable>
- </ui:define>
-
- <ui:define name="outOfTemplateAfter">
- <metamer:attributes value="#{richColumnGroupBean.attributes}" id="attributes" />
- </ui:define>
-
- </ui:composition>
-</html>
\ No newline at end of file
Copied: modules/tests/metamer/trunk/application/src/main/webapp/components/richColumnGroup/headerFooter.xhtml (from rev 20949, modules/tests/metamer/trunk/application/src/main/webapp/components/richColumnGroup/header.xhtml)
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richColumnGroup/headerFooter.xhtml (rev 0)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richColumnGroup/headerFooter.xhtml 2011-01-12 09:52:28 UTC (rev 20960)
@@ -0,0 +1,135 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:metamer="http://java.sun.com/jsf/composite/metamer"
+ xmlns:rich="http://richfaces.org/rich" xmlns:a4j="http://richfaces.org/a4j">
+
+ <!--
+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.
+ -->
+
+ <ui:composition template="/templates/template.xhtml">
+
+ <ui:define name="head">
+ <f:metadata>
+ <f:viewParam name="templates" value="#{templateBean.templates}">
+ <f:converter converterId="templatesListConverter" />
+ </f:viewParam>
+ </f:metadata>
+ </ui:define>
+
+ <ui:define name="outOfTemplateBefore">
+ </ui:define>
+
+ <ui:define name="component">
+
+ <rich:dataTable id="richDataTable" rows="10" value="#{model.employees}" var="record">
+
+ <f:facet name="header">
+
+
+ <rich:columnGroup id="columnGroup"
+ rendered="#{richColumnGroupBean.attributes['rendered'].value}">
+ <rich:column id="colHeaderName" rowspan="2">
+ <h:outputText id="colHeaderNameText" value="Name" />
+ </rich:column>
+ <rich:column id="colHeaderInfo" colspan="4">
+ <h:outputText id="colHeaderInfoText" value="Information" />
+ </rich:column>
+ <rich:column id="colHeaderTitle" breakRowBefore="true">
+ <h:outputText id="colHeaderTitleText" value="Title" />
+ </rich:column>
+ <rich:column id="colHeaderSmoker">
+ <h:outputText id="colHeaderSmokerText" value="Smoker" />
+ </rich:column>
+ <rich:column id="colHeaderColor">
+ <h:outputText id="colHeaderColorText" value="Favorite Color" />
+ </rich:column>
+ <rich:column id="colHeaderNumberOfKids">
+ <h:outputText id="colHeaderNumberOfKidsText" value="Number of Kids" />
+ </rich:column>
+ </rich:columnGroup>
+
+ </f:facet>
+
+ <rich:column id="columnName">
+ <h:outputText value="#{record.name}" />
+ </rich:column>
+
+ <rich:column id="columnTitle">
+ <h:outputText value="#{record.title}" />
+ </rich:column>
+
+ <rich:column id="columnSmoker">
+ <h:selectBooleanCheckbox id="smokerCheckbox" value="#{record.smoker}">
+ <a4j:ajax/>
+ </h:selectBooleanCheckbox>
+ </rich:column>
+
+ <rich:column id="columnFavoriteColor">
+ <h:outputText value="#{record.favoriteColor}" />
+ </rich:column>
+
+ <rich:column id="columnNumberOfKids">
+ <rich:inputNumberSpinner id="numberOfKidsSpinner" value="#{record.numberOfKids}">
+ <a4j:ajax/>
+ </rich:inputNumberSpinner>
+ </rich:column>
+
+ <f:facet name="footer">
+
+
+ <rich:columnGroup id="columnGroup1"
+ rendered="#{richColumnGroupBean.attributes['rendered'].value}">
+ <rich:column colspan="5">
+ <rich:dataScroller />
+ </rich:column>
+ <rich:column id="colHeaderName1" rowspan="2" breakRowBefore="true">
+ <h:outputText id="colHeaderNameText1" value="Name" />
+ </rich:column>
+ <rich:column id="colHeaderTitle1" >
+ <h:outputText id="colHeaderTitleText1" value="Title" />
+ </rich:column>
+ <rich:column id="colHeaderSmoker1">
+ <h:outputText id="colHeaderSmokerText1" value="Smoker" />
+ </rich:column>
+ <rich:column id="colHeaderColor1">
+ <h:outputText id="colHeaderColorText1" value="Favorite Color" />
+ </rich:column>
+ <rich:column id="colHeaderNumberOfKids1">
+ <h:outputText id="colHeaderNumberOfKidsText1" value="Number of Kids" />
+ </rich:column>
+ <rich:column id="colHeaderInfo1" colspan="4" breakRowBefore="true">
+ <h:outputText id="colHeaderInfoText1" value="Information" />
+ </rich:column>
+ </rich:columnGroup>
+
+ </f:facet>
+
+ </rich:dataTable>
+ </ui:define>
+
+ <ui:define name="outOfTemplateAfter">
+ <metamer:attributes value="#{richColumnGroupBean.attributes}" id="attributes" />
+ </ui:define>
+
+ </ui:composition>
+</html>
\ No newline at end of file
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/richColumnGroup/list.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richColumnGroup/list.xhtml 2011-01-12 09:18:00 UTC (rev 20959)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richColumnGroup/list.xhtml 2011-01-12 09:52:28 UTC (rev 20960)
@@ -31,9 +31,13 @@
<ui:define name="links">
- <metamer:testPageLink id="header" outcome="header" value="Header">
- Simple page that contains a table using <b>rich:columnGroup</b> and input boxes for all its attributes.
+ <metamer:testPageLink id="headerFooter" outcome="headerFooter" value="Header and Footer">
+ <b>rich:columnGroup</b> in the header and footer facets of the table
</metamer:testPageLink>
+
+ <metamer:testPageLink id="body" outcome="body" value="Body">
+ <b>rich:columnGroup</b> in the body of the table
+ </metamer:testPageLink>
</ui:define>
13 years, 3 months
JBoss Rich Faces SVN: r20959 - in modules/tests/metamer/trunk: ftest-source/src/main/java/org/richfaces/tests/metamer/ftest and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2011-01-12 04:18:00 -0500 (Wed, 12 Jan 2011)
New Revision: 20959
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richToolbarGroup/
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richToolbarGroup/TestRichToolbarGroup.java
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richToolbarGroup/simple.xhtml
Log:
https://issues.jboss.org/browse/RFPL-955
* added 20 tests for rich:toolbarGroup
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/richToolbarGroup/simple.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richToolbarGroup/simple.xhtml 2011-01-12 00:25:30 UTC (rev 20958)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richToolbarGroup/simple.xhtml 2011-01-12 09:18:00 UTC (rev 20959)
@@ -2,11 +2,11 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:metamer="http://java.sun.com/jsf/composite/metamer"
- xmlns:rich="http://richfaces.org/rich" xmlns:a4j="http://richfaces.org/a4j">
+ xmlns:rich="http://richfaces.org/rich" >
<!--
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.
@@ -69,15 +69,13 @@
onitemmouseover="#{richToolbarGroupBean.attributes['onitemmouseover'].value}"
onitemmouseup="#{richToolbarGroupBean.attributes['onitemmouseup'].value}"
rendered="#{richToolbarGroupBean.attributes['rendered'].value}"
- style="#{richToolbarGroupBean.attributes['style'].value}"
- styleClass="#{richToolbarGroupBean.attributes['styleClass'].value}"
>
- <h:graphicImage library="images/icons" name="create_doc.gif" styleClass="pic" />
- <h:graphicImage library="images/icons" name="create_folder.gif" styleClass="pic" />
- <h:graphicImage library="images/icons" name="copy.gif" styleClass="pic" />
- <h:graphicImage library="images/icons" name="save.gif" styleClass="pic" />
- <h:graphicImage library="images/icons" name="save_as.gif" styleClass="pic" />
- <h:graphicImage library="images/icons" name="save_all.gif" styleClass="pic" />
+ <h:graphicImage id="createDocument" library="images/icons" name="create_doc.gif" styleClass="pic" />
+ <h:graphicImage id="createFolder" library="images/icons" name="create_folder.gif" styleClass="pic" />
+ <h:graphicImage id="copy" library="images/icons" name="copy.gif" styleClass="pic" />
+ <h:graphicImage id="save" library="images/icons" name="save.gif" styleClass="pic" />
+ <h:graphicImage id="saveAs" library="images/icons" name="save_as.gif" styleClass="pic" />
+ <h:graphicImage id="saveAll" library="images/icons" name="save_all.gif" styleClass="pic" />
</rich:toolbarGroup>
<rich:toolbarGroup id="group2" location="right">
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richToolbarGroup/TestRichToolbarGroup.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richToolbarGroup/TestRichToolbarGroup.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richToolbarGroup/TestRichToolbarGroup.java 2011-01-12 09:18:00 UTC (rev 20959)
@@ -0,0 +1,263 @@
+/*******************************************************************************
+ * 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.richToolbarGroup;
+
+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.assertTrue;
+
+import java.net.URL;
+
+import org.jboss.test.selenium.dom.Event;
+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.Inject;
+import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
+import org.richfaces.tests.metamer.ftest.annotations.Use;
+import org.testng.annotations.Test;
+
+/**
+ * Test case for page /faces/components/richToolbarGroup/simple.xhtml
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public class TestRichToolbarGroup extends AbstractMetamerTest {
+
+ private JQueryLocator toolbar = pjq("table[id$=toolbar]");
+ private JQueryLocator separator = pjq("td.rf-tb-sep");
+ private JQueryLocator[] items = {pjq("td[id$=createDocument_itm]"), pjq("td[id$=createFolder_itm]"),
+ pjq("td[id$=copy_itm]"), pjq("td[id$=save_itm]"), pjq("td[id$=saveAs_itm]"), pjq("td[id$=saveAll_itm]")};
+ private JQueryLocator input = pjq("td[id$=input_itm]");
+ private JQueryLocator button = pjq("td[id$=button_itm]");
+ private String[] separators = {"disc", "grid", "line", "square"};
+ @Inject
+ @Use(empty = true)
+ private JQueryLocator item;
+ @Inject
+ @Use(empty = true)
+ private String itemSeparator;
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/richToolbarGroup/simple.xhtml");
+ }
+
+ @Test
+ public void testInit() {
+ assertTrue(selenium.isElementPresent(toolbar), "Toolbar should be present on the page.");
+ assertTrue(selenium.isVisible(toolbar), "Toolbar should be visible.");
+ assertFalse(selenium.isElementPresent(separator), "No item separator should be present on the page.");
+ assertTrue(selenium.isElementPresent(input), "Input should be present on the page.");
+ assertTrue(selenium.isVisible(input), "Input should be visible.");
+ assertTrue(selenium.isElementPresent(button), "Button should be present on the page.");
+ assertTrue(selenium.isVisible(button), "Button should be visible.");
+ }
+
+ @Test
+ @Use(field = "item", value = "items")
+ public void testInitItems() {
+ assertTrue(selenium.isElementPresent(item), "Item (" + item + ") should be present on the page.");
+ assertTrue(selenium.isVisible(item), "Item (" + item + ") should be visible.");
+ }
+
+ @Test
+ @Use(field = "item", value = "items")
+ @IssueTracking("https://issues.jboss.org/browse/RF-9976")
+ public void testItemClass() {
+ testStyleClass(item, "itemClass");
+ }
+
+ @Test
+ @Use(field = "itemSeparator", value = "separators")
+ public void testItemSeparatorCorrect() {
+ selenium.select(pjq("select[id$=itemSeparatorInput]"), optionLabel(itemSeparator));
+ selenium.waitForPageToLoad();
+
+ JQueryLocator separatorDiv = separator.getDescendant(jq("div.rf-tb-sep-" + itemSeparator));
+
+ assertTrue(selenium.isElementPresent(separator), "Item separator should be present on the page.");
+ assertEquals(selenium.getCount(separator), 5, "Number of separators.");
+ assertTrue(selenium.isElementPresent(separatorDiv), "Item separator does not work correctly.");
+ assertEquals(selenium.getCount(separatorDiv), 5, "Number of separators.");
+ }
+
+ @Test
+ public void testItemSeparatorNone() {
+ selenium.select(pjq("select[id$=itemSeparatorInput]"), optionLabel("none"));
+ selenium.waitForPageToLoad();
+
+ assertFalse(selenium.isElementPresent(separator), "No item separator should be present on the page.");
+
+ selenium.select(input, optionLabel("null"));
+ selenium.waitForPageToLoad();
+
+ assertFalse(selenium.isElementPresent(separator), "No item separator should be present on the page.");
+ }
+
+ @Test
+ public void testItemSeparatorCustom() {
+ selenium.select(pjq("select[id$=itemSeparatorInput]"), optionLabel("star"));
+ selenium.waitForPageToLoad();
+
+ JQueryLocator separatorImg = separator.getDescendant(jq("> img"));
+ AttributeLocator attr = separatorImg.getAttribute(Attribute.SRC);
+
+ assertTrue(selenium.isElementPresent(separator), "Item separator should be present on the page.");
+ assertEquals(selenium.getCount(separator), 5, "Number of separators.");
+ assertTrue(selenium.isElementPresent(separatorImg), "Item separator do not work correctly.");
+ assertEquals(selenium.getCount(separatorImg), 5, "Number of separators.");
+
+ String src = selenium.getAttribute(attr);
+ assertTrue(src.contains("star.png"), "Separator's image should link to picture star.png.");
+ }
+
+ @Test
+ public void testItemSeparatorNonExisting() {
+ JQueryLocator input = pjq("select[id$=itemSeparatorInput]");
+ selenium.select(input, optionLabel("non-existing"));
+ selenium.waitForPageToLoad();
+
+ JQueryLocator separatorImg = separator.getDescendant(jq("> img"));
+ AttributeLocator attr = separatorImg.getAttribute(Attribute.SRC);
+
+ assertTrue(selenium.isElementPresent(separator), "Item separators should be present on the page.");
+ assertEquals(selenium.getCount(separator), 5, "Number of separators.");
+ assertTrue(selenium.isElementPresent(separatorImg), "Item separators do not work correctly.");
+ assertEquals(selenium.getCount(separatorImg), 5, "Number of separators.");
+
+ String src = selenium.getAttribute(attr);
+ assertTrue(src.contains("non-existing"), "Separator's image should link to \"non-existing\".");
+ }
+
+ @Test
+ @Use(field = "item", value = "items")
+ @IssueTracking("https://issues.jboss.org/browse/RF-9976")
+ public void testItemStyle() {
+ testStyle(item, "itemStyle");
+ }
+
+ @Test
+ public void testLocation() {
+ JQueryLocator emptyCellBefore = toolbar.getDescendant(jq("td:not([class]):nth-child(1)"));
+ JQueryLocator emptyCellAfter = toolbar.getDescendant(jq("td:not([class]):nth-child(7)"));
+
+ assertFalse(selenium.isElementPresent(emptyCellBefore), "Toolbar group should be located on the left.");
+ assertTrue(selenium.isElementPresent(emptyCellAfter), "Toolbar group should be located on the left.");
+
+ selenium.type(pjq("input[id$=locationInput]"), "right");
+ selenium.waitForPageToLoad();
+
+ assertTrue(selenium.isElementPresent(emptyCellBefore), "Toolbar group should be located on the right.");
+ assertFalse(selenium.isElementPresent(emptyCellAfter), "Toolbar group should be located on the right.");
+
+ selenium.type(pjq("input[id$=locationInput]"), "wrong");
+ selenium.waitForPageToLoad();
+
+ assertFalse(selenium.isElementPresent(emptyCellBefore), "Toolbar group should be located on the left.");
+ assertTrue(selenium.isElementPresent(emptyCellAfter), "Toolbar group should be located on the left.");
+ }
+
+ @Test
+ @Use(field = "item", value = "items")
+ public void testOnitemclick() {
+ testFireEvent(Event.CLICK, item, "itemclick");
+ }
+
+ @Test
+ @Use(field = "item", value = "items")
+ public void testOnitemdblclick() {
+ testFireEvent(Event.DBLCLICK, item, "itemdblclick");
+ }
+
+ @Test
+ @Use(field = "item", value = "items")
+ public void testOnitemkeydown() {
+ testFireEvent(Event.KEYDOWN, item, "itemkeydown");
+ }
+
+ @Test
+ @Use(field = "item", value = "items")
+ public void testOnitemkeypress() {
+ testFireEvent(Event.KEYPRESS, item, "itemkeypress");
+ }
+
+ @Test
+ @Use(field = "item", value = "items")
+ public void testOnitemkeyup() {
+ testFireEvent(Event.KEYUP, item, "itemkeyup");
+ }
+
+ @Test
+ @Use(field = "item", value = "items")
+ public void testOnitemmousedown() {
+ testFireEvent(Event.MOUSEDOWN, item, "itemmousedown");
+ }
+
+ @Test
+ @Use(field = "item", value = "items")
+ public void testOnitemmousemove() {
+ testFireEvent(Event.MOUSEMOVE, item, "itemmousemove");
+ }
+
+ @Test
+ @Use(field = "item", value = "items")
+ public void testOnitemmouseout() {
+ testFireEvent(Event.MOUSEOUT, item, "itemmouseout");
+ }
+
+ @Test
+ @Use(field = "item", value = "items")
+ public void testOnitemmouseover() {
+ testFireEvent(Event.MOUSEOVER, item, "itemmouseover");
+ }
+
+ @Test
+ @Use(field = "item", value = "items")
+ public void testOnitemmouseup() {
+ testFireEvent(Event.MOUSEUP, item, "itemmouseup");
+ }
+
+ @Test
+ public void testRendered() {
+ JQueryLocator renderedInput = pjq("input[type=radio][name$=renderedInput][value=false]");
+ selenium.click(renderedInput);
+ selenium.waitForPageToLoad();
+
+ assertTrue(selenium.isElementPresent(toolbar), "Toolbar should be present on the page.");
+ assertTrue(selenium.isVisible(toolbar), "Toolbar should be visible.");
+ assertFalse(selenium.isElementPresent(separator), "No item separator should be present on the page.");
+ assertTrue(selenium.isElementPresent(renderedInput), "Input should be present on the page.");
+ assertTrue(selenium.isVisible(renderedInput), "Input should be visible.");
+ assertTrue(selenium.isElementPresent(button), "Button should be present on the page.");
+ assertTrue(selenium.isVisible(button), "Button should be visible.");
+
+ for (int i = 0; i < 6; i++) {
+ assertFalse(selenium.isElementPresent(items[i]), "Item " + (i + 1) + " should not be rendered.");
+ }
+ }
+}
Property changes on: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richToolbarGroup/TestRichToolbarGroup.java
___________________________________________________________________
Name: svn:keywords
+ Revision
13 years, 3 months
JBoss Rich Faces SVN: r20958 - trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2011-01-11 19:25:30 -0500 (Tue, 11 Jan 2011)
New Revision: 20958
Modified:
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/FunctionProcessor.java
Log:
CODING IN PROGRESS - issue RF-10179: CDK: functions not generated into taglib properly
https://issues.jboss.org/browse/RF-10179
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/FunctionProcessor.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/FunctionProcessor.java 2011-01-12 00:11:56 UTC (rev 20957)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/FunctionProcessor.java 2011-01-12 00:25:30 UTC (rev 20958)
@@ -36,6 +36,7 @@
import org.richfaces.cdk.CdkProcessingException;
import org.richfaces.cdk.annotations.Function;
+import org.richfaces.cdk.annotations.TagType;
import org.richfaces.cdk.apt.SourceUtils;
import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.ComponentLibrary;
@@ -92,7 +93,7 @@
} else {
model.setName(methodElement.getSimpleName().toString());
}
- utils.setModelProperty(model, function, "type");
+ model.setType(utils.getAnnotationValue(function, "type", TagType.class));
setDescription(model, function, getDocComment(methodElement));
// Calculate method signature
StringBuilder signature = new StringBuilder();
13 years, 3 months
JBoss Rich Faces SVN: r20957 - trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2011-01-11 19:11:56 -0500 (Tue, 11 Jan 2011)
New Revision: 20957
Modified:
trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/LibraryModelWrapper.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/ModelElementBaseTemplateModel.java
Log:
RESOLVED - issue RF-9847: @JsfBehaviorRenderer annotation ignored
https://issues.jboss.org/browse/RF-9847
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/LibraryModelWrapper.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/LibraryModelWrapper.java 2011-01-11 23:45:11 UTC (rev 20956)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/LibraryModelWrapper.java 2011-01-12 00:11:56 UTC (rev 20957)
@@ -26,9 +26,9 @@
import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.EventModel;
import org.richfaces.cdk.model.FacesId;
+import org.richfaces.cdk.model.ModelElementBase;
import org.richfaces.cdk.model.PropertyBase;
import org.richfaces.cdk.model.TagModel;
-import org.richfaces.cdk.model.ViewElement;
import freemarker.ext.beans.BeansWrapper;
import freemarker.ext.beans.StringModel;
@@ -72,7 +72,7 @@
return create(obj, EventTemplateModel.FACTORY);
} else if (obj instanceof TagModel) {
return create(obj, TagTemplateModel.FACTORY);
- } else if (obj instanceof ViewElement) {
+ } else if (obj instanceof ModelElementBase ) {
return create(obj, ModelElementBaseTemplateModel.FACTORY);
} else {
return super.wrap(obj);
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/ModelElementBaseTemplateModel.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/ModelElementBaseTemplateModel.java 2011-01-11 23:45:11 UTC (rev 20956)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/ModelElementBaseTemplateModel.java 2011-01-12 00:11:56 UTC (rev 20957)
@@ -180,13 +180,13 @@
public TemplateModel getImplementedInterfaces() throws TemplateModelException {
Set<ClassName> result = Sets.newTreeSet();
- if (getEventNames().size() > 0) {
- result.add(ClassName.parseName("javax.faces.component.behavior.ClientBehaviorHolder"));
- }
// Import all interfaces implemented by the generated class.
result.addAll(model.getInterfaces());
if (model instanceof ComponentModel) {
ComponentModel component = (ComponentModel) model;
+ if (getEventNames().size() > 0) {
+ result.add(ClassName.parseName("javax.faces.component.behavior.ClientBehaviorHolder"));
+ }
for (EventModel event : component.getEvents()) {
ClassName sourceInterface = event.getSourceInterface();
if (null != sourceInterface) {
13 years, 3 months
JBoss Rich Faces SVN: r20956 - in trunk/cdk: generator/src/main/java/org/richfaces/cdk/apt and 6 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2011-01-11 18:45:11 -0500 (Tue, 11 Jan 2011)
New Revision: 20956
Added:
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/BehaviorRendererProcessor.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/GeneratedFacesComponent.java
trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/event/TestBehavior.java
trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/renderkit/TestBehaviorRenderer.java
Modified:
trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/JsfBehaviorRenderer.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/AptModule.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/BehaviorProcessor.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/ProcessorBase.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/BeanModelBase.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/BehaviorModel.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/BehaviorRendererModel.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/DescriptionGroupBase.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/FacesComponent.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/FacetModel.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/ModelElementBase.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/PropertyBase.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/RenderKitModel.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/ViewElement.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/validator/ValidatorImpl.java
trunk/cdk/generator/src/main/resources/META-INF/templates/behavior.ftl
trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/renderkit/RendererUtils.java
Log:
RESOLVED - issue RF-9847: @JsfBehaviorRenderer annotation ignored
https://issues.jboss.org/browse/RF-9847
Modified: trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/JsfBehaviorRenderer.java
===================================================================
--- trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/JsfBehaviorRenderer.java 2011-01-11 20:06:50 UTC (rev 20955)
+++ trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/JsfBehaviorRenderer.java 2011-01-11 23:45:11 UTC (rev 20956)
@@ -28,6 +28,8 @@
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
+import javax.faces.render.RenderKitFactory;
+
/**
* <p class="changed_added_4_0"></p>
* @author asmirnov(a)exadel.com
@@ -39,8 +41,10 @@
public String type() default "";
- public String renderKitId() default "";
+ public String renderKitId() default RenderKitFactory.HTML_BASIC_RENDER_KIT;
+ public String generate() default "";
+
public Description description() default @Description();
}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/AptModule.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/AptModule.java 2011-01-11 20:06:50 UTC (rev 20955)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/AptModule.java 2011-01-11 23:45:11 UTC (rev 20956)
@@ -27,6 +27,7 @@
import org.richfaces.cdk.apt.processors.AttributesProcessor;
import org.richfaces.cdk.apt.processors.AttributesProcessorImpl;
import org.richfaces.cdk.apt.processors.BehaviorProcessor;
+import org.richfaces.cdk.apt.processors.BehaviorRendererProcessor;
import org.richfaces.cdk.apt.processors.CdkAnnotationProcessor;
import org.richfaces.cdk.apt.processors.ComponentProcessor;
import org.richfaces.cdk.apt.processors.ConverterProcessor;
@@ -58,6 +59,7 @@
Multibinder<CdkAnnotationProcessor> setBinder = Multibinder.newSetBinder(binder(), CdkAnnotationProcessor.class);
setBinder.addBinding().to(ComponentProcessor.class);
setBinder.addBinding().to(BehaviorProcessor.class);
+ setBinder.addBinding().to(BehaviorRendererProcessor.class);
setBinder.addBinding().to(RendererProcessor.class);
setBinder.addBinding().to(ConverterProcessor.class);
setBinder.addBinding().to(ValidatorProcessor.class);
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/BehaviorProcessor.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/BehaviorProcessor.java 2011-01-11 20:06:50 UTC (rev 20955)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/BehaviorProcessor.java 2011-01-11 23:45:11 UTC (rev 20956)
@@ -57,6 +57,11 @@
setTagInfo(behavior, behaviorModel);
processAttributes((TypeElement) element, behaviorModel, behavior);
setDescription(behaviorModel, behavior, getDocComment(element));
+ // Behavior renderer
+ if(!sourceUtils.isDefaultValue(behavior, "renderer")){
+ AnnotationMirror renderer = sourceUtils.getAnnotationValue(behavior, "renderer", AnnotationMirror.class);
+ sourceUtils.setModelProperty(behaviorModel, renderer, "rendererType","type");
+ }
library.getBehaviors().add(behaviorModel);
}
Added: trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/BehaviorRendererProcessor.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/BehaviorRendererProcessor.java (rev 0)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/BehaviorRendererProcessor.java 2011-01-11 23:45:11 UTC (rev 20956)
@@ -0,0 +1,65 @@
+/*
+ * $Id: BehaviorRendererProcessor.java 20938 2011-01-10 22:35:38Z alexsmirnov $
+ *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.cdk.apt.processors;
+
+import java.lang.annotation.Annotation;
+
+import javax.lang.model.element.AnnotationMirror;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.TypeElement;
+
+import org.richfaces.cdk.CdkProcessingException;
+import org.richfaces.cdk.annotations.JsfBehaviorRenderer;
+import org.richfaces.cdk.apt.SourceUtils;
+import org.richfaces.cdk.model.BehaviorRendererModel;
+import org.richfaces.cdk.model.ComponentLibrary;
+import org.richfaces.cdk.model.FacesId;
+
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public class BehaviorRendererProcessor extends ProcessorBase implements CdkAnnotationProcessor {
+
+ @Override
+ public void process(Element element, ComponentLibrary library) throws CdkProcessingException {
+ SourceUtils sourceUtils = getSourceUtils();
+ AnnotationMirror behaviorRenderer = sourceUtils.getAnnotationMirror(element, JsfBehaviorRenderer.class);
+
+ BehaviorRendererModel behaviorRendererModel = new BehaviorRendererModel();
+ setClassNames((TypeElement) element, behaviorRendererModel, behaviorRenderer);
+ sourceUtils.setModelProperty(behaviorRendererModel, behaviorRenderer, "id","type");
+
+ setDescription(behaviorRendererModel, behaviorRenderer, getDocComment(element));
+ FacesId renderKitId = sourceUtils.getAnnotationValue(behaviorRenderer, "renderKitId", FacesId.class);
+ library.addRenderKit(renderKitId).getBehaviorRenderers().add(behaviorRendererModel);
+ }
+
+ @Override
+ public Class<? extends Annotation> getProcessedAnnotation() {
+ return JsfBehaviorRenderer.class;
+ }
+
+}
Property changes on: trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/BehaviorRendererProcessor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
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-11 20:06:50 UTC (rev 20955)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/ProcessorBase.java 2011-01-11 23:45:11 UTC (rev 20956)
@@ -14,6 +14,7 @@
import org.richfaces.cdk.apt.SourceUtils;
import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.DescriptionGroup;
+import org.richfaces.cdk.model.GeneratedFacesComponent;
import org.richfaces.cdk.model.ModelCollection;
import org.richfaces.cdk.model.ModelElementBase;
import org.richfaces.cdk.model.TagModel;
@@ -63,7 +64,7 @@
return tagModel;
}
- protected void setClassNames(TypeElement componentElement, ModelElementBase 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")) {
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/BeanModelBase.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/BeanModelBase.java 2011-01-11 20:06:50 UTC (rev 20955)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/BeanModelBase.java 2011-01-11 23:45:11 UTC (rev 20956)
@@ -45,7 +45,6 @@
}
}
});
-
/**
* <p class="changed_added_4_0">
* Represents JSF component attributes and properties.
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/BehaviorModel.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/BehaviorModel.java 2011-01-11 20:06:50 UTC (rev 20955)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/BehaviorModel.java 2011-01-11 23:45:11 UTC (rev 20956)
@@ -33,7 +33,10 @@
public class BehaviorModel extends ModelElementBase implements ModelElement<BehaviorModel> {
private static final long serialVersionUID = -5023589072935390357L;
+
+ private FacesId rendererType;
+
public BehaviorModel() {
}
@@ -41,6 +44,23 @@
setId(behaviorId);
}
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param rendererType the rendererType to set
+ */
+ public void setRendererType(FacesId rendererType) {
+ this.rendererType = rendererType;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the rendererType
+ */
+ @Merge
+ public FacesId getRendererType() {
+ return rendererType;
+ }
+
public <R,D> R accept(Visitor<R,D> visitor, D data) {
return visitor.visitBehavior(this,data);
}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/BehaviorRendererModel.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/BehaviorRendererModel.java 2011-01-11 20:06:50 UTC (rev 20955)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/BehaviorRendererModel.java 2011-01-11 23:45:11 UTC (rev 20956)
@@ -31,11 +31,14 @@
*
*/
@SuppressWarnings("serial")
-public class BehaviorRendererModel implements ModelElement<BehaviorRendererModel>, FacesComponent {
+public class BehaviorRendererModel extends DescriptionGroupBase implements ModelElement<BehaviorRendererModel>, GeneratedFacesComponent {
private ClassName baseClass;
private ClassName targetClass;
- private boolean generate;
private FacesId id;
+ /**
+ * <p class="changed_added_4_0">Is that bean property generate in the class or should be generated ?</p>
+ */
+ private Boolean generate;
public BehaviorRendererModel(FacesId type) {
this.id = type;
@@ -95,22 +98,7 @@
this.baseClass = baseClass;
}
- /**
- * <p class="changed_added_4_0"></p>
- * @return the generate
- */
- public Boolean getGenerate() {
- return this.generate;
- }
- /**
- * <p class="changed_added_4_0"></p>
- * @param generate the generate to set
- */
- public void setGenerate(Boolean generate) {
- this.generate = generate;
- }
-
@Override
public void merge(BehaviorRendererModel other) {
ComponentLibrary.merge(this, other);
@@ -133,4 +121,13 @@
}
return false;
}
+
+ @Merge
+ public Boolean getGenerate() {
+ return generate;
+ }
+
+ public void setGenerate(Boolean generate) {
+ this.generate = generate;
+ }
}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/DescriptionGroupBase.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/DescriptionGroupBase.java 2011-01-11 20:06:50 UTC (rev 20955)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/DescriptionGroupBase.java 2011-01-11 23:45:11 UTC (rev 20956)
@@ -29,11 +29,6 @@
public class DescriptionGroupBase implements DescriptionGroup, Extensible<ConfigExtension> {
/**
- * <p class="changed_added_4_0">Is that bean property generate in the class or should be generated ?</p>
- */
- private Boolean generate ;
-
- /**
* <p class="changed_added_4_0">
* Long description for documentation
* </p>
@@ -82,15 +77,6 @@
this.icon = icon;
}
- @Merge
- public Boolean getGenerate() {
- return generate;
- }
-
- public void setGenerate(Boolean generate) {
- this.generate = generate;
- }
-
/**
* <p class="changed_added_4_0"></p>
*
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/FacesComponent.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/FacesComponent.java 2011-01-11 20:06:50 UTC (rev 20955)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/FacesComponent.java 2011-01-11 23:45:11 UTC (rev 20956)
@@ -1,24 +1,9 @@
package org.richfaces.cdk.model;
-
import org.richfaces.cdk.util.ComparatorUtils;
import com.google.common.base.Predicate;
-
-/**
- * <p class="changed_added_4_0">This Interface describes all JSF objects that can be generated by cdk:</p>
- * <ul>
- * <li>{@link UIComponent}</li>
- * <li>{@link Renderer}</li>
- * <li>{@link Converter}</li>
- * <li>{@link Validator}</li>
- * <li>{@link ClientBehavior}</li>
- * <li>{@link javax.faces.render.ClientBehaviorRenderer}
- * </ul>
- * @author asmirnov(a)exadel.com
- *
- */
public interface FacesComponent {
/**
@@ -26,10 +11,10 @@
* @author asmirnov(a)exadel.com
*
*/
- public static final class ComponentPredicate implements Predicate<FacesComponent> {
+ public static final class ComponentPredicate implements Predicate<GeneratedFacesComponent> {
private final FacesId id;
-
+
/**
* <p class="changed_added_4_0"></p>
* @param id
@@ -37,7 +22,7 @@
public ComponentPredicate(FacesId id) {
this.id = id;
}
-
+
/**
* <p class="changed_added_4_0"></p>
* @param name
@@ -47,56 +32,33 @@
}
@Override
- public boolean apply(FacesComponent input) {
+ public boolean apply(GeneratedFacesComponent input) {
return ComparatorUtils.nullSafeEquals(input.getId(), this.id);
}
}
+
/**
* <p class="changed_added_4_0"></p>
* @return
*/
- public FacesId getId();
+ FacesId getId();
/**
* <p class="changed_added_4_0"></p>
* @param id
*/
- public void setId(FacesId id);
+ void setId(FacesId id);
/**
* <p class="changed_added_4_0"></p>
* @param targetClass the targetClass to set
*/
- public void setTargetClass(ClassName targetClass);
+ void setTargetClass(ClassName targetClass);
/**
* <p class="changed_added_4_0"></p>
* @return the targetClass
*/
- public ClassName getTargetClass();
+ ClassName getTargetClass();
- /**
- * <p class="changed_added_4_0"></p>
- * @return the baseClass
- */
- public ClassName getBaseClass();
-
- /**
- * <p class="changed_added_4_0"></p>
- * @param baseClass
- */
- public abstract void setBaseClass(ClassName baseClass);
-
- /**
- * <p class="changed_added_4_0"></p>
- * @return
- */
- public Boolean getGenerate();
-
- /**
- * <p class="changed_added_4_0"></p>
- * @param generate
- */
- public void setGenerate(Boolean generate);
-
}
\ No newline at end of file
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/FacetModel.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/FacetModel.java 2011-01-11 20:06:50 UTC (rev 20955)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/FacetModel.java 2011-01-11 23:45:11 UTC (rev 20956)
@@ -38,6 +38,11 @@
private String name;
+ /**
+ * <p class="changed_added_4_0">Is that bean property generate in the class or should be generated ?</p>
+ */
+ private Boolean generate;
+
public FacetModel() {
}
@@ -70,4 +75,13 @@
public boolean same(FacetModel other) {
return ComparatorUtils.nullSafeEquals(this.getName(), other.getName());
}
+
+ @Merge
+ public Boolean getGenerate() {
+ return generate;
+ }
+
+ public void setGenerate(Boolean generate) {
+ this.generate = generate;
+ }
}
Copied: trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/GeneratedFacesComponent.java (from rev 20948, trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/FacesComponent.java)
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/GeneratedFacesComponent.java (rev 0)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/GeneratedFacesComponent.java 2011-01-11 23:45:11 UTC (rev 20956)
@@ -0,0 +1,46 @@
+package org.richfaces.cdk.model;
+
+
+
+
+
+/**
+ * <p class="changed_added_4_0">This Interface describes all JSF objects that can be generated by cdk:</p>
+ * <ul>
+ * <li>{@link UIComponent}</li>
+ * <li>{@link Renderer}</li>
+ * <li>{@link Converter}</li>
+ * <li>{@link Validator}</li>
+ * <li>{@link ClientBehavior}</li>
+ * <li>{@link javax.faces.render.ClientBehaviorRenderer}
+ * </ul>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public interface GeneratedFacesComponent extends FacesComponent {
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the baseClass
+ */
+ public ClassName getBaseClass();
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param baseClass
+ */
+ public abstract void setBaseClass(ClassName baseClass);
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return
+ */
+ public Boolean getGenerate();
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param generate
+ */
+ public void setGenerate(Boolean generate);
+
+}
\ No newline at end of file
Property changes on: trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/GeneratedFacesComponent.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/ModelElementBase.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/ModelElementBase.java 2011-01-11 20:06:50 UTC (rev 20955)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/ModelElementBase.java 2011-01-11 23:45:11 UTC (rev 20956)
@@ -10,7 +10,7 @@
* @author asmirnov(a)exadel.com
*
*/
-public class ModelElementBase extends BeanModelBase implements FacesComponent, ViewElement {
+public class ModelElementBase extends BeanModelBase implements GeneratedFacesComponent, ViewElement {
private FacesId id;
@@ -22,7 +22,12 @@
private final Collection<ClassName> interfaces = Lists.newArrayList();
+ /**
+ * <p class="changed_added_4_0">Is that bean property generate in the class or should be generated ?</p>
+ */
+ private Boolean generate;
+
/* (non-Javadoc)
* @see org.richfaces.cdk.model.ViewElement#getTags()
*/
@@ -40,28 +45,28 @@
}
/* (non-Javadoc)
- * @see org.richfaces.cdk.model.FacesComponent#getId()
+ * @see org.richfaces.cdk.model.GeneratedFacesComponent#getId()
*/
public FacesId getId() {
return id;
}
/* (non-Javadoc)
- * @see org.richfaces.cdk.model.FacesComponent#setId(org.richfaces.cdk.model.FacesId)
+ * @see org.richfaces.cdk.model.GeneratedFacesComponent#setId(org.richfaces.cdk.model.FacesId)
*/
public void setId(FacesId id) {
this.id = id;
}
/* (non-Javadoc)
- * @see org.richfaces.cdk.model.FacesComponent#setTargetClass(org.richfaces.cdk.model.ClassName)
+ * @see org.richfaces.cdk.model.GeneratedFacesComponent#setTargetClass(org.richfaces.cdk.model.ClassName)
*/
public void setTargetClass(ClassName targetClass) {
this.targetClass = targetClass;
}
/* (non-Javadoc)
- * @see org.richfaces.cdk.model.FacesComponent#getTargetClass()
+ * @see org.richfaces.cdk.model.GeneratedFacesComponent#getTargetClass()
*/
public ClassName getTargetClass() {
return targetClass;
@@ -77,9 +82,18 @@
}
/* (non-Javadoc)
- * @see org.richfaces.cdk.model.FacesComponent#getBaseClass()
+ * @see org.richfaces.cdk.model.GeneratedFacesComponent#getBaseClass()
*/
public ClassName getBaseClass() {
return baseClass;
}
+
+ @Merge
+ public Boolean getGenerate() {
+ return generate;
+ }
+
+ public void setGenerate(Boolean generate) {
+ this.generate = generate;
+ }
}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/PropertyBase.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/PropertyBase.java 2011-01-11 20:06:50 UTC (rev 20955)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/PropertyBase.java 2011-01-11 23:45:11 UTC (rev 20956)
@@ -61,7 +61,12 @@
private boolean binding;
private String aliasFor;
+
/**
+ * <p class="changed_added_4_0">Is that bean property generate in the class or should be generated ?</p>
+ */
+ private Boolean generate;
+ /**
* <p class="changed_added_4_0"></p>
*/
public PropertyBase() {
@@ -335,4 +340,13 @@
public String toString() {
return "PropertyModel {name: " + getName() + ", type: " + getType().getName() + "}";
}
+
+ @Merge
+ public Boolean getGenerate() {
+ return generate;
+ }
+
+ public void setGenerate(Boolean generate) {
+ this.generate = generate;
+ }
}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/RenderKitModel.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/RenderKitModel.java 2011-01-11 20:06:50 UTC (rev 20955)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/RenderKitModel.java 2011-01-11 23:45:11 UTC (rev 20956)
@@ -40,8 +40,6 @@
private ClassName targetClass;
- private ClassName baseClass;
-
private FacesId id;
public RenderKitModel() {
@@ -82,22 +80,6 @@
/**
* <p class="changed_added_4_0"></p>
- * @return the baseClass
- */
- public ClassName getBaseClass() {
- return this.baseClass;
- }
-
- /**
- * <p class="changed_added_4_0"></p>
- * @param baseClass the baseClass to set
- */
- public void setBaseClass(ClassName baseClass) {
- this.baseClass = baseClass;
- }
-
- /**
- * <p class="changed_added_4_0"></p>
* @return the renderers
*/
public ModelCollection<RendererModel> getRenderers() {
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/ViewElement.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/ViewElement.java 2011-01-11 20:06:50 UTC (rev 20955)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/ViewElement.java 2011-01-11 23:45:11 UTC (rev 20956)
@@ -1,5 +1,10 @@
package org.richfaces.cdk.model;
+/**
+ * <p class="changed_added_4_0">Defines element for view elements, for which tags should be generated.</p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
public interface ViewElement {
/**
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-11 20:06:50 UTC (rev 20955)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/validator/ValidatorImpl.java 2011-01-11 23:45:11 UTC (rev 20956)
@@ -48,7 +48,7 @@
import org.richfaces.cdk.model.ConverterModel;
import org.richfaces.cdk.model.DescriptionGroup;
import org.richfaces.cdk.model.EventModel;
-import org.richfaces.cdk.model.FacesComponent;
+import org.richfaces.cdk.model.GeneratedFacesComponent;
import org.richfaces.cdk.model.FacesId;
import org.richfaces.cdk.model.FacetModel;
import org.richfaces.cdk.model.InvalidNameException;
@@ -478,7 +478,7 @@
}
}
- private <T extends FacesComponent> T findParent(Iterable<T> components, final T component)
+ private <T extends GeneratedFacesComponent> T findParent(Iterable<T> components, final T component)
throws NoSuchElementException {
return Iterables.find(components, new Predicate<T>() {
@@ -536,7 +536,7 @@
* callback to corresponding naming conventions.
* @return
*/
- protected boolean verifyTypes(FacesComponent component, NamingConventionsCallback callback) {
+ protected boolean verifyTypes(GeneratedFacesComponent component, NamingConventionsCallback callback) {
// Check JsfComponent type.
try {
if (null == component.getId()) {
@@ -570,7 +570,7 @@
return true;
}
- private void verifyGeneratedClasses(FacesComponent component, NamingConventionsCallback callback) throws CallbackException {
+ private void verifyGeneratedClasses(GeneratedFacesComponent component, NamingConventionsCallback callback) throws CallbackException {
if (null == component.getBaseClass()) {
component.setBaseClass(callback.getDefaultBaseClass());
// return;
@@ -580,7 +580,7 @@
}
}
- protected void verifyAttribute(PropertyBase attribute, FacesComponent component) {
+ protected void verifyAttribute(PropertyBase attribute, GeneratedFacesComponent component) {
// Check name.
if (Strings.isEmpty(attribute.getName())) {
log.error("No name for attribute " + attribute);
Modified: trunk/cdk/generator/src/main/resources/META-INF/templates/behavior.ftl
===================================================================
--- trunk/cdk/generator/src/main/resources/META-INF/templates/behavior.ftl 2011-01-11 20:06:50 UTC (rev 20955)
+++ trunk/cdk/generator/src/main/resources/META-INF/templates/behavior.ftl 2011-01-11 23:45:11 UTC (rev 20956)
@@ -14,12 +14,14 @@
* ${description?if_exists}
**/
@Generated({"RichFaces CDK", "4.0.0-SNAPSHOT"})
-public class ${targetClass.simpleName} extends ${baseClass} implements Behavior, PartialStateHolder {
+public class ${targetClass.simpleName} extends ${baseClass} implements Behavior, PartialStateHolder
+<#if (implemented?size > 0)>, <@util.concat seq=implemented ; interface>${interface.simpleName}</(a)util.concat></#if> {
- @Override
- public void broadcast(BehaviorEvent event) {
+ <#if rendererType?exists >
+ public String getRendererType() {
+ return "${rendererType}";
}
-
+ </#if>
<#include "_attributes-old.ftl">
<#include "_state-holder-methods-old.ftl">
Added: trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/event/TestBehavior.java
===================================================================
--- trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/event/TestBehavior.java (rev 0)
+++ trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/event/TestBehavior.java 2011-01-11 23:45:11 UTC (rev 20956)
@@ -0,0 +1,45 @@
+/*
+ * $Id$
+ * 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.cdk.test.event;
+
+import javax.faces.component.behavior.ClientBehaviorBase;
+
+import org.richfaces.cdk.annotations.JsfBehavior;
+import org.richfaces.cdk.annotations.JsfBehaviorRenderer;
+import org.richfaces.cdk.annotations.Tag;
+import org.richfaces.cdk.test.component.Html5Attributes;
+
+/**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @author asmirnov(a)exadel.com
+ *
+ */
+@JsfBehavior(interfaces = Html5Attributes.class, id = "richfaces.test.TestBehavior", renderer = @JsfBehaviorRenderer(type =TestBehavior.RICHFACES_TEST_TEST_BEHAVIOR_RENDERER), tag = @Tag(name = "testBehavior"))
+public abstract class TestBehavior extends ClientBehaviorBase {
+
+ public static final String RICHFACES_TEST_TEST_BEHAVIOR_RENDERER = "richfaces.test.TestBehaviorRenderer";
+
+}
Property changes on: trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/event/TestBehavior.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/renderkit/RendererUtils.java
===================================================================
--- trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/renderkit/RendererUtils.java 2011-01-11 20:06:50 UTC (rev 20955)
+++ trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/renderkit/RendererUtils.java 2011-01-11 23:45:11 UTC (rev 20956)
@@ -21,8 +21,45 @@
// TODO Auto-generated method stub
return null;
}
+ /**
+ * Wrapper class around object value used to transform values into particular JS objects
+ *
+ * @author Nick Belaevski
+ * @since 3.3.2
+ */
+ public enum ScriptHashVariableWrapper {
+ /**
+ * No-op default wrapper
+ */
+ noop,
+
+ /**
+ * Convert parameter to array of srings.
+ */
+ asArray
+ ,
+
+ /**
+ * Event handler functions wrapper. Wraps <pre>functionCode</pre> object into:
+ * <pre>function(event) {
+ * functionCode
+ * }</pre>
+ */
+ eventHandler;
+ /**
+ * Method that does the wrapping
+ *
+ * @param o object to wrap
+ * @return wrapped object
+ */
+ Object wrap(Object o){
+ return o;
+ }
+ }
+
+
public class Attributes {
public Attributes generic(String string, String string2,String ...events) {
Added: trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/renderkit/TestBehaviorRenderer.java
===================================================================
--- trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/renderkit/TestBehaviorRenderer.java (rev 0)
+++ trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/renderkit/TestBehaviorRenderer.java 2011-01-11 23:45:11 UTC (rev 20956)
@@ -0,0 +1,39 @@
+/*
+ * $Id$
+ * 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.cdk.test.renderkit;
+
+import javax.faces.render.ClientBehaviorRenderer;
+
+import org.richfaces.cdk.annotations.JsfBehaviorRenderer;
+import org.richfaces.cdk.test.event.TestBehavior;
+
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+(a)JsfBehaviorRenderer(type=TestBehavior.RICHFACES_TEST_TEST_BEHAVIOR_RENDERER)
+public class TestBehaviorRenderer extends ClientBehaviorRenderer {
+
+}
Property changes on: trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/renderkit/TestBehaviorRenderer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
13 years, 3 months
JBoss Rich Faces SVN: r20955 - in trunk/cdk: generator/src/main/resources/META-INF/templates and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2011-01-11 15:06:50 -0500 (Tue, 11 Jan 2011)
New Revision: 20955
Modified:
trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/FreeMakerUtils.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/LibraryModelWrapper.java
trunk/cdk/generator/src/main/resources/META-INF/templates/_attribute_accessors.ftl
trunk/cdk/generator/src/main/resources/META-INF/templates/_attributes.ftl
trunk/cdk/generator/src/main/resources/META-INF/templates/_state-holder-methods.ftl
trunk/cdk/generator/src/main/resources/META-INF/templates/component.ftl
trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/AbstractTestComponent.java
Log:
RESOLVED - issue RF-8898: CDK could generate object names that conflict with Java keywords.
https://issues.jboss.org/browse/RF-8898
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/FreeMakerUtils.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/FreeMakerUtils.java 2011-01-11 19:38:55 UTC (rev 20954)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/FreeMakerUtils.java 2011-01-11 20:06:50 UTC (rev 20955)
@@ -28,8 +28,10 @@
import org.richfaces.cdk.util.Strings;
import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
import freemarker.template.SimpleScalar;
+import freemarker.template.TemplateBooleanModel;
import freemarker.template.TemplateHashModel;
import freemarker.template.TemplateMethodModel;
import freemarker.template.TemplateMethodModelEx;
@@ -43,6 +45,17 @@
*/
public class FreeMakerUtils implements TemplateHashModel {
+ private static final ImmutableSet<String> KEYWORDS = ImmutableSet.of("abstract", "continue", "for", "new", "switch",
+ "assert", "default", "goto", "package", "synchronized",
+ "boolean", "do", "if", "private", "this",
+ "break", "double", "implements", "protected", "throw",
+ "byte", "else", "import", "public", "throws",
+ "case", "enum", "instanceof", "return", "transient",
+ "catch", "extends", "int", "short", "try",
+ "char", "final", "interface", "static", "void",
+ "class", "finally", "long", "strictfp", "volatile",
+ "const", "float", "native", "super", "while" );
+
private static final ImmutableMap<String, ? extends TemplateMethodModel> FUNCTIONS = ImmutableMap.<String, TemplateMethodModel>builder().
put("version", new TemplateMethodModelEx() {
@SuppressWarnings("unchecked")
@@ -62,6 +75,17 @@
}
}
}).
+ put("isKeyword", new TemplateMethodModel() {
+ @SuppressWarnings("unchecked")
+ @Override
+ public Object exec(List arguments) throws TemplateModelException {
+ if (arguments.size() == 1) {
+ return KEYWORDS.contains(arguments.get(0).toString())?TemplateBooleanModel.TRUE:TemplateBooleanModel.FALSE;
+ } else {
+ return null;
+ }
+ }
+ }).
build();
/* (non-Javadoc)
* @see freemarker.template.TemplateHashModel#get(java.lang.String)
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/LibraryModelWrapper.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/LibraryModelWrapper.java 2011-01-11 19:38:55 UTC (rev 20954)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/LibraryModelWrapper.java 2011-01-11 20:06:50 UTC (rev 20955)
@@ -54,7 +54,7 @@
public LibraryModelWrapper() {
super();
- setStrict(true);
+// setStrict(true);
setSimpleMapWrapper(true);
// setNullModel(TemplateScalarModel.EMPTY_STRING);
setUseCache(true);
Modified: trunk/cdk/generator/src/main/resources/META-INF/templates/_attribute_accessors.ftl
===================================================================
--- trunk/cdk/generator/src/main/resources/META-INF/templates/_attribute_accessors.ftl 2011-01-11 19:38:55 UTC (rev 20954)
+++ trunk/cdk/generator/src/main/resources/META-INF/templates/_attribute_accessors.ftl 2011-01-11 20:06:50 UTC (rev 20955)
@@ -4,17 +4,21 @@
<#else>
<#assign propertyKey=attribute.name>
</#if>
+<#if utils.isKeyword(propertyKey) >
+ <#assign propertyKey>${propertyKey}Value</#assign>
+</#if>
public ${attribute.typeName} ${attribute.getterName}() {
<#if attribute.bindingAttribute || attribute.literal >
- return (${attribute.typeForCasting}) getStateHelper().get(Properties.${propertyKey});
+ ${attribute.typeForCasting} value = (${attribute.typeForCasting}) getStateHelper().get(Properties.${propertyKey});
<#else>
- return (${attribute.typeForCasting}) getStateHelper().eval(Properties.${propertyKey}<#if attribute.defaultValue?exists>, ${attribute.defaultValue}</#if>);
+ ${attribute.typeForCasting} value = (${attribute.typeForCasting}) getStateHelper().eval(Properties.${propertyKey}<#if attribute.defaultValue?exists>, ${attribute.defaultValue}</#if>);
</#if>
+ return value;
}
<#if ! attribute.readOnly >
- public void ${attribute.setterName}(${attribute.typeName} ${attribute.name}) {
- getStateHelper().put(Properties.${propertyKey}, ${attribute.name});
+ public void ${attribute.setterName}(${attribute.typeName} ${propertyKey}) {
+ getStateHelper().put(Properties.${propertyKey}, ${propertyKey});
}
</#if>
\ No newline at end of file
Modified: trunk/cdk/generator/src/main/resources/META-INF/templates/_attributes.ftl
===================================================================
--- trunk/cdk/generator/src/main/resources/META-INF/templates/_attributes.ftl 2011-01-11 19:38:55 UTC (rev 20954)
+++ trunk/cdk/generator/src/main/resources/META-INF/templates/_attributes.ftl 2011-01-11 20:06:50 UTC (rev 20955)
@@ -1,16 +1,21 @@
+<#assign hasKeyword=false/>
protected enum Properties {
- <#list generatedAttributes as attribute>${attribute.name}<#if attribute_has_next>${",\n "}</#if></#list>
+ <@util.concat seq=generatedAttributes delimiter=",\n "; attribute>${attribute.name}<#if utils.isKeyword(attribute.name)>Value("${attribute.name}")<#assign hasKeyword=true/></#if></(a)util.concat>
+ <#if hasKeyword>;
+ String toString;
+
+ Properties(String toString) {
+ this.toString = toString;
}
+ Properties() {
+ }
+
+ public String toString() {
+ return ((this.toString != null) ? this.toString : super.toString());
+ }</#if>
+ }
+
<#list generatedAttributes as attribute>
<#include "_attribute_accessors.ftl">
</#list>
-
- private StateHelper stateHelper = null;
-
- protected StateHelper getStateHelper() {
- if (stateHelper == null) {
- stateHelper = new PartialStateHolderHelper(this);
- }
- return stateHelper;
- }
\ No newline at end of file
Modified: trunk/cdk/generator/src/main/resources/META-INF/templates/_state-holder-methods.ftl
===================================================================
--- trunk/cdk/generator/src/main/resources/META-INF/templates/_state-holder-methods.ftl 2011-01-11 19:38:55 UTC (rev 20954)
+++ trunk/cdk/generator/src/main/resources/META-INF/templates/_state-holder-methods.ftl 2011-01-11 20:06:50 UTC (rev 20955)
@@ -1,3 +1,12 @@
+ private StateHelper stateHelper = null;
+
+ protected StateHelper getStateHelper() {
+ if (stateHelper == null) {
+ stateHelper = new PartialStateHolderHelper(this);
+ }
+ return stateHelper;
+ }
+
// ----------------------------------------------------- StateHolder Methods
@Override
public Object saveState(FacesContext context) {
Modified: trunk/cdk/generator/src/main/resources/META-INF/templates/component.ftl
===================================================================
--- trunk/cdk/generator/src/main/resources/META-INF/templates/component.ftl 2011-01-11 19:38:55 UTC (rev 20954)
+++ trunk/cdk/generator/src/main/resources/META-INF/templates/component.ftl 2011-01-11 20:06:50 UTC (rev 20955)
@@ -1,6 +1,3 @@
-<#macro concat seq delimiter=",">
-<#list seq as item><#nested item/><#if item_has_next>${delimiter}</#if></#list>
-</#macro>
<#include "_copyright.ftl">
package ${targetClass.package};
@@ -26,7 +23,7 @@
**/
@Generated({"RichFaces CDK", "4.0.0-SNAPSHOT"})
public class ${targetClass.simpleName} extends ${baseClass.simpleName}
- <#if (implemented?size > 0)>implements <@concat seq=implemented ; interface>${interface.simpleName}</@concat></#if> {
+ <#if (implemented?size > 0)>implements <@util.concat seq=implemented ; interface>${interface.simpleName}</(a)util.concat></#if> {
public static final String COMPONENT_TYPE="${id}";
@@ -46,7 +43,7 @@
<#if (eventNames?size > 0)>
private static final Collection<String> EVENT_NAMES = Collections.unmodifiableCollection(Arrays.asList(
- <@concat seq=eventNames delimiter=",\n "; event>"${event.name}"</@concat>
+ <@util.concat seq=eventNames delimiter=",\n "; event>"${event.name}"</(a)util.concat>
));
public Collection<String> getEventNames() {
@@ -58,13 +55,9 @@
return <#if defaultEvent?exists>"${defaultEvent.name}"<#else>null</#if>;
}</#if>
- protected static enum Properties {
- <@concat seq=generatedAttributes delimiter=",\n "; attribute>${attribute.name}</@concat>
- }
- <#list generatedAttributes as attribute>
- <#include "_attribute_accessors.ftl">
- </#list>
+ <#include "_attributes.ftl">
+
<#list events as event>
<#include "_event_source_accessors.ftl">
</#list>
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-11 19:38:55 UTC (rev 20954)
+++ trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/AbstractTestComponent.java 2011-01-11 20:06:50 UTC (rev 20955)
@@ -90,6 +90,11 @@
public abstract List<String> getTestValue();
/**
+ * Keyword Attribute
+ */
+ @Attribute
+ public abstract String getFor();
+ /**
* Bar Attribute
*/
@Attribute
13 years, 3 months
JBoss Rich Faces SVN: r20954 - trunk/core/impl/src/main/java/org/richfaces/context.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2011-01-11 14:38:55 -0500 (Tue, 11 Jan 2011)
New Revision: 20954
Modified:
trunk/core/impl/src/main/java/org/richfaces/context/ExtendedPartialViewContextImpl.java
Log:
https://issues.jboss.org/browse/RF-10086
Modified: trunk/core/impl/src/main/java/org/richfaces/context/ExtendedPartialViewContextImpl.java
===================================================================
--- trunk/core/impl/src/main/java/org/richfaces/context/ExtendedPartialViewContextImpl.java 2011-01-11 18:32:03 UTC (rev 20953)
+++ trunk/core/impl/src/main/java/org/richfaces/context/ExtendedPartialViewContextImpl.java 2011-01-11 19:38:55 UTC (rev 20954)
@@ -218,9 +218,10 @@
Collection <String> executeIds = pvc.getExecuteIds();
if (executeIds == null || executeIds.isEmpty()) {
- if (phaseId == PhaseId.APPLY_REQUEST_VALUES) {
- LOG.warn("Partial execute won't happen - executeIds were not specified");
- }
+ //TODO - review
+ //if (phaseId == PhaseId.APPLY_REQUEST_VALUES) {
+ // LOG.warn("Partial execute won't happen - executeIds were not specified");
+ //}
return;
}
13 years, 3 months