Author: nbelaevski
Date: 2010-12-27 15:07:13 -0500 (Mon, 27 Dec 2010)
New Revision: 20817
Added:
trunk/ui/core/api/src/main/java/org/richfaces/component/OutputPanelLayout.java
Modified:
trunk/ui/core/ui/src/main/java/org/richfaces/component/AbstractAjaxLog.java
trunk/ui/core/ui/src/main/java/org/richfaces/component/AbstractOutputPanel.java
trunk/ui/core/ui/src/main/java/org/richfaces/component/AbstractPoll.java
trunk/ui/core/ui/src/main/java/org/richfaces/renderkit/html/AjaxOutputPanelRenderer.java
trunk/ui/core/ui/src/main/java/org/richfaces/renderkit/html/AjaxPollRenderer.java
trunk/ui/core/ui/src/main/templates/org/ajax4jsf/renderkit/html/log.template.xml
Log:
https://issues.jboss.org/browse/RF-10092
Added: trunk/ui/core/api/src/main/java/org/richfaces/component/OutputPanelLayout.java
===================================================================
--- trunk/ui/core/api/src/main/java/org/richfaces/component/OutputPanelLayout.java
(rev 0)
+++
trunk/ui/core/api/src/main/java/org/richfaces/component/OutputPanelLayout.java 2010-12-27
20:07:13 UTC (rev 20817)
@@ -0,0 +1,34 @@
+/*
+ * 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.component;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public enum OutputPanelLayout {
+
+ inline, block;
+
+ public static final OutputPanelLayout DEFAULT = inline;
+
+}
Modified: trunk/ui/core/ui/src/main/java/org/richfaces/component/AbstractAjaxLog.java
===================================================================
--- trunk/ui/core/ui/src/main/java/org/richfaces/component/AbstractAjaxLog.java 2010-12-27
19:31:03 UTC (rev 20816)
+++ trunk/ui/core/ui/src/main/java/org/richfaces/component/AbstractAjaxLog.java 2010-12-27
20:07:13 UTC (rev 20817)
@@ -52,16 +52,16 @@
public static final String COMPONENT_FAMILY = "org.richfaces.AjaxLog";
- @Attribute(defaultValue = "")
+ @Attribute
public abstract String getStyle();
- @Attribute(defaultValue = "")
+ @Attribute
public abstract String getLevel();
- @Attribute(defaultValue = "")
+ @Attribute
public abstract String getStyleClass();
- @Attribute(defaultValue = "LogMode.DEFAULT")
+ @Attribute
public abstract LogMode getMode();
// public abstract String getHotkey();
Modified: trunk/ui/core/ui/src/main/java/org/richfaces/component/AbstractOutputPanel.java
===================================================================
---
trunk/ui/core/ui/src/main/java/org/richfaces/component/AbstractOutputPanel.java 2010-12-27
19:31:03 UTC (rev 20816)
+++
trunk/ui/core/ui/src/main/java/org/richfaces/component/AbstractOutputPanel.java 2010-12-27
20:07:13 UTC (rev 20817)
@@ -51,8 +51,8 @@
@Attribute
public abstract boolean isKeepTransient();
- @Attribute(defaultValue = "inline")
- public abstract String getLayout();
+ @Attribute
+ public abstract OutputPanelLayout getLayout();
@Attribute(events = @EventName("click"))
public abstract String getOnclick();
Modified: trunk/ui/core/ui/src/main/java/org/richfaces/component/AbstractPoll.java
===================================================================
--- trunk/ui/core/ui/src/main/java/org/richfaces/component/AbstractPoll.java 2010-12-27
19:31:03 UTC (rev 20816)
+++ trunk/ui/core/ui/src/main/java/org/richfaces/component/AbstractPoll.java 2010-12-27
20:07:13 UTC (rev 20817)
@@ -61,7 +61,7 @@
public static final String ON_BEFOREDOMUPDATE = "onbeforedomupdate";
- @Attribute(defaultValue = "1000")
+ @Attribute
public abstract int getInterval();
@Attribute(defaultValue = "true")
Modified:
trunk/ui/core/ui/src/main/java/org/richfaces/renderkit/html/AjaxOutputPanelRenderer.java
===================================================================
---
trunk/ui/core/ui/src/main/java/org/richfaces/renderkit/html/AjaxOutputPanelRenderer.java 2010-12-27
19:31:03 UTC (rev 20816)
+++
trunk/ui/core/ui/src/main/java/org/richfaces/renderkit/html/AjaxOutputPanelRenderer.java 2010-12-27
20:07:13 UTC (rev 20817)
@@ -30,6 +30,7 @@
import org.richfaces.cdk.annotations.JsfRenderer;
import org.richfaces.component.AbstractOutputPanel;
+import org.richfaces.component.OutputPanelLayout;
import org.richfaces.renderkit.HtmlConstants;
import org.richfaces.renderkit.RendererBase;
@@ -44,7 +45,7 @@
private boolean hasNoneLayout(UIComponent component) {
//TODO - A1 won't support 'none' layout
- return false;
//"none".equals(component.getAttributes().get("layout"));
+ return false;
}
/* (non-Javadoc)
@@ -96,7 +97,7 @@
*/
private String getTag(AbstractOutputPanel panel) {
Object layout = panel.getAttributes().get("layout");
- return "block".equals(layout) ? HtmlConstants.DIV_ELEM :
HtmlConstants.SPAN_ELEM;
+ return OutputPanelLayout.block.equals(layout) ? HtmlConstants.DIV_ELEM :
HtmlConstants.SPAN_ELEM;
}
/* (non-Javadoc)
Modified:
trunk/ui/core/ui/src/main/java/org/richfaces/renderkit/html/AjaxPollRenderer.java
===================================================================
---
trunk/ui/core/ui/src/main/java/org/richfaces/renderkit/html/AjaxPollRenderer.java 2010-12-27
19:31:03 UTC (rev 20816)
+++
trunk/ui/core/ui/src/main/java/org/richfaces/renderkit/html/AjaxPollRenderer.java 2010-12-27
20:07:13 UTC (rev 20817)
@@ -38,6 +38,7 @@
import org.richfaces.cdk.annotations.JsfRenderer;
import org.richfaces.component.AbstractPoll;
import org.richfaces.renderkit.HtmlConstants;
+import org.richfaces.renderkit.RenderKitUtils;
import org.richfaces.renderkit.RendererBase;
import org.richfaces.renderkit.util.HandlersChain;
@@ -89,9 +90,9 @@
if (poll.isEnabled()) {
JSFunction function = new JSFunction(AJAX_POLL_FUNCTION);
Map<String, Object> options = new HashMap<String, Object>();
- Integer interval = new Integer(poll.getInterval());
- options.put("pollinterval", interval);
- options.put("pollId", component.getClientId(context));
+
+ RenderKitUtils.addToScriptHash(options, "interval",
poll.getInterval(), "1000");
+ RenderKitUtils.addToScriptHash(options, "pollId",
component.getClientId(context));
HandlersChain handlersChain = new HandlersChain(context, poll);
handlersChain.addInlineHandlerFromAttribute(AbstractPoll.ON_TIMER);
handlersChain.addBehaviors(AbstractPoll.TIMER);
Modified:
trunk/ui/core/ui/src/main/templates/org/ajax4jsf/renderkit/html/log.template.xml
===================================================================
---
trunk/ui/core/ui/src/main/templates/org/ajax4jsf/renderkit/html/log.template.xml 2010-12-27
19:31:03 UTC (rev 20816)
+++
trunk/ui/core/ui/src/main/templates/org/ajax4jsf/renderkit/html/log.template.xml 2010-12-27
20:07:13 UTC (rev 20817)
@@ -9,17 +9,19 @@
<cdk:superclass>org.richfaces.renderkit.LogRendererBase</cdk:superclass>
<cdk:component-family>org.richfaces.AjaxLog</cdk:component-family>
<cdk:renderer-type>org.richfaces.AjaxLogRenderer</cdk:renderer-type>
+
+ <cdk:import package="org.richfaces.component"
names="LogMode" />
</cc:interface>
<cc:implementation>
- <div id="richfaces.log" class="rf-log
#{isInline(component.attributes['mode']) ? 'rf-log-inline' :
'rf-log-popup rf-log-popup-cnt'}
#{component.attributes['styleClass']}">
+ <div id="richfaces.log" class="#{concatClasses('rf-log',
isInline(component.attributes['mode']) ? 'rf-log-inline' :
'rf-log-popup rf-log-popup-cnt',
component.attributes['styleClass'])}">
+ <cdk:scriptObject name="options">
+ <cdk:scriptOption attributes="level hotkey" />
+ <cdk:scriptOption attributes="mode"
defaultValue="LogMode.DEFAULT" />
+ <!-- TODO: pass styleClass in -->
+ </cdk:scriptObject>
<script type="text/javascript">
- new RichFaces.HtmlLog({
- level: "#{component.attributes['level']}",
- hotkey: "#{component.attributes['hotkey']}",
- mode: "#{component.attributes['mode']}"
- /* TODO: pass styleClass in */
- });
+ new RichFaces.HtmlLog(#{toScriptArgs(options)});
</script>
</div>
</cc:implementation>