JBoss Rich Faces SVN: r20995 - in trunk: cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/model and 5 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2011-01-13 11:26:56 -0500 (Thu, 13 Jan 2011)
New Revision: 20995
Modified:
trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassVisitor.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CdkObjectElement.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/DefineObjectStatement.java
trunk/cdk/generator/src/main/resources/META-INF/schema/cdk-template.xsd
trunk/cdk/generator/src/main/resources/META-INF/templates/java/define-object.ftl
trunk/cdk/generator/src/test/java/org/richfaces/cdk/templatecompiler/statements/DefineObjectTest.java
trunk/ui/input/ui/src/main/templates/input.template.inc
trunk/ui/input/ui/src/main/templates/inputnumberslider.template.xml
Log:
RF-10095
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassVisitor.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassVisitor.java 2011-01-13 15:49:52 UTC (rev 20994)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassVisitor.java 2011-01-13 16:26:56 UTC (rev 20995)
@@ -540,7 +540,7 @@
}
String type = cdkObjectElement.getType();
DefineObjectStatement statement = addStatement(DefineObjectStatement.class);
- statement.setObject(name, type, value);
+ statement.setObject(name, type, value, cdkObjectElement.isCast());
}
/*
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CdkObjectElement.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CdkObjectElement.java 2011-01-13 15:49:52 UTC (rev 20994)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CdkObjectElement.java 2011-01-13 16:26:56 UTC (rev 20995)
@@ -48,6 +48,9 @@
@XmlAttribute(required = true)
private String type;
+ @XmlAttribute
+ private boolean cast;
+
@XmlAttribute(name = "type-arguments")
private String typeArguments;
@@ -126,4 +129,12 @@
visitor.visitElement(this);
}
+ public void setCast(boolean cast) {
+ this.cast = cast;
+ }
+
+ public boolean isCast() {
+ return cast;
+ }
+
}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/DefineObjectStatement.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/DefineObjectStatement.java 2011-01-13 15:49:52 UTC (rev 20994)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/statements/DefineObjectStatement.java 2011-01-13 16:26:56 UTC (rev 20995)
@@ -44,6 +44,8 @@
private String name;
+ private boolean cast;
+
private final ELParser parser;
private final Logger log;
@@ -69,9 +71,10 @@
* the initializationExpression to set
* @throws ParsingException
*/
- public void setObject(String name, String type, String initializationExpression) {
+ public void setObject(String name, String type, String initializationExpression, boolean cast) {
try {
this.name = name;
+ this.cast = cast;
if (!Strings.isEmpty(initializationExpression)) {
initializationStatement = parser.parse(initializationExpression, this, TypesFactory.OBJECT_TYPE);
initializationStatement.setParent(this);
@@ -117,4 +120,8 @@
return null != initializationStatement ? Collections.<TemplateStatement> singletonList(initializationStatement)
: Collections.<TemplateStatement> emptyList();
}
+
+ public boolean isCast() {
+ return cast;
+ }
}
Modified: trunk/cdk/generator/src/main/resources/META-INF/schema/cdk-template.xsd
===================================================================
--- trunk/cdk/generator/src/main/resources/META-INF/schema/cdk-template.xsd 2011-01-13 15:49:52 UTC (rev 20994)
+++ trunk/cdk/generator/src/main/resources/META-INF/schema/cdk-template.xsd 2011-01-13 16:26:56 UTC (rev 20995)
@@ -531,6 +531,11 @@
</xs:documentation>
</xs:annotation>
</xs:attribute>
+ <xs:attribute type="xs:boolean" name="cast">
+ <xs:annotation>
+ <xs:documentation><p>Defines whether type cast is needed.</p></xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
Modified: trunk/cdk/generator/src/main/resources/META-INF/templates/java/define-object.ftl
===================================================================
--- trunk/cdk/generator/src/main/resources/META-INF/templates/java/define-object.ftl 2011-01-13 15:49:52 UTC (rev 20994)
+++ trunk/cdk/generator/src/main/resources/META-INF/templates/java/define-object.ftl 2011-01-13 16:26:56 UTC (rev 20995)
@@ -1 +1 @@
-${type} ${name} <#if initializationStatement?exists> = ${initializationStatement}</#if>;
\ No newline at end of file
+${type} ${name} <#if initializationStatement?exists> = <#if cast>(${type})</#if>${initializationStatement}</#if>;
\ No newline at end of file
Modified: trunk/cdk/generator/src/test/java/org/richfaces/cdk/templatecompiler/statements/DefineObjectTest.java
===================================================================
--- trunk/cdk/generator/src/test/java/org/richfaces/cdk/templatecompiler/statements/DefineObjectTest.java 2011-01-13 15:49:52 UTC (rev 20994)
+++ trunk/cdk/generator/src/test/java/org/richfaces/cdk/templatecompiler/statements/DefineObjectTest.java 2011-01-13 16:26:56 UTC (rev 20995)
@@ -25,7 +25,7 @@
public void testDefineVariable() throws Exception {
expect(typesFactory.getType("java.lang.String")).andReturn(TypesFactory.STRING_TYPE);
controller.replay();
- statement.setObject("foo","java.lang.String",null);
+ statement.setObject("foo","java.lang.String",null, false);
String code = statement.getCode();
controller.verify();
verifyCode(code, "String"," foo","!=");
@@ -41,7 +41,7 @@
expect(typesFactory.getType("java.lang.String")).andReturn(TypesFactory.STRING_TYPE);
parsedExpression.setParent(statement);expectLastCall();
controller.replay();
- statement.setObject("foo","java.lang.String",HTTP_EXAMPLE_COM);
+ statement.setObject("foo","java.lang.String",HTTP_EXAMPLE_COM, false);
String code = statement.getCode();
verifyCode(code, HTTP_EXAMPLE_COM,"String","=");
controller.verify();
@@ -55,7 +55,7 @@
expect(parsedExpression.getRequiredMethods()).andStubReturn(Collections.<HelperMethod>emptySet());
parsedExpression.setParent(statement);expectLastCall();
controller.replay();
- statement.setObject("foo",null,HTTP_EXAMPLE_COM);
+ statement.setObject("foo",null,HTTP_EXAMPLE_COM, false);
String code = statement.getCode();
verifyCode(code, "Integer","foo","=");
controller.verify();
Modified: trunk/ui/input/ui/src/main/templates/input.template.inc
===================================================================
--- trunk/ui/input/ui/src/main/templates/input.template.inc 2011-01-13 15:49:52 UTC (rev 20994)
+++ trunk/ui/input/ui/src/main/templates/input.template.inc 2011-01-13 16:26:56 UTC (rev 20995)
@@ -25,6 +25,7 @@
<span class="rf-insl-inp-cntr">
<input xmlns:cdk="http://jboss.org/schema/richfaces/cdk/core" name="#{clientId}" type="text"
class="rf-insl-inp #{component.attributes['inputClass']}" value="#{getInputValue(facesContext, component)}"
- cdk:passThrough="accesskey disabled size:inputSize tabindex" readonly="#{!component.attributes['enableManualInput']}"
- style="#{component.attributes['showInput'] ? null : 'display: none;'}" maxlength="#{maxlength > 0 ? maxlength : null}"/>
+ cdk:passThrough="accesskey disabled tabindex" readonly="#{!component.attributes['enableManualInput']}"
+ style="#{component.attributes['showInput'] ? null : 'display: none;'}" maxlength="#{maxlength > 0 ? maxlength : null}"
+ size="#{inputSize > 0 ? inputSize : null}"/>
</span>
\ No newline at end of file
Modified: trunk/ui/input/ui/src/main/templates/inputnumberslider.template.xml
===================================================================
--- trunk/ui/input/ui/src/main/templates/inputnumberslider.template.xml 2011-01-13 15:49:52 UTC (rev 20994)
+++ trunk/ui/input/ui/src/main/templates/inputnumberslider.template.xml 2011-01-13 16:26:56 UTC (rev 20995)
@@ -39,7 +39,8 @@
</cc:interface>
<cc:implementation>
<span id="#{clientId}" class="rf-insl #{component.attributes['styleClass']}" cdk:passThroughWithExclusions="id class">
- <cdk:call expression='int maxlength = (Integer) component.getAttributes().get("maxlength");' />
+ <cdk:object name="maxlength" type="Integer" cast="true" value="#{component.attributes['maxlength']}" />
+ <cdk:object name="inputSize" type="Integer" cast="true" value="#{component.attributes['inputSize']}" />
<c:if test="#{isInputPosition(component, 'left') || isInputPosition(component, 'top')}">
<xi:include xpointer="xpointer(/*)" href="input.template.inc" />
<c:if test="#{isInputPosition(component, 'top') and component.attributes['showInput']}">
13 years, 11 months
JBoss Rich Faces SVN: r20994 - in branches/RF-9797/ui/validator/ui/src/main: resources/META-INF/resources/org.richfaces and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2011-01-13 10:49:52 -0500 (Thu, 13 Jan 2011)
New Revision: 20994
Added:
branches/RF-9797/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/richfaces-message.js
Modified:
branches/RF-9797/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ClientOnlyScript.java
branches/RF-9797/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ValidatorScriptBase.java
branches/RF-9797/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/richfaces-csv.js
branches/RF-9797/ui/validator/ui/src/main/resources/META-INF/richfaces/org.richfaces/csv.library.properties
branches/RF-9797/ui/validator/ui/src/main/resources/META-INF/richfaces/org.richfaces/message.library.properties
Log:
RF-9797
Modified: branches/RF-9797/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ClientOnlyScript.java
===================================================================
--- branches/RF-9797/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ClientOnlyScript.java 2011-01-13 15:31:54 UTC (rev 20993)
+++ branches/RF-9797/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ClientOnlyScript.java 2011-01-13 15:49:52 UTC (rev 20994)
@@ -3,6 +3,8 @@
import java.util.Collection;
import java.util.LinkedHashSet;
+import org.ajax4jsf.javascript.JSFunction;
+import org.ajax4jsf.javascript.JSReference;
import org.ajax4jsf.javascript.ScriptWithDependencies;
import org.richfaces.resource.ResourceKey;
@@ -40,7 +42,7 @@
protected Object buildBody() {
StringBuilder body = new StringBuilder();
// Get component value by clientId.
- body.append("var ").append(ClientValidatorRenderer.VALUE_VAR).append("=");
+ /*body.append("var ").append(ClientValidatorRenderer.VALUE_VAR).append("=");
GET_VALUE_FUNCTION.appendScriptToStringBuilder(body);
body.append(EOL);
// Try client-side validation
@@ -59,7 +61,15 @@
// Catch errors
body.append("} catch(e) {\n");
SEND_ERROR_FUNCTION.appendScriptToStringBuilder(body);body.append(EOL);
- body.append("return false;\n}");
+ body.append("return false;\n}");*/
+ JSFunction callValidator = new JSFunction("RichFaces.csv.validate",
+ new JSReference("event"),
+ new JSReference("id"),
+ new JSReference("element"),
+ new JSReference("c"),
+ new JSReference("v"),
+ new JSReference("p"));
+ body.append(callValidator);
return body;
}
Modified: branches/RF-9797/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ValidatorScriptBase.java
===================================================================
--- branches/RF-9797/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ValidatorScriptBase.java 2011-01-13 15:31:54 UTC (rev 20993)
+++ branches/RF-9797/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ValidatorScriptBase.java 2011-01-13 15:49:52 UTC (rev 20994)
@@ -14,7 +14,7 @@
public static final JSReference EVENT_LITERAL = new JSReference(EVENT);
public static final String DISABLE_AJAX = "disableAjax";
public static final String EOL = ";\n";
- public static final String CLIENT_ID = "clientId";
+ public static final String CLIENT_ID = "id";
public static final JSReference CLIENT_ID_LITERAL = new JSReference(CLIENT_ID);
public static final String SOURCE_ID = "sourceId";
public static final JSReference SOURCE_ID_LITERAL = new JSReference(SOURCE_ID);
@@ -28,7 +28,7 @@
private boolean bodyProcessed = false;
public ValidatorScriptBase() {
- super(CLIENT_ID,ELEMENT,EVENT,DISABLE_AJAX);
+ super(CLIENT_ID,EVENT,ELEMENT);
}
public void appendScript(Appendable target) throws IOException {
Modified: branches/RF-9797/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/richfaces-csv.js
===================================================================
--- branches/RF-9797/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/richfaces-csv.js 2011-01-13 15:31:54 UTC (rev 20993)
+++ branches/RF-9797/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/richfaces-csv.js 2011-01-13 15:49:52 UTC (rev 20994)
@@ -8,6 +8,33 @@
var RE_MESSAGE_PATTERN = /\{(\d+)\}/g;
+ var __interpolateMessage = function (customMessage, values) {
+ var message = customMessage || "";
+ if (message) {
+ var msgObject = message.replace(RE_MESSAGE_PATTERN,"\n$1\n").split("\n");
+ var value;
+ for (var i=1; i<msgObject.length; i+=2) {
+ value = values[msgObject[i]];
+ msgObject[i] = typeof value == "undefined" ? "" : value;
+ }
+ message = msgObject.join('');
+ }
+ return message;
+ }
+
+ var __getValue = function(id) {
+ var value;
+ var element = rf.getDomElement(id);
+ if (element.value) {
+ value = element.value;
+ } else {
+ var component = rf.$(element);
+ // TODO: add getValue to baseComponent and change jsdocs
+ value = component && typeof component["getValue"] == "function" ? component.getValue() : "";
+ }
+ return value;
+ }
+
$.extend(rf.csv, {
RE_DIGITS: /^-?\d+$/,
RE_FLOAT: /^(-?\d+)?(\.(\d+)?(e[+-]?\d+)?)?$/,
@@ -16,17 +43,8 @@
$.extend(_messages, messagesObject);
},
getMessage: function(customMessage, messageId, values) {
- var message = customMessage || _messages[messageId] || "";
- if (message) {
- var msgObject = message.replace(RE_MESSAGE_PATTERN,"\n$1\n").split("\n");
- var value;
- for (var i=1; i<msgObject.length; i+=2) {
- value = values[msgObject[i]];
- msgObject[i] = typeof value == "undefined" ? "" : value;
- }
- message = msgObject.join('');
- }
- return {message:message};
+ var message = customMessage ? {detail:customMessage,summary:customMessage} : _messages[messageId] || {detail:"",summary:""};
+ return {detail:__interpolateMessage(message.detail,values),summary:__interpolateMessage(message.summary,values)};
},
sendMessage: function (componentId, message) {
rf.Event.fire(window.document, rf.Event.MESSAGE_EVENT_TYPE, {'sourceId':componentId, 'message':message});
@@ -45,16 +63,8 @@
getValidator: function (name) {
return _validators[name];
},
- validate: function (event, id, converter, validators) {
- var value;
- var element = rf.getDomElement(id);
- if (element.value) {
- value = element.value;
- } else {
- var component = rf.$(element);
- // TODO: add getValue to baseComponent and change jsdocs
- value = component && typeof component["getValue"] == "function" ? component.getValue() : "";
- }
+ validate: function (event, id, element, converter, validators, params) {
+ var value = __getValue(element || id);
if (converter) {
try {
converter.options.componentId = id;
@@ -80,9 +90,165 @@
}
return true;
},
+ /*
+ function form_3Atext_3Av(clientId,element,event,disableAjax){var value=RichFaces.csv.getValue(clientId,element);
+ try {
+ var convertedValue=value;
+ RichFaces.csv.validateLength(convertedValue,{"detail":"{2}: Validation Error: Specified attribute is not between the expected values of {0} and {1}.","severity":0,"summary":"{2}: Validation Error: Specified attribute is not between the expected values of {0} and {1}."} ,{"minimum":1,"maximum":3} );
+ if(!disableAjax){
+ RichFaces.csv.clearMessage(clientId);
+ }
+ return true;
+ } catch(e) {
+ RichFaces.csv.sendMessage(clientId,e);
+ return false;
+ }}
+ */
+ /*
+ * c: {name:, options:}
+ v: [{type:, customMessage:, [validator params]}]
+ function form_3Atext_3Av(id, el, e, c, v, p) {
+ RichFaces.csv.validate(e, id, el, c, v, p);
+ }
+ */
addFormValidators: function (formId, callValidatorFunctions) {
}
});
+})(jQuery, window.RichFaces || (window.RichFaces={}));
+
+/*
+ * Converters implementation
+ */
+(function($, rf) {
+ RichFaces.csv.addConverter({
+ "boolean": function (value, params) {
+ var result; value = $.trim(value).toLowerCase();
+ result = value=='true' ? true : value.length<1 ? null : false;
+
+ return result;
+ },
+ "byte": function (value, params) {
+ var result; value = $.trim(value);
+ if (!rf.csv.RE_DIGITS.test(value) || (result=parseInt(value,10))<-128 || result>127) {
+ throw rf.csv.getMessage(params.customMessage, 'BYTE_CONVERTER_BYTE', [value, 0, params.componentId]);
+ }
+ return result;
+ },
+ "number": function (value, params) {
+ var result; value=$.trim(value);
+ if (isNaN(value)) {
+ throw rf.csv.getMessage(params.customMessage, 'NUMBER_CONVERTER_NUMBER', [value, 0, params.componentId]);
+ } else {
+ result = parseInt(value, 10);
+ }
+ return result;
+ },
+ "short": function (value, params) {
+ var result; value = $.trim(value);
+ if (!rf.csv.RE_DIGITS.test(value) || (result=parseInt(value,10))<-32768 || result>32767) {
+ throw rf.csv.getMessage(params.customMessage, 'SHORT_CONVERTER_SHORT', [value, 0, params.componentId]);
+ }
+ return result;
+ }
+ });
+})(jQuery, window.RichFaces || (window.RichFaces={}));
+
+/*
+ * Validators implementation
+ */
+(function($, rf) {
+ RichFaces.csv.addValidator({
+ "long-range": function (componentId, value, params) {
+ var type = typeof value;
+ if (type != "number") {
+ if (type != "string") {
+ throw rf.csv.getMessage(params.customMessage, 'LONG_RANGE_VALIDATOR_TYPE', [componentId, ""]);
+ } else {
+ value = $.trim(value);
+ if (!rf.csv.RE_DIGITS.test(value) || (value = parseInt(value, 10))==NaN) {
+ throw rf.csv.getMessage(params.customMessage, 'LONG_RANGE_VALIDATOR_TYPE', [componentId, ""]);
+ }
+ }
+ }
+
+ var isMinSet = typeof params.minimum == "number";
+ var isMaxSet = typeof params.maximum == "number";
+
+ if (isMaxSet && value > params.maximum) {
+ if (isMinSet) {
+ throw rf.csv.getMessage(params.customMessage, 'LONG_RANGE_VALIDATOR_NOT_IN_RANGE', [params.minimum, params.maximum, componentId]);
+ } else {
+ throw rf.csv.getMessage(params.customMessage, 'LONG_RANGE_VALIDATOR_MAXIMUM', [params.maximum, componentId]);
+ }
+ }
+ if (isMinSet && value < params.minimum) {
+ if (isMaxSet) {
+ throw rf.csv.getMessage(params.customMessage, 'LONG_RANGE_VALIDATOR_NOT_IN_RANGE', [params.minimum, params.maximum, componentId]);
+ } else {
+ throw rf.csv.getMessage(params.customMessage, 'LONG_RANGE_VALIDATOR_MINIMUM', [params.minimum, componentId]);
+ }
+ }
+ },
+ "double-range": function (componentId, value, params) {
+ var type = typeof value;
+ if (type != "number") {
+ if (type != "string") {
+ throw rf.csv.getMessage(params.customMessage, 'DOUBLE_RANGE_VALIDATOR_TYPE', [componentId, ""]);
+ } else {
+ value = $.trim(value);
+ if (!rf.csv.RE_FLOAT.test(value) || (value = parseFloat(value))==NaN) {
+ throw rf.csv.getMessage(params.customMessage, 'DOUBLE_RANGE_VALIDATOR_TYPE', [componentId, ""]);
+ }
+ }
+ }
+
+ var isMinSet = typeof params.minimum == "number";
+ var isMaxSet = typeof params.maximum == "number";
+
+ if (isMaxSet && value > params.maximum) {
+ if (isMinSet) {
+ throw rf.csv.getMessage(params.customMessage, 'DOUBLE_RANGE_VALIDATOR_NOT_IN_RANGE', [params.minimum, params.maximum, componentId]);
+ } else {
+ throw rf.csv.getMessage(params.customMessage, 'DOUBLE_RANGE_VALIDATOR_MAXIMUM', [params.maximum, componentId]);
+ }
+ }
+ if (isMinSet && value < params.minimum) {
+ if (isMaxSet) {
+ throw rf.csv.getMessage(params.customMessage, 'DOUBLE_RANGE_VALIDATOR_NOT_IN_RANGE', [params.minimum, params.maximum, componentId]);
+ } else {
+ throw rf.csv.getMessage(params.customMessage, 'DOUBLE_RANGE_VALIDATOR_MINIMUM', [params.minimum, componentId]);
+ }
+ }
+ },
+ "length": function (componentId, value, params) {
+ if (params.maximum && value.length > params.maximum) {
+ throw rf.csv.getMessage(params.customMessage, 'LENGTH_VALIDATOR_MAXIMUM', [params.maximum, componentId]);
+ }
+ if (params.minimum && value.length < params.minimum) {
+ throw rf.csv.getMessage(params.customMessage, 'LENGTH_VALIDATOR_MINIMUM', [params.minimum, componentId]);
+ }
+ },
+ "regex": function (componentId, value, params) {
+ if (typeof params.pattern != "string" || params.pattern.length == 0) {
+ throw rf.csv.getMessage(params.customMessage, 'REGEX_VALIDATOR_PATTERN_NOT_SET', []);
+ }
+
+ var re;
+ try {
+ re = new RegExp(params.pattern);
+ } catch (e) {
+ throw rf.csv.getMessage(params.customMessage, 'REGEX_VALIDATOR_MATCH_EXCEPTION', []);
+ }
+ if (!re.test(value)){
+ throw rf.csv.getMessage(params.customMessage, 'REGEX_VALIDATOR_NOT_MATCHED', [params.pattern]);
+ }
+ },
+ "required": function (componentId, value, params) {
+ if (value.length==0) {
+ throw rf.csv.getMessage(params.customMessage, 'UIINPUT_REQUIRED', [componentId]);
+ }
+ }
+ });
})(jQuery, window.RichFaces || (window.RichFaces={}));
\ No newline at end of file
Added: branches/RF-9797/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/richfaces-message.js
===================================================================
--- branches/RF-9797/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/richfaces-message.js (rev 0)
+++ branches/RF-9797/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/richfaces-message.js 2011-01-13 15:49:52 UTC (rev 20994)
@@ -0,0 +1,77 @@
+(function($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ // Constructor definition
+ rf.ui.Base = function(componentId, options, defaultOptions) {
+ this.namespace = "."+rf.Event.createNamespace(this.name, componentId);
+ // call constructor of parent class
+ $super.constructor.call(this, componentId);
+ this.options = $.extend(this.options, defaultOptions, options);
+ this.attachToDom();
+ this.__bindEventHandlers();
+ };
+
+ // Extend component class and add protected methods from parent class to our container
+ rf.BaseComponent.extend(rf.ui.Base);
+
+ // define super class link
+ var $super = rf.ui.Base.$super;
+
+ $.extend(rf.ui.Base.prototype, {
+ __bindEventHandlers: function () {
+ },
+ destroy: function () {
+ rf.Event.unbindById(this.id, this.namespace);
+ $super.destroy.call(this);
+ }
+ });
+
+})(jQuery, window.RichFaces || (window.RichFaces={}));
+
+(function($, rf) {
+
+ // Constructor definition
+ rf.ui.Message = function(componentId, options) {
+ // call constructor of parent class
+ $super.constructor.call(this, componentId, options, defaultOptions);
+ };
+
+ // Extend component class and add protected methods from parent class to our container
+ rf.ui.Base.extend(rf.ui.Message);
+
+ // define super class link
+ var $super = rf.ui.Message.$super;
+
+ var defaultOptions = {
+
+ };
+
+ var componentHash = {};
+ var componentIndex = 0;
+
+ var onMessage = function (event, element, data) {
+ if (!this.options.forComponentId) {
+ var index = componentHash[data.sourceId];
+ if (typeof index != undefined) {
+ $(rf.getDomElement(this.id+index)).remove();
+ }
+ var content = content = $(rf.getDomElement(this.id));
+
+ componentIndex ++;
+ if (data.message) content.append('<li id="'+this.id+componentIndex+'">'+data.message.summary+'</li>');
+ componentHash[data.sourceId] = componentIndex;
+
+ } else if (this.options.forComponentId==data.sourceId) {
+ rf.getDomElement(this.id).innerHTML = data.message ? '<li>'+data.message.summary+'</li>' : '';
+ }
+ }
+
+ $.extend(rf.ui.Message.prototype, {
+ name: "Message",
+ __bindEventHandlers: function () {
+ rf.Event.bind(window.document, rf.Event.MESSAGE_EVENT_TYPE+this.namespace, onMessage, this);
+ }
+ });
+
+})(jQuery, window.RichFaces || (window.RichFaces={}));
\ No newline at end of file
Modified: branches/RF-9797/ui/validator/ui/src/main/resources/META-INF/richfaces/org.richfaces/csv.library.properties
===================================================================
--- branches/RF-9797/ui/validator/ui/src/main/resources/META-INF/richfaces/org.richfaces/csv.library.properties 2011-01-13 15:31:54 UTC (rev 20993)
+++ branches/RF-9797/ui/validator/ui/src/main/resources/META-INF/richfaces/org.richfaces/csv.library.properties 2011-01-13 15:49:52 UTC (rev 20994)
@@ -1 +1 @@
-resources=jquery.js, richfaces.js, richfaces-event.js, org.richfaces:csv.js
\ No newline at end of file
+resources=jquery.js, richfaces.js, richfaces-event.js, org.richfaces:richfaces-csv.js
\ No newline at end of file
Modified: branches/RF-9797/ui/validator/ui/src/main/resources/META-INF/richfaces/org.richfaces/message.library.properties
===================================================================
--- branches/RF-9797/ui/validator/ui/src/main/resources/META-INF/richfaces/org.richfaces/message.library.properties 2011-01-13 15:31:54 UTC (rev 20993)
+++ branches/RF-9797/ui/validator/ui/src/main/resources/META-INF/richfaces/org.richfaces/message.library.properties 2011-01-13 15:49:52 UTC (rev 20994)
@@ -1 +1 @@
-resources=jquery.js, richfaces.js, richfaces-event.js, richfaces-base-component.js, org.richfaces:message.js
\ No newline at end of file
+resources=jquery.js, richfaces.js, richfaces-event.js, richfaces-base-component.js, org.richfaces:richfaces-message.js
\ No newline at end of file
13 years, 11 months
JBoss Rich Faces SVN: r20993 - in modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest: richColumn and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2011-01-13 10:31:54 -0500 (Thu, 13 Jan 2011)
New Revision: 20993
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumnGroup/
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumnGroup/TestColumnGroupHeaderFooter.java
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/AbstractColumnModelTest.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/ColumnModel.java
Log:
rich:columnGroup - Header and Footer sample automated (RFPL730)
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/AbstractColumnModelTest.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/AbstractColumnModelTest.java 2011-01-13 15:28:51 UTC (rev 20992)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/AbstractColumnModelTest.java 2011-01-13 15:31:54 UTC (rev 20993)
@@ -35,8 +35,8 @@
*/
public abstract class AbstractColumnModelTest extends AbstractMetamerTest {
- ColumnAttributes attributes = new ColumnAttributes();
- ColumnModel model = new ColumnModel("richDataTable", pjq("table.rf-dt[id$=richDataTable]"));
+ protected ColumnAttributes attributes = new ColumnAttributes();
+ protected ColumnModel model = new ColumnModel("richDataTable", pjq("table.rf-dt[id$=richDataTable]"));
List<Capital> capitals;
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/ColumnModel.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/ColumnModel.java 2011-01-13 15:28:51 UTC (rev 20992)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/ColumnModel.java 2011-01-13 15:31:54 UTC (rev 20993)
@@ -45,17 +45,32 @@
private ReferencedLocator<JQueryLocator> tableHeader = ref(root, "> thead.rf-dt-thd");
private ReferencedLocator<JQueryLocator> tableBody = ref(root, "> tbody.rf-dt-b");
+ private ReferencedLocator<JQueryLocator> tableFooter = ref(root, "> tfoot.rf-dt-tft");
private ReferencedLocator<JQueryLocator> headerRow = ref(tableHeader, "> tr.rf-dt-hdr");
private ReferencedLocator<JQueryLocator> bodyRow = ref(tableBody, "> tr.rf-dt-r");
+ private ReferencedLocator<JQueryLocator> footerRow = ref(tableFooter, "> tr.rf-dt-ftr");
private JQueryLocator headerCell = jq("th.rf-dt-hdr-c");
private JQueryLocator bodyCell = jq("td.rf-dt-c");
+ private JQueryLocator footerCell = jq("td.rf-dt-ftr-c");
public ColumnModel(String name, JQueryLocator root) {
super(name, root);
}
+ public int getBodyRowCount() {
+ return selenium.getCount(bodyRow.getChild(bodyCell).getNthChildElement(1));
+ }
+
+ public int getHeaderRowCount() {
+ return selenium.getCount(headerRow.getChild(headerCell).getNthChildElement(1));
+ }
+
+ public int getFooterRowCount() {
+ return selenium.getCount(footerRow.getChild(footerCell).getNthChildElement(1));
+ }
+
public int getBodyRowCellCount(int row) {
return selenium.getCount(bodyRow.getNthChildElement(row).getChild(bodyCell));
}
@@ -64,6 +79,10 @@
return selenium.getCount(headerRow.getNthChildElement(row).getChild(headerCell));
}
+ public int getFooterRowCellCount(int row) {
+ return selenium.getCount(footerRow.getNthChildElement(row).getChild(footerCell));
+ }
+
public JQueryLocator getBodyCell(int row, int column) {
return bodyRow.getNthChildElement(row).getChild(bodyCell).getNthChildElement(column);
}
@@ -72,6 +91,10 @@
return headerRow.getNthChildElement(row).getChild(headerCell).getNthChildElement(column);
}
+ public JQueryLocator getFooterCell(int row, int column) {
+ return footerRow.getNthChildElement(row).getChild(footerCell).getNthChildElement(column);
+ }
+
public Capital getCapital(int index) {
String state = selenium.getText(getBodyCell(index + 1, 1));
String name = selenium.getText(getBodyCell(index + 1, 2));
@@ -80,7 +103,7 @@
result.setState(state);
return result;
}
-
+
public Collection<Capital> getCapitals() {
int count = getBodyRowCount();
List<Capital> capitals = new LinkedList<Capital>();
@@ -89,8 +112,5 @@
}
return capitals;
}
-
- public int getBodyRowCount() {
- return selenium.getCount(bodyRow.getChild(bodyCell).getNthChildElement(1));
- }
+
}
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumnGroup/TestColumnGroupHeaderFooter.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumnGroup/TestColumnGroupHeaderFooter.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumnGroup/TestColumnGroupHeaderFooter.java 2011-01-13 15:31:54 UTC (rev 20993)
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.ftest.richColumnGroup;
+
+import static org.jboss.test.selenium.locator.Attribute.ROWSPAN;
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+
+import java.net.URL;
+
+import org.richfaces.tests.metamer.ftest.richColumn.AbstractColumnModelTest;
+import org.testng.annotations.Test;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public class TestColumnGroupHeaderFooter extends AbstractColumnModelTest {
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/richColumnGroup/headerFooter.xhtml");
+ }
+
+ @Test
+ public void testRendered() {
+ int bodyRowCount = model.getBodyRowCount();
+
+ assertTrue(bodyRowCount > 0);
+
+ assertEquals(model.getHeaderRowCount(), 2);
+ assertEquals(model.getHeaderRowCellCount(1), 2);
+ assertEquals(model.getHeaderRowCellCount(2), 4);
+ assertEquals(selenium.getAttribute(model.getHeaderCell(1, 1).getAttribute(ROWSPAN)), "2");
+
+ assertEquals(model.getFooterRowCount(), 3);
+ assertEquals(model.getFooterRowCellCount(1), 1);
+ assertEquals(model.getFooterRowCellCount(2), 5);
+ assertEquals(model.getFooterRowCellCount(3), 1);
+ assertEquals(selenium.getAttribute(model.getFooterCell(2, 1).getAttribute(ROWSPAN)), "2");
+
+ attributes.setRendered(false);
+
+ assertEquals(model.getBodyRowCount(), bodyRowCount);
+ assertEquals(model.getHeaderRowCount(), 0);
+ assertEquals(model.getFooterRowCount(), 0);
+ }
+}
13 years, 11 months
JBoss Rich Faces SVN: r20992 - trunk/core/impl/src/main/resources/META-INF/resources.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2011-01-13 10:28:51 -0500 (Thu, 13 Jan 2011)
New Revision: 20992
Modified:
trunk/core/impl/src/main/resources/META-INF/resources/skinning_classes.ecss
Log:
https://issues.jboss.org/browse/RF-10191
Modified: trunk/core/impl/src/main/resources/META-INF/resources/skinning_classes.ecss
===================================================================
--- trunk/core/impl/src/main/resources/META-INF/resources/skinning_classes.ecss 2011-01-13 14:46:11 UTC (rev 20991)
+++ trunk/core/impl/src/main/resources/META-INF/resources/skinning_classes.ecss 2011-01-13 15:28:51 UTC (rev 20992)
@@ -311,53 +311,6 @@
color: '#{richSkin.selectControlColor}';
}
- /*gradient styles*/
-
-.rfs-gradient-header-inverse{
- background-image : "url(#{resource['org.richfaces.renderkit.html.gradientimages.HeaderInverseGradientImage']})";
- background-repeat : repeat-x;
-}
-
-.rfs-gradient-header{
- background-image : "url(#{resource['org.richfaces.renderkit.html.gradientimages.HeaderGradientImage']})";
- background-repeat : repeat-x;
-}
-
-.rfs-gradient-tab{
- background-image : "url(#{resource['org.richfaces.renderkit.html.gradientimages.TabGradientImage']})";
- background-repeat : repeat-x;
-}
-
-.rfs-gradient-tab-inverse{
- background-image : "url(#{resource['org.richfaces.renderkit.html.gradientimages.TabInverseGradientImage']})";
- background-repeat : repeat-x;
-}
-
-.rfs-gradient-input{
- background-image : "url(#{resource['org.richfaces.renderkit.html.gradientimages.InputGradientImage']})";
- background-repeat : repeat-x;
-}
-
-.rfs-gradient-menu-inverse{
- background-image : "url(#{resource['org.richfaces.renderkit.html.gradientimages.MenuInverseGradientImage']})";
- background-repeat : repeat-x;
-}
-
-.rfs-gradient-menu{
- background-image : "url(#{resource['org.richfaces.renderkit.html.gradientimages.MenuGradientImage']})";
- background-repeat : repeat-x;
-}
-
-.rfs-gradient-btn-inverse{
- background-image : "url(#{resource['org.richfaces.renderkit.html.gradientimages.ButtonInverseGradientImage']})";
- background-repeat : repeat-x;
-}
-
-.rfs-gradient-btn{
- background-image : "url(#{resource['org.richfaces.renderkit.html.gradientimages.ButtonGradientImage']})";
- background-repeat : repeat-x;
-}
-
/* extended skinning styles */
.rfs-ctn input, .rfs-input,
13 years, 11 months
JBoss Rich Faces SVN: r20991 - trunk/core/impl/src/main/java/org/richfaces/application/push/impl/jms.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2011-01-13 09:46:11 -0500 (Thu, 13 Jan 2011)
New Revision: 20991
Modified:
trunk/core/impl/src/main/java/org/richfaces/application/push/impl/jms/MessagingContext.java
trunk/core/impl/src/main/java/org/richfaces/application/push/impl/jms/PushContextImpl.java
Log:
https://issues.jboss.org/browse/RF-10198
Modified: trunk/core/impl/src/main/java/org/richfaces/application/push/impl/jms/MessagingContext.java
===================================================================
--- trunk/core/impl/src/main/java/org/richfaces/application/push/impl/jms/MessagingContext.java 2011-01-13 14:44:20 UTC (rev 20990)
+++ trunk/core/impl/src/main/java/org/richfaces/application/push/impl/jms/MessagingContext.java 2011-01-13 14:46:11 UTC (rev 20991)
@@ -115,7 +115,7 @@
}
public void stop() throws Exception {
- connection.stop();
+ connection.close();
connection = null;
}
Modified: trunk/core/impl/src/main/java/org/richfaces/application/push/impl/jms/PushContextImpl.java
===================================================================
--- trunk/core/impl/src/main/java/org/richfaces/application/push/impl/jms/PushContextImpl.java 2011-01-13 14:44:20 UTC (rev 20990)
+++ trunk/core/impl/src/main/java/org/richfaces/application/push/impl/jms/PushContextImpl.java 2011-01-13 14:46:11 UTC (rev 20991)
@@ -32,9 +32,9 @@
import javax.faces.event.PreDestroyApplicationEvent;
import javax.faces.event.SystemEvent;
import javax.faces.event.SystemEventListener;
-import javax.naming.CompositeName;
import javax.naming.InitialContext;
import javax.naming.Name;
+import javax.naming.NameParser;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -81,8 +81,11 @@
ConfigurationService configurationService = ServiceTracker.getService(ConfigurationService.class);
InitialContext initialContext = new InitialContext();
- Name cnfName = new CompositeName(configurationService.getStringValue(facesContext, pushJMSConnectionFactory));
- Name topicsNamespace = new CompositeName(configurationService.getStringValue(facesContext, pushJMSTopicsNamespace));
+
+ NameParser nameParser = initialContext.getNameParser("");
+
+ Name cnfName = nameParser.parse(configurationService.getStringValue(facesContext, pushJMSConnectionFactory));
+ Name topicsNamespace = nameParser.parse(configurationService.getStringValue(facesContext, pushJMSTopicsNamespace));
messagingContext = new MessagingContext(initialContext, cnfName, topicsNamespace,
getApplicationName(facesContext),
13 years, 11 months
JBoss Rich Faces SVN: r20990 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2011-01-13 09:44:20 -0500 (Thu, 13 Jan 2011)
New Revision: 20990
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/AbstractColumnModelTest.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/AbstractColumnSortingTest.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/TestColumnComparator.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/TestColumnSorting.java
Log:
rich:column - fixed propagation of @Test to MatrixConfigurator (RFPL-729)
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/AbstractColumnModelTest.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/AbstractColumnModelTest.java 2011-01-13 14:43:10 UTC (rev 20989)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/AbstractColumnModelTest.java 2011-01-13 14:44:20 UTC (rev 20990)
@@ -27,6 +27,7 @@
import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
import org.richfaces.tests.metamer.model.Capital;
import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
/**
* @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/AbstractColumnSortingTest.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/AbstractColumnSortingTest.java 2011-01-13 14:43:10 UTC (rev 20989)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/AbstractColumnSortingTest.java 2011-01-13 14:44:20 UTC (rev 20990)
@@ -31,7 +31,6 @@
import org.richfaces.tests.metamer.ftest.annotations.Inject;
import org.richfaces.tests.metamer.ftest.annotations.Use;
import org.richfaces.tests.metamer.model.Capital;
-import org.testng.annotations.Test;
/**
* @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
@@ -42,8 +41,7 @@
@Inject
@Use(enumeration = true)
SortOrder sortOrder;
-
- @Test
+
public void testSortingWithSortOrder() {
attributes.setRequestType(RequestType.XHR);
attributes.setSortOrder(sortOrder);
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/TestColumnComparator.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/TestColumnComparator.java 2011-01-13 14:43:10 UTC (rev 20989)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/TestColumnComparator.java 2011-01-13 14:44:20 UTC (rev 20990)
@@ -38,4 +38,10 @@
public URL getTestUrl() {
return buildUrl(contextPath, "faces/components/richColumn/comparator.xhtml");
}
+
+ @Test
+ @Override
+ public void testSortingWithSortOrder() {
+ super.testSortingWithSortOrder();
+ }
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/TestColumnSorting.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/TestColumnSorting.java 2011-01-13 14:43:10 UTC (rev 20989)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/TestColumnSorting.java 2011-01-13 14:44:20 UTC (rev 20990)
@@ -38,4 +38,10 @@
public URL getTestUrl() {
return buildUrl(contextPath, "faces/components/richColumn/sorting.xhtml");
}
+
+ @Test
+ @Override
+ public void testSortingWithSortOrder() {
+ super.testSortingWithSortOrder();
+ }
}
13 years, 11 months
JBoss Rich Faces SVN: r20989 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2011-01-13 09:43:10 -0500 (Thu, 13 Jan 2011)
New Revision: 20989
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/ColumnModel.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/TestColumnFiltering.java
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/AbstractColumnModelTest.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/AbstractColumnSortingTest.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/TestColumnSimple.java
Log:
rich:column - Filtering sample automated (RFPL-729)
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/AbstractColumnModelTest.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/AbstractColumnModelTest.java 2011-01-13 14:42:00 UTC (rev 20988)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/AbstractColumnModelTest.java 2011-01-13 14:43:10 UTC (rev 20989)
@@ -21,11 +21,8 @@
*******************************************************************************/
package org.richfaces.tests.metamer.ftest.richColumn;
-import static org.jboss.test.selenium.locator.LocatorFactory.jq;
-
import java.util.List;
-import org.jboss.test.selenium.locator.JQueryLocator;
import org.richfaces.tests.metamer.bean.Model;
import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
import org.richfaces.tests.metamer.model.Capital;
@@ -37,16 +34,8 @@
*/
public abstract class AbstractColumnModelTest extends AbstractMetamerTest {
- JQueryLocator table = pjq("table.rf-dt[id$=richDataTable]");
- JQueryLocator header = table.getChild(jq("thead.rf-dt-thd"));
-
- JQueryLocator headerRow = header.getChild(jq("tr.rf-dt-hdr"));
- JQueryLocator headerCell = jq("th.rf-dt-hdr-c");
-
- JQueryLocator bodyRow = table.getChild(jq("tbody.rf-dt-b")).getChild(jq("tr.rf-dt-r"));
- JQueryLocator bodyCell = jq("td.rf-dt-c");
-
ColumnAttributes attributes = new ColumnAttributes();
+ ColumnModel model = new ColumnModel("richDataTable", pjq("table.rf-dt[id$=richDataTable]"));
List<Capital> capitals;
@@ -54,17 +43,4 @@
public void prepareModel() {
capitals = Model.unmarshallCapitals();
}
-
- public Capital getCapital(int index) {
- String state = selenium.getText(bodyCell(index + 1, 1));
- String name = selenium.getText(bodyCell(index + 1, 2));
- Capital result = new Capital();
- result.setName(name);
- result.setState(state);
- return result;
- }
-
- public JQueryLocator bodyCell(int row, int column) {
- return bodyRow.getNthChildElement(row).getChild(bodyCell).getNthChildElement(column);
- }
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/AbstractColumnSortingTest.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/AbstractColumnSortingTest.java 2011-01-13 14:42:00 UTC (rev 20988)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/AbstractColumnSortingTest.java 2011-01-13 14:43:10 UTC (rev 20989)
@@ -58,7 +58,7 @@
}
for (int i = 0; i < capitals.size(); i++) {
- Capital actualCapital = getCapital(i);
+ Capital actualCapital = model.getCapital(i);
Capital expectedCapital = capitals.get(i);
assertEquals(actualCapital.getName(), expectedCapital.getName());
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/ColumnModel.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/ColumnModel.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/ColumnModel.java 2011-01-13 14:43:10 UTC (rev 20989)
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.ftest.richColumn;
+
+import static org.jboss.test.selenium.locator.LocatorFactory.jq;
+import static org.jboss.test.selenium.locator.reference.ReferencedLocator.ref;
+
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.jboss.test.selenium.framework.AjaxSelenium;
+import org.jboss.test.selenium.framework.AjaxSeleniumProxy;
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.jboss.test.selenium.locator.reference.ReferencedLocator;
+import org.richfaces.tests.metamer.ftest.model.AbstractModel;
+import org.richfaces.tests.metamer.model.Capital;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public class ColumnModel extends AbstractModel<JQueryLocator> {
+
+ AjaxSelenium selenium = AjaxSeleniumProxy.getInstance();
+
+ private ReferencedLocator<JQueryLocator> tableHeader = ref(root, "> thead.rf-dt-thd");
+ private ReferencedLocator<JQueryLocator> tableBody = ref(root, "> tbody.rf-dt-b");
+
+ private ReferencedLocator<JQueryLocator> headerRow = ref(tableHeader, "> tr.rf-dt-hdr");
+ private ReferencedLocator<JQueryLocator> bodyRow = ref(tableBody, "> tr.rf-dt-r");
+
+ private JQueryLocator headerCell = jq("th.rf-dt-hdr-c");
+ private JQueryLocator bodyCell = jq("td.rf-dt-c");
+
+ public ColumnModel(String name, JQueryLocator root) {
+ super(name, root);
+ }
+
+ public int getBodyRowCellCount(int row) {
+ return selenium.getCount(bodyRow.getNthChildElement(row).getChild(bodyCell));
+ }
+
+ public int getHeaderRowCellCount(int row) {
+ return selenium.getCount(headerRow.getNthChildElement(row).getChild(headerCell));
+ }
+
+ public JQueryLocator getBodyCell(int row, int column) {
+ return bodyRow.getNthChildElement(row).getChild(bodyCell).getNthChildElement(column);
+ }
+
+ public JQueryLocator getHeaderCell(int row, int column) {
+ return headerRow.getNthChildElement(row).getChild(headerCell).getNthChildElement(column);
+ }
+
+ public Capital getCapital(int index) {
+ String state = selenium.getText(getBodyCell(index + 1, 1));
+ String name = selenium.getText(getBodyCell(index + 1, 2));
+ Capital result = new Capital();
+ result.setName(name);
+ result.setState(state);
+ return result;
+ }
+
+ public Collection<Capital> getCapitals() {
+ int count = getBodyRowCount();
+ List<Capital> capitals = new LinkedList<Capital>();
+ for (int i = 0; i < count; i++) {
+ capitals.add(getCapital(i));
+ }
+ return capitals;
+ }
+
+ public int getBodyRowCount() {
+ return selenium.getCount(bodyRow.getChild(bodyCell).getNthChildElement(1));
+ }
+}
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/TestColumnFiltering.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/TestColumnFiltering.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/TestColumnFiltering.java 2011-01-13 14:43:10 UTC (rev 20989)
@@ -0,0 +1,107 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.ftest.richColumn;
+
+import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardXhr;
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.testng.Assert.assertEquals;
+
+import java.net.URL;
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.jboss.test.selenium.dom.Event;
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.richfaces.tests.metamer.bean.RichColumnBean;
+import org.richfaces.tests.metamer.model.Capital;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.Collections2;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public class TestColumnFiltering extends AbstractColumnModelTest {
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/richColumn/filtering.xhtml");
+ }
+
+ JQueryLocator stateNameToFilter = pjq("input:text[id$=stateNameToFilter]");
+ private final static String stateName = "Maryland";
+
+ JQueryLocator tableWithFilter = pjq("table.rf-dt[id$=richDataTable1]");
+ JQueryLocator tableWithFilterExpression = pjq("table.rf-dt[id$=richDataTable2]");
+
+ @Test
+ public void testFilterAttribute() {
+ model.setRoot(tableWithFilter);
+ testFiltering();
+ }
+
+ @Test
+ public void testFilterExpressionAttribute() {
+ model.setRoot(tableWithFilterExpression);
+ testFiltering();
+ }
+
+ public void testFiltering() {
+ for (int i = 1; i <= stateName.length(); i++) {
+ String namePart = stateName.substring(0, i);
+
+ selenium.type(stateNameToFilter, namePart);
+ guardXhr(selenium).fireEvent(stateNameToFilter, Event.KEYUP);
+
+ Collection<Capital> actualCapitals = model.getCapitals();
+
+ richColumnBean.setStateNameToFilter(namePart);
+ Collection<Capital> expectedCapitals = Collections2.filter(capitals, new Predicate<Capital>() {
+ @Override
+ public boolean apply(Capital capital) {
+ return richColumnBean.getStateNameFilter().accept(capital);
+ }
+
+ });
+
+ assertEqualsCapitals(actualCapitals, expectedCapitals);
+ }
+ }
+
+ RichColumnBean richColumnBean = new RichColumnBean();
+
+ private void assertEqualsCapitals(Collection<Capital> actualCapitals, Collection<Capital> expectedCapitals) {
+ assertEquals(actualCapitals.size(), expectedCapitals.size());
+
+ Iterator<Capital> actualIterator = actualCapitals.iterator();
+ Iterator<Capital> expectedIterator = expectedCapitals.iterator();
+
+ while (actualIterator.hasNext()) {
+ Capital actual = actualIterator.next();
+ Capital expected = expectedIterator.next();
+
+ assertEquals(actual.getName(), expected.getName());
+ assertEquals(actual.getState(), actual.getState());
+ }
+ }
+}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/TestColumnSimple.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/TestColumnSimple.java 2011-01-13 14:42:00 UTC (rev 20988)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/TestColumnSimple.java 2011-01-13 14:43:10 UTC (rev 20989)
@@ -119,16 +119,16 @@
assertEquals(selenium.getAttribute(headerCell(2, 2).getAttribute(ROWSPAN)), "2");
}
- public JQueryLocator headerCell(int iRow, int iColumn) {
- return headerRow.getNthChildElement(iRow).getChild(headerCell).getNthChildElement(iColumn);
+ public JQueryLocator headerCell(int row, int column) {
+ return model.getHeaderCell(row, column);
}
- public int headerCount(int iRow) {
- return selenium.getCount(headerRow.getNthChildElement(iRow).getChild(headerCell));
+ public int headerCount(int row) {
+ return model.getHeaderRowCellCount(row);
}
- public int bodyCount(int iRow) {
- return selenium.getCount(bodyRow.getNthChildElement(iRow).getChild(bodyCell));
+ public int bodyCount(int row) {
+ return model.getBodyRowCellCount(row);
}
}
13 years, 11 months
JBoss Rich Faces SVN: r20988 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2011-01-13 09:42:00 -0500 (Thu, 13 Jan 2011)
New Revision: 20988
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/AbstractColumnModelTest.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/AbstractColumnSortingTest.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/TestColumnComparator.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/TestColumnSorting.java
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/TestColumnSimple.java
Log:
rich:column - Sorting and Comparator samples automated (RFPL-729)
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/AbstractColumnModelTest.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/AbstractColumnModelTest.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/AbstractColumnModelTest.java 2011-01-13 14:42:00 UTC (rev 20988)
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.ftest.richColumn;
+
+import static org.jboss.test.selenium.locator.LocatorFactory.jq;
+
+import java.util.List;
+
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.richfaces.tests.metamer.bean.Model;
+import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
+import org.richfaces.tests.metamer.model.Capital;
+import org.testng.annotations.BeforeMethod;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public abstract class AbstractColumnModelTest extends AbstractMetamerTest {
+
+ JQueryLocator table = pjq("table.rf-dt[id$=richDataTable]");
+ JQueryLocator header = table.getChild(jq("thead.rf-dt-thd"));
+
+ JQueryLocator headerRow = header.getChild(jq("tr.rf-dt-hdr"));
+ JQueryLocator headerCell = jq("th.rf-dt-hdr-c");
+
+ JQueryLocator bodyRow = table.getChild(jq("tbody.rf-dt-b")).getChild(jq("tr.rf-dt-r"));
+ JQueryLocator bodyCell = jq("td.rf-dt-c");
+
+ ColumnAttributes attributes = new ColumnAttributes();
+
+ List<Capital> capitals;
+
+ @BeforeMethod
+ public void prepareModel() {
+ capitals = Model.unmarshallCapitals();
+ }
+
+ public Capital getCapital(int index) {
+ String state = selenium.getText(bodyCell(index + 1, 1));
+ String name = selenium.getText(bodyCell(index + 1, 2));
+ Capital result = new Capital();
+ result.setName(name);
+ result.setState(state);
+ return result;
+ }
+
+ public JQueryLocator bodyCell(int row, int column) {
+ return bodyRow.getNthChildElement(row).getChild(bodyCell).getNthChildElement(column);
+ }
+}
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/AbstractColumnSortingTest.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/AbstractColumnSortingTest.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/AbstractColumnSortingTest.java 2011-01-13 14:42:00 UTC (rev 20988)
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.ftest.richColumn;
+
+import static org.testng.Assert.assertEquals;
+
+import java.util.Collections;
+
+import org.jboss.test.selenium.request.RequestType;
+import org.richfaces.component.SortOrder;
+import org.richfaces.tests.metamer.bean.RichColumnBean;
+import org.richfaces.tests.metamer.ftest.annotations.Inject;
+import org.richfaces.tests.metamer.ftest.annotations.Use;
+import org.richfaces.tests.metamer.model.Capital;
+import org.testng.annotations.Test;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public abstract class AbstractColumnSortingTest extends AbstractColumnModelTest {
+
+ @Inject
+ @Use(enumeration = true)
+ SortOrder sortOrder;
+
+ @Test
+ public void testSortingWithSortOrder() {
+ attributes.setRequestType(RequestType.XHR);
+ attributes.setSortOrder(sortOrder);
+
+ switch (sortOrder) {
+ case ascending:
+ Collections.sort(capitals, RichColumnBean.STATE_NAME_LENGTH_COMPARATOR);
+ break;
+ case descending:
+ Collections.sort(capitals, Collections.reverseOrder(RichColumnBean.STATE_NAME_LENGTH_COMPARATOR));
+ break;
+ }
+
+ for (int i = 0; i < capitals.size(); i++) {
+ Capital actualCapital = getCapital(i);
+ Capital expectedCapital = capitals.get(i);
+
+ assertEquals(actualCapital.getName(), expectedCapital.getName());
+ assertEquals(actualCapital.getState(), expectedCapital.getState());
+ }
+ }
+}
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/TestColumnComparator.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/TestColumnComparator.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/TestColumnComparator.java 2011-01-13 14:42:00 UTC (rev 20988)
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.ftest.richColumn;
+
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+
+import java.net.URL;
+
+import org.testng.annotations.Test;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+@Test
+public class TestColumnComparator extends AbstractColumnSortingTest {
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/richColumn/comparator.xhtml");
+ }
+}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/TestColumnSimple.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/TestColumnSimple.java 2011-01-13 14:40:51 UTC (rev 20987)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/TestColumnSimple.java 2011-01-13 14:42:00 UTC (rev 20988)
@@ -23,14 +23,12 @@
import static org.jboss.test.selenium.locator.Attribute.COLSPAN;
import static org.jboss.test.selenium.locator.Attribute.ROWSPAN;
-import static org.jboss.test.selenium.locator.LocatorFactory.jq;
import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
import static org.testng.Assert.assertEquals;
import java.net.URL;
import org.jboss.test.selenium.locator.JQueryLocator;
-import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -38,19 +36,8 @@
* @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
* @version $Revision$
*/
-public class TestColumnSimple extends AbstractMetamerTest {
+public class TestColumnSimple extends AbstractColumnModelTest {
- ColumnAttributes attributes = new ColumnAttributes();
-
- JQueryLocator table = pjq("table.rf-dt[id$=richDataTable]");
- JQueryLocator header = table.getChild(jq("thead.rf-dt-thd"));
-
- JQueryLocator headerRow = header.getChild(jq("tr.rf-dt-hdr"));
- JQueryLocator headerCell = jq("th.rf-dt-hdr-c");
-
- JQueryLocator bodyRow = table.getChild(jq("tbody.rf-dt-b")).getChild(jq("tr.rf-dt-r"));
- JQueryLocator bodyCell = jq("td.rf-dt-c");
-
@Override
public URL getTestUrl() {
return buildUrl(contextPath, "faces/components/richColumn/simple.xhtml");
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/TestColumnSorting.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/TestColumnSorting.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richColumn/TestColumnSorting.java 2011-01-13 14:42:00 UTC (rev 20988)
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.ftest.richColumn;
+
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+
+import java.net.URL;
+
+import org.testng.annotations.Test;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+@Test
+public class TestColumnSorting extends AbstractColumnSortingTest {
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/richColumn/sorting.xhtml");
+ }
+}
13 years, 11 months
JBoss Rich Faces SVN: r20987 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2011-01-13 09:40:51 -0500 (Thu, 13 Jan 2011)
New Revision: 20987
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractComponentAttributes.java
Log:
AbstractComponentAttributes able to switch between guarding of XHR and HTTP
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractComponentAttributes.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractComponentAttributes.java 2011-01-13 14:40:00 UTC (rev 20986)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractComponentAttributes.java 2011-01-13 14:40:51 UTC (rev 20987)
@@ -21,6 +21,10 @@
*******************************************************************************/
package org.richfaces.tests.metamer.ftest;
+import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guard;
+import static org.jboss.test.selenium.locator.reference.ReferencedLocator.referenceInferred;
+import static org.richfaces.tests.metamer.ftest.AbstractMetamerTest.pjq;
+
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.WordUtils;
import org.jboss.test.selenium.dom.Event;
@@ -29,15 +33,12 @@
import org.jboss.test.selenium.locator.Attribute;
import org.jboss.test.selenium.locator.AttributeLocator;
import org.jboss.test.selenium.locator.ElementLocator;
+import org.jboss.test.selenium.locator.ExtendedLocator;
import org.jboss.test.selenium.locator.JQueryLocator;
-import org.jboss.test.selenium.locator.ExtendedLocator;
import org.jboss.test.selenium.locator.reference.LocatorReference;
import org.jboss.test.selenium.locator.reference.ReferencedLocator;
+import org.jboss.test.selenium.request.RequestType;
-import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardHttp;
-import static org.richfaces.tests.metamer.ftest.AbstractMetamerTest.pjq;
-import static org.jboss.test.selenium.locator.reference.ReferencedLocator.referenceInferred;
-
/**
* @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
* @version $Revision$
@@ -49,6 +50,8 @@
pjq(""));
ReferencedLocator<JQueryLocator> propertyLocator = referenceInferred(root, "input[id*={0}Input]{1}");
+ RequestType requestType = RequestType.HTTP;
+
public AbstractComponentAttributes() {
}
@@ -94,20 +97,30 @@
locator = propertyLocator.format(propertyName, "[value="
+ ("".equals(valueAsString) ? "null" : valueAsString) + "]");
- if (selenium.isChecked(locator)) {
- guardHttp(selenium).fireEvent(locator, Event.CHANGE);
- } else {
- guardHttp(selenium).click(locator);
+ if (!selenium.isChecked(locator)) {
+ applyRadio(locator);
}
}
}
+ public void setRequestType(RequestType requestType) {
+ this.requestType = requestType;
+ }
+
+ public RequestType getRequestType() {
+ return requestType;
+ }
+
protected void applyText(ElementLocator<?> locator, String value) {
- guardHttp(selenium).type(locator, value);
+ guard(selenium, requestType, false).type(locator, value);
}
protected void applyCheckbox(ElementLocator<?> locator, boolean checked) {
selenium.check(locator, checked);
- guardHttp(selenium).fireEvent(locator, Event.CHANGE);
+ guard(selenium, requestType, false).fireEvent(locator, Event.CHANGE);
}
+
+ protected void applyRadio(ElementLocator<?> locator) {
+ guard(selenium, requestType, false).click(locator);
+ }
}
13 years, 11 months
JBoss Rich Faces SVN: r20986 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2011-01-13 09:40:00 -0500 (Thu, 13 Jan 2011)
New Revision: 20986
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/MatrixConfigurator.java
Log:
fixed MatrixConfigurator for taking the values of enumeration instead of providing that as array (lead into incompability of field and injected value)
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/MatrixConfigurator.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/MatrixConfigurator.java 2011-01-13 14:39:44 UTC (rev 20985)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/MatrixConfigurator.java 2011-01-13 14:40:00 UTC (rev 20986)
@@ -337,7 +337,7 @@
throw new IllegalArgumentException(parameterType + "have to be enumeration");
}
- result.addAll(Arrays.asList((Object) parameterType.getEnumConstants()));
+ result.addAll(Arrays.asList(parameterType.getEnumConstants()));
}
// tries satisfy parameter from fields
13 years, 11 months