JBoss Rich Faces SVN: r21295 - trunk/ui/common/ui/src/main/resources/META-INF/resources/org.richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2011-01-27 14:01:28 -0500 (Thu, 27 Jan 2011)
New Revision: 21295
Modified:
trunk/ui/common/ui/src/main/resources/META-INF/resources/org.richfaces/popup.js
Log:
http://jira.jboss.com/jira/browse/RF-10337
Modified: trunk/ui/common/ui/src/main/resources/META-INF/resources/org.richfaces/popup.js
===================================================================
--- trunk/ui/common/ui/src/main/resources/META-INF/resources/org.richfaces/popup.js 2011-01-27 19:00:01 UTC (rev 21294)
+++ trunk/ui/common/ui/src/main/resources/META-INF/resources/org.richfaces/popup.js 2011-01-27 19:01:28 UTC (rev 21295)
@@ -52,7 +52,7 @@
show: function(event) {
if (!this.visible) {
if (this.attachToBody) {
- this.parentElement = this.popup.parent();
+ this.parentElement = this.popup.parent().get(0);
document.body.appendChild(this.popup.get(0));
}
this.visible = true;
@@ -66,7 +66,7 @@
this.popup.hide();
this.visible = false;
if (this.attachToBody && this.parentElement) {
- his.parentElement.appendChild(this.popup.get(0));
+ this.parentElement.appendChild(this.popup.get(0));
this.parentElement = null;
}
}
13 years, 11 months
JBoss Rich Faces SVN: r21294 - in trunk: ui/validator/ui/src/main/config and 6 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2011-01-27 14:00:01 -0500 (Thu, 27 Jan 2011)
New Revision: 21294
Added:
trunk/ui/validator/ui/src/main/templates/messages.template.xml
Modified:
trunk/examples/validator-demo/src/main/webapp/examples/ajax-validator.xhtml
trunk/examples/validator-demo/src/main/webapp/examples/client-validator.xhtml
trunk/ui/validator/ui/src/main/config/messages.xml
trunk/ui/validator/ui/src/main/java/org/richfaces/renderkit/MessageRendererBase.java
trunk/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/msg.ecss
trunk/ui/validator/ui/src/main/resources/META-INF/richfaces/org.richfaces/message.library.properties
trunk/ui/validator/ui/src/test/java/org/richfaces/component/AjaxValidationTest.java
trunk/ui/validator/ui/src/test/java/org/richfaces/component/ClientValidationTest.java
trunk/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/MessageTestBase.java
trunk/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/SendMessageTest.java
Log:
RESOLVED - issue RF-10064: Finish rich:message HTML design
https://issues.jboss.org/browse/RF-10064
Modified: trunk/examples/validator-demo/src/main/webapp/examples/ajax-validator.xhtml
===================================================================
--- trunk/examples/validator-demo/src/main/webapp/examples/ajax-validator.xhtml 2011-01-27 18:56:39 UTC (rev 21293)
+++ trunk/examples/validator-demo/src/main/webapp/examples/ajax-validator.xhtml 2011-01-27 19:00:01 UTC (rev 21294)
@@ -12,5 +12,6 @@
<h:outputText id="out" value="#{test.value}"></h:outputText>
<csv:message id="uiMessage" for="text" />
</h:form>
+ <csv:messages/>
</h:body>
</html>
Modified: trunk/examples/validator-demo/src/main/webapp/examples/client-validator.xhtml
===================================================================
--- trunk/examples/validator-demo/src/main/webapp/examples/client-validator.xhtml 2011-01-27 18:56:39 UTC (rev 21293)
+++ trunk/examples/validator-demo/src/main/webapp/examples/client-validator.xhtml 2011-01-27 19:00:01 UTC (rev 21294)
@@ -12,5 +12,6 @@
<h:outputText id="out" value="#{test.value}"></h:outputText>
<csv:message id="uiMessage" for="text" />
</h:form>
+ <csv:messages/>
</h:body>
</html>
Modified: trunk/ui/validator/ui/src/main/config/messages.xml
===================================================================
--- trunk/ui/validator/ui/src/main/config/messages.xml 2011-01-27 18:56:39 UTC (rev 21293)
+++ trunk/ui/validator/ui/src/main/config/messages.xml 2011-01-27 19:00:01 UTC (rev 21294)
@@ -17,4 +17,18 @@
</cdk:tag>
</component-extension>
</component>
+ <component>
+ <component-type>org.richfaces.Messages</component-type>
+ <component-class>org.richfaces.component.html.HtmlMessages</component-class>
+ <component-extension>
+ <cdk:generate>true</cdk:generate>
+ <cdk:base-class>javax.faces.component.UIMessages</cdk:base-class>
+ <cdk:component-family>javax.faces.Messages</cdk:component-family>
+ <cdk:renderer-type>org.richfaces.MessagesRenderer</cdk:renderer-type>
+ <cdk:tag>
+ <cdk:tag-name>messages</cdk:tag-name>
+ <cdk:tag-type>Facelets</cdk:tag-type>
+ </cdk:tag>
+ </component-extension>
+ </component>
</faces-config>
Modified: trunk/ui/validator/ui/src/main/java/org/richfaces/renderkit/MessageRendererBase.java
===================================================================
--- trunk/ui/validator/ui/src/main/java/org/richfaces/renderkit/MessageRendererBase.java 2011-01-27 18:56:39 UTC (rev 21293)
+++ trunk/ui/validator/ui/src/main/java/org/richfaces/renderkit/MessageRendererBase.java 2011-01-27 19:00:01 UTC (rev 21294)
@@ -25,11 +25,13 @@
import java.io.IOException;
import java.util.Iterator;
+import java.util.Map;
import javax.faces.application.FacesMessage;
import javax.faces.application.FacesMessage.Severity;
import javax.faces.component.UIComponent;
import javax.faces.component.UIMessage;
+import javax.faces.component.UIMessages;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import javax.faces.render.Renderer;
@@ -43,6 +45,7 @@
import com.google.common.base.Predicate;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableMap.Builder;
import com.google.common.collect.Iterators;
import com.google.common.collect.Lists;
import com.google.common.collect.UnmodifiableIterator;
@@ -100,44 +103,78 @@
String forId = getFor(component);
Iterator<FacesMessage> messages = getMessages(context, forId, component);
UnmodifiableIterator<FacesMessage> filteredMessages =
- Iterators.filter(messages, getMessagesFilter(context, component));
+ Iterators.filter(messages, getMessagesLevelFilter(context, component));
return Lists.newArrayList(filteredMessages);
}
- private Predicate<FacesMessage> getMessagesFilter(FacesContext context, UIComponent component) {
+ private Predicate<FacesMessage> getMessagesLevelFilter(FacesContext context, UIComponent component) {
+ final Severity level = getLevel(component);
+ final boolean displayAll = component instanceof UIMessages;
+ Predicate<FacesMessage> predicate = new Predicate<FacesMessage>() {
+ private int count = 0;
+ public boolean apply(FacesMessage input) {
+ if(input.getSeverity().compareTo(level) >= 0){
+ return displayAll||0 == count++;
+ }
+ return false;
+ }
+ };
+ return predicate;
+ }
+
+ private Severity getLevel(UIComponent component) {
Object levelName = component.getAttributes().get("level");
final Severity level =
(Severity) (FacesMessage.VALUES_MAP.containsKey(levelName) ? FacesMessage.VALUES_MAP.get(levelName)
: FacesMessage.SEVERITY_INFO);
- return new Predicate<FacesMessage>() {
- public boolean apply(FacesMessage input) {
- return input.getSeverity().compareTo(level) >= 0;
- }
- };
+ return level;
}
private String getFor(UIComponent component) {
- return (String) component.getAttributes().get("for");
+ if (component instanceof UIMessages) {
+ UIMessages messages = (UIMessages) component;
+ if(messages.isGlobalOnly()){
+ return "";
+ } else {
+ return messages.getFor();
+ }
+ } else if (component instanceof UIMessage) {
+ UIMessage message = (UIMessage) component;
+ return message.getFor();
+ } else {
+ return (String) component.getAttributes().get("for");
+ }
}
protected void encodeMessage(FacesContext facesContext, UIComponent component, Object msg) throws IOException {
// TODO fix generator to properly detect iteration variable type
FacesMessage message = (FacesMessage) msg;
- UIMessage uiMessage = (UIMessage) component;
+ String summary = message.getSummary();
+ String detail = message.getDetail();
+ boolean showSummary = true;
+ boolean showDetail = false;
+ if (component instanceof UIMessage) {
+ UIMessage uiMessage = (UIMessage) component;
+ showSummary = uiMessage.isShowSummary();
+ showDetail = uiMessage.isShowDetail();
+ } else if (component instanceof UIMessages) {
+ UIMessages uiMessages = (UIMessages) component;
+ showSummary = uiMessages.isShowSummary();
+ showDetail = uiMessages.isShowDetail();
+ }
ResponseWriter responseWriter = facesContext.getResponseWriter();
// tooltip
- boolean wroteTooltip = Boolean.TRUE.equals(uiMessage.getAttributes().get("tooltip"));
- String summary = message.getSummary();
+ boolean wroteTooltip = Boolean.TRUE.equals(component.getAttributes().get("tooltip"));
if(wroteTooltip && !Strings.isNullOrEmpty(summary)){
responseWriter.writeAttribute("title", summary,null);
}
- if (!wroteTooltip && uiMessage.isShowSummary()) {
+ if (!wroteTooltip && showSummary) {
writeMessageLabel(responseWriter, summary, "rf-msg-sum");
}
- if (uiMessage.isShowDetail()) {
- writeMessageLabel(responseWriter, message.getDetail(), "rf-msg-des");
+ if (showDetail) {
+ writeMessageLabel(responseWriter, detail, "rf-msg-des");
}
}
@@ -153,14 +190,30 @@
protected void encodeScript(FacesContext facesContext, UIComponent component) throws IOException {
JavaScriptService javaScriptService = ServiceTracker.getService(JavaScriptService.class);
JSFunction messageObject = new JSObject("RichFaces.ui.Message", component.getClientId(facesContext));
- String forId = (String) component.getAttributes().get("for");
+ Map<String, Object> attributes = component.getAttributes();
+ Builder<String, Object> parametersBuilder = ImmutableMap.builder();
+ String forId = (String) attributes.get("for");
if (!Strings.isNullOrEmpty(forId)) {
UIComponent target = RendererUtils.getInstance().findComponentFor(component, forId);
if (null != target) {
- messageObject.addParameter(ImmutableMap.<String, String> of("forComponentId",
- target.getClientId(facesContext)));
+ parametersBuilder.put("forComponentId",
+ target.getClientId(facesContext));
}
}
+ Severity level = getLevel(component);
+ if(FacesMessage.SEVERITY_INFO != level){
+ parametersBuilder.put("level", level.getOrdinal());
+ }
+ if(!Boolean.TRUE.equals(attributes.get("showSummary"))){
+ parametersBuilder.put("showSummary", false);
+ }
+ if(Boolean.TRUE.equals(attributes.get("showDetail"))){
+ parametersBuilder.put("showDetail", true);
+ }
+ if(Boolean.TRUE.equals(attributes.get("tooltip"))){
+ parametersBuilder.put("tooltip", true);
+ }
+ messageObject.addParameter(parametersBuilder.build());
// RendererUtils.getInstance().writeScript(facesContext, component, messageObject);
javaScriptService.addPageReadyScript(facesContext, messageObject);
}
Modified: trunk/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/msg.ecss
===================================================================
--- trunk/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/msg.ecss 2011-01-27 18:56:39 UTC (rev 21293)
+++ trunk/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/msg.ecss 2011-01-27 19:00:01 UTC (rev 21294)
@@ -15,23 +15,23 @@
}
.rf-msg-err {
- background-image: url(#{resource['org.richfaces:error.png']});
+ background-image: "url(#{resource['org.richfaces:error.png']})";
color:'#{richSkin.errorColor}';
}
.rf-msg-ftl {
- background-image: url(#{resource['org.richfaces:fatal.png']});
+ background-image: "url(#{resource['org.richfaces:fatal.png']})";
color:'#{richSkin.errorColor}';
}
.rf-msg-inf {
- background-image: url(#{resource['org.richfaces:info.png']});
+ background-image: "url(#{resource['org.richfaces:info.png']})";
color:'#{richSkin.generalTextColor}';
}
.rf-msg-wrn {
- background-image: url(#{resource['org.richfaces:warning.png']});
+ background-image: "url(#{resource['org.richfaces:warning.png']})";
color:'#{richSkin.warningColor}';
}
.rf-msg-ok {
- background-image: url(#{resource['org.richfaces:ok.png']});
+ background-image: "url(#{resource['org.richfaces:ok.png']})";
color:'#{richSkin.generalTextColor}';
width:20px;
display:inline-block;
Modified: trunk/ui/validator/ui/src/main/resources/META-INF/richfaces/org.richfaces/message.library.properties
===================================================================
--- trunk/ui/validator/ui/src/main/resources/META-INF/richfaces/org.richfaces/message.library.properties 2011-01-27 18:56:39 UTC (rev 21293)
+++ trunk/ui/validator/ui/src/main/resources/META-INF/richfaces/org.richfaces/message.library.properties 2011-01-27 19:00:01 UTC (rev 21294)
@@ -1 +1 @@
-resources=jquery.js, richfaces.js, richfaces-event.js, richfaces-base-component.js, org.richfaces:richfaces-message.js
\ No newline at end of file
+resources=jquery.js, richfaces.js, richfaces-event.js, richfaces-base-component.js, org.richfaces:message.js
\ No newline at end of file
Added: trunk/ui/validator/ui/src/main/templates/messages.template.xml
===================================================================
--- trunk/ui/validator/ui/src/main/templates/messages.template.xml (rev 0)
+++ trunk/ui/validator/ui/src/main/templates/messages.template.xml 2011-01-27 19:00:01 UTC (rev 21294)
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- JBoss, Home of Professional Open Source Copyright ${year}, 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. -->
+<cdk:root xmlns="http://jboss.org/schema/richfaces/cdk/xhtml-el"
+ xmlns:cdk="http://jboss.org/schema/richfaces/cdk/core" xmlns:cc="http://jboss.org/schema/richfaces/cdk/jsf/composite"
+ xmlns:c="http://jboss.org/schema/richfaces/cdk/jstl/core" xmlns:xi="http://www.w3.org/2001/XInclude">
+ <cc:interface>
+ <cdk:class>org.richfaces.renderkit.html.HtmlMessagesRenderer</cdk:class>
+ <cdk:superclass>org.richfaces.renderkit.MessageRendererBase</cdk:superclass>
+ <cdk:component-family>javax.faces.Messages</cdk:component-family>
+ <cdk:renderer-type>org.richfaces.MessagesRenderer</cdk:renderer-type>
+ <cdk:resource-dependency library="org.richfaces"
+ name="msg.ecss" />
+ <cdk:resource-dependency library="org.richfaces"
+ name="message.reslib" />
+ </cc:interface>
+ <cc:implementation>
+ <span id="#{clientId}" class="rf-msg #{component.attributes['styleClass']}"
+ cdk:passThroughWithExclusions="id class">
+ <c:forEach var="msg"
+ items="#{getVisibleMessages(facesContext,component)}">
+ <span class="#{getMsgClass(facesContext,component,msg)}" style="#{getMsgStyle(facesContext,component,msg)}">
+ <cdk:call>encodeMessage(facesContext,component,msg)</cdk:call>
+ </span>
+ </c:forEach>
+ <cdk:call>encodeScript(facesContext,component)</cdk:call>
+ </span>
+ </cc:implementation>
+</cdk:root>
Modified: trunk/ui/validator/ui/src/test/java/org/richfaces/component/AjaxValidationTest.java
===================================================================
--- trunk/ui/validator/ui/src/test/java/org/richfaces/component/AjaxValidationTest.java 2011-01-27 18:56:39 UTC (rev 21293)
+++ trunk/ui/validator/ui/src/test/java/org/richfaces/component/AjaxValidationTest.java 2011-01-27 19:00:01 UTC (rev 21294)
@@ -51,12 +51,12 @@
@Test
public void testSubmitTooShortValue() throws Exception {
- submitValueAndCheckMesage("",containsString("Error"));
+ submitValueAndCheckMesage("",not(equalTo("")));
}
@Test
public void testSubmitTooLongValue() throws Exception {
- submitValueAndCheckMesage("123456",containsString("Error"));
+ submitValueAndCheckMesage("123456",not(equalTo("")));
}
@Test
Modified: trunk/ui/validator/ui/src/test/java/org/richfaces/component/ClientValidationTest.java
===================================================================
--- trunk/ui/validator/ui/src/test/java/org/richfaces/component/ClientValidationTest.java 2011-01-27 18:56:39 UTC (rev 21293)
+++ trunk/ui/validator/ui/src/test/java/org/richfaces/component/ClientValidationTest.java 2011-01-27 19:00:01 UTC (rev 21294)
@@ -51,12 +51,12 @@
@Test
public void testSubmitTooShortValue() throws Exception {
- submitValueAndCheckMesage("",containsString("Error"));
+ submitValueAndCheckMesage("",not(equalTo("")));
}
@Test
public void testSubmitTooLongValue() throws Exception {
- submitValueAndCheckMesage("123456",containsString("Error"));
+ submitValueAndCheckMesage("123456",not(equalTo("")));
}
@Test
Modified: trunk/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/MessageTestBase.java
===================================================================
--- trunk/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/MessageTestBase.java 2011-01-27 18:56:39 UTC (rev 21293)
+++ trunk/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/MessageTestBase.java 2011-01-27 19:00:01 UTC (rev 21294)
@@ -82,4 +82,15 @@
return "new RichFaces.ui.Message(\"" + MY_MESSAGE + "\", {forComponentId:\"" + COMPONENT + "\""+messageOptions+"})";
}
+ protected void checkMessageContent(String summary) {
+ String text = getMessageAsText();
+ assertTrue(text.contains(summary));
+ }
+
+ protected String getMessageAsText() {
+ HtmlElement htmlElement = getMessageContentElement();
+ String text = htmlElement.asText();
+ return text;
+ }
+
}
Modified: trunk/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/SendMessageTest.java
===================================================================
--- trunk/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/SendMessageTest.java 2011-01-27 18:56:39 UTC (rev 21293)
+++ trunk/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/SendMessageTest.java 2011-01-27 19:00:01 UTC (rev 21294)
@@ -27,26 +27,57 @@
import org.junit.Test;
-import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.DomElement;
+
/**
* <p class="changed_added_4_0"></p>
* @author asmirnov(a)exadel.com
*
*/
public class SendMessageTest extends MessageTestBase {
-
+
@Test
- public void testSend() throws Exception {
- setUpMessage(",showSummary:true");
+ public void testSendDefault() throws Exception {
+ setUpMessage();
sendMessage();
- checkMessageContent(getErrorMessage().getSummary());
+ String messageAsText = getMessageAsText();
+ assertTrue(messageAsText.contains(getErrorMessage().getSummary()));
+ assertFalse(messageAsText.contains(getErrorMessage().getDetail()));
+ checkTitle(DomElement.ATTRIBUTE_NOT_DEFINED);
}
- protected void checkMessageContent(String summary) {
- HtmlElement htmlElement = getMessageContentElement();
- String text = htmlElement.asText();
- assertTrue(text.contains(summary));
+ @Test
+ public void testSendWithDetail() throws Exception {
+ setUpMessage(",showDetail:true");
+ sendMessage();
+ String messageAsText = getMessageAsText();
+ assertTrue(messageAsText.contains(getErrorMessage().getSummary()));
+ assertTrue(messageAsText.contains(getErrorMessage().getDetail()));
+ checkTitle(DomElement.ATTRIBUTE_NOT_DEFINED);
}
+ @Test
+ public void testSendWithLevel() throws Exception {
+ setUpMessage(",level:3");
+ sendMessage();
+ String messageAsText = getMessageAsText();
+ assertTrue(messageAsText.isEmpty());
+ assertTrue(getMessageContentElement().getChildNodes().isEmpty());
+ }
+
+ @Test
+ public void testSendWithTooltip() throws Exception {
+ setUpMessage(",tooltip:true");
+ sendMessage();
+ String messageAsText = getMessageAsText();
+ assertFalse(messageAsText.contains(getErrorMessage().getSummary()));
+ assertFalse(messageAsText.contains(getErrorMessage().getDetail()));
+ checkTitle(getErrorMessage().getSummary());
+ }
+
+ private void checkTitle(String title) {
+ String attribute = ((DomElement) getMessageContentElement().getFirstChild()).getAttribute("title");
+ assertEquals(title, attribute);
+ }
}
13 years, 11 months
JBoss Rich Faces SVN: r21293 - in trunk/ui/output/ui/src/main: resources/META-INF and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2011-01-27 13:56:39 -0500 (Thu, 27 Jan 2011)
New Revision: 21293
Added:
trunk/ui/output/ui/src/main/resources/META-INF/cdk/
trunk/ui/output/ui/src/main/resources/META-INF/cdk/attributes/
trunk/ui/output/ui/src/main/resources/META-INF/cdk/attributes/tooltip-props.xml
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTooltip.java
Log:
RF-10333
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTooltip.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTooltip.java 2011-01-27 18:51:42 UTC (rev 21292)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTooltip.java 2011-01-27 18:56:39 UTC (rev 21293)
@@ -47,7 +47,7 @@
* @since 2010-10-24
*/
@JsfComponent(tag = @Tag(type = TagType.Facelets),
- renderer = @JsfRenderer(type = "org.richfaces.TooltipRenderer"), attributes = {"ajax-props.xml"})
+ renderer = @JsfRenderer(type = "org.richfaces.TooltipRenderer"), attributes = {"tooltip-props.xml", "ajax-props.xml"})
public abstract class AbstractTooltip extends AbstractDivPanel implements MetaComponentResolver, MetaComponentEncoder {
public static final String COMPONENT_TYPE = "org.richfaces.Tooltip";
Added: trunk/ui/output/ui/src/main/resources/META-INF/cdk/attributes/tooltip-props.xml
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/cdk/attributes/tooltip-props.xml (rev 0)
+++ trunk/ui/output/ui/src/main/resources/META-INF/cdk/attributes/tooltip-props.xml 2011-01-27 18:56:39 UTC (rev 21293)
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- JBoss, Home of Professional Open Source Copyright ${year}, 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. -->
+<cdk:properties xmlns:xi="http://www.w3.org/2001/XInclude"
+ xmlns:cdk="http://jboss.org/schema/richfaces/cdk/extensions"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee">
+ <property>
+ <property-name>execute</property-name>
+ <property-class>java.lang.Object</property-class>
+ <property-extension>
+ <cdk:hidden>true</cdk:hidden>
+ </property-extension>
+ </property>
+</cdk:properties>
13 years, 11 months
JBoss Rich Faces SVN: r21292 - trunk/ui/output/ui/src/main/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2011-01-27 13:51:42 -0500 (Thu, 27 Jan 2011)
New Revision: 21292
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractCollapsiblePanel.java
Log:
RF-10312
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractCollapsiblePanel.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractCollapsiblePanel.java 2011-01-27 18:50:53 UTC (rev 21291)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractCollapsiblePanel.java 2011-01-27 18:51:42 UTC (rev 21292)
@@ -70,8 +70,7 @@
@Override
public String getActiveItem() {
- String ai = super.getActiveItem();
- return ai == null ? "true" : ai;
+ return String.valueOf(isExpanded());
}
@Override
@@ -84,15 +83,9 @@
return isExpanded();
}
- @Attribute
- public boolean isExpanded() {
- return Boolean.parseBoolean(getActiveItem());
- }
+ @Attribute(defaultValue="true")
+ public abstract boolean isExpanded();
- public void setExpanded(boolean isExpanded) {
- setActiveItem(String.valueOf(isExpanded));
- }
-
@Override
public void queueEvent(FacesEvent facesEvent) {
PanelToggleEvent event = null;
13 years, 11 months
JBoss Rich Faces SVN: r21291 - trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2011-01-27 13:50:53 -0500 (Thu, 27 Jan 2011)
New Revision: 21291
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java
Log:
RF-10244
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java 2011-01-27 18:46:03 UTC (rev 21290)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java 2011-01-27 18:50:53 UTC (rev 21291)
@@ -233,8 +233,7 @@
writer.startElement(DIV_ELEM, component);
writer.writeAttribute(ID_ATTRIBUTE, component.getClientId(context) + ":content", null);
writer.writeAttribute(CLASS_ATTRIBUTE, concatClasses("rf-cp-b", attributeAsString(component, "bodyClass")), null);
- writer.writeAttribute(STYLE_ATTRIBUTE, concatStyles(styleElement("display", visible ? "block" : "none"),
- attributeAsString(component, "style")), null);
+ writer.writeAttribute(STYLE_ATTRIBUTE, styleElement("display", visible ? "block" : "none"), null);
renderChildren(context, component);
13 years, 11 months
JBoss Rich Faces SVN: r21290 - in trunk: ui/common/ui/src/main/resources/META-INF/resources/org.richfaces and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2011-01-27 13:46:03 -0500 (Thu, 27 Jan 2011)
New Revision: 21290
Modified:
trunk/examples/input-demo/src/main/webapp/examples/autocomplete.xhtml
trunk/ui/common/ui/src/main/resources/META-INF/resources/org.richfaces/popup.js
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/AutocompleteBase.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanel.js
Log:
http://jira.jboss.com/jira/browse/RF-10337
Modified: trunk/examples/input-demo/src/main/webapp/examples/autocomplete.xhtml
===================================================================
--- trunk/examples/input-demo/src/main/webapp/examples/autocomplete.xhtml 2011-01-27 17:23:33 UTC (rev 21289)
+++ trunk/examples/input-demo/src/main/webapp/examples/autocomplete.xhtml 2011-01-27 18:46:03 UTC (rev 21290)
@@ -4,7 +4,9 @@
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:input="http://richfaces.org/input"
+ xmlns:output="http://richfaces.org/output"
xmlns:rich="http://richfaces.org/iteration"
+ xmlns:misc="http://richfaces.org/misc"
xmlns:a4j="http://richfaces.org/a4j">
<f:view contentType="text/html" />
@@ -126,7 +128,18 @@
</h:column>
</input:autocomplete>
</h:form>
-
+ <h:form>
+ <h:commandButton id="leggTilKontroll" value="Button">
+ <misc:componentControl target="popup" operation="show" />
+ </h:commandButton>
+ </h:form>
+ <output:popupPanel id="popup" autosized="true">
+ <h:form>
+ <input:autocomplete mode="cachedAjax" autocompleteMethod="#{autoCompleteBean.autocomplete}" var="country" fetchValue="#{country.name}">
+ #{country.name} #{country.iso} #{country.domain}
+ </input:autocomplete>
+ </h:form>
+ </output:popupPanel>
</ui:define>
</ui:composition>
Modified: trunk/ui/common/ui/src/main/resources/META-INF/resources/org.richfaces/popup.js
===================================================================
--- trunk/ui/common/ui/src/main/resources/META-INF/resources/org.richfaces/popup.js 2011-01-27 17:23:33 UTC (rev 21289)
+++ trunk/ui/common/ui/src/main/resources/META-INF/resources/org.richfaces/popup.js 2011-01-27 18:46:03 UTC (rev 21290)
@@ -53,7 +53,7 @@
if (!this.visible) {
if (this.attachToBody) {
this.parentElement = this.popup.parent();
- this.popup.detach().appendTo("body");
+ document.body.appendChild(this.popup.get(0));
}
this.visible = true;
}
@@ -66,7 +66,7 @@
this.popup.hide();
this.visible = false;
if (this.attachToBody && this.parentElement) {
- this.popup.detach().appendTo(this.parentElement);
+ his.parentElement.appendChild(this.popup.get(0));
this.parentElement = null;
}
}
Modified: trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/AutocompleteBase.js
===================================================================
--- trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/AutocompleteBase.js 2011-01-27 17:23:33 UTC (rev 21289)
+++ trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/AutocompleteBase.js 2011-01-27 18:46:03 UTC (rev 21290)
@@ -199,12 +199,12 @@
if (!this.isVisible) {
if (this.__onBeforeShow(event)!=false) {
this.scrollElements = rf.Event.bindScrollEventHandlers(this.selectId, this.hide, this, this.namespace);
+ var element = rf.getDomElement(this.selectId);
if (this.options.attachToBody) {
- var element = rf.getDomElement(this.selectId);
this.parentElement = element.parentNode;
- $(element).detach().appendTo("body");
+ document.body.appendChild(element);
}
- $(rf.getDomElement(this.selectId)).setPosition({id: this.fieldId}, {type:"DROPDOWN"}).show();
+ $(element).setPosition({id: this.fieldId}, {type:"DROPDOWN"}).show();
this.isVisible = true;
this.__onShow(event);
}
@@ -214,10 +214,10 @@
if (this.isVisible) {
rf.Event.unbindScrollEventHandlers(this.scrollElements, this);
this.scrollElements = null;
- $(rf.getDomElement(this.selectId)).hide();
- this.isVisible = false;
- if (this.options.attachToBody && this.parentElement) {
- $(rf.getDomElement(this.selectId)).detach().appendTo(this.parentElement);
+ $(rf.getDomElement(this.selectId)).hide();
+ this.isVisible = false;
+ if (this.options.attachToBody && this.parentElement) {
+ this.parentElement.appendChild(rf.getDomElement(this.selectId));
this.parentElement = null;
}
this.__onHide(event);
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanel.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanel.js 2011-01-27 17:23:33 UTC (rev 21289)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanel.js 2011-01-27 18:46:03 UTC (rev 21290)
@@ -240,9 +240,9 @@
if (newParent != this.parent) {
this.saveInputValues(element);
- this.shadeDiv.insertAfter($(newParent).children().last());
- this.shadowDiv.insertAfter($(newParent).children().last());
- this.cdiv.insertAfter($(newParent).children().last());
+ newParent.appendChild(this.shadeDiv.get(0));
+ newParent.appendChild(this.shadowDiv.get(0));
+ newParent.appendChild(this.cdiv.get(0));
this.domReattached = true;
} else {
this.parent.show();
@@ -487,9 +487,10 @@
if (this.parent) {
if (this.domReattached) {
this.saveInputValues(element);
- this.div.append(this.shadeDiv);
- this.div.append(this.shadowDiv);
- this.div.append(element);
+ var div = this.div.get(0);
+ div.appendChild(this.shadeDiv.get(0));
+ div.appendChild(this.shadowDiv.get(0));
+ div.appendChild(element.get(0));
this.domReattached = false;
}
13 years, 11 months
JBoss Rich Faces SVN: r21289 - in trunk/ui/dnd/ui/src: test and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2011-01-27 12:23:33 -0500 (Thu, 27 Jan 2011)
New Revision: 21289
Added:
trunk/ui/dnd/ui/src/test/
trunk/ui/dnd/ui/src/test/java/
trunk/ui/dnd/ui/src/test/java/org/
trunk/ui/dnd/ui/src/test/java/org/richfaces/
trunk/ui/dnd/ui/src/test/java/org/richfaces/component/
trunk/ui/dnd/ui/src/test/java/org/richfaces/component/UIDragIndicatorTest.java
trunk/ui/dnd/ui/src/test/java/org/richfaces/component/UIDragSourceTest.java
trunk/ui/dnd/ui/src/test/java/org/richfaces/component/UIDropTargetTest.java
Log:
https://issues.jboss.org/browse/RF-9772 dragBehavior: unit tests development
https://issues.jboss.org/browse/RF-9802 dropBehavior: unit test development
Added: trunk/ui/dnd/ui/src/test/java/org/richfaces/component/UIDragIndicatorTest.java
===================================================================
--- trunk/ui/dnd/ui/src/test/java/org/richfaces/component/UIDragIndicatorTest.java (rev 0)
+++ trunk/ui/dnd/ui/src/test/java/org/richfaces/component/UIDragIndicatorTest.java 2011-01-27 17:23:33 UTC (rev 21289)
@@ -0,0 +1,19 @@
+package org.richfaces.component;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class UIDragIndicatorTest {
+ private UIDragIndicator indicator;
+
+ @Before
+ public void setUp () {
+ indicator = new UIDragIndicator();
+ }
+
+ @Test
+ public void testSomething() {
+ Assert.assertNotNull(indicator);
+ }
+}
Added: trunk/ui/dnd/ui/src/test/java/org/richfaces/component/UIDragSourceTest.java
===================================================================
--- trunk/ui/dnd/ui/src/test/java/org/richfaces/component/UIDragSourceTest.java (rev 0)
+++ trunk/ui/dnd/ui/src/test/java/org/richfaces/component/UIDragSourceTest.java 2011-01-27 17:23:33 UTC (rev 21289)
@@ -0,0 +1,19 @@
+package org.richfaces.component;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class UIDragSourceTest {
+ private UIDragSource dragSource;
+
+ @Before
+ public void setUp () {
+ dragSource = new UIDragSource();
+ }
+
+ @Test
+ public void testSomething() {
+ Assert.assertNotNull(dragSource);
+ }
+}
Added: trunk/ui/dnd/ui/src/test/java/org/richfaces/component/UIDropTargetTest.java
===================================================================
--- trunk/ui/dnd/ui/src/test/java/org/richfaces/component/UIDropTargetTest.java (rev 0)
+++ trunk/ui/dnd/ui/src/test/java/org/richfaces/component/UIDropTargetTest.java 2011-01-27 17:23:33 UTC (rev 21289)
@@ -0,0 +1,19 @@
+package org.richfaces.component;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class UIDropTargetTest {
+ private UIDropTarget dragTarget;
+
+ @Before
+ public void setUp () {
+ dragTarget = new UIDropTarget();
+ }
+
+ @Test
+ public void testSomething() {
+ Assert.assertNotNull(dragTarget);
+ }
+}
13 years, 11 months
JBoss Rich Faces SVN: r21288 - in trunk: ui/dnd/ui/src/main/java/org/richfaces/javascript and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2011-01-27 12:15:16 -0500 (Thu, 27 Jan 2011)
New Revision: 21288
Removed:
trunk/ui/dnd/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-manager.js
Modified:
trunk/core/impl/src/main/resources/META-INF/resources/richfaces-base-component.js
trunk/core/impl/src/main/resources/META-INF/resources/richfaces.js
trunk/ui/dnd/ui/src/main/java/org/richfaces/javascript/DnDScript.java
trunk/ui/dnd/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-draggable.js
trunk/ui/dnd/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-droppable.js
Log:
https://issues.jboss.org/browse/RF-10234 drag-n-drop: move droppable and draggable to base-component
Modified: trunk/core/impl/src/main/resources/META-INF/resources/richfaces-base-component.js
===================================================================
--- trunk/core/impl/src/main/resources/META-INF/resources/richfaces-base-component.js 2011-01-27 16:40:36 UTC (rev 21287)
+++ trunk/core/impl/src/main/resources/META-INF/resources/richfaces-base-component.js 2011-01-27 17:15:16 UTC (rev 21288)
@@ -296,6 +296,97 @@
}
};
})(params));
+
+ richfaces.BaseNonVisualComponent = function(componentId) {
+ this.id = componentId;
+ this.options = this.options || {};
+ };
+
+ richfaces.BaseNonVisualComponent.extend = function(child, h) {
+ return extend(richfaces.BaseNonVisualComponent, child, h);
+ };
+
+ richfaces.BaseNonVisualComponent.extendClass = function (methods) {
+ var DerivedClass = methods.init || richfaces.blankFunction;
+ var SupperClass = this;
+
+ SupperClass.extend(DerivedClass);
+
+ DerivedClass.extendClass = SupperClass.extendClass;
+
+ $.extend(DerivedClass.prototype, methods);
+
+ return DerivedClass;
+ };
+
+ $.extend(richfaces.BaseNonVisualComponent.prototype, (function (params) {
+ return {
+ name: "BaseNonVisualComponent",
+
+ toString: function() {
+ var result = [];
+ if (this.constructor.$super) {
+ result[result.length] = this.constructor.$super.toString();
+ }
+ result[result.length] = this.name;
+ return result.join(', ');
+ },
+
+ getValue: function() {
+ return;
+ },
+ /**
+ * Attach component object to DOM element by component id, DOM element or jQuery object and returns the element
+ * Its required for the client side API calls and to clean up after ajax request or document unload by
+ * calling destroy method
+ *
+ * @function
+ * @name RichFaces.BaseNonVisualComponent#attachToDom
+ * @param {string|DOMElement|jQuery} source - component id, DOM element or DOM elements wrapped by jQuery
+ *
+ * @return {DOMElement}
+ * */
+ attachToDom: function(source) {
+ source = source || this.id;
+ var element = richfaces.getDomElement(source);
+ if (element) {
+ var container = element[richfaces.RICH_CONTAINER] = element[richfaces.RICH_CONTAINER] || {};
+ if (container.attachedComponents){
+ container.attachedComponents[this.name] = this;
+ } else {
+ container.attachedComponents= {};
+ container.attachedComponents[this.name] = this;
+ }
+ }
+ return element;
+ },
+
+ /**
+ * Detach component object from DOM element by component id, DOM element or jQuery object
+ *
+ * @function
+ * @name RichFaces.BaseNonVisualComponent#detach
+ * @param {string|DOMElement|jQuery} source - component id, DOM element or DOM elements wrapped by jQuery
+ *
+ * */
+ detach: function(source) {
+ source = source || this.id;
+ var element = richfaces.getDomElement(source);
+ element && element[richfaces.RICH_CONTAINER] && (element[richfaces.RICH_CONTAINER].attachedComponents[this.name]=null);
+ },
+
+ /**
+ * Destroy method. Will be called before remove component from the page
+ *
+ * @function
+ * @name RichFaces.BaseNonVisualComponent#destroy
+ *
+ * */
+ destroy: function() {
+ }
+ };
+ })(params));
+
})(jQuery, window.RichFaces || (window.RichFaces={}));
Modified: trunk/core/impl/src/main/resources/META-INF/resources/richfaces.js
===================================================================
--- trunk/core/impl/src/main/resources/META-INF/resources/richfaces.js 2011-01-27 16:40:36 UTC (rev 21287)
+++ trunk/core/impl/src/main/resources/META-INF/resources/richfaces.js 2011-01-27 17:15:16 UTC (rev 21288)
@@ -71,6 +71,13 @@
element = element.parentNode;
}
};
+ richfaces.findNonVisualComponents = function (source){
+ var element = richfaces.getDomElement(source);
+
+ if (element) {
+ return (element[richfaces.RICH_CONTAINER] || {})["attachedComponents"];
+ }
+ };
// find component and call his method
richfaces.invokeMethod = function(source, method) {
@@ -85,9 +92,19 @@
richfaces.cleanComponent = function (source) {
var component = richfaces.$(source);
if (component) {
+ //TODO fire destroy event
component.destroy();
component.detach(source);
}
+ var attachedComponents = richfaces.findNonVisualComponents(source);
+ if (attachedComponents) {
+ for (var i in attachedComponents)
+ {
+ if (attachedComponents[i]){
+ attachedComponents[i].destroy();
+ }
+ }
+ }
};
richfaces.cleanDom = function(source) {
Modified: trunk/ui/dnd/ui/src/main/java/org/richfaces/javascript/DnDScript.java
===================================================================
--- trunk/ui/dnd/ui/src/main/java/org/richfaces/javascript/DnDScript.java 2011-01-27 16:40:36 UTC (rev 21287)
+++ trunk/ui/dnd/ui/src/main/java/org/richfaces/javascript/DnDScript.java 2011-01-27 17:15:16 UTC (rev 21288)
@@ -41,6 +41,7 @@
BASE_RESOURCES.add(new ResourceKey("jquery.js", null));
BASE_RESOURCES.add(new ResourceKey("jquery.position.js", null));
BASE_RESOURCES.add(new ResourceKey("richfaces.js", null));
+ BASE_RESOURCES.add(new ResourceKey("richfaces-base-component.js", null));
BASE_RESOURCES.add(new ResourceKey("richfaces-event.js", null));
BASE_RESOURCES.add(new ResourceKey("jquery-ui-core.js", "org.richfaces"));
BASE_RESOURCES.add(new ResourceKey("jquery-dnd.js", "org.richfaces"));
Modified: trunk/ui/dnd/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-draggable.js
===================================================================
--- trunk/ui/dnd/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-draggable.js 2011-01-27 16:40:36 UTC (rev 21287)
+++ trunk/ui/dnd/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-draggable.js 2011-01-27 17:15:16 UTC (rev 21288)
@@ -17,12 +17,17 @@
};
rf.ui.Draggable = function(id, options) {
+ this.options = {};
+ $.extend(this.options, defaultOptions, options || {});
+ $super.constructor.call(this, id);
+
this.id = id;
- this.options = options;
-
+
this.namespace = this.namespace || "."
+ rf.Event.createNamespace(this.name, this.id);
+ this.parentId = this.options.parentId;
+ this.attachToDom(this.parentId);
this.dragElement = $(document.getElementById(this.options.parentId));
this.dragElement.draggable();
@@ -40,18 +45,24 @@
this.dragElement.data('type', this.options.type);
this.dragElement.data("init", true);
this.dragElement.data("id", this.id);
-
- this.dragElement.bind('dragstart', $.proxy(this.dragStart, this));
- this.dragElement.bind('drag', $.proxy(this.drag, this));
- this.dragElement.bind('dragstop', $.proxy(this.dragStop, this));
+ rf.Event.bind(this.dragElement, 'dragstart'+this.namespace, this.dragStart, this);
+ rf.Event.bind(this.dragElement, 'drag'+this.namespace, this.drag, this);
+ rf.Event.bind(this.dragElement, 'dragstop'+this.namespace, this.dragStop, this);
};
+ rf.BaseNonVisualComponent.extend(rf.ui.Draggable);
+
+ // define super class link
+ var $super = rf.ui.Draggable.$super;
+
var defaultOptions = {
};
$.extend(rf.ui.Draggable.prototype, ( function () {
return {
- dragStart: function(e, ui) {
+ name : "Draggable",
+ dragStart: function(e) {
+ var ui = e.rf.data;
var element = ui.helper[0];
this.parentElement = element.parentNode;
ui.helper.detach().appendTo("body").setPosition(e).show();
@@ -65,7 +76,8 @@
}
},
- drag: function(e, ui) {
+ drag: function(e) {
+ var ui = e.rf.data;
if(this.__isCustomDragIndicator()) {
var indicator = rf.$(this.options.indicator);
if(indicator) {
@@ -77,7 +89,8 @@
this.__clearDraggableCss(ui.helper);
},
- dragStop: function(e, ui){
+ dragStop: function(e){
+ var ui = e.rf.data;
ui.helper.hide().detach().appendTo(this.parentElement);
if(ui.helper[0] != this.dragElement[0]) {
//fix to prevent remove custom indicator from DOM tree. see jQuery draggable._clear method for details
@@ -94,6 +107,14 @@
//draggable 'addClasses: false' doesn't work so clear jQuery style
element.removeClass("ui-draggable-dragging");
}
+ },
+
+ destroy : function() {
+ // clean up code here
+ this.detach(this.parentId);
+ rf.Event.unbind(this.dragElement, this.namespace);
+ // call parent's destroy method
+ $super.destroy.call(this);
}
}
})());
Modified: trunk/ui/dnd/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-droppable.js
===================================================================
--- trunk/ui/dnd/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-droppable.js 2011-01-27 16:40:36 UTC (rev 21287)
+++ trunk/ui/dnd/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-droppable.js 2011-01-27 17:15:16 UTC (rev 21288)
@@ -15,24 +15,44 @@
acceptClass : "rf-ind-acpt",
draggingClass : "rf-ind-drag"
};
+
+ var defaultOptions = {
+ };
rf.ui.Droppable = function(id, options) {
- this.options = options;
+ this.options = {};
+ $.extend(this.options, defaultOptions, options || {});
+ $super.constructor.call(this, id);
+
+ this.namespace = this.namespace || "."
+ + rf.Event.createNamespace(this.name, this.id);
+
this.id = id;
-
- this.dropElement = $(document.getElementById(this.options.parentId));
+
+ this.parentId = this.options.parentId;
+
+ this.attachToDom(this.parentId);
+
+ this.dropElement = $(document.getElementById(this.parentId));
this.dropElement.droppable({
addClasses : false
});
this.dropElement.data("init", true);
- this.dropElement.bind('drop', $.proxy(this.drop, this));
- this.dropElement.bind('dropover', $.proxy(this.dropover, this));
- this.dropElement.bind('dropout', $.proxy(this.dropout, this));
+
+ rf.Event.bind(this.dropElement, 'drop'+this.namespace, this.drop, this);
+ rf.Event.bind(this.dropElement, 'dropover'+this.namespace, this.dropover, this);
+ rf.Event.bind(this.dropElement, 'dropout'+this.namespace, this.dropout, this);
+
};
-
+
+ rf.BaseNonVisualComponent.extend(rf.ui.Droppable);
+
+ var $super = rf.ui.Droppable.$super;
+
$.extend(rf.ui.Droppable.prototype, (function() {
return {
- drop : function(e, ui) {
+ drop : function(e) {
+ var ui = e.rf.data;
if (this.accept(ui.draggable)) {
this.__callAjax(e, ui);
}
@@ -47,7 +67,8 @@
}
},
- dropover : function(event, ui) {
+ dropover : function(e) {
+ var ui = e.rf.data;
var draggable = ui.draggable;
var dragIndicatorObj = rf.$(ui.helper.attr("id"));
if (dragIndicatorObj) {
@@ -69,7 +90,8 @@
}
},
- dropout : function(event, ui) {
+ dropout : function(e) {
+ var ui = e.rf.data;
var draggable = ui.draggable;
var dragIndicatorObj = rf.$(ui.helper.attr("id"));
if (dragIndicatorObj) {
@@ -107,7 +129,19 @@
ajaxFunc.call(this, e, dragSource);
}
}
+ },
+
+ destroy : function() {
+ // clean up code here
+ this.detach(this.parentId);
+ rf.Event.unbind(this.dropElement, this.namespace);
+
+ // call parent's destroy method
+ $super.destroy.call(this);
+
}
+
+
}
})());
Deleted: trunk/ui/dnd/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-manager.js
===================================================================
--- trunk/ui/dnd/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-manager.js 2011-01-27 16:40:36 UTC (rev 21287)
+++ trunk/ui/dnd/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-manager.js 2011-01-27 17:15:16 UTC (rev 21288)
@@ -1,51 +0,0 @@
-/*
- * code review by Pavel Yaschenko
- *
- * records in draggables and droppables should be cleaned up when remove component from DOM
- *
- * draft code: something like this
- *
- *
- rf.ui.Draggable = function (id, options) {
- var c = rf.$(id);
- if (c) {
- var baseDestroy = c.destroy;
- c. destroy = f ()
- {
- rf.ui.DnDManager.removeDraggable(id)
- baseDestroy.call(this);
- }
- }
- // other code ...
- }
- */
-
-(function ($, rf) {
-
- rf.ui = rf.ui || {};
-
- rf.ui.DnDManager = rf.ui.DnDManager || {};
-
- $.extend(rf.ui.DnDManager, ( function () {
- var draggables = {};
- var droppables = {};
-
- return {
- draggable: function(event, id, options) {
- var draggable = draggables[id];
- if(!draggable) {
- options['event'] = event;
- draggables[id] = new rf.ui.Draggable(id, options);
- }
- },
-
- droppable: function(event, id, options) {
- var droppable = droppables[id];
- if(!droppable) {
- options['event'] = event;
- droppables[id] = new rf.ui.Droppable(id, options);
- }
- }
- }
- })());
-})(jQuery, window.RichFaces);
\ No newline at end of file
13 years, 11 months
JBoss Rich Faces SVN: r21287 - in modules/tests/metamer/trunk: ftest/src/test/resources and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2011-01-27 11:40:36 -0500 (Thu, 27 Jan 2011)
New Revision: 21287
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hCommandButton.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hCommandButtonWrapped.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hCommandLink.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hGraphicImage.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hInputSecret.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hInputText.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hInputTextWrapped.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hInputTextarea.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hSelectBooleanCheckbox.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hSelectManyCheckbox.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hSelectManyListbox.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hSelectManyMenu.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hSelectOneListbox.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hSelectOneMenu.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hSelectOneRadio.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/list.xhtml
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/AbstractTestCommand.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/AbstractTestSelectMany.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/AbstractTestSelectOne.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/AbstractTestTextInput.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHCommandButton.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHCommandLink.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHGraphicImage.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHInputSecret.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHInputText.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHInputTextarea.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectBooleanCheckbox.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectManyCheckbox.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectManyListbox.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectManyMenu.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectOneListbox.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectOneMenu.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectOneRadio.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandButton/TestA4JCommandButton.java
modules/tests/metamer/trunk/ftest/src/test/resources/testng-misc.xml
Log:
* added 26 tests for a4j:ajax
* refactoring
* samples for a4j:ajax fixed
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hCommandButton.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hCommandButton.xhtml 2011-01-27 16:09:53 UTC (rev 21286)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hCommandButton.xhtml 2011-01-27 16:40:36 UTC (rev 21287)
@@ -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.
@@ -52,6 +52,7 @@
limitRender="#{a4jAjaxBean.attributes['limitRender'].value}"
listener="#{a4jAjaxBean.attributes.listener}"
onbeforedomupdate="#{a4jAjaxBean.attributes['onbeforedomupdate'].value}"
+ onbeforesubmit="#{a4jAjaxBean.attributes['onbeforesubmit'].value}"
onbegin="#{a4jAjaxBean.attributes['onbegin'].value}"
oncomplete="#{a4jAjaxBean.attributes['oncomplete'].value}"
onerror="#{a4jAjaxBean.attributes['onerror'].value}"
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hCommandButtonWrapped.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hCommandButtonWrapped.xhtml 2011-01-27 16:09:53 UTC (rev 21286)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hCommandButtonWrapped.xhtml 2011-01-27 16:40:36 UTC (rev 21287)
@@ -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.
@@ -51,6 +51,7 @@
limitRender="#{a4jAjaxBean.attributes['limitRender'].value}"
listener="#{a4jAjaxBean.attributes.listener}"
onbeforedomupdate="#{a4jAjaxBean.attributes['onbeforedomupdate'].value}"
+ onbeforesubmit="#{a4jAjaxBean.attributes['onbeforesubmit'].value}"
onbegin="#{a4jAjaxBean.attributes['onbegin'].value}"
oncomplete="#{a4jAjaxBean.attributes['oncomplete'].value}"
onerror="#{a4jAjaxBean.attributes['onerror'].value}"
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hCommandLink.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hCommandLink.xhtml 2011-01-27 16:09:53 UTC (rev 21286)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hCommandLink.xhtml 2011-01-27 16:40:36 UTC (rev 21287)
@@ -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.
@@ -52,6 +52,7 @@
limitRender="#{a4jAjaxBean.attributes['limitRender'].value}"
listener="#{a4jAjaxBean.attributes.listener}"
onbeforedomupdate="#{a4jAjaxBean.attributes['onbeforedomupdate'].value}"
+ onbeforesubmit="#{a4jAjaxBean.attributes['onbeforesubmit'].value}"
onbegin="#{a4jAjaxBean.attributes['onbegin'].value}"
oncomplete="#{a4jAjaxBean.attributes['oncomplete'].value}"
onerror="#{a4jAjaxBean.attributes['onerror'].value}"
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hGraphicImage.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hGraphicImage.xhtml 2011-01-27 16:09:53 UTC (rev 21286)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hGraphicImage.xhtml 2011-01-27 16:40:36 UTC (rev 21287)
@@ -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.
@@ -53,6 +53,7 @@
limitRender="#{a4jAjaxBean.attributes['limitRender'].value}"
listener="#{a4jAjaxBean.attributes.listener}"
onbeforedomupdate="#{a4jAjaxBean.attributes['onbeforedomupdate'].value}"
+ onbeforesubmit="#{a4jAjaxBean.attributes['onbeforesubmit'].value}"
onbegin="#{a4jAjaxBean.attributes['onbegin'].value}"
oncomplete="#{a4jAjaxBean.attributes['oncomplete'].value}"
onerror="#{a4jAjaxBean.attributes['onerror'].value}"
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hInputSecret.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hInputSecret.xhtml 2011-01-27 16:09:53 UTC (rev 21286)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hInputSecret.xhtml 2011-01-27 16:40:36 UTC (rev 21287)
@@ -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.
@@ -51,6 +51,7 @@
limitRender="#{a4jAjaxBean.attributes['limitRender'].value}"
listener="#{a4jAjaxBean.attributes.listener}"
onbeforedomupdate="#{a4jAjaxBean.attributes['onbeforedomupdate'].value}"
+ onbeforesubmit="#{a4jAjaxBean.attributes['onbeforesubmit'].value}"
onbegin="#{a4jAjaxBean.attributes['onbegin'].value}"
oncomplete="#{a4jAjaxBean.attributes['oncomplete'].value}"
onerror="#{a4jAjaxBean.attributes['onerror'].value}"
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hInputText.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hInputText.xhtml 2011-01-27 16:09:53 UTC (rev 21286)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hInputText.xhtml 2011-01-27 16:40:36 UTC (rev 21287)
@@ -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.
@@ -51,6 +51,7 @@
limitRender="#{a4jAjaxBean.attributes['limitRender'].value}"
listener="#{a4jAjaxBean.attributes.listener}"
onbeforedomupdate="#{a4jAjaxBean.attributes['onbeforedomupdate'].value}"
+ onbeforesubmit="#{a4jAjaxBean.attributes['onbeforesubmit'].value}"
onbegin="#{a4jAjaxBean.attributes['onbegin'].value}"
oncomplete="#{a4jAjaxBean.attributes['oncomplete'].value}"
onerror="#{a4jAjaxBean.attributes['onerror'].value}"
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hInputTextWrapped.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hInputTextWrapped.xhtml 2011-01-27 16:09:53 UTC (rev 21286)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hInputTextWrapped.xhtml 2011-01-27 16:40:36 UTC (rev 21287)
@@ -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.
@@ -51,6 +51,7 @@
limitRender="#{a4jAjaxBean.attributes['limitRender'].value}"
listener="#{a4jAjaxBean.attributes.listener}"
onbeforedomupdate="#{a4jAjaxBean.attributes['onbeforedomupdate'].value}"
+ onbeforesubmit="#{a4jAjaxBean.attributes['onbeforesubmit'].value}"
onbegin="#{a4jAjaxBean.attributes['onbegin'].value}"
oncomplete="#{a4jAjaxBean.attributes['oncomplete'].value}"
onerror="#{a4jAjaxBean.attributes['onerror'].value}"
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hInputTextarea.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hInputTextarea.xhtml 2011-01-27 16:09:53 UTC (rev 21286)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hInputTextarea.xhtml 2011-01-27 16:40:36 UTC (rev 21287)
@@ -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.
@@ -51,6 +51,7 @@
limitRender="#{a4jAjaxBean.attributes['limitRender'].value}"
listener="#{a4jAjaxBean.attributes.listener}"
onbeforedomupdate="#{a4jAjaxBean.attributes['onbeforedomupdate'].value}"
+ onbeforesubmit="#{a4jAjaxBean.attributes['onbeforesubmit'].value}"
onbegin="#{a4jAjaxBean.attributes['onbegin'].value}"
oncomplete="#{a4jAjaxBean.attributes['oncomplete'].value}"
onerror="#{a4jAjaxBean.attributes['onerror'].value}"
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hSelectBooleanCheckbox.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hSelectBooleanCheckbox.xhtml 2011-01-27 16:09:53 UTC (rev 21286)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hSelectBooleanCheckbox.xhtml 2011-01-27 16:40:36 UTC (rev 21287)
@@ -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.
@@ -50,6 +50,7 @@
limitRender="#{a4jAjaxBean.attributes['limitRender'].value}"
listener="#{a4jAjaxBean.attributes.listener}"
onbeforedomupdate="#{a4jAjaxBean.attributes['onbeforedomupdate'].value}"
+ onbeforesubmit="#{a4jAjaxBean.attributes['onbeforesubmit'].value}"
onbegin="#{a4jAjaxBean.attributes['onbegin'].value}"
oncomplete="#{a4jAjaxBean.attributes['oncomplete'].value}"
onerror="#{a4jAjaxBean.attributes['onerror'].value}"
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hSelectManyCheckbox.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hSelectManyCheckbox.xhtml 2011-01-27 16:09:53 UTC (rev 21286)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hSelectManyCheckbox.xhtml 2011-01-27 16:40:36 UTC (rev 21287)
@@ -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.
@@ -56,6 +56,7 @@
limitRender="#{a4jAjaxBean.attributes['limitRender'].value}"
listener="#{a4jAjaxBean.attributes.listener}"
onbeforedomupdate="#{a4jAjaxBean.attributes['onbeforedomupdate'].value}"
+ onbeforesubmit="#{a4jAjaxBean.attributes['onbeforesubmit'].value}"
onbegin="#{a4jAjaxBean.attributes['onbegin'].value}"
oncomplete="#{a4jAjaxBean.attributes['oncomplete'].value}"
onerror="#{a4jAjaxBean.attributes['onerror'].value}"
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hSelectManyListbox.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hSelectManyListbox.xhtml 2011-01-27 16:09:53 UTC (rev 21286)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hSelectManyListbox.xhtml 2011-01-27 16:40:36 UTC (rev 21287)
@@ -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.
@@ -57,6 +57,7 @@
limitRender="#{a4jAjaxBean.attributes['limitRender'].value}"
listener="#{a4jAjaxBean.attributes.listener}"
onbeforedomupdate="#{a4jAjaxBean.attributes['onbeforedomupdate'].value}"
+ onbeforesubmit="#{a4jAjaxBean.attributes['onbeforesubmit'].value}"
onbegin="#{a4jAjaxBean.attributes['onbegin'].value}"
oncomplete="#{a4jAjaxBean.attributes['oncomplete'].value}"
onerror="#{a4jAjaxBean.attributes['onerror'].value}"
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hSelectManyMenu.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hSelectManyMenu.xhtml 2011-01-27 16:09:53 UTC (rev 21286)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hSelectManyMenu.xhtml 2011-01-27 16:40:36 UTC (rev 21287)
@@ -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.
@@ -57,6 +57,7 @@
limitRender="#{a4jAjaxBean.attributes['limitRender'].value}"
listener="#{a4jAjaxBean.attributes.listener}"
onbeforedomupdate="#{a4jAjaxBean.attributes['onbeforedomupdate'].value}"
+ onbeforesubmit="#{a4jAjaxBean.attributes['onbeforesubmit'].value}"
onbegin="#{a4jAjaxBean.attributes['onbegin'].value}"
oncomplete="#{a4jAjaxBean.attributes['oncomplete'].value}"
onerror="#{a4jAjaxBean.attributes['onerror'].value}"
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hSelectOneListbox.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hSelectOneListbox.xhtml 2011-01-27 16:09:53 UTC (rev 21286)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hSelectOneListbox.xhtml 2011-01-27 16:40:36 UTC (rev 21287)
@@ -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.
@@ -56,6 +56,7 @@
limitRender="#{a4jAjaxBean.attributes['limitRender'].value}"
listener="#{a4jAjaxBean.attributes.listener}"
onbeforedomupdate="#{a4jAjaxBean.attributes['onbeforedomupdate'].value}"
+ onbeforesubmit="#{a4jAjaxBean.attributes['onbeforesubmit'].value}"
onbegin="#{a4jAjaxBean.attributes['onbegin'].value}"
oncomplete="#{a4jAjaxBean.attributes['oncomplete'].value}"
onerror="#{a4jAjaxBean.attributes['onerror'].value}"
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hSelectOneMenu.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hSelectOneMenu.xhtml 2011-01-27 16:09:53 UTC (rev 21286)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hSelectOneMenu.xhtml 2011-01-27 16:40:36 UTC (rev 21287)
@@ -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.
@@ -57,6 +57,7 @@
limitRender="#{a4jAjaxBean.attributes['limitRender'].value}"
listener="#{a4jAjaxBean.attributes.listener}"
onbeforedomupdate="#{a4jAjaxBean.attributes['onbeforedomupdate'].value}"
+ onbeforesubmit="#{a4jAjaxBean.attributes['onbeforesubmit'].value}"
onbegin="#{a4jAjaxBean.attributes['onbegin'].value}"
oncomplete="#{a4jAjaxBean.attributes['oncomplete'].value}"
onerror="#{a4jAjaxBean.attributes['onerror'].value}"
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hSelectOneRadio.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hSelectOneRadio.xhtml 2011-01-27 16:09:53 UTC (rev 21286)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/hSelectOneRadio.xhtml 2011-01-27 16:40:36 UTC (rev 21287)
@@ -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.
@@ -56,6 +56,7 @@
limitRender="#{a4jAjaxBean.attributes['limitRender'].value}"
listener="#{a4jAjaxBean.attributes.listener}"
onbeforedomupdate="#{a4jAjaxBean.attributes['onbeforedomupdate'].value}"
+ onbeforesubmit="#{a4jAjaxBean.attributes['onbeforesubmit'].value}"
onbegin="#{a4jAjaxBean.attributes['onbegin'].value}"
oncomplete="#{a4jAjaxBean.attributes['oncomplete'].value}"
onerror="#{a4jAjaxBean.attributes['onerror'].value}"
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/list.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/list.xhtml 2011-01-27 16:09:53 UTC (rev 21286)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/a4jAjax/list.xhtml 2011-01-27 16:40:36 UTC (rev 21287)
@@ -4,7 +4,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.
Modified: modules/tests/metamer/trunk/ftest/src/test/resources/testng-misc.xml
===================================================================
--- modules/tests/metamer/trunk/ftest/src/test/resources/testng-misc.xml 2011-01-27 16:09:53 UTC (rev 21286)
+++ modules/tests/metamer/trunk/ftest/src/test/resources/testng-misc.xml 2011-01-27 16:40:36 UTC (rev 21287)
@@ -5,6 +5,7 @@
<packages>
<package name="org.richfaces.tests.metamer.ftest.hCommandButton" />
<package name="org.richfaces.tests.metamer.ftest.richComponentControl" />
+ <package name="org.richfaces.tests.metamer.ftest.richDropDownMenu" />
<package name="org.richfaces.tests.metamer.ftest.richFunctions" />
<package name="org.richfaces.tests.metamer.ftest.richJQuery" />
<package name="org.richfaces.tests.metamer.ftest.richMenuGroup" />
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/AbstractTestCommand.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/AbstractTestCommand.java 2011-01-27 16:09:53 UTC (rev 21286)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/AbstractTestCommand.java 2011-01-27 16:40:36 UTC (rev 21287)
@@ -55,17 +55,17 @@
}
public void testBypassUpdates(JQueryLocator command) {
- String timeValue = selenium.getText(time);
+ String reqTime = selenium.getText(time);
selenium.click(pjq("input[type=radio][name$=bypassUpdatesInput][value=true]"));
selenium.waitForPageToLoad();
selenium.type(input, "RichFaces 4");
guardXhr(selenium).click(command);
- waitGui.failWith("Page was not updated").waitForChange(timeValue, retrieveText.locator(time));
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
assertEquals(selenium.getText(output1), "", "Output should not change");
- assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS,
+ phaseInfo.assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS,
PhaseId.RENDER_RESPONSE);
}
@@ -76,16 +76,29 @@
selenium.type(pjq("input[type=text][id$=oncompleteInput]"), "data = event.data");
selenium.waitForPageToLoad();
- String timeValue = selenium.getText(time);
+ String reqTime = selenium.getText(time);
selenium.type(input, "some input text");
guardXhr(selenium).click(command);
- waitGui.failWith("Page was not updated").waitForChange(timeValue, retrieveText.locator(time));
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
String data = selenium.getEval(new JavaScript("window.data"));
assertEquals(data, "RichFaces 4", "Data sent with ajax request");
}
+ public void testDisabled(JQueryLocator command) {
+ selenium.click(pjq("input[type=radio][name$=disabledInput][value=true]"));
+ selenium.waitForPageToLoad();
+
+ String reqTime = selenium.getText(time);
+ selenium.type(input, "RichFaces 4");
+ guardXhr(selenium).click(command);
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
+
+ assertEquals(selenium.getText(output1), "", "Output1 should not change");
+ assertEquals(selenium.getText(output2), "", "Output2 should not change");
+ }
+
public void testExecute(JQueryLocator command) {
selenium.type(pjq("input[type=text][id$=executeInput]"), "input executeChecker");
selenium.waitForPageToLoad();
@@ -105,22 +118,22 @@
}
public void testImmediate(JQueryLocator command) {
- String timeValue = selenium.getText(time);
+ String reqTime = selenium.getText(time);
selenium.click(pjq("input[type=radio][name$=immediateInput][value=true]"));
selenium.waitForPageToLoad();
selenium.type(input, "RichFaces 4");
guardXhr(selenium).click(command);
- waitGui.failWith("Page was not updated").waitForChange(timeValue, retrieveText.locator(time));
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
assertEquals(selenium.getText(output1), "RichFaces 4", "Output should change");
- assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS,
+ phaseInfo.assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS,
PhaseId.UPDATE_MODEL_VALUES, PhaseId.INVOKE_APPLICATION, PhaseId.RENDER_RESPONSE);
}
public void testImmediateBypassUpdates(JQueryLocator command) {
- String timeValue = selenium.getText(time);
+ String reqTime = selenium.getText(time);
selenium.click(pjq("input[type=radio][name$=bypassUpdatesInput][value=true]"));
selenium.waitForPageToLoad();
@@ -129,26 +142,28 @@
selenium.type(input, "RichFaces 4");
guardXhr(selenium).click(command);
- waitGui.failWith("Page was not updated").waitForChange(timeValue, retrieveText.locator(time));
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
assertEquals(selenium.getText(output1), "", "Output should not change");
- assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.RENDER_RESPONSE);
+ phaseInfo.assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.RENDER_RESPONSE);
}
public void testLimitRender(JQueryLocator command) {
selenium.click(pjq("input[type=radio][name$=limitRenderInput][value=true]"));
selenium.waitForPageToLoad();
- String timeValue = selenium.getText(time);
+ String reqTime = selenium.getText(time);
selenium.type(input, "RichFaces 4");
guardXhr(selenium).click(command);
waitGui.failWith("Page was not updated").waitForChange("", retrieveText.locator(output1));
- assertEquals(selenium.getText(time), timeValue, "Ajax-rendered a4j:outputPanel shouldn't change");
+ assertEquals(selenium.getText(time), reqTime, "Ajax-rendered a4j:outputPanel shouldn't change");
}
public void testEvents(JQueryLocator command) {
+ selenium.type(pjq("input[type=text][id$=onbeforesubmitInput]"), "metamerEvents += \"beforesubmit \"");
+ selenium.waitForPageToLoad();
selenium.type(pjq("input[type=text][id$=onbeginInput]"), "metamerEvents += \"begin \"");
selenium.waitForPageToLoad();
selenium.type(pjq("input[type=text][id$=onbeforedomupdateInput]"), "metamerEvents += \"beforedomupdate \"");
@@ -164,10 +179,11 @@
String[] events = selenium.getEval(new JavaScript("window.metamerEvents")).split(" ");
- assertEquals(events.length, 3, "3 events should be fired.");
- assertEquals(events[0], "begin", "Attribute onbegin doesn't work");
- assertEquals(events[1], "beforedomupdate", "Attribute onbeforedomupdate doesn't work");
- assertEquals(events[2], "complete", "Attribute oncomplete doesn't work");
+ assertEquals(events.length, 4, "4 events should be fired.");
+ assertEquals(events[0], "beforesubmit", "Attribute onbeforesubmit doesn't work");
+ assertEquals(events[1], "begin", "Attribute onbegin doesn't work");
+ assertEquals(events[2], "beforedomupdate", "Attribute onbeforedomupdate doesn't work");
+ assertEquals(events[3], "complete", "Attribute oncomplete doesn't work");
}
public void testRender(JQueryLocator command) {
@@ -181,6 +197,14 @@
assertEquals(outputValue, "RichFaces 4", "Wrong output1");
assertEquals(selenium.getText(output2), "", "Wrong output2");
+ }
+ public void testStatus(JQueryLocator command) {
+ selenium.type(pjq("input[type=text][id$=statusInput]"), "statusChecker");
+ selenium.waitForPageToLoad();
+
+ String statusCheckerTime = selenium.getText(statusChecker);
+ guardXhr(selenium).click(command);
+ waitGui.failWith("Attribute status doesn't work").waitForChange(statusCheckerTime, retrieveText.locator(statusChecker));
}
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/AbstractTestSelectMany.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/AbstractTestSelectMany.java 2011-01-27 16:09:53 UTC (rev 21286)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/AbstractTestSelectMany.java 2011-01-27 16:40:36 UTC (rev 21287)
@@ -55,16 +55,16 @@
}
public void testBypassUpdates(JQueryLocator input) {
- String timeValue = selenium.getText(time);
+ String reqTime = selenium.getText(time);
selenium.click(pjq("input[type=radio][name$=bypassUpdatesInput][value=true]"));
selenium.waitForPageToLoad();
guardXhr(selenium).addSelection(input, optionValue("Audi"));
- waitGui.failWith("Page was not updated").waitForChange(timeValue, retrieveText.locator(time));
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
assertEquals(selenium.getText(output1), "[Ferrari, Lexus]", "Output should not change");
- assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS,
+ phaseInfo.assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS,
PhaseId.RENDER_RESPONSE);
}
@@ -75,22 +75,33 @@
selenium.type(pjq("input[type=text][id$=oncompleteInput]"), "data = event.data");
selenium.waitForPageToLoad();
- String timeValue = selenium.getText(time);
-
+ String reqTime = selenium.getText(time);
guardXhr(selenium).addSelection(input, optionValue("Audi"));
- waitGui.failWith("Page was not updated").waitForChange(timeValue, retrieveText.locator(time));
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
String data = selenium.getEval(new JavaScript("window.data"));
assertEquals(data, "RichFaces 4 data", "Data sent with ajax request");
}
+ public void testDisabled(JQueryLocator input) {
+ selenium.click(pjq("input[type=radio][name$=disabledInput][value=true]"));
+ selenium.waitForPageToLoad();
+
+ String reqTime = selenium.getText(time);
+ guardXhr(selenium).addSelection(input, optionValue("Audi"));
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
+
+ assertEquals(selenium.getText(output1), "[Ferrari, Lexus]", "Output1 should not change");
+ assertEquals(selenium.getText(output2), "[Ferrari, Lexus]", "Output2 should not change");
+ }
+
public void testExecute(JQueryLocator input) {
selenium.type(pjq("input[type=text][id$=executeInput]"), "input executeChecker");
selenium.waitForPageToLoad();
- String timeValue = selenium.getText(time);
+ String reqTime = selenium.getText(time);
guardXhr(selenium).addSelection(input, optionValue("Audi"));
- waitGui.failWith("Page was not updated").waitForChange(timeValue, retrieveText.locator(time));
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
JQueryLocator logItems = jq("ul.phases-list li:eq({0})");
for (int i = 0; i < 6; i++) {
@@ -103,21 +114,21 @@
}
public void testImmediate(JQueryLocator input) {
- String timeValue = selenium.getText(time);
+ String reqTime = selenium.getText(time);
selenium.click(pjq("input[type=radio][name$=immediateInput][value=true]"));
selenium.waitForPageToLoad();
guardXhr(selenium).addSelection(input, optionValue("Audi"));
- waitGui.failWith("Page was not updated").waitForChange(timeValue, retrieveText.locator(time));
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
assertEquals(selenium.getText(output1), "[Audi, Ferrari, Lexus]", "Output should change");
- assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS,
+ phaseInfo.assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS,
PhaseId.UPDATE_MODEL_VALUES, PhaseId.INVOKE_APPLICATION, PhaseId.RENDER_RESPONSE);
}
public void testImmediateBypassUpdates(JQueryLocator input) {
- String timeValue = selenium.getText(time);
+ String reqTime = selenium.getText(time);
selenium.click(pjq("input[type=radio][name$=bypassUpdatesInput][value=true]"));
selenium.waitForPageToLoad();
@@ -125,25 +136,26 @@
selenium.waitForPageToLoad();
guardXhr(selenium).addSelection(input, optionValue("Audi"));
- waitGui.failWith("Page was not updated").waitForChange(timeValue, retrieveText.locator(time));
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
assertEquals(selenium.getText(output1), "[Ferrari, Lexus]", "Output should not change");
- assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.RENDER_RESPONSE);
+ phaseInfo.assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.RENDER_RESPONSE);
}
public void testLimitRender(JQueryLocator input) {
selenium.click(pjq("input[type=radio][name$=limitRenderInput][value=true]"));
selenium.waitForPageToLoad();
- String timeValue = selenium.getText(time);
-
+ String reqTime = selenium.getText(time);
guardXhr(selenium).addSelection(input, optionValue("Audi"));
waitGui.failWith("Page was not updated").waitForChange("", retrieveText.locator(output1));
- assertEquals(selenium.getText(time), timeValue, "Ajax-rendered a4j:outputPanel shouldn't change");
+ assertEquals(selenium.getText(time), reqTime, "Ajax-rendered a4j:outputPanel shouldn't change");
}
public void testEvents(JQueryLocator input) {
+ selenium.type(pjq("input[type=text][id$=onbeforesubmitInput]"), "metamerEvents += \"beforesubmit \"");
+ selenium.waitForPageToLoad();
selenium.type(pjq("input[type=text][id$=onbeginInput]"), "metamerEvents += \"begin \"");
selenium.waitForPageToLoad();
selenium.type(pjq("input[type=text][id$=onbeforedomupdateInput]"), "metamerEvents += \"beforedomupdate \"");
@@ -158,9 +170,11 @@
String[] events = selenium.getEval(new JavaScript("window.metamerEvents")).split(" ");
- assertEquals(events[0], "begin", "Attribute onbegin doesn't work");
- assertEquals(events[1], "beforedomupdate", "Attribute onbeforedomupdate doesn't work");
- assertEquals(events[2], "complete", "Attribute oncomplete doesn't work");
+ assertEquals(events.length, 4, "4 events should be fired.");
+ assertEquals(events[0], "beforesubmit", "Attribute onbeforesubmit doesn't work");
+ assertEquals(events[1], "begin", "Attribute onbegin doesn't work");
+ assertEquals(events[2], "beforedomupdate", "Attribute onbeforedomupdate doesn't work");
+ assertEquals(events[3], "complete", "Attribute oncomplete doesn't work");
}
public void testRender(JQueryLocator input) {
@@ -174,4 +188,13 @@
assertEquals(outputValue, "[Audi, Ferrari, Lexus]", "Wrong output1");
assertEquals(selenium.getText(output2), "[Ferrari, Lexus]", "Wrong output2");
}
+
+ public void testStatus(JQueryLocator input) {
+ selenium.type(pjq("input[type=text][id$=statusInput]"), "statusChecker");
+ selenium.waitForPageToLoad();
+
+ String statusCheckerTime = selenium.getText(statusChecker);
+ guardXhr(selenium).addSelection(input, optionValue("Audi"));
+ waitGui.failWith("Attribute status doesn't work").waitForChange(statusCheckerTime, retrieveText.locator(statusChecker));
+ }
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/AbstractTestSelectOne.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/AbstractTestSelectOne.java 2011-01-27 16:09:53 UTC (rev 21286)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/AbstractTestSelectOne.java 2011-01-27 16:40:36 UTC (rev 21287)
@@ -55,16 +55,16 @@
}
public void testBypassUpdates(JQueryLocator input) {
- String timeValue = selenium.getText(time);
+ String reqTime = selenium.getText(time);
selenium.click(pjq("input[type=radio][name$=bypassUpdatesInput][value=true]"));
selenium.waitForPageToLoad();
guardXhr(selenium).select(input, optionValue("Audi"));
- waitGui.failWith("Page was not updated").waitForChange(timeValue, retrieveText.locator(time));
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
assertEquals(selenium.getText(output1), "Ferrari", "Output should not change");
- assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS,
+ phaseInfo.assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS,
PhaseId.RENDER_RESPONSE);
}
@@ -75,22 +75,33 @@
selenium.type(pjq("input[type=text][id$=oncompleteInput]"), "data = event.data");
selenium.waitForPageToLoad();
- String timeValue = selenium.getText(time);
-
+ String reqTime = selenium.getText(time);
guardXhr(selenium).select(input, optionValue("Audi"));
- waitGui.failWith("Page was not updated").waitForChange(timeValue, retrieveText.locator(time));
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
String data = selenium.getEval(new JavaScript("window.data"));
assertEquals(data, "RichFaces 4 data", "Data sent with ajax request");
}
+ public void testDisabled(JQueryLocator input) {
+ selenium.click(pjq("input[type=radio][name$=disabledInput][value=true]"));
+ selenium.waitForPageToLoad();
+
+ String reqTime = selenium.getText(time);
+ guardXhr(selenium).select(input, optionValue("Audi"));
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
+
+ assertEquals(selenium.getText(output1), "Ferrari", "Output1 should not change");
+ assertEquals(selenium.getText(output2), "Ferrari", "Output2 should not change");
+ }
+
public void testExecute(JQueryLocator input) {
selenium.type(pjq("input[type=text][id$=executeInput]"), "input executeChecker");
selenium.waitForPageToLoad();
- String timeValue = selenium.getText(time);
+ String reqTime = selenium.getText(time);
guardXhr(selenium).select(input, optionValue("Audi"));
- waitGui.failWith("Page was not updated").waitForChange(timeValue, retrieveText.locator(time));
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
JQueryLocator logItems = jq("ul.phases-list li:eq({0})");
for (int i = 0; i < 6; i++) {
@@ -103,21 +114,21 @@
}
public void testImmediate(JQueryLocator input) {
- String timeValue = selenium.getText(time);
+ String reqTime = selenium.getText(time);
selenium.click(pjq("input[type=radio][name$=immediateInput][value=true]"));
selenium.waitForPageToLoad();
guardXhr(selenium).select(input, optionValue("Audi"));
- waitGui.failWith("Page was not updated").waitForChange(timeValue, retrieveText.locator(time));
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
assertEquals(selenium.getText(output1), "Audi", "Output should change");
- assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS,
+ phaseInfo.assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS,
PhaseId.UPDATE_MODEL_VALUES, PhaseId.INVOKE_APPLICATION, PhaseId.RENDER_RESPONSE);
}
public void testImmediateBypassUpdates(JQueryLocator input) {
- String timeValue = selenium.getText(time);
+ String reqTime = selenium.getText(time);
selenium.click(pjq("input[type=radio][name$=bypassUpdatesInput][value=true]"));
selenium.waitForPageToLoad();
@@ -125,25 +136,27 @@
selenium.waitForPageToLoad();
guardXhr(selenium).select(input, optionValue("Audi"));
- waitGui.failWith("Page was not updated").waitForChange(timeValue, retrieveText.locator(time));
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
assertEquals(selenium.getText(output1), "Ferrari", "Output should not change");
- assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.RENDER_RESPONSE);
+ phaseInfo.assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.RENDER_RESPONSE);
}
public void testLimitRender(JQueryLocator input) {
selenium.click(pjq("input[type=radio][name$=limitRenderInput][value=true]"));
selenium.waitForPageToLoad();
- String timeValue = selenium.getText(time);
+ String reqTime = selenium.getText(time);
guardXhr(selenium).select(input, optionValue("Audi"));
waitGui.failWith("Page was not updated").waitForChange("", retrieveText.locator(output1));
- assertEquals(selenium.getText(time), timeValue, "Ajax-rendered a4j:outputPanel shouldn't change");
+ assertEquals(selenium.getText(time), reqTime, "Ajax-rendered a4j:outputPanel shouldn't change");
}
public void testEvents(JQueryLocator input) {
+ selenium.type(pjq("input[type=text][id$=onbeforesubmitInput]"), "metamerEvents += \"beforesubmit \"");
+ selenium.waitForPageToLoad();
selenium.type(pjq("input[type=text][id$=onbeginInput]"), "metamerEvents += \"begin \"");
selenium.waitForPageToLoad();
selenium.type(pjq("input[type=text][id$=onbeforedomupdateInput]"), "metamerEvents += \"beforedomupdate \"");
@@ -158,9 +171,11 @@
String[] events = selenium.getEval(new JavaScript("window.metamerEvents")).split(" ");
- assertEquals(events[0], "begin", "Attribute onbegin doesn't work");
- assertEquals(events[1], "beforedomupdate", "Attribute onbeforedomupdate doesn't work");
- assertEquals(events[2], "complete", "Attribute oncomplete doesn't work");
+ assertEquals(events.length, 4, "4 events should be fired.");
+ assertEquals(events[0], "beforesubmit", "Attribute onbeforesubmit doesn't work");
+ assertEquals(events[1], "begin", "Attribute onbegin doesn't work");
+ assertEquals(events[2], "beforedomupdate", "Attribute onbeforedomupdate doesn't work");
+ assertEquals(events[3], "complete", "Attribute oncomplete doesn't work");
}
public void testRender(JQueryLocator input) {
@@ -174,4 +189,13 @@
assertEquals(outputValue, "Audi", "Wrong output1");
assertEquals(selenium.getText(output2), "Ferrari", "Wrong output2");
}
+
+ public void testStatus(JQueryLocator input) {
+ selenium.type(pjq("input[type=text][id$=statusInput]"), "statusChecker");
+ selenium.waitForPageToLoad();
+
+ String statusCheckerTime = selenium.getText(statusChecker);
+ guardXhr(selenium).select(input, optionValue("Audi"));
+ waitGui.failWith("Attribute status doesn't work").waitForChange(statusCheckerTime, retrieveText.locator(statusChecker));
+ }
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/AbstractTestTextInput.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/AbstractTestTextInput.java 2011-01-27 16:09:53 UTC (rev 21286)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/AbstractTestTextInput.java 2011-01-27 16:40:36 UTC (rev 21287)
@@ -61,16 +61,16 @@
}
public void testBypassUpdates(JQueryLocator input) {
- String timeValue = selenium.getText(time);
+ String reqTime = selenium.getText(time);
selenium.click(pjq("input[type=radio][name$=bypassUpdatesInput][value=true]"));
selenium.waitForPageToLoad();
typeToInput(input, "RichFaces 4");
- waitGui.failWith("Page was not updated").waitForChange(timeValue, retrieveText.locator(time));
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
assertEquals(selenium.getText(output1), "", "Output should not change");
- assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS,
+ phaseInfo.assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS,
PhaseId.RENDER_RESPONSE);
}
@@ -81,22 +81,34 @@
selenium.type(pjq("input[type=text][id$=oncompleteInput]"), "data = event.data");
selenium.waitForPageToLoad();
- String timeValue = selenium.getText(time);
+ String reqTime = selenium.getText(time);
typeToInput(input, "RichFaces 4");
- waitGui.failWith("Page was not updated").waitForChange(timeValue, retrieveText.locator(time));
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
String data = selenium.getEval(new JavaScript("window.data"));
assertEquals(data, "RichFaces 4 data", "Data sent with ajax request");
}
+ public void testDisabled(JQueryLocator input) {
+ selenium.click(pjq("input[type=radio][name$=disabledInput][value=true]"));
+ selenium.waitForPageToLoad();
+
+ String reqTime = selenium.getText(time);
+ typeToInput(input, "RichFaces 4");
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
+
+ assertEquals(selenium.getText(output1), "", "Output1 should not change");
+ assertEquals(selenium.getText(output2), "", "Output2 should not change");
+ }
+
public void testExecute(JQueryLocator input) {
selenium.type(pjq("input[type=text][id$=executeInput]"), "@this executeChecker");
selenium.waitForPageToLoad();
- String timeValue = selenium.getText(time);
+ String reqTime = selenium.getText(time);
typeToInput(input, "RichFaces 4");
- waitGui.failWith("Page was not updated").waitForChange(timeValue, retrieveText.locator(time));
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
JQueryLocator logItems = jq("ul.phases-list li:eq({0})");
for (int i = 0; i < 6; i++) {
@@ -109,21 +121,21 @@
}
public void testImmediate(JQueryLocator input) {
- String timeValue = selenium.getText(time);
+ String reqTime = selenium.getText(time);
selenium.click(pjq("input[type=radio][name$=immediateInput][value=true]"));
selenium.waitForPageToLoad();
typeToInput(input, "RichFaces 4");
- waitGui.failWith("Page was not updated").waitForChange(timeValue, retrieveText.locator(time));
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
assertEquals(selenium.getText(output1), "RichFaces 4", "Output should change");
- assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS,
+ phaseInfo.assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS,
PhaseId.UPDATE_MODEL_VALUES, PhaseId.INVOKE_APPLICATION, PhaseId.RENDER_RESPONSE);
}
public void testImmediateBypassUpdates(JQueryLocator input) {
- String timeValue = selenium.getText(time);
+ String reqTime = selenium.getText(time);
selenium.click(pjq("input[type=radio][name$=bypassUpdatesInput][value=true]"));
selenium.waitForPageToLoad();
@@ -131,25 +143,27 @@
selenium.waitForPageToLoad();
typeToInput(input, "RichFaces 4");
- waitGui.failWith("Page was not updated").waitForChange(timeValue, retrieveText.locator(time));
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
assertEquals(selenium.getText(output1), "", "Output should not change");
- assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.RENDER_RESPONSE);
+ phaseInfo.assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.RENDER_RESPONSE);
}
public void testLimitRender(JQueryLocator input) {
selenium.click(pjq("input[type=radio][name$=limitRenderInput][value=true]"));
selenium.waitForPageToLoad();
- String timeValue = selenium.getText(time);
+ String reqTime = selenium.getText(time);
typeToInput(input, "RichFaces 4");
waitGui.failWith("Page was not updated").waitForChange("", retrieveText.locator(output1));
- assertEquals(selenium.getText(time), timeValue, "Ajax-rendered a4j:outputPanel shouldn't change");
+ assertEquals(selenium.getText(time), reqTime, "Ajax-rendered a4j:outputPanel shouldn't change");
}
public void testEvents(JQueryLocator input) {
+ selenium.type(pjq("input[type=text][id$=onbeforesubmitInput]"), "metamerEvents += \"beforesubmit \"");
+ selenium.waitForPageToLoad();
selenium.type(pjq("input[type=text][id$=onbeginInput]"), "metamerEvents += \"begin \"");
selenium.waitForPageToLoad();
selenium.type(pjq("input[type=text][id$=onbeforedomupdateInput]"), "metamerEvents += \"beforedomupdate \"");
@@ -164,9 +178,11 @@
String[] events = selenium.getEval(new JavaScript("window.metamerEvents")).split(" ");
- assertEquals(events[0], "begin", "Attribute onbegin doesn't work");
- assertEquals(events[1], "beforedomupdate", "Attribute onbeforedomupdate doesn't work");
- assertEquals(events[2], "complete", "Attribute oncomplete doesn't work");
+ assertEquals(events.length, 44, "4 events should be fired.");
+ assertEquals(events[0], "beforesubmit", "Attribute onbeforesubmit doesn't work");
+ assertEquals(events[1], "begin", "Attribute onbegin doesn't work");
+ assertEquals(events[2], "beforedomupdate", "Attribute onbeforedomupdate doesn't work");
+ assertEquals(events[3], "complete", "Attribute oncomplete doesn't work");
}
public void testRender(JQueryLocator input) {
@@ -180,4 +196,13 @@
assertEquals(outputValue, "RichFaces 4", "Wrong output1");
assertEquals(selenium.getText(output2), "", "Wrong output2");
}
+
+ public void testStatus(JQueryLocator input) {
+ selenium.type(pjq("input[type=text][id$=statusInput]"), "statusChecker");
+ selenium.waitForPageToLoad();
+
+ String statusCheckerTime = selenium.getText(statusChecker);
+ typeToInput(input, "RichFaces 4");
+ waitGui.failWith("Attribute status doesn't work").waitForChange(statusCheckerTime, retrieveText.locator(statusChecker));
+ }
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHCommandButton.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHCommandButton.java 2011-01-27 16:09:53 UTC (rev 21286)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHCommandButton.java 2011-01-27 16:40:36 UTC (rev 21287)
@@ -38,7 +38,7 @@
public class TestHCommandButton extends AbstractTestCommand {
private JQueryLocator button = pjq("input[type=submit][id$=commandButton]");
-
+
@Override
public URL getTestUrl() {
return buildUrl(contextPath, "faces/components/a4jAjax/hCommandButton.xhtml");
@@ -46,52 +46,62 @@
@Test
public void testSimpleClick() {
- super.testClick(button, "RichFaces 4");
+ testClick(button, "RichFaces 4");
}
@Test
@IssueTracking("https://issues.jboss.org/browse/RF-9665")// </editor-fold>
public void testSimpleClickUnicode() {
- super.testClick(button, "ľščťžýáíéúôň фывацукйешгщь");
+ testClick(button, "ľščťžýáíéúôň фывацукйешгщь");
}
@Test
public void testBypassUpdates() {
- super.testBypassUpdates(button);
+ testBypassUpdates(button);
}
@Test
public void testData() {
- super.testData(button);
+ testData(button);
}
@Test
+ public void testDisabled() {
+ testDisabled(button);
+ }
+
+ @Test
public void testExecute() {
- super.testExecute(button);
+ testExecute(button);
}
@Test
public void testImmediate() {
- super.testImmediate(button);
+ testImmediate(button);
}
@Test
public void testImmediateBypassUpdates() {
- super.testImmediateBypassUpdates(button);
+ testImmediateBypassUpdates(button);
}
@Test
public void testLimitRender() {
- super.testLimitRender(button);
+ testLimitRender(button);
}
@Test
public void testEvents() {
- super.testEvents(button);
+ testEvents(button);
}
@Test
public void testRender() {
- super.testRender(button);
+ testRender(button);
}
+
+ @Test
+ public void testStatus() {
+ testStatus(button);
+ }
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHCommandLink.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHCommandLink.java 2011-01-27 16:09:53 UTC (rev 21286)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHCommandLink.java 2011-01-27 16:40:36 UTC (rev 21287)
@@ -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.
*
@@ -46,52 +46,62 @@
@Test
public void testSimpleClick() {
- super.testClick(link, "RichFaces 4");
+ testClick(link, "RichFaces 4");
}
@Test
@IssueTracking("https://issues.jboss.org/browse/RF-9665")
public void testSimpleClickUnicode() {
- super.testClick(link, "ľščťžýáíéúôň фывацукйешгщь");
+ testClick(link, "ľščťžýáíéúôň фывацукйешгщь");
}
@Test
public void testBypassUpdates() {
- super.testBypassUpdates(link);
+ testBypassUpdates(link);
}
@Test
public void testData() {
- super.testData(link);
+ testData(link);
}
@Test
+ public void testDisabled() {
+ testDisabled(link);
+ }
+
+ @Test
public void testExecute() {
- super.testExecute(link);
+ testExecute(link);
}
@Test
public void testImmediate() {
- super.testImmediate(link);
+ testImmediate(link);
}
@Test
public void testImmediateBypassUpdates() {
- super.testImmediateBypassUpdates(link);
+ testImmediateBypassUpdates(link);
}
@Test
public void testLimitRender() {
- super.testLimitRender(link);
+ testLimitRender(link);
}
@Test
public void testEvents() {
- super.testEvents(link);
+ testEvents(link);
}
@Test
public void testRender() {
- super.testRender(link);
+ testRender(link);
}
+
+ @Test
+ public void testStatus() {
+ testStatus(link);
+ }
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHGraphicImage.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHGraphicImage.java 2011-01-27 16:09:53 UTC (rev 21286)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHGraphicImage.java 2011-01-27 16:40:36 UTC (rev 21287)
@@ -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.
*
@@ -46,52 +46,62 @@
@Test
public void testSimpleClick() {
- super.testClick(button, "RichFaces 4");
+ testClick(button, "RichFaces 4");
}
@Test
@IssueTracking("https://issues.jboss.org/browse/RF-9665")
public void testSimpleClickUnicode() {
- super.testClick(button, "ľščťžýáíéúôň фывацукйешгщь");
+ testClick(button, "ľščťžýáíéúôň фывацукйешгщь");
}
@Test
public void testBypassUpdates() {
- super.testBypassUpdates(button);
+ testBypassUpdates(button);
}
@Test
public void testData() {
- super.testData(button);
+ testData(button);
}
@Test
+ public void testDisabled() {
+ testDisabled(button);
+ }
+
+ @Test
public void testExecute() {
- super.testExecute(button);
+ testExecute(button);
}
@Test
public void testImmediate() {
- super.testImmediate(button);
+ testImmediate(button);
}
@Test
public void testImmediateBypassUpdates() {
- super.testImmediateBypassUpdates(button);
+ testImmediateBypassUpdates(button);
}
@Test
public void testLimitRender() {
- super.testLimitRender(button);
+ testLimitRender(button);
}
@Test
public void testEvents() {
- super.testEvents(button);
+ testEvents(button);
}
@Test
public void testRender() {
- super.testRender(button);
+ testRender(button);
}
+
+ @Test
+ public void testStatus() {
+ testStatus(button);
+ }
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHInputSecret.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHInputSecret.java 2011-01-27 16:09:53 UTC (rev 21286)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHInputSecret.java 2011-01-27 16:40:36 UTC (rev 21287)
@@ -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.
*
@@ -24,9 +24,9 @@
import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
import java.net.URL;
+
import org.jboss.test.selenium.locator.JQueryLocator;
import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
-
import org.testng.annotations.Test;
/**
@@ -46,52 +46,62 @@
@Test
public void testSimpleType() {
- super.testType(input, "RichFaces 4");
+ testType(input, "RichFaces 4");
}
@Test
@IssueTracking("https://issues.jboss.org/browse/RF-9665")
public void testSimpleTypeUnicode() {
- super.testType(input, "ľščťžýáíéúôň фывацукйешгщь");
+ testType(input, "ľščťžýáíéúôň фывацукйешгщь");
}
@Test
public void testBypassUpdates() {
- super.testBypassUpdates(input);
+ testBypassUpdates(input);
}
@Test
public void testData() {
- super.testData(input);
+ testData(input);
}
@Test
+ public void testDisabled() {
+ testDisabled(input);
+ }
+
+ @Test
public void testExecute() {
- super.testExecute(input);
+ testExecute(input);
}
@Test
public void testImmediate() {
- super.testImmediate(input);
+ testImmediate(input);
}
@Test
public void testImmediateBypassUpdates() {
- super.testImmediateBypassUpdates(input);
+ testImmediateBypassUpdates(input);
}
@Test
public void testLimitRender() {
- super.testLimitRender(input);
+ testLimitRender(input);
}
@Test
public void testEvents() {
- super.testEvents(input);
+ testEvents(input);
}
@Test
public void testRender() {
- super.testRender(input);
+ testRender(input);
}
+
+ @Test
+ public void testStatus() {
+ testStatus(input);
+ }
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHInputText.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHInputText.java 2011-01-27 16:09:53 UTC (rev 21286)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHInputText.java 2011-01-27 16:40:36 UTC (rev 21287)
@@ -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.
*
@@ -24,9 +24,9 @@
import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
import java.net.URL;
+
import org.jboss.test.selenium.locator.JQueryLocator;
import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
-
import org.testng.annotations.Test;
/**
@@ -46,52 +46,62 @@
@Test
public void testSimpleType() {
- super.testType(input, "RichFaces 4");
+ testType(input, "RichFaces 4");
}
@Test
@IssueTracking("https://issues.jboss.org/browse/RF-9665")
public void testSimpleTypeUnicode() {
- super.testType(input, "ľščťžýáíéúôň фывацукйешгщь");
+ testType(input, "ľščťžýáíéúôň фывацукйешгщь");
}
@Test
public void testBypassUpdates() {
- super.testBypassUpdates(input);
+ testBypassUpdates(input);
}
@Test
public void testData() {
- super.testData(input);
+ testData(input);
}
@Test
+ public void testDisabled() {
+ testDisabled(input);
+ }
+
+ @Test
public void testExecute() {
- super.testExecute(input);
+ testExecute(input);
}
@Test
public void testImmediate() {
- super.testImmediate(input);
+ testImmediate(input);
}
@Test
public void testImmediateBypassUpdates() {
- super.testImmediateBypassUpdates(input);
+ testImmediateBypassUpdates(input);
}
@Test
public void testLimitRender() {
- super.testLimitRender(input);
+ testLimitRender(input);
}
@Test
public void testEvents() {
- super.testEvents(input);
+ testEvents(input);
}
@Test
public void testRender() {
- super.testRender(input);
+ testRender(input);
}
+
+ @Test
+ public void testStatus() {
+ testStatus(input);
+ }
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHInputTextarea.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHInputTextarea.java 2011-01-27 16:09:53 UTC (rev 21286)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHInputTextarea.java 2011-01-27 16:40:36 UTC (rev 21287)
@@ -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.
*
@@ -24,9 +24,9 @@
import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
import java.net.URL;
+
import org.jboss.test.selenium.locator.JQueryLocator;
import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
-
import org.testng.annotations.Test;
/**
@@ -46,52 +46,62 @@
@Test
public void testSimpleType() {
- super.testType(input, "RichFaces 4");
+ testType(input, "RichFaces 4");
}
@Test
@IssueTracking("https://issues.jboss.org/browse/RF-9665")
public void testSimpleTypeUnicode() {
- super.testType(input, "ľščťžýáíéúôň фывацукйешгщь");
+ testType(input, "ľščťžýáíéúôň фывацукйешгщь");
}
@Test
public void testBypassUpdates() {
- super.testBypassUpdates(input);
+ testBypassUpdates(input);
}
@Test
public void testData() {
- super.testData(input);
+ testData(input);
}
@Test
+ public void testDisabled() {
+ testDisabled(input);
+ }
+
+ @Test
public void testExecute() {
- super.testExecute(input);
+ testExecute(input);
}
@Test
public void testImmediate() {
- super.testImmediate(input);
+ testImmediate(input);
}
@Test
public void testImmediateBypassUpdates() {
- super.testImmediateBypassUpdates(input);
+ testImmediateBypassUpdates(input);
}
@Test
public void testLimitRender() {
- super.testLimitRender(input);
+ testLimitRender(input);
}
@Test
public void testEvents() {
- super.testEvents(input);
+ testEvents(input);
}
@Test
public void testRender() {
- super.testRender(input);
+ testRender(input);
}
+
+ @Test
+ public void testStatus() {
+ testStatus(input);
+ }
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectBooleanCheckbox.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectBooleanCheckbox.java 2011-01-27 16:09:53 UTC (rev 21286)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectBooleanCheckbox.java 2011-01-27 16:40:36 UTC (rev 21287)
@@ -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.
*
@@ -66,16 +66,16 @@
@Test
public void testBypassUpdates() {
- String timeValue = selenium.getText(time);
+ String reqTime = selenium.getText(time);
selenium.click(pjq("input[type=radio][name$=bypassUpdatesInput][value=true]"));
selenium.waitForPageToLoad();
guardXhr(selenium).click(input);
- waitGui.failWith("Page was not updated").waitForChange(timeValue, retrieveText.locator(time));
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
assertEquals(selenium.getText(output1), "false", "Output should not change");
- assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS,
+ phaseInfo.assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS,
PhaseId.RENDER_RESPONSE);
}
@@ -87,23 +87,36 @@
selenium.type(pjq("input[type=text][id$=oncompleteInput]"), "data = event.data");
selenium.waitForPageToLoad();
- String timeValue = selenium.getText(time);
+ String reqTime = selenium.getText(time);
guardXhr(selenium).click(input);
- waitGui.failWith("Page was not updated").waitForChange(timeValue, retrieveText.locator(time));
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
String data = selenium.getEval(new JavaScript("window.data"));
assertEquals(data, "RichFaces 4 data", "Data sent with ajax request");
}
@Test
+ public void testDisabled() {
+ selenium.click(pjq("input[type=radio][name$=disabledInput][value=true]"));
+ selenium.waitForPageToLoad();
+
+ String reqTime = selenium.getText(time);
+ guardXhr(selenium).click(input);
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
+
+ assertEquals(selenium.getText(output1), "false", "Output1 should not change");
+ assertEquals(selenium.getText(output2), "false", "Output2 should not change");
+ }
+
+ @Test
public void testExecute() {
selenium.type(pjq("input[type=text][id$=executeInput]"), "input executeChecker");
selenium.waitForPageToLoad();
- String timeValue = selenium.getText(time);
+ String reqTime = selenium.getText(time);
guardXhr(selenium).click(input);
- waitGui.failWith("Page was not updated").waitForChange(timeValue, retrieveText.locator(time));
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
JQueryLocator logItems = jq("ul.phases-list li:eq({0})");
for (int i = 0; i < 6; i++) {
@@ -117,22 +130,22 @@
@Test
public void testImmediate() {
- String timeValue = selenium.getText(time);
+ String reqTime = selenium.getText(time);
selenium.click(pjq("input[type=radio][name$=immediateInput][value=true]"));
selenium.waitForPageToLoad();
guardXhr(selenium).click(input);
- waitGui.failWith("Page was not updated").waitForChange(timeValue, retrieveText.locator(time));
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
assertEquals(selenium.getText(output1), "true", "Output should change");
- assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS,
+ phaseInfo.assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS,
PhaseId.UPDATE_MODEL_VALUES, PhaseId.INVOKE_APPLICATION, PhaseId.RENDER_RESPONSE);
}
@Test
public void testImmediateBypassUpdates() {
- String timeValue = selenium.getText(time);
+ String reqTime = selenium.getText(time);
selenium.click(pjq("input[type=radio][name$=bypassUpdatesInput][value=true]"));
selenium.waitForPageToLoad();
@@ -140,10 +153,10 @@
selenium.waitForPageToLoad();
guardXhr(selenium).click(input);
- waitGui.failWith("Page was not updated").waitForChange(timeValue, retrieveText.locator(time));
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
assertEquals(selenium.getText(output1), "false", "Output should not change");
- assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.RENDER_RESPONSE);
+ phaseInfo.assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.RENDER_RESPONSE);
}
@Test
@@ -151,16 +164,18 @@
selenium.click(pjq("input[type=radio][name$=limitRenderInput][value=true]"));
selenium.waitForPageToLoad();
- String timeValue = selenium.getText(time);
+ String reqTime = selenium.getText(time);
guardXhr(selenium).click(input);
waitGui.failWith("Page was not updated").waitForChange("", retrieveText.locator(output1));
- assertEquals(selenium.getText(time), timeValue, "Ajax-rendered a4j:outputPanel shouldn't change");
+ assertEquals(selenium.getText(time), reqTime, "Ajax-rendered a4j:outputPanel shouldn't change");
}
@Test
public void testEvents() {
+ selenium.type(pjq("input[type=text][id$=onbeforesubmitInput]"), "metamerEvents += \"beforesubmit \"");
+ selenium.waitForPageToLoad();
selenium.type(pjq("input[type=text][id$=onbeginInput]"), "metamerEvents += \"begin \"");
selenium.waitForPageToLoad();
selenium.type(pjq("input[type=text][id$=onbeforedomupdateInput]"), "metamerEvents += \"beforedomupdate \"");
@@ -175,9 +190,11 @@
String[] events = selenium.getEval(new JavaScript("window.metamerEvents")).split(" ");
- assertEquals(events[0], "begin", "Attribute onbegin doesn't work");
- assertEquals(events[1], "beforedomupdate", "Attribute onbeforedomupdate doesn't work");
- assertEquals(events[2], "complete", "Attribute oncomplete doesn't work");
+ assertEquals(events.length, 4, "4 events should be fired.");
+ assertEquals(events[0], "beforesubmit", "Attribute onbeforesubmit doesn't work");
+ assertEquals(events[1], "begin", "Attribute onbegin doesn't work");
+ assertEquals(events[2], "beforedomupdate", "Attribute onbeforedomupdate doesn't work");
+ assertEquals(events[3], "complete", "Attribute oncomplete doesn't work");
}
@Test
@@ -192,4 +209,14 @@
assertEquals(outputValue, "true", "Wrong output1");
assertEquals(selenium.getText(output2), "false", "Wrong output2");
}
+
+ @Test
+ public void testStatus() {
+ selenium.type(pjq("input[type=text][id$=statusInput]"), "statusChecker");
+ selenium.waitForPageToLoad();
+
+ String statusCheckerTime = selenium.getText(statusChecker);
+ guardXhr(selenium).click(input);
+ waitGui.failWith("Attribute status doesn't work").waitForChange(statusCheckerTime, retrieveText.locator(statusChecker));
+ }
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectManyCheckbox.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectManyCheckbox.java 2011-01-27 16:09:53 UTC (rev 21286)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectManyCheckbox.java 2011-01-27 16:40:36 UTC (rev 21287)
@@ -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.
*
@@ -66,16 +66,16 @@
@Test
public void testBypassUpdates() {
- String timeValue = selenium.getText(time);
+ String reqTime = selenium.getText(time);
selenium.click(pjq("input[type=radio][name$=bypassUpdatesInput][value=true]"));
selenium.waitForPageToLoad();
guardXhr(selenium).click(input);
- waitGui.failWith("Page was not updated").waitForChange(timeValue, retrieveText.locator(time));
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
assertEquals(selenium.getText(output1), "[Ferrari, Lexus]", "Output should not change");
- assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS,
+ phaseInfo.assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS,
PhaseId.RENDER_RESPONSE);
}
@@ -87,23 +87,35 @@
selenium.type(pjq("input[type=text][id$=oncompleteInput]"), "data = event.data");
selenium.waitForPageToLoad();
- String timeValue = selenium.getText(time);
-
+ String reqTime = selenium.getText(time);
guardXhr(selenium).click(input);
- waitGui.failWith("Page was not updated").waitForChange(timeValue, retrieveText.locator(time));
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
String data = selenium.getEval(new JavaScript("window.data"));
assertEquals(data, "RichFaces 4 data", "Data sent with ajax request");
}
@Test
+ public void testDisabled() {
+ selenium.click(pjq("input[type=radio][name$=disabledInput][value=true]"));
+ selenium.waitForPageToLoad();
+
+ String reqTime = selenium.getText(time);
+ guardXhr(selenium).click(input);
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
+
+ assertEquals(selenium.getText(output1), "[Ferrari, Lexus]", "Output1 should not change");
+ assertEquals(selenium.getText(output2), "[Ferrari, Lexus]", "Output2 should not change");
+ }
+
+ @Test
public void testExecute() {
selenium.type(pjq("input[type=text][id$=executeInput]"), "input executeChecker");
selenium.waitForPageToLoad();
- String timeValue = selenium.getText(time);
+ String reqTime = selenium.getText(time);
guardXhr(selenium).click(input);
- waitGui.failWith("Page was not updated").waitForChange(timeValue, retrieveText.locator(time));
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
JQueryLocator logItems = jq("ul.phases-list li:eq({0})");
for (int i = 0; i < 6; i++) {
@@ -117,22 +129,22 @@
@Test
public void testImmediate() {
- String timeValue = selenium.getText(time);
+ String reqTime = selenium.getText(time);
selenium.click(pjq("input[type=radio][name$=immediateInput][value=true]"));
selenium.waitForPageToLoad();
guardXhr(selenium).click(input);
- waitGui.failWith("Page was not updated").waitForChange(timeValue, retrieveText.locator(time));
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
assertEquals(selenium.getText(output1), "[Audi, Ferrari, Lexus]", "Output should change");
- assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS,
+ phaseInfo.assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS,
PhaseId.UPDATE_MODEL_VALUES, PhaseId.INVOKE_APPLICATION, PhaseId.RENDER_RESPONSE);
}
@Test
public void testImmediateBypassUpdates() {
- String timeValue = selenium.getText(time);
+ String reqTime = selenium.getText(time);
selenium.click(pjq("input[type=radio][name$=bypassUpdatesInput][value=true]"));
selenium.waitForPageToLoad();
@@ -140,10 +152,10 @@
selenium.waitForPageToLoad();
guardXhr(selenium).click(input);
- waitGui.failWith("Page was not updated").waitForChange(timeValue, retrieveText.locator(time));
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
assertEquals(selenium.getText(output1), "[Ferrari, Lexus]", "Output should not change");
- assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.RENDER_RESPONSE);
+ phaseInfo.assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.RENDER_RESPONSE);
}
@Test
@@ -151,16 +163,18 @@
selenium.click(pjq("input[type=radio][name$=limitRenderInput][value=true]"));
selenium.waitForPageToLoad();
- String timeValue = selenium.getText(time);
+ String reqTime = selenium.getText(time);
guardXhr(selenium).click(input);
waitGui.failWith("Page was not updated").waitForChange("", retrieveText.locator(output1));
- assertEquals(selenium.getText(time), timeValue, "Ajax-rendered a4j:outputPanel shouldn't change");
+ assertEquals(selenium.getText(time), reqTime, "Ajax-rendered a4j:outputPanel shouldn't change");
}
@Test
public void testEvents() {
+ selenium.type(pjq("input[type=text][id$=onbeforesubmitInput]"), "metamerEvents += \"beforesubmit \"");
+ selenium.waitForPageToLoad();
selenium.type(pjq("input[type=text][id$=onbeginInput]"), "metamerEvents += \"begin \"");
selenium.waitForPageToLoad();
selenium.type(pjq("input[type=text][id$=onbeforedomupdateInput]"), "metamerEvents += \"beforedomupdate \"");
@@ -175,9 +189,11 @@
String[] events = selenium.getEval(new JavaScript("window.metamerEvents")).split(" ");
- assertEquals(events[0], "begin", "Attribute onbegin doesn't work");
- assertEquals(events[1], "beforedomupdate", "Attribute onbeforedomupdate doesn't work");
- assertEquals(events[2], "complete", "Attribute oncomplete doesn't work");
+ assertEquals(events.length, 4, "4 events should be fired.");
+ assertEquals(events[0], "beforesubmit", "Attribute onbeforesubmit doesn't work");
+ assertEquals(events[1], "begin", "Attribute onbegin doesn't work");
+ assertEquals(events[2], "beforedomupdate", "Attribute onbeforedomupdate doesn't work");
+ assertEquals(events[3], "complete", "Attribute oncomplete doesn't work");
}
@Test
@@ -192,4 +208,14 @@
assertEquals(outputValue, "[Audi, Ferrari, Lexus]", "Wrong output1");
assertEquals(selenium.getText(output2), "[Ferrari, Lexus]", "Wrong output2");
}
+
+ @Test
+ public void testStatus() {
+ selenium.type(pjq("input[type=text][id$=statusInput]"), "statusChecker");
+ selenium.waitForPageToLoad();
+
+ String statusCheckerTime = selenium.getText(statusChecker);
+ guardXhr(selenium).click(input);
+ waitGui.failWith("Attribute status doesn't work").waitForChange(statusCheckerTime, retrieveText.locator(statusChecker));
+ }
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectManyListbox.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectManyListbox.java 2011-01-27 16:09:53 UTC (rev 21286)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectManyListbox.java 2011-01-27 16:40:36 UTC (rev 21287)
@@ -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.
*
@@ -24,8 +24,8 @@
import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
import java.net.URL;
+
import org.jboss.test.selenium.locator.JQueryLocator;
-
import org.testng.annotations.Test;
/**
@@ -45,46 +45,56 @@
@Test
public void testSimpleClick() {
- super.testClick(input);
+ testClick(input);
}
@Test
public void testBypassUpdates() {
- super.testBypassUpdates(input);
+ testBypassUpdates(input);
}
@Test
public void testData() {
- super.testData(input);
+ testData(input);
}
@Test
+ public void testDisabled() {
+ testDisabled(input);
+ }
+
+ @Test
public void testExecute() {
- super.testExecute(input);
+ testExecute(input);
}
@Test
public void testImmediate() {
- super.testImmediate(input);
+ testImmediate(input);
}
@Test
public void testImmediateBypassUpdates() {
- super.testImmediateBypassUpdates(input);
+ testImmediateBypassUpdates(input);
}
@Test
public void testLimitRender() {
- super.testLimitRender(input);
+ testLimitRender(input);
}
@Test
public void testEvents() {
- super.testEvents(input);
+ testEvents(input);
}
@Test
public void testRender() {
- super.testRender(input);
+ testRender(input);
}
+
+ @Test
+ public void testStatus() {
+ testStatus(input);
+ }
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectManyMenu.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectManyMenu.java 2011-01-27 16:09:53 UTC (rev 21286)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectManyMenu.java 2011-01-27 16:40:36 UTC (rev 21287)
@@ -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.
*
@@ -24,8 +24,8 @@
import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
import java.net.URL;
+
import org.jboss.test.selenium.locator.JQueryLocator;
-
import org.testng.annotations.Test;
/**
@@ -45,46 +45,56 @@
@Test
public void testSimpleClick() {
- super.testClick(input);
+ testClick(input);
}
@Test
public void testBypassUpdates() {
- super.testBypassUpdates(input);
+ testBypassUpdates(input);
}
@Test
public void testData() {
- super.testData(input);
+ testData(input);
}
@Test
+ public void testDisabled() {
+ testDisabled(input);
+ }
+
+ @Test
public void testExecute() {
- super.testExecute(input);
+ testExecute(input);
}
@Test
public void testImmediate() {
- super.testImmediate(input);
+ testImmediate(input);
}
@Test
public void testImmediateBypassUpdates() {
- super.testImmediateBypassUpdates(input);
+ testImmediateBypassUpdates(input);
}
@Test
public void testLimitRender() {
- super.testLimitRender(input);
+ testLimitRender(input);
}
@Test
public void testEvents() {
- super.testEvents(input);
+ testEvents(input);
}
@Test
public void testRender() {
- super.testRender(input);
+ testRender(input);
}
+
+ @Test
+ public void testStatus() {
+ testStatus(input);
+ }
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectOneListbox.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectOneListbox.java 2011-01-27 16:09:53 UTC (rev 21286)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectOneListbox.java 2011-01-27 16:40:36 UTC (rev 21287)
@@ -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.
*
@@ -24,8 +24,8 @@
import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
import java.net.URL;
+
import org.jboss.test.selenium.locator.JQueryLocator;
-
import org.testng.annotations.Test;
/**
@@ -45,46 +45,56 @@
@Test
public void testSimpleClick() {
- super.testClick(input);
+ testClick(input);
}
@Test
public void testBypassUpdates() {
- super.testBypassUpdates(input);
+ testBypassUpdates(input);
}
@Test
public void testData() {
- super.testData(input);
+ testData(input);
}
@Test
+ public void testDisabled() {
+ testDisabled(input);
+ }
+
+ @Test
public void testExecute() {
- super.testExecute(input);
+ testExecute(input);
}
@Test
public void testImmediate() {
- super.testImmediate(input);
+ testImmediate(input);
}
@Test
public void testImmediateBypassUpdates() {
- super.testImmediateBypassUpdates(input);
+ testImmediateBypassUpdates(input);
}
@Test
public void testLimitRender() {
- super.testLimitRender(input);
+ testLimitRender(input);
}
@Test
public void testEvents() {
- super.testEvents(input);
+ testEvents(input);
}
@Test
public void testRender() {
- super.testRender(input);
+ testRender(input);
}
+
+ @Test
+ public void testStatus() {
+ testStatus(input);
+ }
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectOneMenu.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectOneMenu.java 2011-01-27 16:09:53 UTC (rev 21286)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectOneMenu.java 2011-01-27 16:40:36 UTC (rev 21287)
@@ -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.
*
@@ -24,8 +24,8 @@
import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
import java.net.URL;
+
import org.jboss.test.selenium.locator.JQueryLocator;
-
import org.testng.annotations.Test;
/**
@@ -45,46 +45,56 @@
@Test
public void testSimpleClick() {
- super.testClick(input);
+ testClick(input);
}
@Test
public void testBypassUpdates() {
- super.testBypassUpdates(input);
+ testBypassUpdates(input);
}
@Test
public void testData() {
- super.testData(input);
+ testData(input);
}
@Test
+ public void testDisabled() {
+ testDisabled(input);
+ }
+
+ @Test
public void testExecute() {
- super.testExecute(input);
+ testExecute(input);
}
@Test
public void testImmediate() {
- super.testImmediate(input);
+ testImmediate(input);
}
@Test
public void testImmediateBypassUpdates() {
- super.testImmediateBypassUpdates(input);
+ testImmediateBypassUpdates(input);
}
@Test
public void testLimitRender() {
- super.testLimitRender(input);
+ testLimitRender(input);
}
@Test
public void testEvents() {
- super.testEvents(input);
+ testEvents(input);
}
@Test
public void testRender() {
- super.testRender(input);
+ testRender(input);
}
+
+ @Test
+ public void testStatus() {
+ testStatus(input);
+ }
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectOneRadio.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectOneRadio.java 2011-01-27 16:09:53 UTC (rev 21286)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectOneRadio.java 2011-01-27 16:40:36 UTC (rev 21287)
@@ -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.
*
@@ -28,7 +28,9 @@
import static org.testng.Assert.fail;
import java.net.URL;
+
import javax.faces.event.PhaseId;
+
import org.jboss.test.selenium.encapsulated.JavaScript;
import org.jboss.test.selenium.locator.JQueryLocator;
import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
@@ -64,16 +66,16 @@
@Test
public void testBypassUpdates() {
- String timeValue = selenium.getText(time);
+ String reqTime = selenium.getText(time);
selenium.click(pjq("input[type=radio][name$=bypassUpdatesInput][value=true]"));
selenium.waitForPageToLoad();
guardXhr(selenium).click(input);
- waitGui.failWith("Page was not updated").waitForChange(timeValue, retrieveText.locator(time));
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
assertEquals(selenium.getText(output1), "Ferrari", "Output should not change");
- assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS,
+ phaseInfo.assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS,
PhaseId.RENDER_RESPONSE);
}
@@ -85,39 +87,51 @@
selenium.type(pjq("input[type=text][id$=oncompleteInput]"), "data = event.data");
selenium.waitForPageToLoad();
- String timeValue = selenium.getText(time);
-
+ String reqTime = selenium.getText(time);
guardXhr(selenium).click(input);
- waitGui.failWith("Page was not updated").waitForChange(timeValue, retrieveText.locator(time));
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
String data = selenium.getEval(new JavaScript("window.data"));
assertEquals(data, "RichFaces 4 data", "Data sent with ajax request");
}
@Test
+ public void testDisabled() {
+ selenium.click(pjq("input[type=radio][name$=disabledInput][value=true]"));
+ selenium.waitForPageToLoad();
+
+ String reqTime = selenium.getText(time);
+ guardXhr(selenium).click(input);
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
+
+ assertEquals(selenium.getText(output1), "Ferrari", "Output1 should not change");
+ assertEquals(selenium.getText(output2), "Ferrari", "Output2 should not change");
+ }
+
+ @Test
public void testImmediate() {
- String timeValue = selenium.getText(time);
+ String reqTime = selenium.getText(time);
selenium.click(pjq("input[type=radio][name$=immediateInput][value=true]"));
selenium.waitForPageToLoad();
guardXhr(selenium).click(input);
- waitGui.failWith("Page was not updated").waitForChange(timeValue, retrieveText.locator(time));
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
assertEquals(selenium.getText(output1), "Audi", "Output should change");
- assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS,
+ phaseInfo.assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS,
PhaseId.UPDATE_MODEL_VALUES, PhaseId.INVOKE_APPLICATION, PhaseId.RENDER_RESPONSE);
}
@Test
public void testExecute() {
- String timeValue = selenium.getText(time);
+ String reqTime = selenium.getText(time);
selenium.type(pjq("input[type=text][id$=executeInput]"), "input executeChecker");
selenium.waitForPageToLoad();
guardXhr(selenium).click(input);
- waitGui.failWith("Page was not updated").waitForChange(timeValue, retrieveText.locator(time));
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
JQueryLocator logItems = jq("ul.phases-list li:eq({0})");
for (int i = 0; i < 6; i++) {
@@ -131,7 +145,7 @@
@Test
public void testImmediateBypassUpdates() {
- String timeValue = selenium.getText(time);
+ String reqTime = selenium.getText(time);
selenium.click(pjq("input[type=radio][name$=bypassUpdatesInput][value=true]"));
selenium.waitForPageToLoad();
@@ -139,10 +153,10 @@
selenium.waitForPageToLoad();
guardXhr(selenium).click(input);
- waitGui.failWith("Page was not updated").waitForChange(timeValue, retrieveText.locator(time));
+ waitGui.failWith("Page was not updated").waitForChange(reqTime, retrieveText.locator(time));
assertEquals(selenium.getText(output1), "Ferrari", "Output should not change");
- assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.RENDER_RESPONSE);
+ phaseInfo.assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.RENDER_RESPONSE);
}
@Test
@@ -150,16 +164,18 @@
selenium.click(pjq("input[type=radio][name$=limitRenderInput][value=true]"));
selenium.waitForPageToLoad();
- String timeValue = selenium.getText(time);
+ String reqTime = selenium.getText(time);
guardXhr(selenium).click(input);
waitGui.failWith("Page was not updated").waitForChange("", retrieveText.locator(output1));
- assertEquals(selenium.getText(time), timeValue, "Ajax-rendered a4j:outputPanel shouldn't change");
+ assertEquals(selenium.getText(time), reqTime, "Ajax-rendered a4j:outputPanel shouldn't change");
}
@Test
public void testEvents() {
+ selenium.type(pjq("input[type=text][id$=onbeforesubmitInput]"), "metamerEvents += \"beforesubmit \"");
+ selenium.waitForPageToLoad();
selenium.type(pjq("input[type=text][id$=onbeginInput]"), "metamerEvents += \"begin \"");
selenium.waitForPageToLoad();
selenium.type(pjq("input[type=text][id$=onbeforedomupdateInput]"), "metamerEvents += \"beforedomupdate \"");
@@ -174,9 +190,11 @@
String[] events = selenium.getEval(new JavaScript("window.metamerEvents")).split(" ");
- assertEquals(events[0], "begin", "Attribute onbegin doesn't work");
- assertEquals(events[1], "beforedomupdate", "Attribute onbeforedomupdate doesn't work");
- assertEquals(events[2], "complete", "Attribute oncomplete doesn't work");
+ assertEquals(events.length, 4, "4 events should be fired.");
+ assertEquals(events[0], "beforesubmit", "Attribute onbeforesubmit doesn't work");
+ assertEquals(events[1], "begin", "Attribute onbegin doesn't work");
+ assertEquals(events[2], "beforedomupdate", "Attribute onbeforedomupdate doesn't work");
+ assertEquals(events[3], "complete", "Attribute oncomplete doesn't work");
}
@Test
@@ -191,4 +209,14 @@
assertEquals(outputValue, "Audi", "Wrong output1");
assertEquals(selenium.getText(output2), "Ferrari", "Wrong output2");
}
+
+ @Test
+ public void testStatus() {
+ selenium.type(pjq("input[type=text][id$=statusInput]"), "statusChecker");
+ selenium.waitForPageToLoad();
+
+ String statusCheckerTime = selenium.getText(statusChecker);
+ guardXhr(selenium).click(input);
+ waitGui.failWith("Attribute status doesn't work").waitForChange(statusCheckerTime, retrieveText.locator(statusChecker));
+ }
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandButton/TestA4JCommandButton.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandButton/TestA4JCommandButton.java 2011-01-27 16:09:53 UTC (rev 21286)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandButton/TestA4JCommandButton.java 2011-01-27 16:40:36 UTC (rev 21287)
@@ -166,7 +166,7 @@
assertEquals(selenium.getText(output1), "", "Output 1 should not change");
assertEquals(selenium.getText(output2), "", "Output 2 should not change");
assertEquals(selenium.getText(output3), "", "Output 3 should not change");
- assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS,
+ phaseInfo.assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.PROCESS_VALIDATIONS,
PhaseId.RENDER_RESPONSE);
String listenerOutput = selenium.getText(jq("div#phasesPanel li:eq(3)"));
@@ -235,7 +235,7 @@
assertEquals(selenium.getText(output1), "", "Output 1 should not change");
assertEquals(selenium.getText(output2), "", "Output 2 should not change");
assertEquals(selenium.getText(output3), "", "Output 3 should not change");
- assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.RENDER_RESPONSE);
+ phaseInfo.assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES, PhaseId.RENDER_RESPONSE);
String listenerOutput = selenium.getText(jq("div#phasesPanel li:eq(2)"));
assertEquals(listenerOutput, "* action listener invoked", "Action listener's output");
13 years, 11 months
JBoss Rich Faces SVN: r21286 - in trunk/ui: common/ui/src/test/java/org/richfaces/component/util and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2011-01-27 11:09:53 -0500 (Thu, 27 Jan 2011)
New Revision: 21286
Added:
trunk/ui/common/ui/src/test/java/org/richfaces/component/util/SelectUtilsTest.java
Modified:
trunk/ui/common/ui/src/main/java/org/richfaces/component/util/SelectUtils.java
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InputRendererBase.java
Log:
RF-10131: SelectItem(s) compatibility with JSF 2.0 is improved
Modified: trunk/ui/common/ui/src/main/java/org/richfaces/component/util/SelectUtils.java
===================================================================
--- trunk/ui/common/ui/src/main/java/org/richfaces/component/util/SelectUtils.java 2011-01-27 16:08:30 UTC (rev 21285)
+++ trunk/ui/common/ui/src/main/java/org/richfaces/component/util/SelectUtils.java 2011-01-27 16:09:53 UTC (rev 21286)
@@ -21,96 +21,90 @@
package org.richfaces.component.util;
-import java.lang.reflect.Array;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
+import org.richfaces.log.Logger;
+import org.richfaces.log.RichfacesLogger;
-import javax.el.ELContext;
import javax.el.ValueExpression;
-import javax.faces.FacesException;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIInput;
-import javax.faces.component.UIOutput;
-import javax.faces.component.UISelectItem;
-import javax.faces.component.UISelectItems;
-import javax.faces.component.UISelectMany;
+import javax.faces.application.ProjectStage;
+import javax.faces.component.*;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.ConverterException;
import javax.faces.model.SelectItem;
+import java.util.*;
+import java.util.Map.Entry;
-import org.ajax4jsf.Messages;
-import org.richfaces.log.Logger;
-import org.richfaces.log.RichfacesLogger;
-
/**
* @author Maksim Kaszynski
*/
public final class SelectUtils {
private static final Logger LOG = RichfacesLogger.APPLICATION.getLogger();
+
private SelectUtils() {
}
/**
* Gathers all select items from specified component's children
*
- * @param context
- * @param component
- * @return list of {@link SelectItems} taken from f:selectItem and f:selectItems
+ * @param context Faces context
+ * @param component UIComponent with UISelectItem or UISelectItems children
+ * @return list of {@link SelectItem} taken from f:selectItem and f:selectItems
*/
+ @SuppressWarnings("unchecked")
public static List<SelectItem> getSelectItems(FacesContext context, UIComponent component) {
ArrayList<SelectItem> list = new ArrayList<SelectItem>();
- Iterator<UIComponent> kids = component.getChildren().iterator();
- while (kids.hasNext()) {
- UIComponent kid = kids.next();
+ for (UIComponent uiComponent : component.getChildren()) {
- if (kid instanceof UISelectItem) {
- Object value = ((UISelectItem) kid).getValue();
+ if (uiComponent instanceof UISelectItem) {
+ UISelectItem uiSelectItem = (UISelectItem) uiComponent;
+ Object value = uiSelectItem.getValue();
if (value == null) {
- UISelectItem item = (UISelectItem) kid;
-
+ UISelectItem item = (UISelectItem) uiComponent;
list.add(new SelectItem(item.getItemValue(), item.getItemLabel(), item.getItemDescription(),
- item.isItemDisabled()));
+ item.isItemDisabled(), item.isItemEscaped(), item.isNoSelectionOption()));
} else if (value instanceof SelectItem) {
list.add((SelectItem) value);
} else {
- String valueClass = value != null ? "'" + value.getClass().getName() + "'" : "";
-
- throw new IllegalArgumentException(Messages.getMessage(Messages.INVALID_ATTRIBUTE_VALUE,
- valueClass, "<selectItem>"));
+ ValueExpression expression = uiSelectItem.getValueExpression("value");
+ throw new IllegalArgumentException("ValueExpression '"
+ + (expression == null ? null : expression.getExpressionString()) + "' of UISelectItem : "
+ + RichfacesLogger.getComponentPath(uiComponent) + " does not reference an Object of type SelectItem");
}
- } else if ((kid instanceof UISelectItems) && (null != context)) {
- Object value = ((UISelectItems) kid).getValue();
+ } else if ((uiComponent instanceof UISelectItems) && (null != context)) {
+ UISelectItems currentUISelectItems = ((UISelectItems) uiComponent);
+ Object value = currentUISelectItems.getValue();
if (value instanceof SelectItem) {
list.add((SelectItem) value);
} else if (value instanceof SelectItem[]) {
SelectItem[] items = (SelectItem[]) value;
-
list.addAll(Arrays.asList(items));
} else if (value instanceof Collection) {
list.addAll((Collection<SelectItem>) value);
} else if (value instanceof Map) {
Map<Object, Object> map = (Map<Object, Object>) value;
Set<Entry<Object, Object>> entrySet = map.entrySet();
-
for (Entry<Object, Object> entry : entrySet) {
list.add(new SelectItem(entry.getValue(), entry.getKey().toString(), null));
}
} else {
- String valueClass = (value != null) ? "'" + value.getClass().getName() + "'" : "";
-
- throw new IllegalArgumentException(Messages.getMessage(Messages.INVALID_ATTRIBUTE_VALUE,
- valueClass, "<selectItems>"));
+ Logger.Level level = Logger.Level.INFO;
+ if (!context.isProjectStage(ProjectStage.Production)) {
+ level = Logger.Level.WARNING;
+ }
+ if (LOG.isLogEnabled(level)) {
+ ValueExpression expression = currentUISelectItems.getValueExpression("value");
+ LOG.log(level, String.format("ValueExpression %s of UISelectItems with component-path %s"
+ + " does not reference an Object of type SelectItem,"
+ + " array, Iterable or Map, but of type: %s",
+ (expression == null ? null : expression.getExpressionString()),
+ RichfacesLogger.getComponentPath(uiComponent),
+ (value == null ? null : value.getClass().getName())
+ ));
+ }
}
}
}
@@ -118,156 +112,12 @@
return list;
}
- /**
- * Converts UISelectMany submitted value to converted value
- *
- * @param facesContext
- * @param component
- * @param submittedValue
- * @return
- * @throws ConverterException
- * @author Manfred Geiler
- */
- public static Object getConvertedUISelectManyValue(FacesContext facesContext, UISelectMany component,
- String[] submittedValue) throws ConverterException {
-
- // Attention!
- // This code is duplicated in jsfapi component package.
- // If you change something here please do the same in the other class!
- if (submittedValue == null) {
- throw new NullPointerException("submittedValue");
- }
-
- ELContext elContext = facesContext.getELContext();
- ValueExpression vb = component.getValueExpression("value");
- Class<?> valueType = null;
- Class<?> arrayComponentType = null;
-
- if (vb != null) {
- valueType = vb.getType(elContext);
-
- if ((valueType != null) && valueType.isArray()) {
- arrayComponentType = valueType.getComponentType();
- }
- }
-
- Converter converter = component.getConverter();
-
- if (converter == null) {
- if (valueType == null) {
-
- // No converter, and no idea of expected type
- // --> return the submitted String array
- return submittedValue;
- }
-
- if (List.class.isAssignableFrom(valueType)) {
-
- // expected type is a List
- // --> according to javadoc of UISelectMany we assume that the
- // element type
- // is java.lang.String, and copy the String array to a new List
- List<String> lst = Arrays.asList(submittedValue);
-
- return lst;
- }
-
- if (arrayComponentType == null) {
- throw new IllegalArgumentException(Messages.getMessage(Messages.VALUE_BINDING_TYPE_ERROR));
- }
-
- if (String.class.equals(arrayComponentType)) {
- return submittedValue; // No conversion needed for String type
- }
-
- if (Object.class.equals(arrayComponentType)) {
- return submittedValue; // No conversion for Object class
- }
-
- try {
- converter = facesContext.getApplication().createConverter(arrayComponentType);
- } catch (FacesException e) {
- LOG.error(Messages.getMessage(Messages.NO_CONVERTER_FOUND_ERROR, arrayComponentType.getName()), e);
-
- return submittedValue;
- }
- }
-
- // Now, we have a converter...
- if (valueType == null) {
-
- // ...but have no idea of expected type
- // --> so let's convert it to an Object array
- int len = submittedValue.length;
- Object[] convertedValues = (Object[]) Array.newInstance((arrayComponentType == null)
- ? Object.class : arrayComponentType, len);
-
- for (int i = 0; i < len; i++) {
- convertedValues[i] = converter.getAsObject(facesContext, component, submittedValue[i]);
- }
-
- return convertedValues;
- }
-
- if (List.class.isAssignableFrom(valueType)) {
-
- // Curious case: According to specs we should assume, that the
- // element type
- // of this List is java.lang.String. But there is a Converter set
- // for this
- // component. Because the user must know what he is doing, we will
- // convert the values.
- int len = submittedValue.length;
- List<Object> lst = new ArrayList<Object>(len);
-
- for (int i = 0; i < len; i++) {
- lst.add(converter.getAsObject(facesContext, component, submittedValue[i]));
- }
-
- return lst;
- }
-
- if (arrayComponentType == null) {
- throw new IllegalArgumentException(Messages.getMessage(Messages.VALUE_BINDING_TYPE_ERROR));
- }
-
- if (arrayComponentType.isPrimitive()) {
-
- // primitive array
- int len = submittedValue.length;
- Object convertedValues = Array.newInstance(arrayComponentType, len);
-
- for (int i = 0; i < len; i++) {
- Array.set(convertedValues, i, converter.getAsObject(facesContext, component, submittedValue[i]));
- }
-
- return convertedValues;
- } else {
-
- // Object array
- int len = submittedValue.length;
- ArrayList<Object> convertedValues = new ArrayList<Object>(len);
-
- for (int i = 0; i < len; i++) {
- convertedValues.add(i, converter.getAsObject(facesContext, component, submittedValue[i]));
- }
-
- return convertedValues.toArray((Object[]) Array.newInstance(arrayComponentType, len));
- }
- }
-
- public static Object getConvertedUIInputValue(FacesContext facesContext, UIInput component, String submittedValue)
- throws ConverterException {
-
- /*
- * if (submittedValue == null)
- * throw new NullPointerException("submittedValue");
- */
+ public static Object getConvertedUIInputValue(FacesContext facesContext, UIInput component, String submittedValue) throws ConverterException {
if (InputUtils.EMPTY_STRING.equals(submittedValue)) {
return null;
}
- Converter converter = getConverterForProperty(facesContext, component, "value");
+ Converter converter = SelectUtils.findConverter(facesContext, component, "value");
if (converter != null) {
return converter.getAsObject(facesContext, component, submittedValue);
}
@@ -275,48 +125,13 @@
return submittedValue;
}
- /**
- * @param facesContext
- * @param component
- * @param property
- * @return converter for specified component attribute
- * @deprecated use SelectUtils.findConverter instead
- */
-
- @Deprecated
- public static Converter getConverterForProperty(FacesContext facesContext, UIOutput component, String property) {
- Converter converter = component.getConverter();
-
- if (converter == null) {
- ValueExpression ve = component.getValueExpression(property);
-
- if (ve != null) {
- Class<?> valueType = ve.getType(facesContext.getELContext());
-
- if ((valueType == null) || Object.class.equals(valueType)) {
-
- // No converter needed
- } else {
- converter = facesContext.getApplication().createConverter(valueType);
-
- if (converter == null && !String.class.equals(valueType)) {
- throw new ConverterException(Messages.getMessage(Messages.NO_CONVERTER_FOUND_ERROR,
- valueType.getName()));
- }
- }
- }
- }
-
- return converter;
- }
-
public static Converter findConverter(FacesContext facesContext, UIOutput component, String property) {
Converter converter = component.getConverter();
if (converter == null) {
ValueExpression ve = component.getValueExpression(property);
-
+
if (ve != null) {
Class<?> valueType = ve.getType(facesContext.getELContext());
@@ -325,11 +140,11 @@
} else {
converter = facesContext.getApplication().createConverter(valueType);
}
-
+
}
}
return converter;
}
-
+
}
Added: trunk/ui/common/ui/src/test/java/org/richfaces/component/util/SelectUtilsTest.java
===================================================================
--- trunk/ui/common/ui/src/test/java/org/richfaces/component/util/SelectUtilsTest.java (rev 0)
+++ trunk/ui/common/ui/src/test/java/org/richfaces/component/util/SelectUtilsTest.java 2011-01-27 16:09:53 UTC (rev 21286)
@@ -0,0 +1,112 @@
+package org.richfaces.component.util;
+
+import org.jboss.test.faces.AbstractFacesTest;
+import org.junit.Assert;
+
+import javax.faces.component.UIParameter;
+import javax.faces.component.UISelectItem;
+import javax.faces.component.UISelectOne;
+import javax.faces.model.SelectItem;
+import java.util.List;
+
+/**
+ * @author Gleb Galkin
+ * @since 27.01.11
+ */
+public class SelectUtilsTest extends AbstractFacesTest {
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ setupFacesRequest();
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /**
+ * The aim of this test is to check first part of {@link SelectUtils#getSelectItems}, for {@link UISelectOne}
+ */
+ public void testGetSelectItem() {
+ UISelectOne selectOne = new UISelectOne();
+ selectOne.getChildren().add(new UISelectItemStub("value1", "label1", "description1", false, false, false));
+ selectOne.getChildren().add(new UISelectItemStub("value2", "label2", "description2", false, true, true));
+
+ UISelectItem item = new UISelectItem();
+ item.setValue(new SelectItem("value3", "label3", "description3", true, true, true));
+ selectOne.getChildren().add(item);
+
+ // non select item at end
+ UIParameter param = new UIParameter();
+ param.setName("param");
+ param.setValue("paramValue");
+ selectOne.getChildren().add(param);
+
+ checkSelectItems(SelectUtils.getSelectItems(facesContext, selectOne));
+
+ // non select item in middle
+ selectOne = new UISelectOne();
+ selectOne.getChildren().add(new UISelectItemStub("value1", "label1", "description1", false, false, false));
+ selectOne.getChildren().add(param);
+ selectOne.getChildren().add(new UISelectItemStub("value2", "label2", "description2", false, true, true));
+ checkTwoSelectItems(SelectUtils.getSelectItems(facesContext, selectOne));
+
+ // non select item as value cause IllegalArgumentException
+ item = new UISelectItem();
+ item.setValue(new UISelectItem());
+ selectOne.getChildren().add(item);
+ try {
+ SelectUtils.getSelectItems(facesContext, selectOne);
+ } catch (Exception e) {
+ if (!(e instanceof IllegalArgumentException)) {
+ Assert.fail("Non select item as value should cause IllegalArgumentException");
+ }
+ }
+ }
+
+ private void checkSelectItems(List<SelectItem> selectItems) {
+ checkTwoSelectItems(selectItems);
+
+ Assert.assertNotNull(selectItems.get(2));
+ Assert.assertEquals("value3", selectItems.get(2).getValue());
+ Assert.assertEquals("label3", selectItems.get(2).getLabel());
+ Assert.assertEquals("description3", selectItems.get(2).getDescription());
+ Assert.assertEquals(true, selectItems.get(2).isDisabled());
+ Assert.assertEquals(true, selectItems.get(2).isEscape());
+ Assert.assertEquals(true, selectItems.get(2).isNoSelectionOption());
+ }
+
+ private void checkTwoSelectItems(List<SelectItem> selectItems) {
+ Assert.assertNotNull(selectItems.get(0));
+ Assert.assertEquals("value1", selectItems.get(0).getValue());
+ Assert.assertEquals("label1", selectItems.get(0).getLabel());
+ Assert.assertEquals("description1", selectItems.get(0).getDescription());
+ Assert.assertEquals(false, selectItems.get(0).isDisabled());
+ Assert.assertEquals(false, selectItems.get(0).isEscape());
+ Assert.assertEquals(false, selectItems.get(0).isNoSelectionOption());
+
+ Assert.assertNotNull(selectItems.get(1));
+ Assert.assertEquals("value2", selectItems.get(1).getValue());
+ Assert.assertEquals("label2", selectItems.get(1).getLabel());
+ Assert.assertEquals("description2", selectItems.get(1).getDescription());
+ Assert.assertEquals(false, selectItems.get(1).isDisabled());
+ Assert.assertEquals(true, selectItems.get(1).isEscape());
+ Assert.assertEquals(true, selectItems.get(1).isNoSelectionOption());
+ }
+
+ private class UISelectItemStub extends UISelectItem {
+
+ public UISelectItemStub(Object itemValue, String itemLabel, String itemDescription,
+ boolean itemDisabled, boolean itemEscaped, boolean noSelectionOption) {
+ super();
+ setItemValue(itemValue);
+ setItemLabel(itemLabel);
+ setItemDescription(itemDescription);
+ setItemDisabled(itemDisabled);
+ setItemEscaped(itemEscaped);
+ setNoSelectionOption(noSelectionOption);
+ }
+ }
+}
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InputRendererBase.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InputRendererBase.java 2011-01-27 16:08:30 UTC (rev 21285)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InputRendererBase.java 2011-01-27 16:09:53 UTC (rev 21286)
@@ -22,16 +22,15 @@
package org.richfaces.renderkit;
-import java.util.Map;
+import org.richfaces.component.util.SelectUtils;
import javax.faces.component.UIComponent;
import javax.faces.component.UIInput;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.ConverterException;
+import java.util.Map;
-import org.richfaces.component.util.SelectUtils;
-
/**
* @author Nick Belaevski - nbelaevski(a)exadel.com
* created 23.01.2007
@@ -60,7 +59,7 @@
if (value == null) {
Object curVal = input.getValue();
- Converter converter = SelectUtils.getConverterForProperty(context, input, "value");
+ Converter converter = SelectUtils.findConverter(context, input, "value");
if (converter != null) {
value = converter.getAsString(context, input, curVal);
13 years, 11 months