Author: pyaschenko
Date: 2010-12-17 10:59:45 -0500 (Fri, 17 Dec 2010)
New Revision: 20657
Modified:
branches/RF-7654/core/impl/src/main/resources/META-INF/resources/richfaces-event.js
branches/RF-7654/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/csv.js
branches/RF-7654/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/message.js
branches/RF-7654/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/richfaces-csv.js
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/MessageTestBase.java
Log:
http://jira.jboss.com/jira/browse/RF-9250
Modified:
branches/RF-7654/core/impl/src/main/resources/META-INF/resources/richfaces-event.js
===================================================================
---
branches/RF-7654/core/impl/src/main/resources/META-INF/resources/richfaces-event.js 2010-12-17
15:56:05 UTC (rev 20656)
+++
branches/RF-7654/core/impl/src/main/resources/META-INF/resources/richfaces-event.js 2010-12-17
15:59:45 UTC (rev 20657)
@@ -61,6 +61,8 @@
* @type string
* */
EVENT_NAMESPACE_SEPARATOR : ".",
+
+ MESSAGE_EVENT_TYPE: "onmessage",
/**
* Attach an event handler to execute when the DOM is fully loaded.
Modified:
branches/RF-7654/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/csv.js
===================================================================
---
branches/RF-7654/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/csv.js 2010-12-17
15:56:05 UTC (rev 20656)
+++
branches/RF-7654/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/csv.js 2010-12-17
15:59:45 UTC (rev 20657)
@@ -22,16 +22,15 @@
$.extend(rf.csv, {
RE_DIGITS: /^-?\d+$/,
RE_FLOAT: /^(-?\d+)?(\.(\d+)?(e[+-]?\d+)?)?$/,
- MESSAGE_EVENT_NAME: "onmessage",
// Messages API
getMessage :function(facesMessage,values){
return
{detail:_interpolateMessage(facesMessage.detail,values),summary:_interpolateMessage(facesMessage.summary,values)};
},
sendMessage: function (componentId, message) {
- rf.Event.fire(window.document, rf.csv.MESSAGE_EVENT_NAME,
{'componentId':componentId, 'message':message});
+ rf.Event.fire(window.document, rf.Event.MESSAGE_EVENT_TYPE,
{'sourceId':componentId, 'message':message});
},
clearMessage: function (componentId) {
- rf.Event.fire(window.document, rf.csv.MESSAGE_EVENT_NAME,
{'componentId':componentId, 'message':''});
+ rf.Event.fire(window.document, rf.Event.MESSAGE_EVENT_TYPE,
{'sourceId':componentId, 'message':''});
},
getValue: function (clientId, element){
var value;
@@ -95,66 +94,4 @@
}
});
- /*
- // component ids hash that can send messages
- // each hash item contains array of message component id that receive messages from the
component
- _componentIds = {};
- // array of message component id that will receive messages from all components
- _messageComponentIds = {};
-
- var messageDispatchers = {};
- var addDispatcher = function (dispatcherId) {
- };
- var removeDispatcher: function (dispatcherId) {
- };
-
- rf.MessageDispatcher = function(id) {
- this.id = id;
- };
- rf.BaseComponent.extend(rf.MessageDispatcher);
-
- $.extend(rf.MessageDispatcher.prototype, {
- register: function (messageComponentId, componentIds) {
- if (!componentIds || componentIds.length==0) {
- // global message listener
- _messageComponents.push(messageComponentId);
- }
- var messageComponents;
- for (var i=0;i<componentIds.length;i++) {
- messageComponents = _components[componentIds[i]];
- if (!messageComponents) {
- messageComponents = _components[componentIds[i]] = [];
- }
- messageComponents.push(messageComponentId);
- }
- },
- unregister: function (messageComponentId) {
- var messageComponents;
- for (var i=0;i<_components.length;i++) {
- messageComponents = _components[i];
- if (!messageComponents) {
- messageComponents = _components[componentIds[i]] = [];
- }
- messageComponents.push(messageComponentId);
- }
- },
- send: function (componentId, message) {
- var messageComponents = _components[componentId];
- if (messageComponents) {
- for (var i=0;i<messageComponents.length;i++) {
- rf.$(messageComponents[id]).update(message);
- }
- }
- }
- });
- */
-
- /*
- * message.constructor () {
- * rf.Event.bindById(componentId, "onMessage.RichFaces", onMessage );
- * rf.Event.bindById(document, "onMessage.RichFaces", onMessage );
- * }
- *
- */
-
})(jQuery, window.RichFaces || (window.RichFaces={}));
\ No newline at end of file
Modified:
branches/RF-7654/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/message.js
===================================================================
---
branches/RF-7654/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/message.js 2010-12-17
15:56:05 UTC (rev 20656)
+++
branches/RF-7654/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/message.js 2010-12-17
15:59:45 UTC (rev 20657)
@@ -52,18 +52,18 @@
var onMessage = function (event, element, data) {
if (!this.options.forComponentId) {
- var index = componentHash[data.componentId];
+ var index = componentHash[data.sourceId];
if (typeof index != undefined) {
$(rf.getDomElement(this.id+":Content"+index)).remove();
}
var content = content = $(rf.getDomElement(this.id+":Content"));
componentIndex ++;
- if (data.message) content.append('<li
id="'+this.id+":Content"+componentIndex+'">'+data.message+'</li>');
- componentHash[data.componentId] = componentIndex;
+ if (data.message) content.append('<li
id="'+this.id+":Content"+componentIndex+'">'+data.message.summary+'</li>');
+ componentHash[data.sourceId] = componentIndex;
- } else if (this.options.forComponentId==data.componentId) {
- rf.getDomElement(this.id+":Content").innerHTML = data.message ?
'<li>'+data.message+'</li>' : '';
+ } else if (this.options.forComponentId==data.sourceId) {
+ rf.getDomElement(this.id+":Content").innerHTML = data.message ?
'<li>'+data.message.summary+'</li>' : '';
}
}
Modified:
branches/RF-7654/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/richfaces-csv.js
===================================================================
---
branches/RF-7654/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/richfaces-csv.js 2010-12-17
15:56:05 UTC (rev 20656)
+++
branches/RF-7654/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/richfaces-csv.js 2010-12-17
15:59:45 UTC (rev 20657)
@@ -11,7 +11,6 @@
$.extend(rf.csv, {
RE_DIGITS: /^-?\d+$/,
RE_FLOAT: /^(-?\d+)?(\.(\d+)?(e[+-]?\d+)?)?$/,
- MESSAGE_EVENT_NAME: "onmessage."+rf.Event.RICH_NAMESPACE,
// Messages API
addMessage: function (messagesObject) {
$.extend(_messages, messagesObject);
@@ -30,8 +29,7 @@
return {message:message};
},
sendMessage: function (componentId, message) {
- rf.Event.fireById(document, MESSAGE_EVENT_NAME, message);
- rf.Event.fireById(componentId, MESSAGE_EVENT_NAME, message);
+ rf.Event.fire(window.document, rf.Event.MESSAGE_EVENT_TYPE,
{'sourceId':componentId, 'message':message});
},
// Converters API
addConverter: function (converterFunctions) {
@@ -87,66 +85,4 @@
}
});
- /*
- // component ids hash that can send messages
- // each hash item contains array of message component id that receive messages from the
component
- _componentIds = {};
- // array of message component id that will receive messages from all components
- _messageComponentIds = {};
-
- var messageDispatchers = {};
- var addDispatcher = function (dispatcherId) {
- };
- var removeDispatcher: function (dispatcherId) {
- };
-
- rf.MessageDispatcher = function(id) {
- this.id = id;
- };
- rf.BaseComponent.extend(rf.MessageDispatcher);
-
- $.extend(rf.MessageDispatcher.prototype, {
- register: function (messageComponentId, componentIds) {
- if (!componentIds || componentIds.length==0) {
- // global message listener
- _messageComponents.push(messageComponentId);
- }
- var messageComponents;
- for (var i=0;i<componentIds.length;i++) {
- messageComponents = _components[componentIds[i]];
- if (!messageComponents) {
- messageComponents = _components[componentIds[i]] = [];
- }
- messageComponents.push(messageComponentId);
- }
- },
- unregister: function (messageComponentId) {
- var messageComponents;
- for (var i=0;i<_components.length;i++) {
- messageComponents = _components[i];
- if (!messageComponents) {
- messageComponents = _components[componentIds[i]] = [];
- }
- messageComponents.push(messageComponentId);
- }
- },
- send: function (componentId, message) {
- var messageComponents = _components[componentId];
- if (messageComponents) {
- for (var i=0;i<messageComponents.length;i++) {
- rf.$(messageComponents[id]).update(message);
- }
- }
- }
- });
- */
-
- /*
- * message.constructor () {
- * rf.Event.bindById(componentId, "onMessage.RichFaces", onMessage );
- * rf.Event.bindById(document, "onMessage.RichFaces", onMessage );
- * }
- *
- */
-
})(jQuery, window.RichFaces || (window.RichFaces={}));
\ No newline at end of file
Modified:
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/MessageTestBase.java
===================================================================
---
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/MessageTestBase.java 2010-12-17
15:56:05 UTC (rev 20656)
+++
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/MessageTestBase.java 2010-12-17
15:59:45 UTC (rev 20657)
@@ -5,7 +5,6 @@
import org.ajax4jsf.javascript.JSFunction;
import org.jboss.test.qunit.Qunit;
import org.jboss.test.qunit.Qunit.Builder;
-import org.junit.Before;
import org.junit.Rule;
import org.richfaces.javascript.Message;