Author: nbelaevski
Date: 2010-10-27 10:34:46 -0400 (Wed, 27 Oct 2010)
New Revision: 19686
Removed:
branches/RF-7817/ui/core/ui/src/main/java/org/richfaces/component/QueuePreRenderViewListener.java
branches/RF-7817/ui/core/ui/src/main/resources/META-INF/queue-prender-listener.faces-config.xml
Modified:
branches/RF-7817/ui/core/api/pom.xml
branches/RF-7817/ui/core/ui/pom.xml
branches/RF-7817/ui/core/ui/src/main/java/org/ajax4jsf/component/behavior/ClientBehavior.java
branches/RF-7817/ui/core/ui/src/main/java/org/richfaces/component/AbstractPoll.java
branches/RF-7817/ui/core/ui/src/main/java/org/richfaces/component/QueueRegistry.java
branches/RF-7817/ui/core/ui/src/main/java/org/richfaces/renderkit/html/AjaxPollRenderer.java
branches/RF-7817/ui/core/ui/src/main/java/org/richfaces/renderkit/html/AjaxPushRenderer.java
branches/RF-7817/ui/core/ui/src/main/java/org/richfaces/renderkit/html/AjaxStatusRenderer.java
branches/RF-7817/ui/core/ui/src/main/java/org/richfaces/renderkit/html/QueueRendererBase.java
branches/RF-7817/ui/core/ui/src/main/java/org/richfaces/renderkit/html/QueueResourceComponentRenderer.java
branches/RF-7817/ui/core/ui/src/main/java/org/richfaces/view/facelets/html/BehaviorsTagHandlerDelegateFactoryImpl.java
Log:
Merged revisions
19156-19157,19159-19160,19176,19186-19187,19190,19194,19196,19199,19203-19204,19231-19234,19248-19249,19255-19256,19258-19262,19276,19279-19281,19283,19285,19291-19299,19307,19312,19315,19318-19319,19325,19341-19342,19345-19351,19353-19355,19358-19359,19364,19367-19369,19371,19374-19377,19379-19385,19387,19393-19394,19400,19402-19404,19418-19422,19426,19430-19431,19434-19441,19443-19444,19446,19468,19470,19477,19491,19498-19499,19501,19504,19506-19507,19517-19519,19525,19542-19543,19548,19550,19555,19557,19560-19561,19565-19566,19571-19573,19582-19585,19592-19593,19599,19601-19602,19613,19646,19657-19659,19665,19671-19674
via svnmerge from
https://svn.jboss.org/repos/richfaces/trunk
Modified: branches/RF-7817/ui/core/api/pom.xml
===================================================================
--- branches/RF-7817/ui/core/api/pom.xml 2010-10-27 14:33:43 UTC (rev 19685)
+++ branches/RF-7817/ui/core/api/pom.xml 2010-10-27 14:34:46 UTC (rev 19686)
@@ -30,6 +30,14 @@
<name>Richfaces UI Components: Core API</name>
<packaging>jar</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
<dependencies>
<!-- runtime -->
<dependency>
Modified: branches/RF-7817/ui/core/ui/pom.xml
===================================================================
--- branches/RF-7817/ui/core/ui/pom.xml 2010-10-27 14:33:43 UTC (rev 19685)
+++ branches/RF-7817/ui/core/ui/pom.xml 2010-10-27 14:34:46 UTC (rev 19686)
@@ -54,9 +54,12 @@
<groupId>org.richfaces.cdk</groupId>
<artifactId>maven-cdk-plugin</artifactId>
</plugin>
+ <plugin>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ </plugin>
</plugins>
</build>
-
+
<scm>
<
connection>scm:svn:http://anonsvn.jboss.org/repos/richfaces/trunk/ui/c...
</connection>
Modified:
branches/RF-7817/ui/core/ui/src/main/java/org/ajax4jsf/component/behavior/ClientBehavior.java
===================================================================
---
branches/RF-7817/ui/core/ui/src/main/java/org/ajax4jsf/component/behavior/ClientBehavior.java 2010-10-27
14:33:43 UTC (rev 19685)
+++
branches/RF-7817/ui/core/ui/src/main/java/org/ajax4jsf/component/behavior/ClientBehavior.java 2010-10-27
14:34:46 UTC (rev 19686)
@@ -138,7 +138,7 @@
if (stateObject.length == 3) {
getStateHelper().restoreState(context, stateObject[1]);
- restoreBindings(context, stateObject[2]);
+ this.bindings = restoreBindings(context, stateObject[2]);
clearInitialState();
}
@@ -167,7 +167,6 @@
// Utility for restoring bindings from state
private static Map<String, ValueExpression> restoreBindings(FacesContext
context, Object state) {
-
if (state == null) {
return (null);
}
@@ -175,7 +174,7 @@
Object[] values = (Object[]) state;
String[] names = (String[]) values[0];
Object[] states = (Object[]) values[1];
- Map<String, ValueExpression> bindings = new HashMap<String,
ValueExpression>(names.length);
+ Map<String, ValueExpression> bindings = new HashMap<String,
ValueExpression>();
for (int i = 0; i < names.length; i++) {
bindings.put(names[i], (ValueExpression)
UIComponentBase.restoreAttachedState(context, states[i]));
}
Modified:
branches/RF-7817/ui/core/ui/src/main/java/org/richfaces/component/AbstractPoll.java
===================================================================
---
branches/RF-7817/ui/core/ui/src/main/java/org/richfaces/component/AbstractPoll.java 2010-10-27
14:33:43 UTC (rev 19685)
+++
branches/RF-7817/ui/core/ui/src/main/java/org/richfaces/component/AbstractPoll.java 2010-10-27
14:34:46 UTC (rev 19686)
@@ -47,7 +47,19 @@
public static final String TIMER = "timer";
public static final String ON_TIMER = "ontimer";
+
+ public static final String BEGIN = "begin";
+ public static final String ON_BEGIN = "onbegin";
+
+ public static final String COMPLETE = "complete";
+
+ public static final String ON_COMPLETE = "oncomplete";
+
+ public static final String BEFOREDOMUPDATE = "beforedomupdate";
+
+ public static final String ON_BEFOREDOMUPDATE = "onbeforedomupdate";
+
@Attribute(defaultValue = "1000")
public abstract int getInterval();
Deleted:
branches/RF-7817/ui/core/ui/src/main/java/org/richfaces/component/QueuePreRenderViewListener.java
===================================================================
---
branches/RF-7817/ui/core/ui/src/main/java/org/richfaces/component/QueuePreRenderViewListener.java 2010-10-27
14:33:43 UTC (rev 19685)
+++
branches/RF-7817/ui/core/ui/src/main/java/org/richfaces/component/QueuePreRenderViewListener.java 2010-10-27
14:34:46 UTC (rev 19686)
@@ -1,68 +0,0 @@
-/*
- * 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;
-
-import static
org.richfaces.application.configuration.ConfigurationServiceHelper.getBooleanConfigurationValue;
-
-import javax.faces.application.Application;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIOutput;
-import javax.faces.component.UIViewRoot;
-import javax.faces.context.FacesContext;
-import javax.faces.event.AbortProcessingException;
-import javax.faces.event.SystemEvent;
-import javax.faces.event.SystemEventListener;
-
-import org.richfaces.application.CommonComponentsConfiguration;
-
-/**
- * @author Nick Belaevski
- *
- */
-public class QueuePreRenderViewListener implements SystemEventListener {
-
- private static final String QUEUE_RESOURCE_COMPONENT_RENDERER_TYPE =
"org.richfaces.QueueResourceComponentRenderer";
-
- public boolean isListenerForSource(Object source) {
- return true;
- }
-
- public void processEvent(SystemEvent event) throws AbortProcessingException {
- FacesContext context = FacesContext.getCurrentInstance();
- UIViewRoot viewRoot = context.getViewRoot();
-
- boolean queueEnabled = getBooleanConfigurationValue(context,
CommonComponentsConfiguration.Items.queueEnabled);
- if (queueEnabled) {
- Application application = context.getApplication();
- UIComponent queueResourceComponent = application.createComponent(context,
- UIOutput.COMPONENT_TYPE, QUEUE_RESOURCE_COMPONENT_RENDERER_TYPE);
-
- //fix for JSF duplicate ID exception
- queueResourceComponent.setId(QueueRegistry.QUEUE_SCRIPT_ID);
-
- viewRoot.addComponentResource(context, queueResourceComponent);
- } else {
- //queue can be switched off at application level, not a page level, so no
need to remove it if it is switched off
- }
- }
-
-}
Modified:
branches/RF-7817/ui/core/ui/src/main/java/org/richfaces/component/QueueRegistry.java
===================================================================
---
branches/RF-7817/ui/core/ui/src/main/java/org/richfaces/component/QueueRegistry.java 2010-10-27
14:33:43 UTC (rev 19685)
+++
branches/RF-7817/ui/core/ui/src/main/java/org/richfaces/component/QueueRegistry.java 2010-10-27
14:34:46 UTC (rev 19686)
@@ -81,6 +81,14 @@
}
public boolean hasQueuesToEncode() {
- return !queuesData.isEmpty();
+ if (queuesData.isEmpty()) {
+ return false;
+ }
+ for (Map.Entry<String, UIComponent> queue : queuesData.entrySet()) {
+ if (queue.getValue().isRendered()) {
+ return true;
+ }
+ }
+ return false;
}
}
\ No newline at end of file
Modified:
branches/RF-7817/ui/core/ui/src/main/java/org/richfaces/renderkit/html/AjaxPollRenderer.java
===================================================================
---
branches/RF-7817/ui/core/ui/src/main/java/org/richfaces/renderkit/html/AjaxPollRenderer.java 2010-10-27
14:33:43 UTC (rev 19685)
+++
branches/RF-7817/ui/core/ui/src/main/java/org/richfaces/renderkit/html/AjaxPollRenderer.java 2010-10-27
14:34:46 UTC (rev 19686)
@@ -95,6 +95,12 @@
HandlersChain handlersChain = new HandlersChain(context, poll);
handlersChain.addInlineHandlerFromAttribute(AbstractPoll.ON_TIMER);
handlersChain.addBehaviors(AbstractPoll.TIMER);
+ handlersChain.addInlineHandlerFromAttribute(AbstractPoll.ON_BEGIN);
+ handlersChain.addBehaviors(AbstractPoll.BEGIN);
+ handlersChain.addInlineHandlerFromAttribute(AbstractPoll.ON_COMPLETE);
+ handlersChain.addBehaviors(AbstractPoll.COMPLETE);
+
handlersChain.addInlineHandlerFromAttribute(AbstractPoll.ON_BEFOREDOMUPDATE);
+ handlersChain.addBehaviors(AbstractPoll.BEFOREDOMUPDATE);
handlersChain.addAjaxSubmitFunction();
String handler = handlersChain.toScript();
Modified:
branches/RF-7817/ui/core/ui/src/main/java/org/richfaces/renderkit/html/AjaxPushRenderer.java
===================================================================
---
branches/RF-7817/ui/core/ui/src/main/java/org/richfaces/renderkit/html/AjaxPushRenderer.java 2010-10-27
14:33:43 UTC (rev 19685)
+++
branches/RF-7817/ui/core/ui/src/main/java/org/richfaces/renderkit/html/AjaxPushRenderer.java 2010-10-27
14:34:46 UTC (rev 19686)
@@ -21,6 +21,8 @@
package org.richfaces.renderkit.html;
+import static org.richfaces.renderkit.RenderKitUtils.shouldRenderAttribute;
+
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
@@ -89,7 +91,7 @@
Map<String, Object> options = new HashMap<String, Object>();
int interval = push.getInterval();
- if (!getUtils().shouldRenderAttribute(interval)) {
+ if (shouldRenderAttribute(interval)) {
String intervalInitParameter =
context.getExternalContext().getInitParameter(PUSH_INTERVAL_PARAMETER);
if (null != intervalInitParameter) {
interval = Integer.parseInt(intervalInitParameter);
Modified:
branches/RF-7817/ui/core/ui/src/main/java/org/richfaces/renderkit/html/AjaxStatusRenderer.java
===================================================================
---
branches/RF-7817/ui/core/ui/src/main/java/org/richfaces/renderkit/html/AjaxStatusRenderer.java 2010-10-27
14:33:43 UTC (rev 19685)
+++
branches/RF-7817/ui/core/ui/src/main/java/org/richfaces/renderkit/html/AjaxStatusRenderer.java 2010-10-27
14:34:46 UTC (rev 19686)
@@ -21,6 +21,9 @@
package org.richfaces.renderkit.html;
+import static org.richfaces.renderkit.RenderKitUtils.addToScriptHash;
+import static org.richfaces.renderkit.RenderKitUtils.renderAttribute;
+
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
@@ -35,10 +38,9 @@
import org.richfaces.component.AbstractAjaxStatus;
import org.richfaces.component.util.HtmlUtil;
import org.richfaces.renderkit.HtmlConstants;
+import org.richfaces.renderkit.RenderKitUtils.ScriptHashVariableWrapper;
import org.richfaces.renderkit.RendererBase;
import org.richfaces.renderkit.util.HandlersChain;
-import org.richfaces.renderkit.util.RendererUtils;
-import org.richfaces.renderkit.util.RendererUtils.ScriptHashVariableWrapper;
/**
* @author Nick Belaevski
@@ -128,8 +130,6 @@
}
}
- private RendererUtils rendererUtils = RendererUtils.getInstance();
-
protected void encodeState(FacesContext facesContext, AbstractAjaxStatus status,
StatusState state) throws IOException {
@@ -150,14 +150,13 @@
String stateStyle = (String)
statusAttributes.get(state.getStyleAttributeName());
- rendererUtils.writeAttribute(writer, HtmlConstants.STYLE_ATTRIBUTE,
- HtmlUtil.concatStyles(stateStyle,
- state.isInitial() ? null : "display:none")
+ renderAttribute(facesContext, HtmlConstants.STYLE_ATTRIBUTE,
+ HtmlUtil.concatStyles(stateStyle, state.isInitial() ? null :
"display:none")
);
String stateStyleClass = (String)
statusAttributes.get(state.getStyleClassAttributeName());
- rendererUtils.writeAttribute(writer, HtmlConstants.CLASS_ATTRIBUTE,
+ renderAttribute(facesContext, HtmlConstants.CLASS_ATTRIBUTE,
HtmlUtil.concatClasses(state.getDefaultStyleClass(),
stateStyleClass));
@@ -201,12 +200,12 @@
HandlersChain handlersChain = new HandlersChain(context, component, true);
handlersChain.addInlineHandlerFromAttribute(eventAttribute);
handlersChain.addBehaviors(eventName);
- rendererUtils.addToScriptHash(options, eventAttribute,
+ addToScriptHash(options, eventAttribute,
handlersChain.toScript(), null,
- ScriptHashVariableWrapper.EVENT_HANDLER);
+ ScriptHashVariableWrapper.eventHandler);
}
- rendererUtils.addToScriptHash(options, "statusName",
attributes.get("name"));
+ addToScriptHash(options, "statusName",
attributes.get("name"));
if (!options.isEmpty()) {
statusConstructor.addParameter(options);
Modified:
branches/RF-7817/ui/core/ui/src/main/java/org/richfaces/renderkit/html/QueueRendererBase.java
===================================================================
---
branches/RF-7817/ui/core/ui/src/main/java/org/richfaces/renderkit/html/QueueRendererBase.java 2010-10-27
14:33:43 UTC (rev 19685)
+++
branches/RF-7817/ui/core/ui/src/main/java/org/richfaces/renderkit/html/QueueRendererBase.java 2010-10-27
14:34:46 UTC (rev 19686)
@@ -23,8 +23,12 @@
import static
org.richfaces.application.configuration.ConfigurationServiceHelper.getBooleanConfigurationValue;
+import java.util.List;
+
+import javax.faces.application.Application;
import javax.faces.application.ResourceDependency;
import javax.faces.component.UIComponent;
+import javax.faces.component.UIOutput;
import javax.faces.context.FacesContext;
import javax.faces.event.AbortProcessingException;
import javax.faces.event.ComponentSystemEvent;
@@ -55,6 +59,28 @@
protected static final String NAME_ATTRIBBUTE = "name";
protected static final Logger LOGGER = RichfacesLogger.COMPONENTS.getLogger();
+ private static final String QUEUE_RESOURCE_COMPONENT_RENDERER_TYPE =
"org.richfaces.QueueResourceComponentRenderer";
+ private static final String QUEUE_RESOURCE_COMPONENT_TARGET = "head";
+
+ private void addQueueResourceComponent(FacesContext context) {
+ List<UIComponent> resources =
context.getViewRoot().getComponentResources(context, QUEUE_RESOURCE_COMPONENT_TARGET);
+
+ for (UIComponent resource: resources) {
+ if
(QUEUE_RESOURCE_COMPONENT_RENDERER_TYPE.equals(resource.getRendererType())) {
+ return;
+ }
+ }
+
+ Application application = context.getApplication();
+ UIComponent queueResourceComponent = application.createComponent(context,
+ UIOutput.COMPONENT_TYPE, QUEUE_RESOURCE_COMPONENT_RENDERER_TYPE);
+
+ //fix for JSF duplicate ID exception
+ queueResourceComponent.setId(QueueRegistry.QUEUE_SCRIPT_ID);
+
+ context.getViewRoot().addComponentResource(context, queueResourceComponent,
QUEUE_RESOURCE_COMPONENT_TARGET);
+ }
+
public void processEvent(ComponentSystemEvent event) throws AbortProcessingException
{
FacesContext context = FacesContext.getCurrentInstance();
@@ -63,12 +89,12 @@
}
UIComponent comp = event.getComponent();
-
String queueName = getQueueName(context, comp);
QueueRegistry queueRegistry = QueueRegistry.getInstance(context);
if (event instanceof PostAddToViewEvent) {
queueRegistry.addQueue(queueName, comp);
+ addQueueResourceComponent(context);
} else if (event instanceof PreRemoveFromViewEvent) {
queueRegistry.removeQueue(queueName);
}
Modified:
branches/RF-7817/ui/core/ui/src/main/java/org/richfaces/renderkit/html/QueueResourceComponentRenderer.java
===================================================================
---
branches/RF-7817/ui/core/ui/src/main/java/org/richfaces/renderkit/html/QueueResourceComponentRenderer.java 2010-10-27
14:33:43 UTC (rev 19685)
+++
branches/RF-7817/ui/core/ui/src/main/java/org/richfaces/renderkit/html/QueueResourceComponentRenderer.java 2010-10-27
14:34:46 UTC (rev 19686)
@@ -22,6 +22,7 @@
package org.richfaces.renderkit.html;
import static
org.richfaces.application.configuration.ConfigurationServiceHelper.getBooleanConfigurationValue;
+import static org.richfaces.renderkit.RenderKitUtils.addToScriptHash;
import java.io.IOException;
import java.util.LinkedHashMap;
@@ -40,7 +41,6 @@
import org.richfaces.cdk.annotations.JsfRenderer;
import org.richfaces.component.QueueRegistry;
import org.richfaces.renderkit.HtmlConstants;
-import org.richfaces.renderkit.util.RendererUtils;
/**
* @author Nick Belaevski
@@ -52,8 +52,6 @@
private static final String FUNCTION_NAME =
"RichFaces.queue.setQueueOptions";
- private final RendererUtils utils = RendererUtils.getInstance();
-
private enum QueueOptions {
onbeforedomupdate, oncomplete, onerror, onevent, onrequestdequeue,
onrequestqueue, onsubmit,
requestDelay, timeout, status, queueId, ignoreDupResponses, requestGroupingId
@@ -65,7 +63,7 @@
for (QueueOptions option : QueueOptions.values()) {
String optionName = option.name();
Object value = attributes.get(optionName);
- utils.addToScriptHash(optionsHash, optionName, value);
+ addToScriptHash(optionsHash, optionName, value);
}
}
@@ -93,6 +91,9 @@
boolean isFirst = true;
Map<String, UIComponent> registeredQueues =
registry.getRegisteredQueues();
for (Entry<String, UIComponent> queueEntry :
registeredQueues.entrySet()) {
+ if (!queueEntry.getValue().isRendered()) {
+ break;
+ }
if (isFirst) {
isFirst = false;
} else {
Modified:
branches/RF-7817/ui/core/ui/src/main/java/org/richfaces/view/facelets/html/BehaviorsTagHandlerDelegateFactoryImpl.java
===================================================================
---
branches/RF-7817/ui/core/ui/src/main/java/org/richfaces/view/facelets/html/BehaviorsTagHandlerDelegateFactoryImpl.java 2010-10-27
14:33:43 UTC (rev 19685)
+++
branches/RF-7817/ui/core/ui/src/main/java/org/richfaces/view/facelets/html/BehaviorsTagHandlerDelegateFactoryImpl.java 2010-10-27
14:34:46 UTC (rev 19686)
@@ -59,8 +59,8 @@
if (isMyFaces) {
//TODO - RF M3 workaround for
https://jira.jboss.org/browse/RF-9025 /
https://issues.apache.org/jira/browse/MYFACES-2888
- LOGGER.warn("MyFaces implementation of JavaServer Faces detected.
" +
- "Wrapping of components using RichFaces behaviors (a4j:ajax etc.)
won't work!");
+ LOGGER.warn("MyFaces implementation of JavaServer Faces detected.
"
+ + "Wrapping of components using RichFaces behaviors (a4j:ajax
etc.) won't work!");
}
} else {
LOGGER.warn("Cannot detect Mojarra vs MyFaces implementation of
JavaServer Faces");
Deleted:
branches/RF-7817/ui/core/ui/src/main/resources/META-INF/queue-prender-listener.faces-config.xml
===================================================================
---
branches/RF-7817/ui/core/ui/src/main/resources/META-INF/queue-prender-listener.faces-config.xml 2010-10-27
14:33:43 UTC (rev 19685)
+++
branches/RF-7817/ui/core/ui/src/main/resources/META-INF/queue-prender-listener.faces-config.xml 2010-10-27
14:34:46 UTC (rev 19686)
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<faces-config
xmlns="http://java.sun.com/xml/ns/javaee"
- version="2.0">
-
- <application>
- <system-event-listener>
- <system-event-listener-class>org.richfaces.component.QueuePreRenderViewListener</system-event-listener-class>
- <system-event-class>javax.faces.event.PreRenderViewEvent</system-event-class>
- </system-event-listener>
- </application>
-</faces-config>
\ No newline at end of file