Author: nbelaevski
Date: 2009-08-21 14:15:57 -0400 (Fri, 21 Aug 2009)
New Revision: 15265
Added:
root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces-jsf-log.js/
root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces-jsf-log.js/4_0_0.js
Modified:
root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces.js/4_0_0.js
root/framework/trunk/impl/src/test/resources/javascript/4_0_0.html
root/pom.xml
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/facelets/tag/AjaxHandler.java
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIAjaxLog.java
Log:
Fixed failing unit tests
Compilation errors fixed
Added:
root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces-jsf-log.js/4_0_0.js
===================================================================
---
root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces-jsf-log.js/4_0_0.js
(rev 0)
+++
root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces-jsf-log.js/4_0_0.js 2009-08-21
18:15:57 UTC (rev 15265)
@@ -0,0 +1,94 @@
+(function(jQuery, richfaces, jsf) {
+
+ //JSF log adapter
+ var identifyElement = function(elt) {
+ var identifier = '<' + elt.tagName.toLowerCase();
+ var e = jQuery(elt);
+ if (e.attr('id')) {
+ identifier += (' id=' + e.attr('id'));
+ }
+ if (e.attr('class')) {
+ identifier += (' class=' + e.attr('class'));
+ }
+
+ identifier += ' ...>';
+
+ return identifier;
+ }
+
+ var formatPartialResponseElement = function(logElement, responseElement) {
+ var change = jQuery(responseElement);
+
+ logElement.append("Element <b>" + responseElement.nodeName +
"</b>");
+ if (change.attr("id")) {
+ logElement.append(document.createTextNode(" for id=" +
change.attr("id")));
+ }
+
+ jQuery(document.createElement("br")).appendTo(logElement);
+ jQuery("<span
style='color:dimgray'></span>").appendTo(logElement).text(change.toXML());
+ jQuery(document.createElement("br")).appendTo(logElement);
+ }
+
+ var formatPartialResponse = function(partialResponse) {
+ var logElement = jQuery(document.createElement("span"));
+
+ partialResponse.children().each(function() {
+ var responseElement = jQuery(this);
+ if (responseElement.is('changes')) {
+ logElement.append("Listing content of response <b>changes</b>
element:<br />");
+ responseElement.children().each(function() {
+ formatPartialResponseElement(logElement, this);
+ });
+ } else {
+ formatPartialResponseElement(logElement, this);
+ }
+ });
+
+ return logElement;
+ }
+
+ var jsfAjaxLogAdapter = function(data) {
+ try {
+ var log = richfaces.log;
+
+ var source = data.source;
+ var status = data.status;
+ var type = data.type;
+
+ var responseCode = data.responseCode;
+ var responseXML = data.responseXML;
+ var responseText = data.responseText;
+
+ if (type == 'event') {
+ log.info("Received '" + status + "' event from " +
identifyElement(source));
+
+ if (status == 'complete') {
+ var partialResponse;
+
+ if (responseXML) {
+ partialResponse = jQuery(responseXML).children("partial-response");
+ }
+
+ var responseTextEntry = jQuery("<span>Server returned responseText:
</span><span
style='color:dimgray'></span>").eq(1).text(responseText).end();
+
+ if (partialResponse && partialResponse.length) {
+ log.debug(responseTextEntry);
+ log.info(formatPartialResponse(partialResponse));
+ } else {
+ log.info(responseTextEntry);
+ }
+ }
+ } else if (type == 'error') {
+ log.error("Received '" + status + "' error event from " +
identifyElement(source));
+ log.error("[" + data.responseCode + "] " + data.errorName +
": " + data.errorMessage);
+ }
+ } catch (e) {
+ //ignore logging errors
+ }
+ };
+
+ jsf.ajax.addOnEvent(jsfAjaxLogAdapter);
+ jsf.ajax.addOnError(jsfAjaxLogAdapter);
+ //
+}(jQuery, RichFaces, jsf));
+
Modified:
root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces.js/4_0_0.js
===================================================================
---
root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces.js/4_0_0.js 2009-08-21
17:55:58 UTC (rev 15264)
+++
root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces.js/4_0_0.js 2009-08-21
18:15:57 UTC (rev 15265)
@@ -91,13 +91,13 @@
if (!consoleInitialized) {
consoleInitialized = true;
- var clearBtn = console.find("button.rich-log-element");
+ var clearBtn = console.children("button.rich-log-element");
if (clearBtn.length == 0) {
clearBtn = jQuery("<button
class='rich-log-element'>Clear</button>").appendTo(console);
}
clearBtn.click(clear);
- var levelSelect = console.find("select.rich-log-element");
+ var levelSelect = console.children("select.rich-log-element");
if (levelSelect.length == 0) {
levelSelect = jQuery("<select class='rich-log-element'
/>").appendTo(console);
}
@@ -111,7 +111,7 @@
levelSelect.val(currentLogLevel);
levelSelect.change(function(event) { clear();
setLevelFromSelect(parseInt(jQuery(this).val(), 10)); return false;});
- var consoleEntries = console.find(".rich-log-contents");
+ var consoleEntries = console.children(".rich-log-contents");
if (consoleEntries.length == 0) {
consoleEntries = jQuery("<div
class='rich-log-contents'></div>").appendTo(console);
}
@@ -180,97 +180,6 @@
return methods;
}(jQuery));
- //JSF log adapter
- var identifyElement = function(elt) {
- var identifier = '<' + elt.tagName.toLowerCase();
- var e = jQuery(elt);
- if (e.attr('id')) {
- identifier += (' id=' + e.attr('id'));
- }
- if (e.attr('class')) {
- identifier += (' class=' + e.attr('class'));
- }
-
- identifier += ' ...>';
-
- return identifier;
- }
-
- var formatPartialResponseElement = function(logElement, responseElement) {
- var change = jQuery(responseElement);
-
- logElement.append("Element <b>" + responseElement.nodeName +
"</b>");
- if (change.attr("id")) {
- logElement.append(document.createTextNode(" for id=" +
change.attr("id")));
- }
-
- jQuery(document.createElement("br")).appendTo(logElement);
- jQuery("<span
style='color:dimgray'></span>").appendTo(logElement).text(change.toXML());
- jQuery(document.createElement("br")).appendTo(logElement);
- }
-
- var formatPartialResponse = function(partialResponse) {
- var logElement = jQuery(document.createElement("span"));
-
- partialResponse.children().each(function() {
- var responseElement = jQuery(this);
- if (responseElement.is('changes')) {
- logElement.append("Listing content of response <b>changes</b>
element:<br />");
- responseElement.children().each(function() {
- formatPartialResponseElement(logElement, this);
- });
- } else {
- formatPartialResponseElement(logElement, this);
- }
- });
-
- return logElement;
- }
-
- var jsfAjaxLogAdapter = function(data) {
- try {
- var log = richfaces.log;
-
- var source = data.source;
- var status = data.status;
- var type = data.type;
-
- var responseCode = data.responseCode;
- var responseXML = data.responseXML;
- var responseText = data.responseText;
-
- if (type == 'event') {
- log.info("Received '" + status + "' event from " +
identifyElement(source));
-
- if (status == 'complete') {
- var partialResponse;
-
- if (responseXML) {
- partialResponse = jQuery(responseXML).children("partial-response");
- }
-
- var responseTextEntry = jQuery("<span>Server returned responseText:
</span><span
style='color:dimgray'></span>").eq(1).text(responseText).end();
-
- if (partialResponse && partialResponse.length) {
- log.debug(responseTextEntry);
- log.info(formatPartialResponse(partialResponse));
- } else {
- log.info(responseTextEntry);
- }
- }
- } else if (type == 'error') {
- log.error("Received '" + status + "' error event from " +
identifyElement(source));
- log.error("[" + data.responseCode + "] " + data.errorName +
": " + data.errorMessage);
- }
- } catch (e) {
- //ignore logging errors
- }
- };
-
- jsf.ajax.addOnEvent(jsfAjaxLogAdapter);
- jsf.ajax.addOnError(jsfAjaxLogAdapter);
- //
-
/**
* Evaluates chained properties for the "base" object.
* For example, window.document.location is equivalent to
Modified: root/framework/trunk/impl/src/test/resources/javascript/4_0_0.html
===================================================================
--- root/framework/trunk/impl/src/test/resources/javascript/4_0_0.html 2009-08-21 17:55:58
UTC (rev 15264)
+++ root/framework/trunk/impl/src/test/resources/javascript/4_0_0.html 2009-08-21 18:15:57
UTC (rev 15265)
@@ -35,12 +35,11 @@
});
test("RichFaces.log test", function() {
- expect(8);
+ expect(7);
var log = jQuery("#richfaces\\.log");
- equals(log.size(), 0);
RichFaces.log.error("some error");
RichFaces.log.info("some info");
- log = jQuery("#richfaces\\.log");
+ log = jQuery("#richfaces\\.log .rich-log-contents");
equals(log.find("div").size(), 2);
equals(log.find("div:contains('some error')").size(), 1);
equals(log.find("div:contains('some info')").size(), 1);
@@ -97,6 +96,7 @@
expect(1);
var options = {
pushId : "pushId",
+ clientId: "pushElt",
interval : 700,
ondataavailable : function() {
ok(true, "Function 'ondataavailable' has been called");
@@ -125,12 +125,18 @@
expect(3);
var ajaxSource = "source";
var ajaxEvent = "event";
- var ajaxOptions = {};
+ var ajaxOptions = {parameters: {'param': 'value'}};
jsf.ajax = {
request : function(source, event, options) {
equals(source, ajaxSource);
equals(event, ajaxEvent);
- same(options, ajaxOptions);
+ same(options, {
+ 'execute': '@component',
+ 'render': '@component',
+ 'param': 'value',
+ 'RICHFACES_AJAX': 'source',
+ 'source': 'source'
+ });
}
}
RichFaces.ajax(ajaxSource, ajaxEvent, ajaxOptions);
@@ -144,6 +150,8 @@
<ol id="tests"></ol>
<div id="main">
<form />
+ <span id="pushElt" />
+ <div id="richfaces.log" />
</div>
</body>
</html>
Modified: root/pom.xml
===================================================================
--- root/pom.xml 2009-08-21 17:55:58 UTC (rev 15264)
+++ root/pom.xml 2009-08-21 18:15:57 UTC (rev 15265)
@@ -13,7 +13,7 @@
<modules>
<module>framework/${framework.svn.dir}</module>
- <module>cdk/${cdk.svn.dir}</module>
+ <!--module>cdk/${cdk.svn.dir}</module-->
<module>ui/${ui.svn.dir}</module>
<!--<module>ui-sandbox/${ui-sandbox.svn.dir}</module>-->
<module>examples/${examples.svn.dir}</module>
Modified:
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/facelets/tag/AjaxHandler.java
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/facelets/tag/AjaxHandler.java 2009-08-21
17:55:58 UTC (rev 15264)
+++
root/ui/trunk/components/core/src/main/java/org/ajax4jsf/facelets/tag/AjaxHandler.java 2009-08-21
18:15:57 UTC (rev 15265)
@@ -28,9 +28,7 @@
import org.ajax4jsf.component.behavior.AjaxBehavior;
-import com.sun.faces.facelets.tag.jsf.CompositeComponentTagHandler;
-
public class AjaxHandler extends TagHandler implements
BehaviorHolderAttachedObjectHandler {
private final TagAttribute event;
@@ -81,7 +79,8 @@
}
if (UIComponent.isCompositeComponent(parent)) {
-
+ throw new UnsupportedOperationException("This type of configuration is not
supported!");
+ /*
BeanInfo componentBeanInfo = (BeanInfo)
parent.getAttributes().get(UIComponent.BEANINFO_KEY);
if (null == componentBeanInfo) {
throw new TagException(tag, "Error: enclosing composite component does not have
BeanInfo attribute");
@@ -113,8 +112,7 @@
CompositeComponentTagHandler.getAttachedObjectHandlers(parent).add(this);
} else {
throw new TagException(tag, "Error: enclosing composite component does not
support event " + eventName);
- }
-
+ }*/
} else if (parent instanceof ClientBehaviorHolder) {
applyAttachedObject(ctx, parent, eventName);
} else {
Modified:
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIAjaxLog.java
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIAjaxLog.java 2009-08-21
17:55:58 UTC (rev 15264)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIAjaxLog.java 2009-08-21
18:15:57 UTC (rev 15265)
@@ -32,6 +32,7 @@
@ResourceDependencies(value = {
@ResourceDependency(name = "jquery.js"),
@ResourceDependency(name = "richfaces.js"),
+ @ResourceDependency(name = "richfaces-jsf-log.js"),
@ResourceDependency(name = "richfaces.css")
})
public class UIAjaxLog extends UIComponentBase {