Author: konstantin.mishin
Date: 2009-08-19 11:50:10 -0400 (Wed, 19 Aug 2009)
New Revision: 15223
Added:
root/examples/trunk/components/core-demo/src/main/webapp/log.xhtml
root/ui/trunk/components/core/src/main/java/org/richfaces/component/html/HtmlAjaxLog.java
root/ui/trunk/components/core/src/main/resources/META-INF/resources/
root/ui/trunk/components/core/src/main/resources/META-INF/resources/richfaces.css/
root/ui/trunk/components/core/src/main/resources/META-INF/resources/richfaces.css/4_0_0.css
Modified:
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIAjaxLog.java
root/ui/trunk/components/core/src/main/resources/META-INF/a4j.taglib.xml
root/ui/trunk/components/core/src/main/resources/META-INF/faces-config.xml
root/ui/trunk/components/core/src/main/templates/org/ajax4jsf/renderkit/html/log.template.xml
Log:
a4j:log initial integration into 4.0
Added: root/examples/trunk/components/core-demo/src/main/webapp/log.xhtml
===================================================================
--- root/examples/trunk/components/core-demo/src/main/webapp/log.xhtml
(rev 0)
+++ root/examples/trunk/components/core-demo/src/main/webapp/log.xhtml 2009-08-19 15:50:10
UTC (rev 15223)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:a4j="http://richfaces.org/a4j">
+<f:view>
+ <h:head>
+ <style>
+ <!--
+ .log{
+ background: gray;
+ }
+ -->
+ </style>
+ </h:head>
+ <h:body>
+ <input id="input" type="text" />
+ <select id="select" class="rich-log-element">
+ <option value="debug">debug</option>
+ <option value="info">info</option>
+ <option value="warn">warn</option>
+ <option value="error">error</option>
+ </select>
+ <input type="button" value="Log"
onclick="eval('RichFaces.log.' + jQuery('#select').val() +
'(\'' + jQuery('#input').val() + '\')')"/>
+ <a4j:log level="debug" style="border: solid red 1px"
styleClass="log"/>
+ </h:body>
+</f:view>
+</html>
\ No newline at end of file
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-19
15:09:57 UTC (rev 15222)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/component/UIAjaxLog.java 2009-08-19
15:50:10 UTC (rev 15223)
@@ -21,12 +21,19 @@
package org.richfaces.component;
+import javax.faces.application.ResourceDependencies;
+import javax.faces.application.ResourceDependency;
import javax.faces.component.UIComponentBase;
/**
* @author Nick Belaevski
*
*/
+@ResourceDependencies(value = {
+ @ResourceDependency(name = "jquery.js"),
+ @ResourceDependency(name = "richfaces.js"),
+ @ResourceDependency(name = "richfaces.css")
+ })
public class UIAjaxLog extends UIComponentBase {
public static final String COMPONENT_FAMILY = "org.richfaces.AjaxLog";
Added:
root/ui/trunk/components/core/src/main/java/org/richfaces/component/html/HtmlAjaxLog.java
===================================================================
---
root/ui/trunk/components/core/src/main/java/org/richfaces/component/html/HtmlAjaxLog.java
(rev 0)
+++
root/ui/trunk/components/core/src/main/java/org/richfaces/component/html/HtmlAjaxLog.java 2009-08-19
15:50:10 UTC (rev 15223)
@@ -0,0 +1,66 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.component.html;
+
+/**
+ * @author Konstantin Mishin
+ *
+ */
+
+import org.richfaces.component.UIAjaxLog;
+
+public class HtmlAjaxLog extends UIAjaxLog {
+
+ public final static String COMPONENT_TYPE = "org.richfaces.AjaxLog";
+
+ private static enum PropertyKeys {
+ style, level, styleClass
+ }
+
+ public HtmlAjaxLog(){
+ setRendererType("org.richfaces.AjaxLogRenderer");
+ }
+
+ public String getStyle() {
+ return (String) getStateHelper().eval(PropertyKeys.style, "");
+ }
+
+ public void setStyle(String style) {
+ getStateHelper().put(PropertyKeys.style, style);
+ }
+
+ public String getLevel() {
+ return (String) getStateHelper().eval(PropertyKeys.level, "");
+ }
+
+ public void setLevel(String level) {
+ getStateHelper().put(PropertyKeys.level, level);
+ }
+
+ public String getStyleClass() {
+ return (String) getStateHelper().eval(PropertyKeys.styleClass, "");
+ }
+
+ public void setStyleClass(String styleClass) {
+ getStateHelper().put(PropertyKeys.styleClass, styleClass);
+ }
+}
Modified: root/ui/trunk/components/core/src/main/resources/META-INF/a4j.taglib.xml
===================================================================
--- root/ui/trunk/components/core/src/main/resources/META-INF/a4j.taglib.xml 2009-08-19
15:09:57 UTC (rev 15222)
+++ root/ui/trunk/components/core/src/main/resources/META-INF/a4j.taglib.xml 2009-08-19
15:50:10 UTC (rev 15223)
@@ -33,5 +33,12 @@
<handler-class>org.richfaces.taglib.html.facelets.MediaOutputHandler</handler-class>
</component>
</tag>
+ <tag>
+ <tag-name>log</tag-name>
+ <component>
+ <component-type>org.richfaces.AjaxLog</component-type>
+ <renderer-type>org.richfaces.AjaxLogRenderer</renderer-type>
+ </component>
+ </tag>
</facelet-taglib>
Modified: root/ui/trunk/components/core/src/main/resources/META-INF/faces-config.xml
===================================================================
--- root/ui/trunk/components/core/src/main/resources/META-INF/faces-config.xml 2009-08-19
15:09:57 UTC (rev 15222)
+++ root/ui/trunk/components/core/src/main/resources/META-INF/faces-config.xml 2009-08-19
15:50:10 UTC (rev 15223)
@@ -29,6 +29,11 @@
<component-class>org.richfaces.component.html.HtmlOutputPanel</component-class>
</component>
+ <component>
+ <component-type>org.richfaces.AjaxLog</component-type>
+ <component-class>org.richfaces.component.html.HtmlAjaxLog</component-class>
+ </component>
+
<render-kit>
<render-kit-id>HTML_BASIC</render-kit-id>
<renderer>
@@ -51,5 +56,10 @@
<renderer-type>org.richfaces.OutputPanelRenderer</renderer-type>
<renderer-class>org.richfaces.renderkit.html.AjaxOutputPanelRenderer</renderer-class>
</renderer>
+ <renderer>
+ <component-family>org.richfaces.AjaxLog</component-family>
+ <renderer-type>org.richfaces.AjaxLogRenderer</renderer-type>
+ <renderer-class>org.richfaces.renderkit.html.AjaxLogRenderer</renderer-class>
+ </renderer>
</render-kit>
</faces-config>
\ No newline at end of file
Added:
root/ui/trunk/components/core/src/main/resources/META-INF/resources/richfaces.css/4_0_0.css
===================================================================
---
root/ui/trunk/components/core/src/main/resources/META-INF/resources/richfaces.css/4_0_0.css
(rev 0)
+++
root/ui/trunk/components/core/src/main/resources/META-INF/resources/richfaces.css/4_0_0.css 2009-08-19
15:50:10 UTC (rev 15223)
@@ -0,0 +1,5 @@
+.rich-log{
+ height: 300px;
+ overflow: auto;
+ width: 100%;
+}
Modified:
root/ui/trunk/components/core/src/main/templates/org/ajax4jsf/renderkit/html/log.template.xml
===================================================================
---
root/ui/trunk/components/core/src/main/templates/org/ajax4jsf/renderkit/html/log.template.xml 2009-08-19
15:09:57 UTC (rev 15222)
+++
root/ui/trunk/components/core/src/main/templates/org/ajax4jsf/renderkit/html/log.template.xml 2009-08-19
15:50:10 UTC (rev 15223)
@@ -2,11 +2,11 @@
<cdk:root
xmlns="http://richfaces.org/xhtml-el"
xmlns:cdk="http://richfaces.org/cdk"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- class="org.richfaces.renderkit.html.LogRenderer"
- superclass="org.richfaces.renderkit.AjaxComponentRendererBase"
+ class="org.richfaces.renderkit.html.AjaxLogRenderer"
+ superclass="javax.faces.render.Renderer"
componentclass="org.richfaces.component.UIAjaxLog">
- <!-- f:clientid var="clientId"/ -->
+ <!-- f:clientid var="clientId"/ >
<cdk:choose>
<cdk:when test="#{component.isPopup()}">
<script id="#{clientId}" type="text/javascript">
@@ -28,5 +28,11 @@
</script>
</div>
</cdk:otherwise>
- </cdk:choose>
+ </cdk:choose-->
+ <div id="richfaces.log" class="rich-log
#{component.attributes['styleClass']}"
+ cdk:passThroughWithExclusions="class">
+ <script type="text/javascript">
+ RichFaces.log.setLevel("#{component.attributes['level']}");
+ </script>
+ </div>
</cdk:root>