JBoss Rich Faces SVN: r20819 - in trunk/core: api/src/test/java/org/ajax4jsf/javascript and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-12-27 18:26:18 -0500 (Mon, 27 Dec 2010)
New Revision: 20819
Modified:
trunk/core/api/src/main/java/org/ajax4jsf/javascript/ScriptUtils.java
trunk/core/api/src/test/java/org/ajax4jsf/javascript/ScriptUtilsTest.java
trunk/core/impl/src/main/resources/META-INF/resources/richfaces.js
Log:
https://issues.jboss.org/browse/RF-10092
Modified: trunk/core/api/src/main/java/org/ajax4jsf/javascript/ScriptUtils.java
===================================================================
--- trunk/core/api/src/main/java/org/ajax4jsf/javascript/ScriptUtils.java 2010-12-27 20:30:58 UTC (rev 20818)
+++ trunk/core/api/src/main/java/org/ajax4jsf/javascript/ScriptUtils.java 2010-12-27 23:26:18 UTC (rev 20819)
@@ -154,6 +154,8 @@
// all other put as encoded strings.
appendEncodedString(appendable, obj);
+ } else if (obj instanceof Character) {
+ appendEncodedString(appendable, obj);
} else if (obj instanceof Enum<?>) {
// all other put as encoded strings.
Modified: trunk/core/api/src/test/java/org/ajax4jsf/javascript/ScriptUtilsTest.java
===================================================================
--- trunk/core/api/src/test/java/org/ajax4jsf/javascript/ScriptUtilsTest.java 2010-12-27 20:30:58 UTC (rev 20818)
+++ trunk/core/api/src/test/java/org/ajax4jsf/javascript/ScriptUtilsTest.java 2010-12-27 23:26:18 UTC (rev 20819)
@@ -287,6 +287,10 @@
assertEquals("\"TestEnum: B\"", ScriptUtils.toScript(TestEnum.B));
}
+ public void testCharacter() throws Exception {
+ assertEquals("\"N\"", ScriptUtils.toScript('N'));
+ }
+
private void assertCaptureEquals(Capture<? extends Object> capture, String expected) {
StringBuilder sb = new StringBuilder();
List<? extends Object> list = capture.getValues();
Modified: trunk/core/impl/src/main/resources/META-INF/resources/richfaces.js
===================================================================
--- trunk/core/impl/src/main/resources/META-INF/resources/richfaces.js 2010-12-27 20:30:58 UTC (rev 20818)
+++ trunk/core/impl/src/main/resources/META-INF/resources/richfaces.js 2010-12-27 23:26:18 UTC (rev 20819)
@@ -288,9 +288,9 @@
//
var pollTracker = {};
- richfaces.startPoll = function(options) {
+ richfaces.startPoll = function(options) {
var pollId = options.pollId;
- var interval = options.pollinterval;
+ var interval = options.interval || 1000;
var ontimer = options.ontimer;
richfaces.stopPoll(pollId);
14 years, 1 month
JBoss Rich Faces SVN: r20818 - trunk/ui/input/ui/src/main/templates.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2010-12-27 15:30:58 -0500 (Mon, 27 Dec 2010)
New Revision: 20818
Modified:
trunk/ui/input/ui/src/main/templates/inputnumberspinner.template.xml
Log:
RF-9568
Modified: trunk/ui/input/ui/src/main/templates/inputnumberspinner.template.xml
===================================================================
--- trunk/ui/input/ui/src/main/templates/inputnumberspinner.template.xml 2010-12-27 20:07:13 UTC (rev 20817)
+++ trunk/ui/input/ui/src/main/templates/inputnumberspinner.template.xml 2010-12-27 20:30:58 UTC (rev 20818)
@@ -40,7 +40,7 @@
<span id="#{clientId}" class="rf-insp #{component.attributes['styleClass']}" cdk:passThroughWithExclusions="id class" >
<input name="#{clientId}" type="text"
class="rf-insp-inp #{component.attributes['inputClass']}" value="#{getInputValue(facesContext, component)}"
- cdk:passThrough="accesskey disabled maxlength onblur onfocus onclick:oninputclick ondblclick:ondblinputclick onkeydown:oninputkeydown
+ cdk:passThrough="accesskey disabled maxlength onblur onfocus onclick:oninputclick ondblclick:oninputdblclick onkeydown:oninputkeydown
onkeypress:oninputkeypress onkeyup:oninputkeyup onmousedown:oninputmousedown onmousemove:oninputmousemove onmouseout:oninputmouseout
onmouseover:oninputmouseover onmouseup:oninputmouseup onselect size:inputSize tabindex"
readonly="#{!component.attributes['enableManualInput']}" autocomplete="#{component.attributes['disableBrowserAutoComplete'] ? 'off' : ''}" />
14 years, 1 month
JBoss Rich Faces SVN: r20817 - in trunk/ui/core: ui/src/main/java/org/richfaces/component and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
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>
14 years, 1 month
JBoss Rich Faces SVN: r20816 - in trunk/ui/misc/ui/src/main: resources/META-INF/resources/org.richfaces and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-12-27 14:31:03 -0500 (Mon, 27 Dec 2010)
New Revision: 20816
Modified:
trunk/ui/misc/ui/src/main/java/org/richfaces/component/AbstractJQuery.java
trunk/ui/misc/ui/src/main/resources/META-INF/resources/org.richfaces/jquery.component.js
Log:
https://issues.jboss.org/browse/RF-10099
Modified: trunk/ui/misc/ui/src/main/java/org/richfaces/component/AbstractJQuery.java
===================================================================
--- trunk/ui/misc/ui/src/main/java/org/richfaces/component/AbstractJQuery.java 2010-12-27 19:16:45 UTC (rev 20815)
+++ trunk/ui/misc/ui/src/main/java/org/richfaces/component/AbstractJQuery.java 2010-12-27 19:31:03 UTC (rev 20816)
@@ -59,10 +59,10 @@
@Attribute
public abstract String getQuery();
- @Attribute(defaultValue = "JQueryAttachType.DEFAULT")
+ @Attribute
public abstract JQueryAttachType getAttachType();
- @Attribute(defaultValue = "JQueryTiming.DEFAULT")
+ @Attribute
public abstract JQueryTiming getTiming();
}
Modified: trunk/ui/misc/ui/src/main/resources/META-INF/resources/org.richfaces/jquery.component.js
===================================================================
--- trunk/ui/misc/ui/src/main/resources/META-INF/resources/org.richfaces/jquery.component.js 2010-12-27 19:16:45 UTC (rev 20815)
+++ trunk/ui/misc/ui/src/main/resources/META-INF/resources/org.richfaces/jquery.component.js 2010-12-27 19:31:03 UTC (rev 20816)
@@ -60,10 +60,10 @@
};
var query = function(options) {
- if (options.timing == 'domready') {
+ if (options.timing == 'immediate') {
+ createQueryFunction(options).call(this);
+ } else {
jquery(document).ready(createQueryFunction(options));
- } else {
- createQueryFunction(options).call(this);
}
};
14 years, 1 month
JBoss Rich Faces SVN: r20815 - in trunk: core/api/src/main/java/org/richfaces/context and 11 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-12-27 14:16:45 -0500 (Mon, 27 Dec 2010)
New Revision: 20815
Added:
trunk/core/api/src/main/java/org/richfaces/context/ExtendedPartialViewContext.java
trunk/core/impl/src/main/java/org/richfaces/context/ExtendedPartialViewContextFactoryImpl.java
trunk/core/impl/src/main/java/org/richfaces/context/ExtendedPartialViewContextImpl.java
Removed:
trunk/core/api/src/main/java/org/ajax4jsf/context/AjaxContext.java
trunk/core/api/src/main/java/org/ajax4jsf/context/package-info.java
trunk/core/impl/src/main/java/org/ajax4jsf/context/AjaxContextImpl.java
trunk/core/impl/src/main/java/org/richfaces/context/PartialViewContextFactoryImpl.java
trunk/core/impl/src/main/java/org/richfaces/context/PartialViewContextImpl.java
trunk/ui/validator/ui/src/main/java/org/richfaces/component/UIBeanValidator.java
Modified:
trunk/core/api/src/main/java/org/richfaces/renderkit/util/CoreAjaxRendererUtils.java
trunk/core/impl/src/main/resources/META-INF/components.faces-config.xml
trunk/core/impl/src/main/resources/META-INF/faces-config.xml
trunk/examples/input-demo/src/main/webapp/resources/tests/autocomplete-qunit.js
trunk/ui/common/ui/src/main/java/org/richfaces/renderkit/util/AjaxRendererUtils.java
trunk/ui/core/ui/src/main/java/org/richfaces/renderkit/html/AjaxOutputPanelRenderer.java
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteRendererBase.java
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeEncoderBase.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeRendererBase.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarBaseRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TooltipRenderer.java
trunk/ui/validator/ui/src/main/java/org/richfaces/component/UIAjaxValidator.java
Log:
https://issues.jboss.org/browse/RF-10091
Fixed wrong detection of one-arg method in 'autocompleteMethod' attribute
Updated autocomplete-qunit.js
Deleted: trunk/core/api/src/main/java/org/ajax4jsf/context/AjaxContext.java
===================================================================
--- trunk/core/api/src/main/java/org/ajax4jsf/context/AjaxContext.java 2010-12-27 18:59:46 UTC (rev 20814)
+++ trunk/core/api/src/main/java/org/ajax4jsf/context/AjaxContext.java 2010-12-27 19:16:45 UTC (rev 20815)
@@ -1,223 +0,0 @@
-/**
- * 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.ajax4jsf.context;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import javax.faces.FacesException;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.resource.util.URLToStreamHelper;
-
-public abstract class AjaxContext {
-
- /**
- * Key for keep request state information in request-scope attributes.
- */
- public static final String AJAX_CONTEXT_KEY = "ajaxContext";
- static final String SERVICE_RESOURCE = "META-INF/services/" + AjaxContext.class.getName();
- private static final String DEFAULT_CONTEXT_CLASS = "org.ajax4jsf.context.AjaxContextImpl";
- private static Map<ClassLoader, Class<? extends AjaxContext>> ajaxContextClasses =
- new HashMap<ClassLoader, Class<? extends AjaxContext>>();
- private boolean limitRender;
-
- protected AjaxContext() { }
-
- public abstract Map<String, Object> getCommonAjaxParameters();
-
- public abstract String getAjaxActionURL(FacesContext context);
-
- public abstract void setResponseData(Object responseData);
-
- public abstract Object getResponseData();
-
- public abstract void setOncomplete(Object oncompleteFunction);
-
- public abstract void appendOncomplete(Object oncompleteFunction);
-
- public abstract Object getOncomplete();
-
- public abstract void setOnbeforedomupdate(Object onbeforedomupdateFunction);
-
- public abstract Object getOnbeforedomupdate();
-
- public abstract boolean removeRenderedArea(String id);
-
- public abstract void addRenderedArea(String id);
-
- public abstract Set<String> getAjaxRenderedAreas();
-
- public abstract void addRegionsFromComponent(UIComponent component);
-
- /**
- * @param component
- * @since 3.3.0
- */
- public abstract void addAreasToProcessFromComponent(FacesContext context, UIComponent component);
-
- public abstract Set<String> getAjaxAreasToRender();
-
- public abstract Set<String> getAjaxAreasToProcess();
-
- public boolean isAjaxRequest(FacesContext facesContext) {
- return isAjaxRequest();
- }
-
- public abstract boolean isAjaxRequest();
-
- public abstract void encodeAjaxEnd(FacesContext context) throws IOException;
-
- public abstract void encodeAjaxBegin(FacesContext context) throws IOException;
-
- public abstract void renderAjax(FacesContext context);
-
- public abstract void release();
-
- public abstract Map<String, Object> getResponseComponentDataMap();
-
- public abstract void setAjaxRequest(boolean b);
-
- public abstract boolean isSelfRender();
-
- public abstract void setSelfRender(boolean b);
-
- public abstract String getSubmittedRegionClientId();
-
- public abstract void saveViewState(FacesContext context) throws IOException;
-
- public abstract void setAjaxSingleClientId(String ajaxSingleClientId);
-
- public abstract String getAjaxSingleClientId();
-
- public abstract void setAjaxAreasToProcess(Set<String> ajaxAreasToProcess);
-
- public abstract void setSubmittedRegionClientId(String submittedClientId);
-
- public boolean isLimitRender() {
- return limitRender;
- }
-
- public void setLimitRender(boolean limitRender) {
- this.limitRender = limitRender;
- }
-
- /**
- * Get instance of current AJAX Context. Instance get by
- * variable {@link AjaxContext#AJAX_CONTEXT_KEY}
- *
- * @return memento instance for current request
- */
- public static AjaxContext getCurrentInstance() {
- FacesContext context = FacesContext.getCurrentInstance();
-
- return getCurrentInstance(context);
- }
-
- /**
- * Get instance of current AJAX Context. Instance get by
- * variable {@link AjaxContext#AJAX_CONTEXT_KEY}
- *
- * @param context
- * current FacesContext
- * @return instance of AjaxContext.
- */
- public static AjaxContext getCurrentInstance(FacesContext context) {
- if (null == context) {
- throw new NullPointerException("FacesContext is null");
- }
-
- Map<String, Object> requestMap = context.getExternalContext().getRequestMap();
- AjaxContext ajaxContext = (AjaxContext) requestMap.get(AJAX_CONTEXT_KEY);
-
- if (null == ajaxContext) {
- ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
-
- if (null == contextClassLoader) {
- contextClassLoader = AjaxContext.class.getClassLoader();
- }
-
- Class<? extends AjaxContext> clazz;
-
- synchronized (ajaxContextClasses) {
- clazz = ajaxContextClasses.get(contextClassLoader);
-
- if (null == clazz) {
- String factoryClassName = DEFAULT_CONTEXT_CLASS;
-
- // Pluggable factories.
- InputStream input = null; // loader.getResourceAsStream(SERVICE_RESOURCE);
-
- input = URLToStreamHelper.urlToStreamSafe(contextClassLoader.getResource(SERVICE_RESOURCE));
-
- // have services file.
- if (input != null) {
- try {
- BufferedReader reader = new BufferedReader(new InputStreamReader(input));
-
- factoryClassName = reader.readLine();
- } catch (Exception e) {
- throw new FacesException("Error to create AjaxContext Instance", e);
- } finally {
- try {
- input.close();
- } catch (IOException e) {
-
- // Ignore
- }
- }
- }
-
- try {
- clazz = Class.forName(factoryClassName, false,
- contextClassLoader).asSubclass(AjaxContext.class);
- } catch (ClassNotFoundException e) {
- throw new FacesException("AjaxContext implementation class " + factoryClassName
- + " not found ", e);
- }
-
- ajaxContextClasses.put(contextClassLoader, clazz);
- }
- }
-
- try {
- ajaxContext = clazz.newInstance();
- } catch (InstantiationException e) {
- throw new FacesException("Error to create AjaxContext Instance", e);
- } catch (IllegalAccessException e) {
- throw new FacesException("No access to AjaxContext constructor", e);
- }
-
- requestMap.put(AJAX_CONTEXT_KEY, ajaxContext);
- }
-
- return ajaxContext;
- }
-}
Deleted: trunk/core/api/src/main/java/org/ajax4jsf/context/package-info.java
===================================================================
--- trunk/core/api/src/main/java/org/ajax4jsf/context/package-info.java 2010-12-27 18:59:46 UTC (rev 20814)
+++ trunk/core/api/src/main/java/org/ajax4jsf/context/package-info.java 2010-12-27 19:16:45 UTC (rev 20815)
@@ -1,5 +0,0 @@
-
-/**
- * Classes and interfaces that defines contextual request information
- */
-package org.ajax4jsf.context;
Added: trunk/core/api/src/main/java/org/richfaces/context/ExtendedPartialViewContext.java
===================================================================
--- trunk/core/api/src/main/java/org/richfaces/context/ExtendedPartialViewContext.java (rev 0)
+++ trunk/core/api/src/main/java/org/richfaces/context/ExtendedPartialViewContext.java 2010-12-27 19:16:45 UTC (rev 20815)
@@ -0,0 +1,117 @@
+/*
+ * 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.context;
+
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+import javax.faces.context.PartialViewContext;
+
+import com.google.common.collect.Maps;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public abstract class ExtendedPartialViewContext extends PartialViewContext {
+
+ private static final String ATTRIBUTE_NAME = ExtendedPartialViewContext.class.getName();
+
+ private FacesContext facesContext;
+
+ private boolean limitRender = false;
+
+ private Object responseData = null;
+
+ private Map<String, Object> responseComponentDataMap = Maps.newHashMap();
+
+ private StringBuilder beforedomupdateHandler = new StringBuilder();
+
+ private StringBuilder completeHandler = new StringBuilder();
+
+ public ExtendedPartialViewContext(FacesContext facesContext) {
+ this.facesContext = facesContext;
+
+ setInstance(facesContext, this);
+ }
+
+ protected FacesContext getFacesContext() {
+ return facesContext;
+ }
+
+ private static void setInstance(FacesContext facesContext, ExtendedPartialViewContext instance) {
+ facesContext.getAttributes().put(ATTRIBUTE_NAME, instance);
+ }
+
+ public static ExtendedPartialViewContext getInstance(FacesContext facesContext) {
+ return (ExtendedPartialViewContext) facesContext.getAttributes().get(ATTRIBUTE_NAME);
+ }
+
+ @Override
+ public void release() {
+ setInstance(facesContext, null);
+ facesContext = null;
+ }
+
+ public Object getResponseData() {
+ return responseData;
+ }
+
+ public void setResponseData(Object responseData) {
+ this.responseData = responseData;
+ }
+
+ public void appendOncomplete(Object handler) {
+ if (handler != null) {
+ completeHandler.append(handler.toString());
+ completeHandler.append(';');
+ }
+ }
+
+ public Object getOncomplete() {
+ return completeHandler.toString();
+ }
+
+ public void appendOnbeforedomupdate(Object handler) {
+ if (handler != null) {
+ beforedomupdateHandler.append(handler.toString());
+ beforedomupdateHandler.append(';');
+ }
+ }
+
+ public Object getOnbeforedomupdate() {
+ return beforedomupdateHandler.toString();
+ }
+
+ public Map<String, Object> getResponseComponentDataMap() {
+ return responseComponentDataMap;
+ }
+
+ public boolean isLimitRender() {
+ return limitRender;
+ }
+
+ public void setLimitRender(boolean limitRender) {
+ this.limitRender = limitRender;
+ }
+
+}
Modified: trunk/core/api/src/main/java/org/richfaces/renderkit/util/CoreAjaxRendererUtils.java
===================================================================
--- trunk/core/api/src/main/java/org/richfaces/renderkit/util/CoreAjaxRendererUtils.java 2010-12-27 18:59:46 UTC (rev 20814)
+++ trunk/core/api/src/main/java/org/richfaces/renderkit/util/CoreAjaxRendererUtils.java 2010-12-27 19:16:45 UTC (rev 20815)
@@ -34,8 +34,8 @@
import javax.faces.context.FacesContext;
import javax.faces.context.PartialResponseWriter;
-import org.ajax4jsf.context.AjaxContext;
import org.richfaces.application.ServiceTracker;
+import org.richfaces.context.ExtendedPartialViewContext;
import org.richfaces.renderkit.AjaxDataSerializer;
import org.richfaces.renderkit.HtmlConstants;
@@ -109,14 +109,14 @@
}
public static void renderAjaxExtensions(FacesContext facesContext, UIComponent component) throws IOException {
- AjaxContext ajaxContext = AjaxContext.getCurrentInstance(facesContext);
+ ExtendedPartialViewContext partialContext = ExtendedPartialViewContext.getInstance(facesContext);
Map<String, String> attributes = Collections.singletonMap(HtmlConstants.ID_ATTRIBUTE,
facesContext.getExternalContext().encodeNamespace(EXTENSION_ID));
PartialResponseWriter writer = facesContext.getPartialViewContext().getPartialResponseWriter();
boolean[] writingState = new boolean[]{false};
- Object onbeforedomupdate = ajaxContext.getOnbeforedomupdate();
+ Object onbeforedomupdate = partialContext.getOnbeforedomupdate();
if (onbeforedomupdate != null) {
String string = onbeforedomupdate.toString();
if (string.length() != 0) {
@@ -127,7 +127,7 @@
}
}
- Object oncomplete = ajaxContext.getOncomplete();
+ Object oncomplete = partialContext.getOncomplete();
if (oncomplete != null) {
String string = oncomplete.toString();
if (string.length() != 0) {
@@ -138,7 +138,7 @@
}
}
- Object responseData = ajaxContext.getResponseData();
+ Object responseData = partialContext.getResponseData();
if (responseData != null) {
startExtensionElementIfNecessary(writer, attributes, writingState);
writer.startElement(DATA_ELEMENT_NAME, component);
@@ -149,7 +149,7 @@
writer.endElement(DATA_ELEMENT_NAME);
}
- Map<String, Object> responseComponentDataMap = ajaxContext.getResponseComponentDataMap();
+ Map<String, Object> responseComponentDataMap = partialContext.getResponseComponentDataMap();
if (responseComponentDataMap != null && !responseComponentDataMap.isEmpty()) {
startExtensionElementIfNecessary(writer, attributes, writingState);
writer.startElement(COMPONENT_DATA_ELEMENT_NAME, component);
Deleted: trunk/core/impl/src/main/java/org/ajax4jsf/context/AjaxContextImpl.java
===================================================================
--- trunk/core/impl/src/main/java/org/ajax4jsf/context/AjaxContextImpl.java 2010-12-27 18:59:46 UTC (rev 20814)
+++ trunk/core/impl/src/main/java/org/ajax4jsf/context/AjaxContextImpl.java 2010-12-27 19:16:45 UTC (rev 20815)
@@ -1,520 +0,0 @@
-/**
- * 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.ajax4jsf.context;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.lang.reflect.Method;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedHashSet;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Set;
-
-import javax.faces.FacesException;
-import javax.faces.FactoryFinder;
-import javax.faces.application.StateManager;
-import javax.faces.application.ViewHandler;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIViewRoot;
-import javax.faces.context.ExternalContext;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-import javax.faces.render.RenderKit;
-import javax.faces.render.RenderKitFactory;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-
-import org.ajax4jsf.Messages;
-import org.richfaces.log.Logger;
-import org.richfaces.log.RichfacesLogger;
-import org.richfaces.renderkit.HtmlConstants;
-import org.richfaces.renderkit.util.CoreAjaxRendererUtils;
-import org.richfaces.renderkit.util.CoreRendererUtils;
-
-/**
- * This class incapsulated
- *
- * @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.7 $ $Date: 2007/02/08 19:07:16 $
- */
-public class AjaxContextImpl extends AjaxContext {
- public static final String SERVLET_ERROR_EXCEPTION_ATTRIBUTE = "javax.servlet.error.exception";
-
- //TODO remove this
- private static final String SERIALIZED_STATE_KEY = "org.ajax4jsf.view.serializedstate";
-
- private static final Logger LOG = RichfacesLogger.CONTEXT.getLogger();
- Set<String> ajaxAreasToProcess = null;
- Set<String> ajaxAreasToRender = new LinkedHashSet<String>();
- Set<String> ajaxRenderedAreas = new LinkedHashSet<String>();
- boolean ajaxRequest = false;
- String ajaxSingleClientId = null;
- Object oncomplete = null;
- Object onbeforedomupdate = null;
- boolean selfRender = false;
- String submittedRegionClientId = null;
- Integer viewSequence = new Integer(1);
- Map<String, Object> responseComponentDataMap = new HashMap<String, Object>();
- Map<String, Object> commonAjaxParameters = new HashMap<String, Object>();
- Object responseData = null;
-
- public void release() {
- ajaxAreasToRender = new LinkedHashSet<String>();
- ajaxAreasToProcess = null;
- ajaxRenderedAreas = new LinkedHashSet<String>();
- ajaxRequest = false;
- selfRender = false;
- viewSequence = new Integer(1);
- submittedRegionClientId = null;
- responseComponentDataMap = new HashMap<String, Object>();
- commonAjaxParameters = new HashMap<String, Object>();
- responseData = null;
- }
-
- /**
- * @param context
- * @throws javax.faces.event.AbortProcessingException
- *
- */
- public void renderAjax(FacesContext context) throws FacesException {
- if (LOG.isDebugEnabled()) {
- LOG.debug(Messages.getMessage(Messages.RENDER_AJAX_REQUEST, getSubmittedRegionClientId()));
- }
-
- try {
-
- // Just in case...
- setSelfRender(true);
- setAjaxRequest(true);
-
- // create response writer.
- ExternalContext extContext = context.getExternalContext();
- RenderKit renderKit = context.getRenderKit();
- String encoding;
-
- // Depends if we talk about servlets, portlets, ...
- if (extContext.getRequest() instanceof ServletRequest) {
- ServletRequest request = (ServletRequest) extContext.getRequest();
- ServletResponse response = (ServletResponse) extContext.getResponse();
-
- // Setup encoding and content type
- String contentType = "text/xml";
-
- // get the encoding - must be setup by faces context or filter.
- encoding = request.getCharacterEncoding();
-
- if (encoding == null) {
- encoding = "UTF-8";
- }
-
- response.setContentType(contentType + ";charset=" + encoding);
- } else {
- encoding = "UTF-8";
- }
-
- PrintWriter servletWriter;
-
- servletWriter = getWriter(extContext);
-
- ResponseWriter writer = renderKit.createResponseWriter(servletWriter, null, encoding);
-
- context.setResponseWriter(writer);
-
- // make response
- writer.startDocument();
- encodeAjaxBegin(context);
- context.getViewRoot().encodeAll(context);
- saveViewState(context);
- encodeAjaxEnd(context);
- writer.endDocument();
- writer.flush();
- writer.close();
- servletWriter.close();
-
- // Save tree state.
- } catch (IOException e) {
- throw new FacesException(Messages.getMessage(Messages.RENDERING_AJAX_REGION_ERROR,
- getSubmittedRegionClientId()), e);
- } finally {
- context.responseComplete();
-
- // component.setRendererType(defaultRenderer);
- }
- }
-
- /**
- * Encode declaration for AJAX response. Render <html><body>
- *
- * @param context
- * @throws IOException
- */
- public void encodeAjaxBegin(FacesContext context) throws IOException {
- UIViewRoot viewRoot = context.getViewRoot();
-
- // AjaxContainer ajax = (AjaxContainer) component;
- ResponseWriter out = context.getResponseWriter();
-
- // DebugUtils.traceView("ViewRoot in AJAX Page encode begin");
- out.startElement(HtmlConstants.HTML_ELEMENT, viewRoot);
-
- Locale locale = viewRoot.getLocale();
-
- out.writeAttribute(HtmlConstants.LANG_ATTRIBUTE, locale.toString(), "lang");
- out.startElement(HtmlConstants.BODY_ELEMENT, viewRoot);
- }
-
- /**
- * End encoding of AJAX response. Render tag with included areas and close
- * </body></html>
- *
- * @param context
- * @throws IOException
- */
- public void encodeAjaxEnd(FacesContext context) throws IOException {
-
- // AjaxContainer ajax = (AjaxContainer) component;
- ResponseWriter out = context.getResponseWriter();
-
- // DebugUtils.traceView("ViewRoot in AJAX Page encode begin");
- out.endElement(HtmlConstants.BODY_ELEMENT);
- out.endElement(HtmlConstants.HTML_ELEMENT);
- }
-
- public void saveViewState(FacesContext context) throws IOException {
- ResponseWriter writer = context.getResponseWriter();
- StateManager stateManager = context.getApplication().getStateManager();
- Object serializedView = stateManager.saveView(context);
-
- if ((null != serializedView) && (null != writer)) {
- StringWriter bufWriter = new StringWriter();
- ResponseWriter tempWriter;
-
- tempWriter = writer.cloneWithWriter(bufWriter);
- context.setResponseWriter(tempWriter);
- stateManager.writeState(context, serializedView);
- tempWriter.flush();
-
- if (bufWriter.getBuffer().length() > 0) {
- context.getExternalContext().getRequestMap().put(SERIALIZED_STATE_KEY,
- bufWriter.toString());
- }
-
- context.setResponseWriter(writer);
- }
- }
-
- protected RenderKit getRenderKit(FacesContext context) {
- RenderKit renderKit = context.getRenderKit();
-
- if (null == renderKit) {
- String renderKitId = context.getApplication().getViewHandler().calculateRenderKitId(context);
- RenderKitFactory factory = (RenderKitFactory) FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY);
-
- renderKit = factory.getRenderKit(context, renderKitId);
- }
-
- return renderKit;
- }
-
- /**
- * @return Returns the ajaxRequest.
- */
- public boolean isAjaxRequest() {
- return ajaxRequest;
- }
-
- /**
- * @param ajaxRequest The ajaxRequest to set.
- */
- public void setAjaxRequest(boolean ajaxRequest) {
- this.ajaxRequest = ajaxRequest;
- }
-
- /**
- * @return Returns the ajaxAreasToRender.
- */
- public Set<String> getAjaxAreasToRender() {
- return this.ajaxAreasToRender;
- }
-
- /**
- * @return the ajaxAreasToProcess
- */
- @Override
- public Set<String> getAjaxAreasToProcess() {
- return ajaxAreasToProcess;
- }
-
- /**
- * @param ajaxAreasToProcess the ajaxAreasToProcess to set
- */
- @Override
- public void setAjaxAreasToProcess(Set<String> ajaxAreasToProcess) {
- this.ajaxAreasToProcess = ajaxAreasToProcess;
- }
-
- /**
- * Add affected regions's ID to ajaxView component.
- *
- * @param component
- */
- public void addRegionsFromComponent(UIComponent component) {
-
- // First step - find parent ajax view
- Set<String> ajaxRegions = CoreAjaxRendererUtils.getAjaxAreas(component);
-
- // if (ajaxRegions == null){
- // FacesContext context = FacesContext.getCurrentInstance();
- // ajaxRegions = AjaxRendererUtils.getAbsoluteId(context,component);
- // }
- if (LOG.isDebugEnabled()) {
- LOG.debug(Messages.getMessage(Messages.INVOKE_AJAX_REGION_LISTENER, component.getId()));
- }
-
-
- if (ajaxRegions != null) {
- ajaxAreasToRender.addAll(CoreRendererUtils.INSTANCE.findComponentsFor(FacesContext.getCurrentInstance(), component, ajaxRegions));
- }
-
- // Is that component limit to list ?
- if (Boolean.TRUE.equals(component.getAttributes().get("limitRender"))) {
- setLimitRender(true);
- }
- }
-
- /**
- * Add IDs of regions to process
- *
- * @see org.ajax4jsf.context.AjaxContext#addAreasToProcessFromComponent(javax.faces.component.UIComponent)
- */
- @Override
- public void addAreasToProcessFromComponent(FacesContext context, UIComponent component) {
- Set<String> areasToProcess = CoreAjaxRendererUtils.getAjaxAreasToProcess(component);
-
- if (areasToProcess != null) {
- Collection<String> convertedAreaIds = CoreRendererUtils.INSTANCE.findComponentsFor(context, component, areasToProcess);
-
- if (this.ajaxAreasToProcess == null) {
- this.ajaxAreasToProcess = new HashSet<String>(convertedAreaIds);
- } else {
- this.ajaxAreasToProcess.addAll(convertedAreaIds);
- }
- }
- }
-
- /**
- * @return Returns the ajaxRenderedAreas.
- */
- public Set<String> getAjaxRenderedAreas() {
- return ajaxRenderedAreas;
- }
-
- public void addRenderedArea(String id) {
- ajaxRenderedAreas.add(id);
- }
-
- public boolean removeRenderedArea(String id) {
- return ajaxRenderedAreas.remove(id);
- }
-
- /**
- * @return Returns the submittedClientId.
- */
- public String getSubmittedRegionClientId() {
- return this.submittedRegionClientId;
- }
-
- /**
- * @param submittedClientId The submittedClientId to set.
- */
- @Override
- public void setSubmittedRegionClientId(String submittedClientId) {
- this.submittedRegionClientId = submittedClientId;
- }
-
- /**
- * @return the ajaxSingleClientId
- */
- @Override
- public String getAjaxSingleClientId() {
- return ajaxSingleClientId;
- }
-
- /**
- * @param ajaxSingleClientId the ajaxSingleClientId to set
- */
- @Override
- public void setAjaxSingleClientId(String ajaxSingleClientId) {
- this.ajaxSingleClientId = ajaxSingleClientId;
- }
-
- /**
- * @return Returns the selfRender.
- */
- public boolean isSelfRender() {
- return selfRender;
- }
-
- /**
- * @param selfRender The selfRender to set.
- */
- public void setSelfRender(boolean selfRender) {
- this.selfRender = selfRender;
- }
-
- /**
- * @return the responseData
- */
- public Object getResponseData() {
- return responseData;
- }
-
- /**
- * @param responseData the responseData to set
- */
- public void setResponseData(Object responseData) {
- this.responseData = responseData;
- }
-
- /**
- * @return the responseDataMap
- */
- public Map<String, Object> getResponseComponentDataMap() {
- return responseComponentDataMap;
- }
-
- /**
- * Gives back the writer of a Response object.
- *
- * @param extContext The external context.
- * @return The writer of the response.
- * @throws FacesException If the response object has no getWriter() method.
- */
- protected PrintWriter getWriter(ExternalContext extContext) throws FacesException {
- PrintWriter writer = null;
- Object response = extContext.getResponse();
-
- try {
- Method gW = response.getClass().getMethod("getWriter", new Class[0]);
-
- writer = (PrintWriter) gW.invoke(response, new Object[0]);
- } catch (Exception e) {
- throw new FacesException(e);
- }
-
- return writer;
- }
-
- public String getAjaxActionURL(FacesContext context) {
-
- // Check arguments
- if (null == context) {
- throw new NullPointerException("Faces context for build AJAX Action URL is null");
- }
-
- UIViewRoot viewRoot = context.getViewRoot();
-
- if (null == viewRoot) {
- throw new NullPointerException("Faces view tree for build AJAX Action URL is null");
- }
-
- String viewId = viewRoot.getViewId();
-
- if (null == viewId) {
- throw new NullPointerException("View id for build AJAX Action URL is null");
- }
-
- if (!viewId.startsWith("/")) {
- throw new IllegalArgumentException("Illegal view Id for build AJAX Action URL: " + viewId);
- }
-
- ViewHandler viewHandler = context.getApplication().getViewHandler();
- String actionURL = viewHandler.getActionURL(context, viewId);
-
- // HACK - check for a Jboss PortletBridge implementation. If present, append DirectLink attribute to url.
- // TODO - how to detect portlet application ?
- if (null != context.getExternalContext().getApplicationMap().get(
- "org.jboss.portletbridge.application.PortletStateHolder")) {
-
- // Mark Ajax action url as transparent with jsf-portlet bridge.
- actionURL = actionURL + ((actionURL.lastIndexOf('?') > 0) ? "&" : "?")
- + "javax.portlet.faces.DirectLink=true";
- }
-
- return context.getExternalContext().encodeActionURL(actionURL);
- }
-
- /**
- * @return the commonAjaxParameters
- */
- public Map<String, Object> getCommonAjaxParameters() {
- return commonAjaxParameters;
- }
-
- /**
- * @return the oncomplete
- */
- public Object getOncomplete() {
- return oncomplete;
- }
-
- /**
- * @param oncomplete the oncomplete to set
- */
- public void setOncomplete(Object oncomplete) {
- this.oncomplete = oncomplete;
- }
-
- public void appendOncomplete(Object onComplete) {
- StringBuilder res = new StringBuilder();
- if (this.oncomplete != null) {
- res.append(this.oncomplete);
- res.append(';');
- }
-
- if (onComplete != null) {
- res.append(onComplete).append(';');
- }
-
- this.oncomplete = res.toString();
- }
-
- /* (non-Javadoc)
- * @see org.ajax4jsf.context.AjaxContext#getOnbeforedomupdate()
- */
- @Override
- public Object getOnbeforedomupdate() {
- return onbeforedomupdate;
- }
-
- /* (non-Javadoc)
- * @see org.ajax4jsf.context.AjaxContext#setOnbeforedomupdate(java.lang.Object)
- */
- @Override
- public void setOnbeforedomupdate(Object onbeforedomupdateFunction) {
- this.onbeforedomupdate = onbeforedomupdateFunction;
- }
-}
Copied: trunk/core/impl/src/main/java/org/richfaces/context/ExtendedPartialViewContextFactoryImpl.java (from rev 20790, trunk/core/impl/src/main/java/org/richfaces/context/PartialViewContextFactoryImpl.java)
===================================================================
--- trunk/core/impl/src/main/java/org/richfaces/context/ExtendedPartialViewContextFactoryImpl.java (rev 0)
+++ trunk/core/impl/src/main/java/org/richfaces/context/ExtendedPartialViewContextFactoryImpl.java 2010-12-27 19:16:45 UTC (rev 20815)
@@ -0,0 +1,50 @@
+/**
+ * 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.context;
+
+import javax.faces.context.FacesContext;
+import javax.faces.context.PartialViewContext;
+import javax.faces.context.PartialViewContextFactory;
+
+/**
+ * @author Nick Belaevski
+ * @since 4.0
+ */
+public class ExtendedPartialViewContextFactoryImpl extends PartialViewContextFactory {
+
+ private PartialViewContextFactory parentFactory;
+
+ public ExtendedPartialViewContextFactoryImpl(PartialViewContextFactory parentFactory) {
+ super();
+ this.parentFactory = parentFactory;
+ }
+
+ @Override
+ public PartialViewContext getPartialViewContext(final FacesContext context) {
+ return new ExtendedPartialViewContextImpl(parentFactory.getPartialViewContext(context), context);
+ }
+
+ @Override
+ public PartialViewContextFactory getWrapped() {
+ return parentFactory;
+ }
+}
Copied: trunk/core/impl/src/main/java/org/richfaces/context/ExtendedPartialViewContextImpl.java (from rev 20790, trunk/core/impl/src/main/java/org/richfaces/context/PartialViewContextImpl.java)
===================================================================
--- trunk/core/impl/src/main/java/org/richfaces/context/ExtendedPartialViewContextImpl.java (rev 0)
+++ trunk/core/impl/src/main/java/org/richfaces/context/ExtendedPartialViewContextImpl.java 2010-12-27 19:16:45 UTC (rev 20815)
@@ -0,0 +1,534 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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.context;
+
+import static org.richfaces.renderkit.AjaxConstants.AJAX_COMPONENT_ID_PARAMETER;
+import static org.richfaces.renderkit.AjaxConstants.ALL;
+import static org.richfaces.renderkit.AjaxConstants.BEHAVIOR_EVENT_PARAMETER;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.EnumSet;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Set;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIViewRoot;
+import javax.faces.component.visit.VisitCallback;
+import javax.faces.component.visit.VisitContext;
+import javax.faces.component.visit.VisitHint;
+import javax.faces.component.visit.VisitResult;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import javax.faces.context.PartialResponseWriter;
+import javax.faces.context.PartialViewContext;
+import javax.faces.context.ResponseWriter;
+import javax.faces.event.PhaseId;
+
+import org.ajax4jsf.javascript.ScriptUtils;
+import org.richfaces.application.ServiceTracker;
+import org.richfaces.component.MetaComponentEncoder;
+import org.richfaces.javascript.JavaScriptService;
+import org.richfaces.javascript.ScriptsHolder;
+import org.richfaces.log.Logger;
+import org.richfaces.log.RichfacesLogger;
+import org.richfaces.renderkit.util.CoreAjaxRendererUtils;
+
+/**
+ * @author Nick Belaevski
+ * @since 4.0
+ */
+public class ExtendedPartialViewContextImpl extends ExtendedPartialViewContext {
+
+ private static final Logger LOG = RichfacesLogger.CONTEXT.getLogger();
+
+ private static final String ORIGINAL_WRITER = "org.richfaces.PartialViewContextImpl.ORIGINAL_WRITER";
+
+ private enum ContextMode {
+ WRAPPED, DIRECT
+ }
+
+ private ContextMode contextMode = null;
+
+ private Collection<String> executeIds = null;
+
+ private Collection<String> renderIds = null;
+
+ private Collection<String> componentRenderIds = null;
+
+ private Boolean renderAll = null;
+
+ private String activatorComponentId = null;
+ private String behaviorEvent = null;
+
+ private boolean released = false;
+
+ private boolean limitRender = false;
+
+ private PartialViewContext wrappedViewContext;
+
+ private String onbeforedomupdate;
+
+ private String oncomplete;
+
+ private Object responseData;
+
+ public ExtendedPartialViewContextImpl(PartialViewContext wrappedViewContext, FacesContext facesContext) {
+ super(facesContext);
+
+ this.wrappedViewContext = wrappedViewContext;
+ }
+
+ @Override
+ public Collection<String> getExecuteIds() {
+ assertNotReleased();
+
+ if (detectContextMode() == ContextMode.DIRECT) {
+ if (executeIds == null) {
+ executeIds = new LinkedHashSet<String>();
+ visitActivatorAtExecute();
+ }
+
+ return executeIds;
+ } else {
+ return wrappedViewContext.getExecuteIds();
+ }
+ }
+
+ @Override
+ public Collection<String> getRenderIds() {
+ assertNotReleased();
+
+ if (detectContextMode() == ContextMode.DIRECT) {
+ if (renderIds == null) {
+ renderIds = new LinkedHashSet<String>();
+ }
+
+ return renderIds;
+ } else {
+ return wrappedViewContext.getRenderIds();
+ }
+ }
+
+ @Override
+ public boolean isAjaxRequest() {
+ assertNotReleased();
+
+ return wrappedViewContext.isAjaxRequest();
+ }
+
+ @Override
+ public boolean isPartialRequest() {
+ assertNotReleased();
+
+ return wrappedViewContext.isPartialRequest();
+ }
+
+ @Override
+ public void setPartialRequest(boolean isPartialRequest) {
+ assertNotReleased();
+
+ wrappedViewContext.setPartialRequest(isPartialRequest);
+ }
+
+ @Override
+ public boolean isExecuteAll() {
+ assertNotReleased();
+
+ if (detectContextMode() == ContextMode.DIRECT) {
+ return getExecuteIds().contains(ALL);
+ } else {
+ return wrappedViewContext.isExecuteAll();
+ }
+ }
+
+ @Override
+ public boolean isRenderAll() {
+ assertNotReleased();
+
+ if (detectContextMode() == ContextMode.DIRECT) {
+ if (renderAll != null) {
+ return renderAll.booleanValue();
+ }
+
+ return getRenderIds().contains(ALL);
+ } else {
+ return wrappedViewContext.isRenderAll();
+ }
+ }
+
+ @Override
+ public void setRenderAll(boolean isRenderAll) {
+ assertNotReleased();
+
+ if (detectContextMode() == ContextMode.DIRECT) {
+ renderAll = isRenderAll;
+ } else {
+ wrappedViewContext.setRenderAll(isRenderAll);
+ }
+ }
+
+ @Override
+ public PartialResponseWriter getPartialResponseWriter() {
+ return wrappedViewContext.getPartialResponseWriter();
+ }
+
+ private boolean isProcessedExecutePhase(PhaseId phaseId) {
+ return phaseId == PhaseId.APPLY_REQUEST_VALUES || phaseId == PhaseId.PROCESS_VALIDATIONS
+ || phaseId == PhaseId.UPDATE_MODEL_VALUES;
+ }
+
+ @Override
+ public void processPartial(PhaseId phaseId) {
+ if (detectContextMode() == ContextMode.DIRECT) {
+ if (phaseId == PhaseId.RENDER_RESPONSE) {
+ processPartialRenderPhase();
+ } else if (isProcessedExecutePhase(phaseId)) {
+ processPartialExecutePhase(phaseId);
+ }
+ } else {
+ wrappedViewContext.processPartial(phaseId);
+ }
+ }
+
+ protected void processPartialExecutePhase(PhaseId phaseId) {
+ FacesContext facesContext = getFacesContext();
+ PartialViewContext pvc = facesContext.getPartialViewContext();
+ Collection <String> executeIds = pvc.getExecuteIds();
+
+ if (executeIds == null || executeIds.isEmpty()) {
+ if (phaseId == PhaseId.APPLY_REQUEST_VALUES) {
+ LOG.warn("Partial execute won't happen - executeIds were not specified");
+ }
+ return;
+ }
+
+ try {
+ executeComponents(phaseId, executeIds);
+ } catch (Exception e) {
+ LOG.error(e.getMessage(), e);
+ }
+
+ if (phaseId == PhaseId.APPLY_REQUEST_VALUES) {
+ //fix for MyFaces
+ ExternalContext externalContext = facesContext.getExternalContext();
+ externalContext.setResponseCharacterEncoding(externalContext.getRequestCharacterEncoding());
+
+ PartialResponseWriter writer = pvc.getPartialResponseWriter();
+ facesContext.setResponseWriter(writer);
+ }
+ }
+
+ protected void executeComponents(PhaseId phaseId, Collection<String> executeIds) {
+ FacesContext facesContext = getFacesContext();
+ EnumSet<VisitHint> hints = EnumSet.of(VisitHint.SKIP_UNRENDERED);
+ VisitContext visitContext = new ExecuteExtendedVisitContext(facesContext, executeIds, hints);
+ PartialViewExecuteVisitCallback callback = new PartialViewExecuteVisitCallback(facesContext, phaseId);
+ facesContext.getViewRoot().visitTree(visitContext, callback);
+ }
+
+ protected void processPartialRenderPhase() {
+ FacesContext facesContext = getFacesContext();
+ PartialViewContext pvc = facesContext.getPartialViewContext();
+ UIViewRoot viewRoot = facesContext.getViewRoot();
+ Collection<String> phaseIds = pvc.getRenderIds();
+ visitActivatorAtRender(phaseIds);
+
+ try {
+ PartialResponseWriter writer = pvc.getPartialResponseWriter();
+ ResponseWriter orig = facesContext.getResponseWriter();
+ facesContext.getAttributes().put(ORIGINAL_WRITER, orig);
+ facesContext.setResponseWriter(writer);
+
+ ExternalContext exContext = facesContext.getExternalContext();
+ exContext.setResponseContentType("text/xml");
+ exContext.addResponseHeader("Cache-Control", "no-cache");
+ writer.startDocument();
+ if (isRenderAll()) {
+ renderAll(facesContext, viewRoot);
+ renderState(facesContext);
+ writer.endDocument();
+ return;
+ }
+
+ // Skip this processing if "none" is specified in the render list,
+ // or there were no render phase client ids.
+ if ((phaseIds != null && !phaseIds.isEmpty()) ||
+ (!limitRender && PartialViewContextAjaxOutputTracker.hasNestedAjaxOutputs(viewRoot))) {
+
+ EnumSet<VisitHint> hints = EnumSet.of(VisitHint.SKIP_UNRENDERED);
+ VisitContext visitContext = new RenderExtendedVisitContext(facesContext, phaseIds, hints, limitRender);
+ VisitCallback visitCallback = new RenderVisitCallback(facesContext);
+ viewRoot.visitTree(visitContext, visitCallback);
+ }
+
+ renderState(facesContext);
+
+ //TODO - render extensions for renderAll?
+ renderExtensions(facesContext, viewRoot);
+
+ writer.endDocument();
+ } catch (IOException ex) {
+ this.cleanupAfterView();
+ //TODO - review?
+ ex.printStackTrace();
+ } catch (RuntimeException ex) {
+ //TODO - review?
+ this.cleanupAfterView();
+ // Throw the exception
+ throw ex;
+ }
+ }
+
+ private void setupExecuteCallbackData(ExecuteComponentCallback callback) {
+ executeIds.addAll(callback.getExecuteIds());
+
+ setupRenderCallbackData(callback);
+ }
+
+ private void setupRenderCallbackData(RenderComponentCallback callback) {
+ componentRenderIds = callback.getRenderIds();
+ onbeforedomupdate = callback.getOnbeforedomupdate();
+ oncomplete = callback.getOncomplete();
+ responseData = callback.getData();
+ limitRender = callback.isLimitRender();
+ }
+
+ private void visitActivatorAtExecute() {
+ ExecuteComponentCallback callback = new ExecuteComponentCallback(getFacesContext(), behaviorEvent);
+
+ if (visitActivatorComponent(activatorComponentId, callback, EnumSet.of(VisitHint.SKIP_UNRENDERED))) {
+ setupExecuteCallbackData(callback);
+
+ if (!executeIds.contains(ALL)) {
+ addImplicitExecuteIds(executeIds);
+ }
+ } else {
+ //TODO - log or exception?
+ //TODO - process default execute value
+ }
+ }
+
+ private void visitActivatorAtRender(Collection<String> ids) {
+ if (!isRenderAll()) {
+ RenderComponentCallback callback = new RenderComponentCallback(getFacesContext(), behaviorEvent);
+
+ if (visitActivatorComponent(activatorComponentId, callback, EnumSet.noneOf(VisitHint.class))) {
+ setupRenderCallbackData(callback);
+ } else {
+ //TODO - the same as for "execute"
+ }
+
+ //take collection value stored during execute
+ if (componentRenderIds != null) {
+ ids.addAll(componentRenderIds);
+ }
+
+ if (!Boolean.TRUE.equals(renderAll) && !ids.contains(ALL)) {
+ addImplicitRenderIds(ids, limitRender);
+
+ appendOnbeforedomupdate(onbeforedomupdate);
+ appendOncomplete(oncomplete);
+ setResponseData(responseData);
+ }
+ }
+ }
+
+ private void renderAll(FacesContext context, UIViewRoot viewRoot) throws IOException {
+ // If this is a "render all via ajax" request,
+ // make sure to wrap the entire page in a <render> elemnt
+ // with the special id of VIEW_ROOT_ID. This is how the client
+ // JavaScript knows how to replace the entire document with
+ // this response.
+ PartialViewContext pvc = context.getPartialViewContext();
+ PartialResponseWriter writer = pvc.getPartialResponseWriter();
+ writer.startUpdate(PartialResponseWriter.RENDER_ALL_MARKER);
+
+ if (viewRoot.getChildCount() > 0) {
+ for (UIComponent child : viewRoot.getChildren()) {
+ child.encodeAll(context);
+ }
+ }
+
+ writer.endUpdate();
+ }
+
+ private void renderState(FacesContext context) throws IOException {
+ if (!context.getViewRoot().isTransient()) {
+ // Get the view state and write it to the response..
+ PartialViewContext pvc = context.getPartialViewContext();
+ PartialResponseWriter writer = pvc.getPartialResponseWriter();
+ writer.startUpdate(PartialResponseWriter.VIEW_STATE_MARKER);
+ String state = context.getApplication().getStateManager().getViewState(context);
+ writer.write(state);
+ writer.endUpdate();
+ }
+ }
+
+ @Override
+ public void release() {
+ super.release();
+
+ assertNotReleased();
+
+ released = true;
+
+ wrappedViewContext.release();
+ wrappedViewContext = null;
+
+ renderAll = null;
+ executeIds = null;
+ renderIds = null;
+
+ limitRender = false;
+
+ activatorComponentId = null;
+ behaviorEvent = null;
+ contextMode = null;
+ }
+
+ protected void addImplicitExecuteIds(Collection<String> ids) {
+ if (!ids.isEmpty()) {
+ UIViewRoot root = getFacesContext().getViewRoot();
+ if (root.getFacetCount() > 0) {
+ if (root.getFacet(UIViewRoot.METADATA_FACET_NAME) != null) {
+ //TODO nick - does ordering matter?
+ ids.add(UIViewRoot.METADATA_FACET_NAME);
+ //ids.add(0, UIViewRoot.METADATA_FACET_NAME);
+ }
+ }
+ }
+ }
+
+ protected void addImplicitRenderIds(Collection<String> ids, boolean limitRender) {
+ }
+
+ protected void renderExtensions(FacesContext context, UIComponent component) throws IOException {
+ // ADD deffered scripts
+ ScriptsHolder scriptsHolder = ServiceTracker.getService(JavaScriptService.class).getScriptsHolder(context);
+ for (Object script : scriptsHolder.getScripts()) {
+ appendOncomplete(ScriptUtils.toScript(script));
+ }
+ for (Object script : scriptsHolder.getPageReadyScripts()) {
+ appendOncomplete(ScriptUtils.toScript(script));
+ }
+ CoreAjaxRendererUtils.renderAjaxExtensions(context, component);
+ }
+
+ private void assertNotReleased() {
+ if (released) {
+ throw new IllegalStateException("PartialViewContext already released!");
+ }
+ }
+
+ private boolean visitActivatorComponent(String componentActivatorId, VisitCallback visitCallback, Set<VisitHint> visitHints) {
+ FacesContext facesContext = getFacesContext();
+
+ Set<String> idsToVisit = Collections.singleton(componentActivatorId);
+ VisitContext visitContext = new ExecuteExtendedVisitContext(facesContext, idsToVisit, visitHints);
+
+ boolean visitResult = facesContext.getViewRoot().visitTree(visitContext, visitCallback);
+ return visitResult;
+ }
+
+ private void cleanupAfterView() {
+ FacesContext facesContext = getFacesContext();
+
+ ResponseWriter orig = (ResponseWriter) facesContext.getAttributes().get(ORIGINAL_WRITER);
+ assert null != orig;
+ // move aside the PartialResponseWriter
+ facesContext.setResponseWriter(orig);
+ }
+
+ protected ContextMode detectContextMode() {
+ if (contextMode == null) {
+ Map<String, String> requestParameterMap = getFacesContext().getExternalContext().getRequestParameterMap();
+ activatorComponentId = requestParameterMap.get(AJAX_COMPONENT_ID_PARAMETER);
+
+ if (activatorComponentId != null) {
+ contextMode = ContextMode.DIRECT;
+ behaviorEvent = requestParameterMap.get(BEHAVIOR_EVENT_PARAMETER);
+ } else {
+ contextMode = ContextMode.WRAPPED;
+ }
+ }
+
+ return contextMode;
+ }
+
+ private static final class RenderVisitCallback implements VisitCallback {
+
+ private FacesContext ctx;
+
+ private RenderVisitCallback(FacesContext ctx) {
+ this.ctx = ctx;
+ }
+
+ private void logException(Exception e) {
+ if (LOG.isErrorEnabled()) {
+ LOG.error(e.getMessage());
+ }
+ if (LOG.isDebugEnabled()) {
+ LOG.debug(e.getMessage(), e);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.component.visit.VisitCallback#visit(javax.faces.component.visit.VisitContext, javax.faces.component.UIComponent)
+ */
+ public VisitResult visit(VisitContext context, UIComponent target) {
+ String metaComponentId = (String) ctx.getAttributes().get(ExtendedVisitContext.META_COMPONENT_ID);
+ if (metaComponentId != null) {
+ MetaComponentEncoder encoder = (MetaComponentEncoder) target;
+ try {
+ encoder.encodeMetaComponent(ctx, metaComponentId);
+ } catch (Exception e) {
+ logException(e);
+ }
+ } else {
+ PartialResponseWriter writer = ctx.getPartialViewContext().getPartialResponseWriter();
+
+ try {
+ writer.startUpdate(target.getClientId(ctx));
+ try {
+ // do the default behavior...
+ target.encodeAll(ctx);
+ } catch (Exception ce) {
+ logException(ce);
+ }
+
+ writer.endUpdate();
+ } catch (IOException e) {
+ logException(e);
+ }
+ }
+
+ // Once we visit a component, there is no need to visit
+ // its children, since processDecodes/Validators/Updates and
+ // encodeAll() already traverse the subtree. We return
+ // VisitResult.REJECT to supress the subtree visit.
+ return VisitResult.REJECT;
+ }
+ }
+}
Deleted: trunk/core/impl/src/main/java/org/richfaces/context/PartialViewContextFactoryImpl.java
===================================================================
--- trunk/core/impl/src/main/java/org/richfaces/context/PartialViewContextFactoryImpl.java 2010-12-27 18:59:46 UTC (rev 20814)
+++ trunk/core/impl/src/main/java/org/richfaces/context/PartialViewContextFactoryImpl.java 2010-12-27 19:16:45 UTC (rev 20815)
@@ -1,50 +0,0 @@
-/**
- * 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.context;
-
-import javax.faces.context.FacesContext;
-import javax.faces.context.PartialViewContext;
-import javax.faces.context.PartialViewContextFactory;
-
-/**
- * @author Nick Belaevski
- * @since 4.0
- */
-public class PartialViewContextFactoryImpl extends PartialViewContextFactory {
-
- private PartialViewContextFactory parentFactory;
-
- public PartialViewContextFactoryImpl(PartialViewContextFactory parentFactory) {
- super();
- this.parentFactory = parentFactory;
- }
-
- @Override
- public PartialViewContext getPartialViewContext(final FacesContext context) {
- return new PartialViewContextImpl(parentFactory.getPartialViewContext(context), context);
- }
-
- @Override
- public PartialViewContextFactory getWrapped() {
- return parentFactory;
- }
-}
Deleted: trunk/core/impl/src/main/java/org/richfaces/context/PartialViewContextImpl.java
===================================================================
--- trunk/core/impl/src/main/java/org/richfaces/context/PartialViewContextImpl.java 2010-12-27 18:59:46 UTC (rev 20814)
+++ trunk/core/impl/src/main/java/org/richfaces/context/PartialViewContextImpl.java 2010-12-27 19:16:45 UTC (rev 20815)
@@ -1,540 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, 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.context;
-
-import static org.richfaces.renderkit.AjaxConstants.AJAX_COMPONENT_ID_PARAMETER;
-import static org.richfaces.renderkit.AjaxConstants.ALL;
-import static org.richfaces.renderkit.AjaxConstants.BEHAVIOR_EVENT_PARAMETER;
-
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.EnumSet;
-import java.util.LinkedHashSet;
-import java.util.Map;
-import java.util.Set;
-
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIViewRoot;
-import javax.faces.component.visit.VisitCallback;
-import javax.faces.component.visit.VisitContext;
-import javax.faces.component.visit.VisitHint;
-import javax.faces.component.visit.VisitResult;
-import javax.faces.context.ExternalContext;
-import javax.faces.context.FacesContext;
-import javax.faces.context.PartialResponseWriter;
-import javax.faces.context.PartialViewContext;
-import javax.faces.context.ResponseWriter;
-import javax.faces.event.PhaseId;
-
-import org.ajax4jsf.context.AjaxContext;
-import org.ajax4jsf.javascript.ScriptUtils;
-import org.richfaces.application.ServiceTracker;
-import org.richfaces.component.MetaComponentEncoder;
-import org.richfaces.javascript.JavaScriptService;
-import org.richfaces.javascript.ScriptsHolder;
-import org.richfaces.log.Logger;
-import org.richfaces.log.RichfacesLogger;
-import org.richfaces.renderkit.util.CoreAjaxRendererUtils;
-
-/**
- * @author Nick Belaevski
- * @since 4.0
- */
-public class PartialViewContextImpl extends PartialViewContext {
-
- private static final Logger LOG = RichfacesLogger.CONTEXT.getLogger();
-
- private static final String ORIGINAL_WRITER = "org.richfaces.PartialViewContextImpl.ORIGINAL_WRITER";
-
- private enum ContextMode {
- WRAPPED, DIRECT
- }
-
- private ContextMode contextMode = null;
-
- private FacesContext facesContext;
-
- private Collection<String> executeIds = null;
-
- private Collection<String> renderIds = null;
-
- private Collection<String> componentRenderIds = null;
-
- private Boolean renderAll = null;
-
- private String activatorComponentId = null;
- private String behaviorEvent = null;
-
- private boolean released = false;
-
- private boolean limitRender = false;
-
- private PartialViewContext wrappedViewContext;
-
- private String onbeforedomupdate;
-
- private String oncomplete;
-
- private Object responseData;
-
- public PartialViewContextImpl(PartialViewContext wrappedViewContext, FacesContext facesContext) {
- super();
-
- this.wrappedViewContext = wrappedViewContext;
- this.facesContext = facesContext;
- }
-
- @Override
- public Collection<String> getExecuteIds() {
- assertNotReleased();
-
- if (detectContextMode() == ContextMode.DIRECT) {
- if (executeIds == null) {
- executeIds = new LinkedHashSet<String>();
- visitActivatorAtExecute();
- }
-
- return executeIds;
- } else {
- return wrappedViewContext.getExecuteIds();
- }
- }
-
- @Override
- public Collection<String> getRenderIds() {
- assertNotReleased();
-
- if (detectContextMode() == ContextMode.DIRECT) {
- if (renderIds == null) {
- renderIds = new LinkedHashSet<String>();
- }
-
- return renderIds;
- } else {
- return wrappedViewContext.getRenderIds();
- }
- }
-
- @Override
- public boolean isAjaxRequest() {
- assertNotReleased();
-
- return wrappedViewContext.isAjaxRequest();
- }
-
- @Override
- public boolean isPartialRequest() {
- assertNotReleased();
-
- return wrappedViewContext.isPartialRequest();
- }
-
- @Override
- public void setPartialRequest(boolean isPartialRequest) {
- assertNotReleased();
-
- wrappedViewContext.setPartialRequest(isPartialRequest);
- }
-
- @Override
- public boolean isExecuteAll() {
- assertNotReleased();
-
- if (detectContextMode() == ContextMode.DIRECT) {
- return getExecuteIds().contains(ALL);
- } else {
- return wrappedViewContext.isExecuteAll();
- }
- }
-
- @Override
- public boolean isRenderAll() {
- assertNotReleased();
-
- if (detectContextMode() == ContextMode.DIRECT) {
- if (renderAll != null) {
- return renderAll.booleanValue();
- }
-
- return getRenderIds().contains(ALL);
- } else {
- return wrappedViewContext.isRenderAll();
- }
- }
-
- @Override
- public void setRenderAll(boolean isRenderAll) {
- assertNotReleased();
-
- if (detectContextMode() == ContextMode.DIRECT) {
- renderAll = isRenderAll;
- } else {
- wrappedViewContext.setRenderAll(isRenderAll);
- }
- }
-
- @Override
- public PartialResponseWriter getPartialResponseWriter() {
- return wrappedViewContext.getPartialResponseWriter();
- }
-
- private boolean isProcessedExecutePhase(PhaseId phaseId) {
- return phaseId == PhaseId.APPLY_REQUEST_VALUES || phaseId == PhaseId.PROCESS_VALIDATIONS
- || phaseId == PhaseId.UPDATE_MODEL_VALUES;
- }
-
- @Override
- public void processPartial(PhaseId phaseId) {
- if (detectContextMode() == ContextMode.DIRECT) {
- if (phaseId == PhaseId.RENDER_RESPONSE) {
- processPartialRenderPhase();
- } else if (isProcessedExecutePhase(phaseId)) {
- processPartialExecutePhase(phaseId);
- }
- } else {
- wrappedViewContext.processPartial(phaseId);
- }
- }
-
- protected void processPartialExecutePhase(PhaseId phaseId) {
- PartialViewContext pvc = facesContext.getPartialViewContext();
- Collection <String> executeIds = pvc.getExecuteIds();
-
- if (executeIds == null || executeIds.isEmpty()) {
- if (phaseId == PhaseId.APPLY_REQUEST_VALUES) {
- LOG.warn("Partial execute won't happen - executeIds were not specified");
- }
- return;
- }
-
- try {
- executeComponents(phaseId, executeIds);
- } catch (Exception e) {
- LOG.error(e.getMessage(), e);
- }
-
- if (phaseId == PhaseId.APPLY_REQUEST_VALUES) {
- //fix for MyFaces
- ExternalContext externalContext = facesContext.getExternalContext();
- externalContext.setResponseCharacterEncoding(externalContext.getRequestCharacterEncoding());
-
- PartialResponseWriter writer = pvc.getPartialResponseWriter();
- facesContext.setResponseWriter(writer);
- }
- }
-
- protected void executeComponents(PhaseId phaseId, Collection<String> executeIds) {
- EnumSet<VisitHint> hints = EnumSet.of(VisitHint.SKIP_UNRENDERED);
- VisitContext visitContext = new ExecuteExtendedVisitContext(facesContext, executeIds, hints);
- PartialViewExecuteVisitCallback callback = new PartialViewExecuteVisitCallback(facesContext, phaseId);
- facesContext.getViewRoot().visitTree(visitContext, callback);
- }
-
- protected void processPartialRenderPhase() {
- PartialViewContext pvc = facesContext.getPartialViewContext();
- UIViewRoot viewRoot = facesContext.getViewRoot();
- Collection<String> phaseIds = pvc.getRenderIds();
- visitActivatorAtRender(phaseIds);
-
- try {
- PartialResponseWriter writer = pvc.getPartialResponseWriter();
- ResponseWriter orig = facesContext.getResponseWriter();
- facesContext.getAttributes().put(ORIGINAL_WRITER, orig);
- facesContext.setResponseWriter(writer);
-
- ExternalContext exContext = facesContext.getExternalContext();
- exContext.setResponseContentType("text/xml");
- exContext.addResponseHeader("Cache-Control", "no-cache");
- writer.startDocument();
- if (isRenderAll()) {
- renderAll(facesContext, viewRoot);
- renderState(facesContext);
- writer.endDocument();
- return;
- }
-
- // Skip this processing if "none" is specified in the render list,
- // or there were no render phase client ids.
- if ((phaseIds != null && !phaseIds.isEmpty()) ||
- (!limitRender && PartialViewContextAjaxOutputTracker.hasNestedAjaxOutputs(viewRoot))) {
-
- EnumSet<VisitHint> hints = EnumSet.of(VisitHint.SKIP_UNRENDERED);
- VisitContext visitContext = new RenderExtendedVisitContext(facesContext, phaseIds, hints, limitRender);
- VisitCallback visitCallback = new RenderVisitCallback(facesContext);
- viewRoot.visitTree(visitContext, visitCallback);
- }
-
- renderState(facesContext);
-
- //TODO - render extensions for renderAll?
- renderExtensions(facesContext, viewRoot);
-
- writer.endDocument();
- } catch (IOException ex) {
- this.cleanupAfterView();
- //TODO - review?
- ex.printStackTrace();
- } catch (RuntimeException ex) {
- //TODO - review?
- this.cleanupAfterView();
- // Throw the exception
- throw ex;
- }
- }
-
- private void setupExecuteCallbackData(ExecuteComponentCallback callback) {
- executeIds.addAll(callback.getExecuteIds());
-
- setupRenderCallbackData(callback);
- }
-
- private void setupRenderCallbackData(RenderComponentCallback callback) {
- componentRenderIds = callback.getRenderIds();
- onbeforedomupdate = callback.getOnbeforedomupdate();
- oncomplete = callback.getOncomplete();
- responseData = callback.getData();
- limitRender = callback.isLimitRender();
- }
-
- private void visitActivatorAtExecute() {
- ExecuteComponentCallback callback = new ExecuteComponentCallback(facesContext, behaviorEvent);
-
- if (visitActivatorComponent(activatorComponentId, callback, EnumSet.of(VisitHint.SKIP_UNRENDERED))) {
- setupExecuteCallbackData(callback);
-
- if (!executeIds.contains(ALL)) {
- addImplicitExecuteIds(executeIds);
- }
- } else {
- //TODO - log or exception?
- //TODO - process default execute value
- }
- }
-
- private void visitActivatorAtRender(Collection<String> ids) {
- if (!isRenderAll()) {
- RenderComponentCallback callback = new RenderComponentCallback(facesContext, behaviorEvent);
-
- if (visitActivatorComponent(activatorComponentId, callback, EnumSet.noneOf(VisitHint.class))) {
- setupRenderCallbackData(callback);
- } else {
- //TODO - the same as for "execute"
- }
-
- //take collection value stored during execute
- if (componentRenderIds != null) {
- ids.addAll(componentRenderIds);
- }
-
- if (!Boolean.TRUE.equals(renderAll) && !ids.contains(ALL)) {
- addImplicitRenderIds(ids, limitRender);
-
- //TODO - review
- AjaxContext ajaxContext = AjaxContext.getCurrentInstance();
- ajaxContext.setOnbeforedomupdate(onbeforedomupdate);
- ajaxContext.appendOncomplete(oncomplete);
- ajaxContext.setResponseData(responseData);
- }
- }
- }
-
- private void renderAll(FacesContext context, UIViewRoot viewRoot) throws IOException {
- // If this is a "render all via ajax" request,
- // make sure to wrap the entire page in a <render> elemnt
- // with the special id of VIEW_ROOT_ID. This is how the client
- // JavaScript knows how to replace the entire document with
- // this response.
- PartialViewContext pvc = context.getPartialViewContext();
- PartialResponseWriter writer = pvc.getPartialResponseWriter();
- writer.startUpdate(PartialResponseWriter.RENDER_ALL_MARKER);
-
- if (viewRoot.getChildCount() > 0) {
- for (UIComponent child : viewRoot.getChildren()) {
- child.encodeAll(context);
- }
- }
-
- writer.endUpdate();
- }
-
- private void renderState(FacesContext context) throws IOException {
- if (!context.getViewRoot().isTransient()) {
- // Get the view state and write it to the response..
- PartialViewContext pvc = context.getPartialViewContext();
- PartialResponseWriter writer = pvc.getPartialResponseWriter();
- writer.startUpdate(PartialResponseWriter.VIEW_STATE_MARKER);
- String state = context.getApplication().getStateManager().getViewState(context);
- writer.write(state);
- writer.endUpdate();
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.context.PartialViewContext#release()
- */
- @Override
- public void release() {
- assertNotReleased();
-
- released = true;
-
- wrappedViewContext.release();
- wrappedViewContext = null;
-
- facesContext = null;
-
- renderAll = null;
- executeIds = null;
- renderIds = null;
-
- limitRender = false;
-
- activatorComponentId = null;
- behaviorEvent = null;
- contextMode = null;
- }
-
- protected void addImplicitExecuteIds(Collection<String> ids) {
- if (!ids.isEmpty()) {
- UIViewRoot root = facesContext.getViewRoot();
- if (root.getFacetCount() > 0) {
- if (root.getFacet(UIViewRoot.METADATA_FACET_NAME) != null) {
- //TODO nick - does ordering matter?
- ids.add(UIViewRoot.METADATA_FACET_NAME);
- //ids.add(0, UIViewRoot.METADATA_FACET_NAME);
- }
- }
- }
- }
-
- protected void addImplicitRenderIds(Collection<String> ids, boolean limitRender) {
- }
-
- protected void renderExtensions(FacesContext context, UIComponent component) throws IOException {
- // ADD deffered scripts
- AjaxContext ajaxContext = AjaxContext.getCurrentInstance();
- ScriptsHolder scriptsHolder = ServiceTracker.getService(JavaScriptService.class).getScriptsHolder(context);
- for (Object script : scriptsHolder.getScripts()) {
- ajaxContext.appendOncomplete(ScriptUtils.toScript(script));
- }
- for (Object script : scriptsHolder.getPageReadyScripts()) {
- ajaxContext.appendOncomplete(ScriptUtils.toScript(script));
- }
- CoreAjaxRendererUtils.renderAjaxExtensions(context, component);
- }
-
- private void assertNotReleased() {
- if (released) {
- throw new IllegalStateException("PartialViewContext already released!");
- }
- }
-
- private boolean visitActivatorComponent(String componentActivatorId, VisitCallback visitCallback, Set<VisitHint> visitHints) {
-
- Set<String> idsToVisit = Collections.singleton(componentActivatorId);
- VisitContext visitContext = new ExecuteExtendedVisitContext(facesContext, idsToVisit, visitHints);
-
- boolean visitResult = facesContext.getViewRoot().visitTree(visitContext, visitCallback);
- return visitResult;
- }
-
- private void cleanupAfterView() {
- ResponseWriter orig = (ResponseWriter) facesContext.getAttributes().get(ORIGINAL_WRITER);
- assert null != orig;
- // move aside the PartialResponseWriter
- facesContext.setResponseWriter(orig);
- }
-
- protected ContextMode detectContextMode() {
- if (contextMode == null) {
- Map<String, String> requestParameterMap = facesContext.getExternalContext().getRequestParameterMap();
- activatorComponentId = requestParameterMap.get(AJAX_COMPONENT_ID_PARAMETER);
-
- if (activatorComponentId != null) {
- contextMode = ContextMode.DIRECT;
- behaviorEvent = requestParameterMap.get(BEHAVIOR_EVENT_PARAMETER);
- } else {
- contextMode = ContextMode.WRAPPED;
- }
- }
-
- return contextMode;
- }
-
- private static final class RenderVisitCallback implements VisitCallback {
-
- private FacesContext ctx;
-
- private RenderVisitCallback(FacesContext ctx) {
- this.ctx = ctx;
- }
-
- private void logException(Exception e) {
- if (LOG.isErrorEnabled()) {
- LOG.error(e.getMessage());
- }
- if (LOG.isDebugEnabled()) {
- LOG.debug(e.getMessage(), e);
- }
- }
-
- /* (non-Javadoc)
- * @see javax.faces.component.visit.VisitCallback#visit(javax.faces.component.visit.VisitContext, javax.faces.component.UIComponent)
- */
- public VisitResult visit(VisitContext context, UIComponent target) {
- String metaComponentId = (String) ctx.getAttributes().get(ExtendedVisitContext.META_COMPONENT_ID);
- if (metaComponentId != null) {
- MetaComponentEncoder encoder = (MetaComponentEncoder) target;
- try {
- encoder.encodeMetaComponent(ctx, metaComponentId);
- } catch (Exception e) {
- logException(e);
- }
- } else {
- PartialResponseWriter writer = ctx.getPartialViewContext().getPartialResponseWriter();
-
- try {
- writer.startUpdate(target.getClientId(ctx));
- try {
- // do the default behavior...
- target.encodeAll(ctx);
- } catch (Exception ce) {
- logException(ce);
- }
-
- writer.endUpdate();
- } catch (IOException e) {
- logException(e);
- }
- }
-
- // Once we visit a component, there is no need to visit
- // its children, since processDecodes/Validators/Updates and
- // encodeAll() already traverse the subtree. We return
- // VisitResult.REJECT to supress the subtree visit.
- return VisitResult.REJECT;
- }
- }
-}
Modified: trunk/core/impl/src/main/resources/META-INF/components.faces-config.xml
===================================================================
--- trunk/core/impl/src/main/resources/META-INF/components.faces-config.xml 2010-12-27 18:59:46 UTC (rev 20814)
+++ trunk/core/impl/src/main/resources/META-INF/components.faces-config.xml 2010-12-27 19:16:45 UTC (rev 20815)
@@ -2,8 +2,8 @@
<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0">
<factory>
- <external-context-factory>org.richfaces.context.SkinningExternalContextFactory</external-context-factory>
- <partial-view-context-factory>org.richfaces.context.PartialViewContextFactoryImpl</partial-view-context-factory>
+ <external-context-factory>org.richfaces.context.SkinningExternalContextFactory</external-context-factory>
+ <partial-view-context-factory>org.richfaces.context.ExtendedPartialViewContextFactoryImpl</partial-view-context-factory>
</factory>
<application>
Modified: trunk/core/impl/src/main/resources/META-INF/faces-config.xml
===================================================================
--- trunk/core/impl/src/main/resources/META-INF/faces-config.xml 2010-12-27 18:59:46 UTC (rev 20814)
+++ trunk/core/impl/src/main/resources/META-INF/faces-config.xml 2010-12-27 19:16:45 UTC (rev 20815)
@@ -33,11 +33,6 @@
<managed-bean-class>org.richfaces.skin.SkinBean</managed-bean-class>
<managed-bean-scope>application</managed-bean-scope>
</managed-bean>
- <managed-bean>
- <managed-bean-name>ajaxContext</managed-bean-name>
- <managed-bean-class>org.ajax4jsf.context.AjaxContextImpl</managed-bean-class>
- <managed-bean-scope>request</managed-bean-scope>
- </managed-bean>
<!-- component>
<component-type>javax.faces.ViewRoot</component-type>
Modified: trunk/examples/input-demo/src/main/webapp/resources/tests/autocomplete-qunit.js
===================================================================
--- trunk/examples/input-demo/src/main/webapp/resources/tests/autocomplete-qunit.js 2010-12-27 18:59:46 UTC (rev 20814)
+++ trunk/examples/input-demo/src/main/webapp/resources/tests/autocomplete-qunit.js 2010-12-27 19:16:45 UTC (rev 20815)
@@ -35,8 +35,8 @@
equals(c.name, "Autocomplete", "name");
equals(c.id, AUTOCOMPLETE_ID+'Default', "id");
// test default options
- equals(c.options.selectedItemClass, 'rf-au-sel', "options.selectedItemClass");
- equals(c.options.itemClass, 'rf-au-opt', "options.itemClass");
+ equals(c.options.selectedItemClass, 'rf-au-itm-sel', "options.selectedItemClass");
+ equals(c.options.itemClass, 'rf-au-itm', "options.itemClass");
equals(c.options.autofill, true, "options.autofill");
equals(c.options.minChars, 1, "options.minChars");
equals(c.options.selectFirst, true, "options.selectFirst");
Modified: trunk/ui/common/ui/src/main/java/org/richfaces/renderkit/util/AjaxRendererUtils.java
===================================================================
--- trunk/ui/common/ui/src/main/java/org/richfaces/renderkit/util/AjaxRendererUtils.java 2010-12-27 18:59:46 UTC (rev 20814)
+++ trunk/ui/common/ui/src/main/java/org/richfaces/renderkit/util/AjaxRendererUtils.java 2010-12-27 19:16:45 UTC (rev 20815)
@@ -28,7 +28,6 @@
import javax.faces.context.FacesContext;
import org.ajax4jsf.component.AjaxClientBehavior;
-import org.ajax4jsf.context.AjaxContext;
import org.ajax4jsf.javascript.JSFunctionDefinition;
import org.ajax4jsf.javascript.JSReference;
import org.richfaces.renderkit.AjaxConstants;
@@ -591,25 +590,4 @@
return (String) component.getAttributes().get(ONBEGIN_ATTR_NAME);
}
- protected static String getAjaxActionUrl(FacesContext facesContext) {
- return AjaxContext.getCurrentInstance(facesContext).getAjaxActionURL(facesContext);
- }
-
- /**
- * @param facesContext
- * @return
- */
- public static boolean isAjaxRequest(FacesContext facesContext) {
- return AjaxContext.getCurrentInstance(facesContext).isAjaxRequest();
- }
-
- /**
- * @param facesContext
- * @param component
- */
- public static void addRegionsFromComponent(UIComponent component, FacesContext facesContext) {
- AjaxContext.getCurrentInstance(facesContext).addRegionsFromComponent(component);
- }
-
-
}
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 18:59:46 UTC (rev 20814)
+++ trunk/ui/core/ui/src/main/java/org/richfaces/renderkit/html/AjaxOutputPanelRenderer.java 2010-12-27 19:16:45 UTC (rev 20815)
@@ -23,13 +23,11 @@
import java.io.IOException;
import java.util.Iterator;
-import java.util.Set;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
-import org.ajax4jsf.context.AjaxContext;
import org.richfaces.cdk.annotations.JsfRenderer;
import org.richfaces.component.AbstractOutputPanel;
import org.richfaces.renderkit.HtmlConstants;
@@ -56,33 +54,7 @@
@Override
public void encodeChildren(FacesContext context, UIComponent component) throws IOException {
//
- AbstractOutputPanel panel = (AbstractOutputPanel) component;
- if (hasNoneLayout(panel)) {
- if (component.getChildCount() > 0) {
- AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
- boolean ajaxRequest = ajaxContext.isAjaxRequest();
- Set<String> ajaxRenderedAreas = ajaxContext.getAjaxRenderedAreas();
- for (UIComponent child : component.getChildren()) {
- String childId = child.getClientId(context);
- if (child.isRendered()) {
- child.encodeAll(context);
- } else {
- // Render "dummy" span.
- ResponseWriter out = context.getResponseWriter();
- out.startElement(HtmlConstants.SPAN_ELEM, child);
- out.writeAttribute(HtmlConstants.ID_ATTRIBUTE, childId, HtmlConstants.ID_ATTRIBUTE);
- out.writeAttribute(HtmlConstants.STYLE_ATTRIBUTE, "display: none;", "style");
- out.endElement(HtmlConstants.SPAN_ELEM);
- }
- // register child as rendered
- if (ajaxRequest && null != ajaxRenderedAreas) {
- ajaxRenderedAreas.add(childId);
- }
- }
- }
- } else {
- renderChildren(context, component);
- }
+ renderChildren(context, component);
}
/* (non-Javadoc)
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteRendererBase.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteRendererBase.java 2010-12-27 18:59:46 UTC (rev 20814)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/AutocompleteRendererBase.java 2010-12-27 19:16:45 UTC (rev 20815)
@@ -29,7 +29,9 @@
import java.util.Map;
import javax.el.ELException;
+import javax.el.ExpressionFactory;
import javax.el.MethodExpression;
+import javax.el.MethodNotFoundException;
import javax.faces.application.ResourceDependencies;
import javax.faces.application.ResourceDependency;
import javax.faces.component.UIComponent;
@@ -44,13 +46,15 @@
import javax.faces.model.ResultSetDataModel;
import javax.servlet.jsp.jstl.sql.Result;
-import org.ajax4jsf.context.AjaxContext;
import org.ajax4jsf.javascript.JSObject;
import org.ajax4jsf.javascript.JSReference;
import org.richfaces.component.AbstractAutocomplete;
import org.richfaces.component.AutocompleteLayout;
import org.richfaces.component.MetaComponentResolver;
import org.richfaces.component.util.InputUtils;
+import org.richfaces.context.ExtendedPartialViewContext;
+import org.richfaces.log.Logger;
+import org.richfaces.log.RichfacesLogger;
/**
* @author Nick Belaevski
@@ -67,6 +71,8 @@
})
public abstract class AutocompleteRendererBase extends InputRendererBase implements MetaComponentRenderer {
+ private static final Logger LOGGER = RichfacesLogger.RENDERKIT.getLogger();
+
public JSReference getClientFilterFunction(UIComponent component) {
AbstractAutocomplete autocomplete = (AbstractAutocomplete) component;
String clientFilter = (String) autocomplete.getAttributes().get("clientFilterFunction");
@@ -88,22 +94,19 @@
Map<String, String> requestParameters = facesContext.getExternalContext().getRequestParameterMap();
String value = requestParameters.get(component.getClientId(facesContext) + "Value");
try {
- // String value = getInputValue(facesContext, component);
-
- itemsObject = autocompleteMethod.invoke(facesContext.getELContext(), new Object[]{facesContext,
- component, value});
- } catch (ELException e) {
try {
- autocompleteMethod = facesContext
- .getApplication()
- .getExpressionFactory()
- .createMethodExpression(facesContext.getELContext(), autocompleteMethod.getExpressionString(),
- Void.class, new Class[]{String.class});
+ // String value = getInputValue(facesContext, component);
+ itemsObject = autocompleteMethod.invoke(facesContext.getELContext(), new Object[]{facesContext,
+ component, value});
+ } catch (MethodNotFoundException e) {
+ ExpressionFactory expressionFactory = facesContext.getApplication().getExpressionFactory();
+ autocompleteMethod = expressionFactory.createMethodExpression(facesContext.getELContext(),
+ autocompleteMethod.getExpressionString(),
+ Object.class, new Class[]{String.class});
itemsObject = autocompleteMethod.invoke(facesContext.getELContext(), new Object[]{value});
- } catch (ELException ee) {
- ee.printStackTrace();
}
-
+ } catch (ELException ee) {
+ LOGGER.error(ee.getMessage(), ee);
}
} else {
itemsObject = component.getAutocompleteList();
@@ -293,7 +296,7 @@
partialWriter.endUpdate();
if (!fetchValues.isEmpty()) {
- Map<String, Object> dataMap = AjaxContext.getCurrentInstance(context).getResponseComponentDataMap();
+ Map<String, Object> dataMap = ExtendedPartialViewContext.getInstance(context).getResponseComponentDataMap();
dataMap.put(component.getClientId(context), fetchValues);
}
} else {
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2010-12-27 18:59:46 UTC (rev 20814)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2010-12-27 19:16:45 UTC (rev 20815)
@@ -45,7 +45,6 @@
import javax.faces.convert.ConverterException;
import javax.faces.convert.DateTimeConverter;
-import org.ajax4jsf.context.AjaxContext;
import org.ajax4jsf.javascript.JSFunction;
import org.ajax4jsf.javascript.JSReference;
import org.richfaces.component.AbstractCalendar;
@@ -53,6 +52,7 @@
import org.richfaces.component.util.HtmlUtil;
import org.richfaces.component.util.MessageUtil;
import org.richfaces.component.util.SelectUtils;
+import org.richfaces.context.ExtendedPartialViewContext;
import org.richfaces.event.CurrentDateChangeEvent;
import org.richfaces.utils.CalendarHelper;
@@ -558,7 +558,7 @@
if (AbstractCalendar.DAYSDATA_META_COMPONENT_ID.equals(metaComponentId)) {
Object preload = ((AbstractCalendar) component).getPreload();
if (preload != null) {
- Map<String, Object> dataMap = AjaxContext.getCurrentInstance(context).getResponseComponentDataMap();
+ Map<String, Object> dataMap = ExtendedPartialViewContext.getInstance(context).getResponseComponentDataMap();
dataMap.put(component.getClientId(context), preload);
}
} else {
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeEncoderBase.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeEncoderBase.java 2010-12-27 18:59:46 UTC (rev 20814)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeEncoderBase.java 2010-12-27 19:16:45 UTC (rev 20815)
@@ -28,11 +28,11 @@
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
-import org.ajax4jsf.context.AjaxContext;
import org.ajax4jsf.javascript.JSFunction;
import org.richfaces.component.AbstractTree;
import org.richfaces.component.AbstractTreeNode;
import org.richfaces.component.util.HtmlUtil;
+import org.richfaces.context.ExtendedPartialViewContext;
import org.richfaces.model.TreeDataModelTuple;
import org.richfaces.model.TreeDataVisitor;
@@ -191,8 +191,8 @@
TreeNodeState initialState = (TreeNodeState) context.getAttributes().get(TreeNodeRendererBase.AJAX_TOGGLED_NODE_STATE_ATTRIBUTE);
if (initialState.isDifferentThan(nodeState)) {
- AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
- ajaxContext.appendOncomplete(new JSFunction("RichFaces.ui.TreeNode.emitToggleEvent", treeNode.getClientId(context)));
+ ExtendedPartialViewContext partialContext = ExtendedPartialViewContext.getInstance(context);
+ partialContext.appendOncomplete(new JSFunction("RichFaces.ui.TreeNode.emitToggleEvent", treeNode.getClientId(context)));
}
}
}
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeRendererBase.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeRendererBase.java 2010-12-27 18:59:46 UTC (rev 20814)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeRendererBase.java 2010-12-27 19:16:45 UTC (rev 20815)
@@ -36,13 +36,13 @@
import javax.faces.context.PartialViewContext;
import javax.faces.context.ResponseWriter;
-import org.ajax4jsf.context.AjaxContext;
import org.ajax4jsf.javascript.JSFunction;
import org.ajax4jsf.javascript.JSReference;
import org.richfaces.component.AbstractTree;
import org.richfaces.component.AbstractTreeNode;
import org.richfaces.component.MetaComponentResolver;
import org.richfaces.component.SwitchType;
+import org.richfaces.context.ExtendedPartialViewContext;
import org.richfaces.event.TreeSelectionChangeEvent;
import org.richfaces.log.Logger;
import org.richfaces.log.RichfacesLogger;
@@ -179,8 +179,8 @@
JSFunction function = new JSFunction("RichFaces.$", component.getClientId(context));
- AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
- ajaxContext.appendOncomplete(function.toScript() + ".__updateSelectionFromInput();");
+ ExtendedPartialViewContext partialContext = ExtendedPartialViewContext.getInstance(context);
+ partialContext.appendOncomplete(function.toScript() + ".__updateSelectionFromInput();");
} else {
throw new IllegalArgumentException(metaComponentId);
}
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java 2010-12-27 18:59:46 UTC (rev 20814)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/CollapsiblePanelRenderer.java 2010-12-27 19:16:45 UTC (rev 20815)
@@ -22,24 +22,28 @@
package org.richfaces.renderkit.html;
-import static org.richfaces.renderkit.HtmlConstants.*;
+import static org.richfaces.component.AbstractCollapsiblePanel.States.collapsed;
+import static org.richfaces.component.AbstractCollapsiblePanel.States.expanded;
+import static org.richfaces.renderkit.HtmlConstants.CLASS_ATTRIBUTE;
+import static org.richfaces.renderkit.HtmlConstants.DIV_ELEM;
+import static org.richfaces.renderkit.HtmlConstants.ID_ATTRIBUTE;
+import static org.richfaces.renderkit.HtmlConstants.STYLE_ATTRIBUTE;
-import org.ajax4jsf.javascript.JSObject;
-import org.richfaces.component.AbstractCollapsiblePanel;
-import org.richfaces.component.AbstractTogglePanel;
-import org.richfaces.component.AbstractTogglePanelTitledItem;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
import javax.faces.application.ResourceDependencies;
import javax.faces.application.ResourceDependency;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import static org.richfaces.component.AbstractCollapsiblePanel.States.*;
+import org.ajax4jsf.javascript.JSObject;
+import org.richfaces.component.AbstractCollapsiblePanel;
+import org.richfaces.component.AbstractTogglePanel;
+import org.richfaces.component.AbstractTogglePanelTitledItem;
/**
* @author akolonitsky
@@ -80,7 +84,7 @@
context.getPartialViewContext().getRenderIds().add(clientId);
//TODO nick - this should be done on encode, not on decode
- addOnCompleteParam(newValue, panel.getClientId());
+ addOnCompleteParam(context, newValue, panel.getClientId());
}
}
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java 2010-12-27 18:59:46 UTC (rev 20814)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuGroupRenderer.java 2010-12-27 19:16:45 UTC (rev 20815)
@@ -23,23 +23,39 @@
package org.richfaces.renderkit.html;
+import static org.richfaces.renderkit.HtmlConstants.ALT_ATTRIBUTE;
+import static org.richfaces.renderkit.HtmlConstants.CLASS_ATTRIBUTE;
+import static org.richfaces.renderkit.HtmlConstants.DIV_ELEM;
+import static org.richfaces.renderkit.HtmlConstants.ID_ATTRIBUTE;
+import static org.richfaces.renderkit.HtmlConstants.IMG_ELEMENT;
+import static org.richfaces.renderkit.HtmlConstants.INPUT_ELEM;
+import static org.richfaces.renderkit.HtmlConstants.INPUT_TYPE_HIDDEN;
+import static org.richfaces.renderkit.HtmlConstants.NAME_ATTRIBUTE;
+import static org.richfaces.renderkit.HtmlConstants.SRC_ATTRIBUTE;
+import static org.richfaces.renderkit.HtmlConstants.STYLE_ATTRIBUTE;
+import static org.richfaces.renderkit.HtmlConstants.TABLE_ELEMENT;
+import static org.richfaces.renderkit.HtmlConstants.TBODY_ELEMENT;
+import static org.richfaces.renderkit.HtmlConstants.TD_ELEM;
+import static org.richfaces.renderkit.HtmlConstants.TR_ELEMENT;
+import static org.richfaces.renderkit.HtmlConstants.TYPE_ATTR;
+import static org.richfaces.renderkit.HtmlConstants.VALUE_ATTRIBUTE;
+import static org.richfaces.renderkit.html.TogglePanelRenderer.addEventOption;
+import static org.richfaces.renderkit.html.TogglePanelRenderer.getAjaxOptions;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
import org.ajax4jsf.javascript.JSObject;
import org.richfaces.component.AbstractPanelMenuGroup;
import org.richfaces.component.AbstractPanelMenuItem;
import org.richfaces.component.html.HtmlPanelMenuGroup;
import org.richfaces.renderkit.RenderKitUtils;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-
-import static org.richfaces.renderkit.HtmlConstants.*;
-import static org.richfaces.renderkit.html.TogglePanelRenderer.addEventOption;
-import static org.richfaces.renderkit.html.TogglePanelRenderer.getAjaxOptions;
-
/**
* @author akolonitsky
* @since 2010-10-25
@@ -76,7 +92,7 @@
context.getPartialViewContext().getRenderIds().add(clientId);
//TODO nick - this should be done on encode, not on decode
- PanelMenuRenderer.addOnCompleteParam(clientId);
+ PanelMenuRenderer.addOnCompleteParam(context, clientId);
}
}
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java 2010-12-27 18:59:46 UTC (rev 20814)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PanelMenuRenderer.java 2010-12-27 19:16:45 UTC (rev 20815)
@@ -23,25 +23,26 @@
package org.richfaces.renderkit.html;
-import org.ajax4jsf.context.AjaxContext;
-import org.ajax4jsf.javascript.JSObject;
-import org.richfaces.component.AbstractPanelMenu;
-import org.richfaces.component.AbstractPanelMenuItem;
-import org.richfaces.component.html.HtmlPanelMenu;
-import org.richfaces.renderkit.HtmlConstants;
+import static org.richfaces.renderkit.html.TogglePanelRenderer.getAjaxOptions;
+import static org.richfaces.renderkit.html.TogglePanelRenderer.getValueRequestParamName;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
import javax.faces.application.ResourceDependencies;
import javax.faces.application.ResourceDependency;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import javax.faces.event.ActionEvent;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import static org.richfaces.renderkit.html.TogglePanelRenderer.getAjaxOptions;
-import static org.richfaces.renderkit.html.TogglePanelRenderer.getValueRequestParamName;
+import org.ajax4jsf.javascript.JSObject;
+import org.richfaces.component.AbstractPanelMenu;
+import org.richfaces.component.AbstractPanelMenuItem;
+import org.richfaces.component.html.HtmlPanelMenu;
+import org.richfaces.context.ExtendedPartialViewContext;
+import org.richfaces.renderkit.HtmlConstants;
/**
* @author akolonitsky
@@ -81,13 +82,13 @@
context.getPartialViewContext().getRenderIds().add(panelItem.getClientId(context));
//TODO nick - this should be done on encode, not on decode
- addOnCompleteParam(panelItem.getClientId(context));
+ addOnCompleteParam(context, panelItem.getClientId(context));
}
}
}
- protected static void addOnCompleteParam(String itemId) {
- AjaxContext.getCurrentInstance().appendOncomplete(new StringBuilder()
+ protected static void addOnCompleteParam(FacesContext context, String itemId) {
+ ExtendedPartialViewContext.getInstance(context).appendOncomplete(new StringBuilder()
.append("RichFaces.$('").append(itemId).append("').onCompleteHandler();").toString());
}
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarBaseRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarBaseRenderer.java 2010-12-27 18:59:46 UTC (rev 20814)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarBaseRenderer.java 2010-12-27 19:16:45 UTC (rev 20815)
@@ -37,12 +37,12 @@
import javax.faces.context.PartialResponseWriter;
import javax.faces.context.PartialViewContext;
-import org.ajax4jsf.context.AjaxContext;
import org.ajax4jsf.javascript.JSReference;
import org.richfaces.component.AbstractProgressBar;
import org.richfaces.component.MetaComponentResolver;
import org.richfaces.component.NumberUtils;
import org.richfaces.component.SwitchType;
+import org.richfaces.context.ExtendedPartialViewContext;
import org.richfaces.renderkit.AjaxFunction;
import org.richfaces.renderkit.AjaxOptions;
import org.richfaces.renderkit.MetaComponentRenderer;
@@ -169,8 +169,8 @@
if (AbstractProgressBar.STATE_META_COMPONENT_ID.equals(metaComponentId)) {
ProgressBarState state = getCurrentState(context, component);
- AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
- ajaxContext.getResponseComponentDataMap().put(component.getClientId(context), NumberUtils.getNumber(component.getAttributes().get("value")));
+ ExtendedPartialViewContext partialContext = ExtendedPartialViewContext.getInstance(context);
+ partialContext.getResponseComponentDataMap().put(component.getClientId(context), NumberUtils.getNumber(component.getAttributes().get("value")));
PartialResponseWriter partialResponseWriter = context.getPartialViewContext().getPartialResponseWriter();
partialResponseWriter.startUpdate(state.getStateClientId(context, component));
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java 2010-12-27 18:59:46 UTC (rev 20814)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java 2010-12-27 19:16:45 UTC (rev 20815)
@@ -34,13 +34,13 @@
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
-import org.ajax4jsf.context.AjaxContext;
import org.ajax4jsf.javascript.JSFunctionDefinition;
import org.ajax4jsf.javascript.JSObject;
import org.ajax4jsf.javascript.JSReference;
import org.richfaces.component.AbstractTogglePanel;
import org.richfaces.component.AbstractTogglePanelItem;
import org.richfaces.component.util.HtmlUtil;
+import org.richfaces.context.ExtendedPartialViewContext;
import org.richfaces.renderkit.AjaxOptions;
import org.richfaces.renderkit.HtmlConstants;
import org.richfaces.renderkit.util.AjaxRendererUtils;
@@ -87,17 +87,17 @@
context.getPartialViewContext().getRenderIds().add(panelItem.getClientId(context));
//TODO nick - this should be done on encode, not on decode
- addOnCompleteParam(newValue, panel.getClientId());
+ addOnCompleteParam(context, newValue, panel.getClientId());
}
}
}
- protected static void addOnCompleteParam(String newValue, String panelId) {
+ protected static void addOnCompleteParam(FacesContext context, String newValue, String panelId) {
StringBuilder onComplete = new StringBuilder();
onComplete.append("RichFaces.$('").append(panelId)
.append("').onCompleteHandler('").append(newValue).append("');");
- AjaxContext.getCurrentInstance().appendOncomplete(onComplete.toString());
+ ExtendedPartialViewContext.getInstance(context).appendOncomplete(onComplete.toString());
}
static String getValueRequestParamName(FacesContext context, UIComponent component) {
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TooltipRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TooltipRenderer.java 2010-12-27 18:59:46 UTC (rev 20814)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TooltipRenderer.java 2010-12-27 19:16:45 UTC (rev 20815)
@@ -23,7 +23,8 @@
package org.richfaces.renderkit.html;
-import static org.richfaces.renderkit.HtmlConstants.*;
+import static org.richfaces.renderkit.HtmlConstants.CLASS_ATTRIBUTE;
+import static org.richfaces.renderkit.HtmlConstants.ID_ATTRIBUTE;
import static org.richfaces.renderkit.RenderKitUtils.renderPassThroughAttributes;
import static org.richfaces.renderkit.html.TogglePanelRenderer.addEventOption;
import static org.richfaces.renderkit.html.TogglePanelRenderer.getAjaxOptions;
@@ -39,11 +40,11 @@
import javax.faces.context.PartialResponseWriter;
import javax.faces.context.ResponseWriter;
-import org.ajax4jsf.context.AjaxContext;
import org.ajax4jsf.javascript.JSObject;
import org.richfaces.TooltipMode;
import org.richfaces.component.AbstractTooltip;
import org.richfaces.component.html.HtmlTooltip;
+import org.richfaces.context.ExtendedPartialViewContext;
import org.richfaces.renderkit.HtmlConstants;
import org.richfaces.renderkit.MetaComponentRenderer;
@@ -81,12 +82,12 @@
context.getPartialViewContext().getRenderIds().add(tooltip.getContentClientId(context));
//TODO nick - this should be done on encode, not on decode
- addOnCompleteParam(tooltip.getClientId());
+ addOnCompleteParam(context, tooltip.getClientId());
}
}
- protected static void addOnCompleteParam(String tooltipId) {
- AjaxContext.getCurrentInstance().appendOncomplete(new StringBuilder()
+ protected static void addOnCompleteParam(FacesContext context, String tooltipId) {
+ ExtendedPartialViewContext.getInstance(context).appendOncomplete(new StringBuilder()
.append("RichFaces.$('").append(tooltipId).append("').onCompleteHandler();").toString());
}
Modified: trunk/ui/validator/ui/src/main/java/org/richfaces/component/UIAjaxValidator.java
===================================================================
--- trunk/ui/validator/ui/src/main/java/org/richfaces/component/UIAjaxValidator.java 2010-12-27 18:59:46 UTC (rev 20814)
+++ trunk/ui/validator/ui/src/main/java/org/richfaces/component/UIAjaxValidator.java 2010-12-27 19:16:45 UTC (rev 20815)
@@ -39,7 +39,6 @@
import javax.faces.event.FacesEvent;
import javax.faces.event.PhaseId;
-import org.ajax4jsf.context.AjaxContext;
import org.richfaces.event.ValidatorEvent;
/**
@@ -126,14 +125,14 @@
}
public void encodeAjax(FacesContext context) throws IOException {
- AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
- Set<String> renderedAreas = ajaxContext.getAjaxRenderedAreas();
- for (UIComponent message : getMessages(context, this)) {
- if (message.isRendered()) {
- message.encodeAll(context);
- renderedAreas.add(message.getClientId(context));
- }
- }
+// AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
+// Set<String> renderedAreas = ajaxContext.getAjaxRenderedAreas();
+// for (UIComponent message : getMessages(context, this)) {
+// if (message.isRendered()) {
+// message.encodeAll(context);
+// renderedAreas.add(message.getClientId(context));
+// }
+// }
// Write information about encoded areas after submission.
// AjaxRendererUtils.encodeAreas(context, this);
}
Deleted: trunk/ui/validator/ui/src/main/java/org/richfaces/component/UIBeanValidator.java
===================================================================
--- trunk/ui/validator/ui/src/main/java/org/richfaces/component/UIBeanValidator.java 2010-12-27 18:59:46 UTC (rev 20814)
+++ trunk/ui/validator/ui/src/main/java/org/richfaces/component/UIBeanValidator.java 2010-12-27 19:16:45 UTC (rev 20815)
@@ -1,25 +0,0 @@
-/**
- *
- */
-package org.richfaces.component;
-
-/**
- * Stage class to keep backward compatibility.
- *
- * @author asmirnov
- * @deprecated That class has been renamed, Use {@link UIAjaxValidator} instead
- *
- */
-public abstract class UIBeanValidator extends UIAjaxValidator {
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.component.UIComponent#getFamily()
- */
- @Override
- public String getFamily() {
- return COMPONENT_FAMILY;
- }
-
-}
14 years, 1 month
JBoss Rich Faces SVN: r20814 - in branches/RF-9323: core/api/src/main/java/org/ajax4jsf and 41 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-12-27 13:59:46 -0500 (Mon, 27 Dec 2010)
New Revision: 20814
Added:
branches/RF-9323/core/api/src/main/java/org/richfaces/el/GenericsIntrospectionService.java
branches/RF-9323/core/impl/src/main/java/org/richfaces/el/CapturingELResolver.java
branches/RF-9323/core/impl/src/main/java/org/richfaces/el/GenericsIntrospectionServiceImpl.java
branches/RF-9323/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/TreeModelDataBean.java
branches/RF-9323/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/PackageKey.java
branches/RF-9323/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/PackageKeyConverter.java
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/UITreeModelAdaptor.java
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/UITreeModelRecursiveAdaptor.java
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/view/facelets/TreeAdaptorRowKeyConverterRule.java
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/view/facelets/TreeModelAdaptorHandler.java
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/view/facelets/TreeModelRecursiveAdaptorHandler.java
Removed:
branches/RF-9323/core/api/src/main/java/org/ajax4jsf/component/AjaxChildrenEncoder.java
branches/RF-9323/core/api/src/main/java/org/ajax4jsf/component/AjaxComponent.java
branches/RF-9323/core/api/src/main/java/org/ajax4jsf/component/AjaxContainerBase.java
branches/RF-9323/core/api/src/main/java/org/ajax4jsf/component/AjaxDataEncoder.java
branches/RF-9323/core/api/src/main/java/org/ajax4jsf/component/AjaxSupport.java
branches/RF-9323/core/api/src/main/java/org/ajax4jsf/context/ViewIdHolder.java
branches/RF-9323/core/api/src/main/java/org/ajax4jsf/event/
branches/RF-9323/core/api/src/main/java/org/ajax4jsf/model/KeepAlive.java
branches/RF-9323/core/api/src/main/java/org/ajax4jsf/renderkit/
branches/RF-9323/core/api/src/main/java/org/richfaces/el/util/CapturingELResolver.java
branches/RF-9323/core/api/src/main/java/org/richfaces/el/util/GenericsIntrospectionCache.java
branches/RF-9323/core/api/src/main/java/org/richfaces/el/util/ReferenceMap.java
branches/RF-9323/core/impl/src/main/java/org/ajax4jsf/el/
branches/RF-9323/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/SimpleRecursiveNode.java
branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/renderkit/AjaxChildrenRenderer.java
branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/renderkit/AjaxComponentRendererBase.java
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTreeModelRecursiveAdaptor.java
Modified:
branches/RF-9323/
branches/RF-9323/core/api/src/main/java/org/ajax4jsf/context/AjaxContext.java
branches/RF-9323/core/api/src/main/java/org/richfaces/el/util/ELUtils.java
branches/RF-9323/core/api/src/main/java/org/richfaces/renderkit/util/CoreAjaxRendererUtils.java
branches/RF-9323/core/impl/src/main/java/org/ajax4jsf/context/AjaxContextImpl.java
branches/RF-9323/core/impl/src/main/java/org/richfaces/application/DefaultModule.java
branches/RF-9323/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/TreeModelBean.java
branches/RF-9323/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/SourceDirectory.java
branches/RF-9323/examples/iteration-demo/src/main/webapp/WEB-INF/faces-config.xml
branches/RF-9323/examples/iteration-demo/src/main/webapp/treeModel.xhtml
branches/RF-9323/examples/richfaces-showcase/src/main/java/org/richfaces/demo/panelmenu/PanelMenuBean.java
branches/RF-9323/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tables/model/slides/Picture.java
branches/RF-9323/examples/richfaces-showcase/src/main/webapp/richfaces/dragDrop/dragDrop.xhtml
branches/RF-9323/examples/richfaces-showcase/src/main/webapp/richfaces/dragDrop/samples/dragDrop-sample.xhtml
branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/component/UIDataAdaptor.java
branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/component/UISequence.java
branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/convert/ConverterUtil.java
branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/renderkit/util/AjaxRendererUtils.java
branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/view/facelets/RowKeyConverterRule.java
branches/RF-9323/ui/input/ui/src/main/java/org/richfaces/component/AbstractAutocomplete.java
branches/RF-9323/ui/input/ui/src/main/java/org/richfaces/renderkit/InputRendererBase.java
branches/RF-9323/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSlider.js
branches/RF-9323/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/select.js
branches/RF-9323/ui/input/ui/src/main/templates/inputnumberslider.template.xml
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/DataScrollerUtils.java
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractCollapsibleSubTable.java
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractCollapsibleSubTableToggler.java
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataScroller.java
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTreeModelAdaptor.java
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/DeclarativeTreeDataModelWalker.java
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/TreeModelAdaptor.java
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/TreeModelRecursiveAdaptor.java
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/convert/DeclarativeModelSequenceKeyConverter.java
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/convert/IntegerSequenceRowKeyConverter.java
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/convert/SequenceRowKeyConverter.java
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/model/DeclarativeTreeDataModelImpl.java
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/renderkit/SortingFilteringRowsRenderer.java
branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/taglib/DataScrollerHandler.java
branches/RF-9323/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datatable.js
branches/RF-9323/ui/iteration/ui/src/test/java/org/richfaces/renderkit/ExtendedDataTableRendererTest.java
branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/component/AbstractToolbar.java
branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/component/AbstractTooltip.java
branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/component/UITooltip.java
branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PopupPanelBaseRenderer.java
branches/RF-9323/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml
branches/RF-9323/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml
branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanel.ecss
branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanel.js
branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/menu.js
branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanel.ecss
branches/RF-9323/ui/validator/ui/src/main/java/org/richfaces/component/UIAjaxValidator.java
branches/RF-9323/ui/validator/ui/src/main/java/org/richfaces/component/UIGraphValidator.java
Log:
Merged revisions 20786,20788,20790-20796,20801-20813 via svnmerge from
https://svn.jboss.org/repos/richfaces/trunk
.......
r20786 | nbelaevski | 2010-12-23 09:16:54 -0800 (Thu, 23 Dec 2010) | 1 line
Legacy 3.x code removal
.......
r20788 | nbelaevski | 2010-12-23 11:24:00 -0800 (Thu, 23 Dec 2010) | 2 lines
Legacy 3.x code removal
ELUtils refactoring
.......
r20790 | amarkhel | 2010-12-24 06:26:38 -0800 (Fri, 24 Dec 2010) | 1 line
RF-9560 collapsiblePanel: use 'pointer' cursor over the switch control
.......
r20791 | nbelaevski | 2010-12-24 08:16:11 -0800 (Fri, 24 Dec 2010) | 1 line
Legacy 3.x code removal
.......
r20792 | abelevich | 2010-12-24 08:20:03 -0800 (Fri, 24 Dec 2010) | 1 line
RF-9967
.......
r20793 | nbelaevski | 2010-12-24 08:57:48 -0800 (Fri, 24 Dec 2010) | 1 line
Failing test ignored
.......
r20794 | abelevich | 2010-12-24 10:15:26 -0800 (Fri, 24 Dec 2010) | 1 line
re-fix RF-9931
.......
r20795 | nbelaevski | 2010-12-24 11:12:09 -0800 (Fri, 24 Dec 2010) | 1 line
Small performance optimization in declarative tree model impl.
.......
r20796 | konstantin.mishin | 2010-12-24 12:10:20 -0800 (Fri, 24 Dec 2010) | 1 line
RF-4464
.......
r20801 | amarkhel | 2010-12-26 15:24:08 -0800 (Sun, 26 Dec 2010) | 1 line
https://issues.jboss.org/browse/RF-9966 Dropdown menu component: close open menu when select another one
.......
r20802 | ilya_shaikovsky | 2010-12-27 01:31:58 -0800 (Mon, 27 Dec 2010) | 1 line
https://issues.jboss.org/browse/RF-10074
.......
r20803 | ilya_shaikovsky | 2010-12-27 02:00:18 -0800 (Mon, 27 Dec 2010) | 1 line
https://issues.jboss.org/browse/RF-10068
.......
r20804 | ilya_shaikovsky | 2010-12-27 02:13:24 -0800 (Mon, 27 Dec 2010) | 1 line
sysout removed
.......
r20805 | amarkhel | 2010-12-27 02:21:43 -0800 (Mon, 27 Dec 2010) | 1 line
https://issues.jboss.org/browse/RF-9653 popupPanel: trimOverlayedElements not working
.......
r20806 | Alex.Kolonitsky | 2010-12-27 04:32:01 -0800 (Mon, 27 Dec 2010) | 1 line
move TooltipDirection to commons-ui
.......
r20807 | amarkhel | 2010-12-27 04:48:01 -0800 (Mon, 27 Dec 2010) | 1 line
https://issues.jboss.org/browse/RF-9653 popupPanel: trimOverlayedElements not working
.......
r20808 | abelevich | 2010-12-27 05:36:30 -0800 (Mon, 27 Dec 2010) | 1 line
https://jira.jboss.org/browse/RF-9734
.......
r20809 | nbelaevski | 2010-12-27 05:37:38 -0800 (Mon, 27 Dec 2010) | 4 lines
https://issues.jboss.org/browse/RF-10047
https://issues.jboss.org/browse/RF-10038
https://issues.jboss.org/browse/RF-9995
.......
r20810 | abelevich | 2010-12-27 06:48:05 -0800 (Mon, 27 Dec 2010) | 1 line
https://jira.jboss.org/browse/RF-9937
.......
r20811 | abelevich | 2010-12-27 07:41:34 -0800 (Mon, 27 Dec 2010) | 1 line
RF-9939, RF-9944
.......
r20812 | nbelaevski | 2010-12-27 07:50:27 -0800 (Mon, 27 Dec 2010) | 4 lines
https://issues.jboss.org/browse/RF-10047
https://issues.jboss.org/browse/RF-10038
https://issues.jboss.org/browse/RF-9995
https://issues.jboss.org/browse/RF-10007
.......
r20813 | nbelaevski | 2010-12-27 08:10:14 -0800 (Mon, 27 Dec 2010) | 1 line
https://issues.jboss.org/browse/RF-9987
.......
Property changes on: branches/RF-9323
___________________________________________________________________
Name: svnmerge-integrated
- /trunk:1-20785
+ /trunk:1-20813
Deleted: branches/RF-9323/core/api/src/main/java/org/ajax4jsf/component/AjaxChildrenEncoder.java
===================================================================
--- branches/RF-9323/core/api/src/main/java/org/ajax4jsf/component/AjaxChildrenEncoder.java 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/core/api/src/main/java/org/ajax4jsf/component/AjaxChildrenEncoder.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -1,56 +0,0 @@
-/**
- * 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.ajax4jsf.component;
-
-import java.io.IOException;
-
-import java.util.Set;
-
-import javax.faces.context.FacesContext;
-
-/**
- * Marker interface for components, have ability to manipulate rendering in case of Ajax responses.
- * Such as ajax-enabled iterator, menus etc
- * @author shura
- *
- */
-public interface AjaxChildrenEncoder {
-
- /**
- * Iterate over all childs of components. If component id contains in list ,
- * or, if list is empty, compotents is submitted form - render it.
- * TODO - Instead of calculate full path for every component, build current Path
- * for componet and send as parameter.
- *
- * @param context -
- * current context
- * @param component -
- * curent faces component.
- * @param ids -
- * list of Id to render.
- * @throws IOException
- */
- public void encodeAjaxChild(FacesContext context, String path, Set<String> ids, Set<String> renderedAreas)
- throws IOException;
-}
Deleted: branches/RF-9323/core/api/src/main/java/org/ajax4jsf/component/AjaxComponent.java
===================================================================
--- branches/RF-9323/core/api/src/main/java/org/ajax4jsf/component/AjaxComponent.java 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/core/api/src/main/java/org/ajax4jsf/component/AjaxComponent.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -1,228 +0,0 @@
-/**
- * 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.ajax4jsf.component;
-
-/**
- * Base Interface for Ajax-enabled acting components.
- * TODO - extend <code>ActionSource</code>???
- * @author shura (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.2 $ $Date: 2007/01/23 20:01:01 $
- *
- */
-public interface AjaxComponent {
- public static final String AJAX_COMPONETT_PARAMETER = AjaxComponent.class.getName() + ".parameter";
-
- /**
- * setter method for property
- * @param new value of String, <code>Collection</code> or array of component's Id , updated in case of Ajax request by parent component. to set
- */
- public abstract void setReRender(Object targetId);
-
- /**
- * @return value or result of valueBinding of String, <code>Collection</code> or array of component's Id , updated in case of Ajax request by parent component.
- */
- public abstract Object getReRender();
-
- /**
- * setter method for property
- * @param new value of String, <code>Collection</code> or array of component's Id , processed at the phases 2-5
- * in the case of Ajax request by parent component. to set
- */
- public abstract void setProcess(Object targetId);
-
- /**
- * @return value or result of valueBinding of String, <code>Collection</code> or array of component's Id , processed at the phases 2-5 in case of Ajax request by parent component.
- */
- public abstract Object getProcess();
-
- /**
- * setter method for property
- * @param new value of ajaxType of control component - link or input to set
- */
-
-// public abstract void setAjaxType(String ajaxType);
-
- /**
- * @return value or result of valueBinding of ajaxType of control component - link or input
- */
-// public abstract String getAjaxType();
-
- /**
- * setter method for property
- * @param new value of Id ( in format of UIComponent.findComponent() call ) of request status indicator to set
- */
- public abstract void setStatus(String status);
-
- /**
- * @return value or result of valueBinding of Id ( in format of UIComponent.findComponent() call ) of request status indicator
- */
- public abstract String getStatus();
-
- /**
- * setter method for property
- * @param new value of Name of JavaScript function, called on complete Ajax request to set
- */
- public abstract void setOncomplete(String oncomplete);
-
- /**
- * @return value or result of valueBinding of Name of JavaScript function, called on complete Ajax request
- */
- public abstract String getOncomplete();
-
- /**
- * @return value or result of valueBinding of Name of JavaScript function, called before updating DOM
- */
- public abstract String getOnbeforedomupdate();
-
- /**
- * setter method for property
- * @param new value of Name of JavaScript function, called before updating DOM to set
- */
- public abstract void setOnbeforedomupdate(String beforeUpdate);
-
- public abstract String getOnbegin();
-
- public abstract void setOnbegin(String onbegin);
-
- /**
- * setter method for property
- * @param new value of custom data translated to oncomplete function by AJAX
- */
- public abstract void setData(Object data);
-
- /**
- * @return value of custom data for translate to oncomplete function by AJAX
- */
- public abstract Object getData();
-
- /**
- * setter method for property
- * @param new value of Submit ( or not ) full form on Ajax action. to set
- */
- public abstract void setLimitRender(boolean submitForm);
-
- /**
- * @return value or result of valueBinding of Submit ( or not ) full form on Ajax action.
- */
- public abstract boolean isLimitRender();
-
- /**
- * setter method for property
- * @param new value of Submit ( or not ) full form on Ajax action. to set
- */
- public abstract void setAjaxSingle(boolean single);
-
- /**
- * @return value or result of valueBinding of Submit ( or not ) full form on Ajax action.
- */
- public abstract boolean isAjaxSingle();
-
- /**
- * Getter for bypassUpdates bean property. Indicate that component must invoke listeners after Process Validators phase
- * and force render response after it - since no values of components will be updated. Can be used to perform validation of client input
- * using server-side validators.
- * @return true if component must force render after validation phase.
- */
- public abstract boolean isBypassUpdates();
-
- /**
- * Setter for bypassUpdates bean property.
- * @param bypass true if component must force render after validation phase.
- */
- public abstract void setBypassUpdates(boolean bypass);
-
- /**
- * Getter for property name of events queue on client side - for avoid to send requests too frequnly ( on key events, for example ), implementation will be generated by
- * componnents-generator
- * @return property value
- */
- public abstract String getEventsQueue();
-
- /**
- * Setter for flag indicated aborting unfinished ajax requests in queue.
- * @param newvalue - new property value. If true, unfinished request in queue will be aborted on new events.
- */
- public abstract void setIgnoreDupResponses(boolean newvalue);
-
- /**
- * Getter for property flag indicated aborting unfinished ajax requests in queue.
- * componnents-generator
- * @return property value
- */
- public abstract boolean isIgnoreDupResponses();
-
- /**
- * Setter for property name of events queue on client side - for avoid to send requests too frequnly ( on key events, for example ), implementation will be generated by
- * componnents-generator
- * @param newvalue - new property value
- */
- public abstract void setEventsQueue(String newvalue);
-
- /**
- * Getter for property Delay ( in ms. ) for send ajax request on JavaScript event. In conjunction with events queue can reduce number of requests on keyboard or mouse move events., implementation will be generated by
- * componnents-generator
- * @return property value
- */
- public abstract int getRequestDelay();
-
- /**
- * Setter for property Delay ( in ms. ) for send ajax request on JavaScript event. In conjunction with events queue can reduce number of requests on keyboard or mouse move events., implementation will be generated by
- * componnents-generator
- * @param newvalue - new property value
- */
- public abstract void setRequestDelay(int newvalue);
-
- /**
- * Getter for request timeout
- * @return timeout in ms.
- */
- public abstract int getTimeout();
-
- /**
- * Setter for request timeout
- * @param timeout new value in ms.
- */
- public abstract void setTimeout(int timeout);
-
- /**
- * Setter for a 'focus' bean property - id of component( or of DOM element ), to set focus after AJAX request.
- * @param focus
- */
- public abstract void setFocus(String focus);
-
- /**
- * @return
- */
- public abstract String getFocus();
-
- /**
- *
- */
- public abstract void setSimilarityGroupingId(String similarityGroupingId);
-
- /**
- *
- */
- public abstract String getSimilarityGroupingId();
-}
Deleted: branches/RF-9323/core/api/src/main/java/org/ajax4jsf/component/AjaxContainerBase.java
===================================================================
--- branches/RF-9323/core/api/src/main/java/org/ajax4jsf/component/AjaxContainerBase.java 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/core/api/src/main/java/org/ajax4jsf/component/AjaxContainerBase.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -1,87 +0,0 @@
-/**
- * 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.ajax4jsf.component;
-
-import javax.el.MethodExpression;
-
-/**
- * Base interface for controller component, managed AJAX Requests.
- * Component, implemented this interface, must always return <code>true</code> for
- * <code>javax.faces.component.UIComponent#getRendersChildren()</code> method.
- * in common, set of components, rendered of current request, maintain by it.
- * TODO - add capabilites for components, rendered in <code>PhaseListener</code>
- * @author shura (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.2 $ $Date: 2007/02/06 16:23:20 $
- *
- */
-public interface AjaxContainerBase {
-
- /**
- * getter for AjaxListener method. Same as for <code>ActionSource</code>
- *
- * @see javax.faces.component.ActionSource#getActionListener()
- */
- public MethodExpression getAjaxListener();
-
- /**
- * setter for AjaxListener <code>MethodBinding</code>
- * in case on AjaxRequest, component must call this method in
- * <code>PhaseId.APPLY_REQUEST_VALUES</code> or
- * <code>PhaseId.INVOKE_APPLICATION</code> phases, depend on immediate flag.
- *
- * @see javax.faces.component.ActionSource#setActionListener(javax.faces.el.MethodBinding)
- */
- public void setAjaxListener(MethodExpression ajaxListener);
-
- /**
- * getter for flag immediate call Listener's on PhaseId.APPLY_REQUEST_VALUES phase.
- *
- * @see javax.faces.component.ActionSource#isImmediate()
- */
- public boolean isImmediate();
-
- /**
- * getter for render method flag of subview. If true, on AJAX-request component render it children
- * after {@link com.sun.faces.lifecycle.Phase.INVOKE_APPLICATION }
- * @return value of selfRendered flag
- */
- public boolean isSelfRendered();
-
- /**
- * setter for self-render flag.
- * @param selfRendered
- */
- public void setSelfRendered(boolean selfRendered);
-
- /**
- * setter for immediate flag.
- *
- * @see javax.faces.component.ActionSource#setImmediate(boolean)
- */
- public void setImmediate(boolean immediate);
-
- public boolean isSubmitted();
-
- public void setSubmitted(boolean submitted);
-}
Deleted: branches/RF-9323/core/api/src/main/java/org/ajax4jsf/component/AjaxDataEncoder.java
===================================================================
--- branches/RF-9323/core/api/src/main/java/org/ajax4jsf/component/AjaxDataEncoder.java 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/core/api/src/main/java/org/ajax4jsf/component/AjaxDataEncoder.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -1,42 +0,0 @@
-/**
- * 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.ajax4jsf.component;
-
-import java.util.Set;
-
-/**
- * Interface for iterable component, allowed for render given set of rows in ajax response.
- * @author shura
- *
- */
-public interface AjaxDataEncoder extends AjaxChildrenEncoder {
-
- /**
- * @return Set for values of {@link org.ajax4jsf.model.ExtendedDataModel} keys, encoded in ajax response by
- * this component.
- */
- public Set<Object> getAjaxKeys();
-
- public void setAjaxKeys(Set<Object> ajaxKeys);
-}
Deleted: branches/RF-9323/core/api/src/main/java/org/ajax4jsf/component/AjaxSupport.java
===================================================================
--- branches/RF-9323/core/api/src/main/java/org/ajax4jsf/component/AjaxSupport.java 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/core/api/src/main/java/org/ajax4jsf/component/AjaxSupport.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -1,88 +0,0 @@
-/**
- * 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.ajax4jsf.component;
-
-import javax.faces.component.UIComponent;
-
-/**
- * Version of {@link org.ajax4jsf.component.AjaxComponent} for append
- * Ajax functions for non-ajax components
- * @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:57:34 $
- *
- */
-public interface AjaxSupport {
-
- /**
- * @return JavaScript eventString. Rebuild on every call, since
- * can be in loop ( as in dataTable ) with different parameters.
- */
- public String getEventString();
-
- /**
- * setter method for property
- * @param new value of Name of event property of parent component for build JavaScript AJAX.Submit call to set
- */
- public abstract void setEvent(String event);
-
- /**
- * @return value or result of valueBinding of Name of event property of parent component for build JavaScript AJAX.Submit call
- */
- public abstract String getEvent();
-
- /**
- * Name of JavaScript function, called before submit Ajax request
- * description
- *
- * @parameter
- * @return the acceptClass
- */
- public abstract String getOnsubmit();
-
- /**
- * @param newOnsubmit
- * the value to set
- */
- public abstract void setOnsubmit(String newOnsubmit);
-
- /**
- * Getter for property If true, disable default action for target event ( encode 'return false' to JavaScript ), implementation will be generated by
- * componnents-generator
- * @return property value
- */
- public abstract boolean isDisableDefault();
-
- /**
- * Setter for property If true, disable default action for target event ( encode 'return false' to JavaScript ), implementation will be generated by
- * componnents-generator
- * @param newvalue - new property value
- */
- public abstract void setDisableDefault(boolean newvalue);
-
- /**
- * Set property for JavaScrept event generated by this component.
- * @param parent
- */
- public void setParentProperties(UIComponent parent);
-}
Modified: branches/RF-9323/core/api/src/main/java/org/ajax4jsf/context/AjaxContext.java
===================================================================
--- branches/RF-9323/core/api/src/main/java/org/ajax4jsf/context/AjaxContext.java 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/core/api/src/main/java/org/ajax4jsf/context/AjaxContext.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -69,10 +69,6 @@
public abstract Object getOnbeforedomupdate();
- public abstract void setViewIdHolder(ViewIdHolder viewIdHolder);
-
- public abstract ViewIdHolder getViewIdHolder();
-
public abstract boolean removeRenderedArea(String id);
public abstract void addRenderedArea(String id);
Deleted: branches/RF-9323/core/api/src/main/java/org/ajax4jsf/context/ViewIdHolder.java
===================================================================
--- branches/RF-9323/core/api/src/main/java/org/ajax4jsf/context/ViewIdHolder.java 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/core/api/src/main/java/org/ajax4jsf/context/ViewIdHolder.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -1,37 +0,0 @@
-/**
- * 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.ajax4jsf.context;
-
-/**
- * Interface to skip navigation cases in ViewHandler and , instead, store new ViewId.
- * @author shura
- *
- */
-public interface ViewIdHolder {
- public boolean skipNavigation(String viewId);
-
- public String getViewId();
-
- public void setViewId(String newViewId);
-}
Deleted: branches/RF-9323/core/api/src/main/java/org/ajax4jsf/model/KeepAlive.java
===================================================================
--- branches/RF-9323/core/api/src/main/java/org/ajax4jsf/model/KeepAlive.java 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/core/api/src/main/java/org/ajax4jsf/model/KeepAlive.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -1,49 +0,0 @@
-/**
- * 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.ajax4jsf.model;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Marker annotation, to keep request-scope beans between requests in the view state.
- * @author asmirnov
- *
- */
-(a)Target(ElementType.TYPE)
-(a)Retention(RetentionPolicy.RUNTIME)
-@Documented
-public @interface KeepAlive {
-
- /**
- * Boolean attribute indicating whether kept beans are accessible for all requests or AJAX-only.
- *
- * @return
- * @since 3.2.2
- */
- boolean ajaxOnly() default false;
-}
Copied: branches/RF-9323/core/api/src/main/java/org/richfaces/el/GenericsIntrospectionService.java (from rev 20813, trunk/core/api/src/main/java/org/richfaces/el/GenericsIntrospectionService.java)
===================================================================
--- branches/RF-9323/core/api/src/main/java/org/richfaces/el/GenericsIntrospectionService.java (rev 0)
+++ branches/RF-9323/core/api/src/main/java/org/richfaces/el/GenericsIntrospectionService.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -0,0 +1,35 @@
+/*
+ * 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.el;
+
+import javax.el.ValueExpression;
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public interface GenericsIntrospectionService {
+
+ public Class<?> getContainerClass(FacesContext facesContext, ValueExpression expression);
+
+}
Deleted: branches/RF-9323/core/api/src/main/java/org/richfaces/el/util/CapturingELResolver.java
===================================================================
--- branches/RF-9323/core/api/src/main/java/org/richfaces/el/util/CapturingELResolver.java 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/core/api/src/main/java/org/richfaces/el/util/CapturingELResolver.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -1,68 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * 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.el.util;
-
-import javax.el.ELContext;
-import javax.el.ELResolver;
-
-import org.richfaces.el.ELResolverWrapper;
-
-/**
- * @author Nick Belaevski
- * @since 3.3.0
- */
-public class CapturingELResolver extends ELResolverWrapper {
- private Object base;
- private Object property;
-
- public CapturingELResolver(ELResolver resolver) {
- super(resolver);
- }
-
- @Override
- public Object getValue(ELContext context, Object base, Object property) {
- if ((base != null) && (property != null)) {
- this.base = base;
- this.property = property;
- }
-
- return super.getValue(context, base, property);
- }
-
- @Override
- public Class<?> getType(ELContext context, Object base, Object property) {
- if ((base != null) && (property != null)) {
- this.base = base;
- this.property = property;
- }
-
- return super.getType(context, base, property);
- }
-
- public Object getBase() {
- return base;
- }
-
- public Object getProperty() {
- return property;
- }
-}
Modified: branches/RF-9323/core/api/src/main/java/org/richfaces/el/util/ELUtils.java
===================================================================
--- branches/RF-9323/core/api/src/main/java/org/richfaces/el/util/ELUtils.java 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/core/api/src/main/java/org/richfaces/el/util/ELUtils.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -21,27 +21,7 @@
package org.richfaces.el.util;
-import java.beans.BeanInfo;
-import java.beans.IntrospectionException;
-import java.beans.Introspector;
-import java.beans.PropertyDescriptor;
-import java.lang.ref.SoftReference;
-import java.lang.reflect.Method;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.ResourceBundle;
-import javax.el.ELContext;
-import javax.el.ValueExpression;
-import javax.faces.FacesException;
-import javax.faces.context.FacesContext;
-
-import org.richfaces.el.ELContextWrapper;
-import org.richfaces.el.util.GenericsIntrospectionCache.GenericsCacheEntry;
-
/**
* @author asmirnov
*/
@@ -79,130 +59,4 @@
return false;
}
- public static Object evaluateValueExpression(ValueExpression expression, ELContext elContext) {
-
- if (expression.isLiteralText()) {
- return expression.getExpressionString();
- } else {
- return expression.getValue(elContext);
- }
-
- }
-
- public static ValueExpression createValueExpression(String expression) {
-
- return createValueExpression(expression, Object.class);
-
- }
-
- public static ValueExpression createValueExpression(String expression, Class<?> expectedType) {
- FacesContext context = FacesContext.getCurrentInstance();
- return context.getApplication().getExpressionFactory().createValueExpression(context.getELContext(), expression, expectedType);
- }
-
- private static Class<?> resolveType(Type type) {
- Class<?> result = Object.class;
-
- if (type instanceof ParameterizedType) {
- ParameterizedType parameterizedType = (ParameterizedType) type;
- Type[] types = parameterizedType.getActualTypeArguments();
-
- if ((types != null) && (types.length != 0)) {
- Type actualType = types[0];
-
- if (actualType instanceof Class) {
- result = (Class<?>) actualType;
- }
- }
- }
-
- return result;
- }
-
- private static BeanInfo getBeanInfo(Class<?> beanClass, GenericsCacheEntry entry) {
- BeanInfo beanInfo = null;
- SoftReference<BeanInfo> beanInfoReference = entry.beanInfoReference;
-
- if (beanInfoReference != null) {
- beanInfo = beanInfoReference.get();
- }
-
- if (beanInfo == null) {
- try {
- beanInfo = Introspector.getBeanInfo(beanClass);
- entry.beanInfoReference = new SoftReference<BeanInfo>(beanInfo);
- } catch (IntrospectionException e) {
- throw new FacesException(e.getMessage(), e);
- }
- }
-
- return beanInfo;
- }
-
- private static Class<?> getGenericCollectionType(FacesContext context, Object base, String propertyName) {
- Class<?> genericPropertyClass = null;
-
- if ((base != null) && (propertyName != null)) {
- Class<? extends Object> beanClass = base.getClass();
-
- // Map and ResourceBundle have special resolvers that we doesn't support
- if (!Map.class.isAssignableFrom(beanClass) && !ResourceBundle.class.isAssignableFrom(beanClass)) {
- GenericsIntrospectionCache introspectionCache = GenericsIntrospectionCache.getInstance(context);
-
- synchronized (introspectionCache) {
- GenericsCacheEntry cacheEntry = introspectionCache.getGenericCacheEntry(beanClass);
-
- if (cacheEntry.genericPropertiesClasses == null) {
- cacheEntry.genericPropertiesClasses = new HashMap<String, Class<?>>();
- } else {
- genericPropertyClass = cacheEntry.genericPropertiesClasses.get(propertyName);
- }
-
- if (genericPropertyClass == null) {
- if (!cacheEntry.genericPropertiesClasses.containsKey(propertyName)) {
- BeanInfo beanInfo = getBeanInfo(beanClass, cacheEntry);
- PropertyDescriptor[] descriptors = beanInfo.getPropertyDescriptors();
-
- for (PropertyDescriptor pd : descriptors) {
- if (propertyName.equals(pd.getName())) {
- Method readMethod = pd.getReadMethod();
-
- genericPropertyClass = resolveType(readMethod.getGenericReturnType());
-
- break;
- }
- }
-
- cacheEntry.genericPropertiesClasses.put(propertyName, genericPropertyClass);
- } else {
-
- // property Class has been already resolved as null
- }
- }
- }
- }
- }
-
- return genericPropertyClass;
- }
-
- public static Class<?> getContainerClass(FacesContext facesContext, ValueExpression expression) {
- ELContext initialELContext = facesContext.getELContext();
- CapturingELResolver capturingELResolver = new CapturingELResolver(initialELContext.getELResolver());
- Class<?> type = expression.getType(new ELContextWrapper(initialELContext, capturingELResolver));
- Class<?> containerType = type.getComponentType();
-
- if ((containerType == null) && (type != null)) {
- if (Collection.class.isAssignableFrom(type)) {
- Object base = capturingELResolver.getBase();
- Object property = capturingELResolver.getProperty();
-
- if ((base != null) && (property != null)) {
- containerType = getGenericCollectionType(facesContext, base, property.toString());
- }
- }
- }
-
- return containerType;
- }
}
Deleted: branches/RF-9323/core/api/src/main/java/org/richfaces/el/util/GenericsIntrospectionCache.java
===================================================================
--- branches/RF-9323/core/api/src/main/java/org/richfaces/el/util/GenericsIntrospectionCache.java 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/core/api/src/main/java/org/richfaces/el/util/GenericsIntrospectionCache.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -1,99 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * 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.el.util;
-
-import java.beans.BeanInfo;
-import java.lang.ref.Reference;
-import java.lang.ref.SoftReference;
-import java.util.Collections;
-import java.util.Map;
-
-import javax.faces.context.ExternalContext;
-import javax.faces.context.FacesContext;
-
-import org.richfaces.util.LRUMap;
-
-/**
- * @author Nick Belaevski
- * @since 3.3.0
- */
-final class GenericsIntrospectionCache {
- private static final String CACHE_SIZE_PARAMETER = "org.richfaces.GenericsIntrospectionCacheSize";
- private static final int DEFAULT_CACHE_SIZE = 256;
- private static final String INSTANCE_ATTRIBUTE_NAME = GenericsIntrospectionCache.class.getName();
- private Map<Class<?>, GenericsCacheEntry> genericsCache;
-
- private GenericsIntrospectionCache(int cacheSize) {
- genericsCache = new ReferenceMap<Class<?>,
- GenericsCacheEntry>(Collections.synchronizedMap(new LRUMap<Class<?>,
- Reference<GenericsCacheEntry>>(cacheSize)));
- }
-
- private static int getSize(ExternalContext externalContext) {
- int cacheSize = DEFAULT_CACHE_SIZE;
- String cacheSizeParameter = externalContext.getInitParameter(CACHE_SIZE_PARAMETER);
-
- if (cacheSizeParameter != null && cacheSizeParameter.length() != 0) {
- try {
- cacheSize = Integer.valueOf(cacheSizeParameter);
- } catch (NumberFormatException e) {
- externalContext.log("Error converting " + CACHE_SIZE_PARAMETER + " init parameter to int: "
- + e.getMessage(), e);
- }
- }
-
- return cacheSize;
- }
-
- public GenericsCacheEntry getGenericCacheEntry(Class<?> beanClass) {
- GenericsCacheEntry cacheEntry = genericsCache.get(beanClass);
-
- if (cacheEntry == null) {
- cacheEntry = new GenericsCacheEntry();
- genericsCache.put(beanClass, cacheEntry);
- }
-
- return cacheEntry;
- }
-
- static GenericsIntrospectionCache getInstance(FacesContext facesContext) {
- ExternalContext externalContext = facesContext.getExternalContext();
- Map<String, Object> applicationMap = externalContext.getApplicationMap();
- GenericsIntrospectionCache instance;
-
- synchronized (applicationMap) {
- instance = (GenericsIntrospectionCache) applicationMap.get(INSTANCE_ATTRIBUTE_NAME);
-
- if (instance == null) {
- instance = new GenericsIntrospectionCache(getSize(externalContext));
- applicationMap.put(INSTANCE_ATTRIBUTE_NAME, instance);
- }
- }
-
- return instance;
- }
-
- static final class GenericsCacheEntry {
- SoftReference<BeanInfo> beanInfoReference;
- Map<String, Class<?>> genericPropertiesClasses;
- }
-}
Deleted: branches/RF-9323/core/api/src/main/java/org/richfaces/el/util/ReferenceMap.java
===================================================================
--- branches/RF-9323/core/api/src/main/java/org/richfaces/el/util/ReferenceMap.java 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/core/api/src/main/java/org/richfaces/el/util/ReferenceMap.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -1,177 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * 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.el.util;
-
-import java.lang.ref.Reference;
-import java.lang.ref.ReferenceQueue;
-import java.lang.ref.SoftReference;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Created 17.03.2008
- *
- * @author Nick Belaevski
- * @since 3.2
- */
-public class ReferenceMap<K, V> implements Map<K, V> {
- private ReferenceQueue<V> queue = new ReferenceQueue<V>();
- private Map<K, Reference<V>> map;
-
- public ReferenceMap() {
- this(Collections.synchronizedMap(new HashMap<K, Reference<V>>()));
- }
-
- public ReferenceMap(Map<K, Reference<V>> map) {
- super();
- this.map = map;
- }
-
- private void purge() {
- Reference<? extends V> reference = null;
-
- while ((reference = queue.poll()) != null) {
- ReferenceMapSoftReference<?, ?> entry = (ReferenceMapSoftReference<?, ?>) reference;
-
- entry.clear();
- map.remove(entry.getKey());
- }
- }
-
- public void clear() {
- map.clear();
-
- Reference<? extends V> reference = null;
-
- while ((reference = queue.poll()) != null) {
-
- // release queue entries
- reference.clear();
- }
- }
-
- public boolean containsKey(Object key) {
- purge();
-
- return map.containsKey(key);
- }
-
- public boolean containsValue(Object value) {
- throw new UnsupportedOperationException();
- }
-
- public Set<java.util.Map.Entry<K, V>> entrySet() {
- throw new UnsupportedOperationException();
- }
-
- public V get(Object key) {
- purge();
-
- Reference<V> reference = map.get(key);
-
- if (reference != null) {
- return reference.get();
- }
-
- return null;
- }
-
- public boolean isEmpty() {
- purge();
-
- return map.isEmpty();
- }
-
- public Set<K> keySet() {
- purge();
-
- return map.keySet();
- }
-
- private V doPut(K key, V value) {
- Reference<V> reference = map.put(key, new ReferenceMapSoftReference<K, V>(key, value, queue));
-
- if (reference != null) {
- return reference.get();
- }
-
- return null;
- }
-
- public V put(K key, V value) {
- purge();
-
- V v = doPut(key, value);
-
- purge();
-
- return v;
- }
-
- public void putAll(Map<? extends K, ? extends V> t) {
- purge();
-
- for (Map.Entry<? extends K, ? extends V> entry : t.entrySet()) {
- doPut(entry.getKey(), entry.getValue());
- }
-
- purge();
- }
-
- public V remove(Object key) {
- purge();
-
- Reference<V> reference = map.remove(key);
-
- if (reference != null) {
- return reference.get();
- }
-
- return null;
- }
-
- public int size() {
- purge();
-
- return map.size();
- }
-
- public Collection<V> values() {
- throw new UnsupportedOperationException();
- }
-
- protected static class ReferenceMapSoftReference<K, V> extends SoftReference<V> {
- private K key;
-
- public ReferenceMapSoftReference(K key, V value, ReferenceQueue<? super V> queue) {
- super(value, queue);
- this.key = key;
- }
-
- public K getKey() {
- return key;
- }
- }
-}
Modified: branches/RF-9323/core/api/src/main/java/org/richfaces/renderkit/util/CoreAjaxRendererUtils.java
===================================================================
--- branches/RF-9323/core/api/src/main/java/org/richfaces/renderkit/util/CoreAjaxRendererUtils.java 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/core/api/src/main/java/org/richfaces/renderkit/util/CoreAjaxRendererUtils.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -34,7 +34,6 @@
import javax.faces.context.FacesContext;
import javax.faces.context.PartialResponseWriter;
-import org.ajax4jsf.component.AjaxComponent;
import org.ajax4jsf.context.AjaxContext;
import org.richfaces.application.ServiceTracker;
import org.richfaces.renderkit.AjaxDataSerializer;
@@ -181,14 +180,7 @@
* @return List of areas Id's , updated by this component.
*/
public static Set<String> getAjaxAreas(UIComponent uiComponent) {
- Object areas;
-
- if (uiComponent instanceof AjaxComponent) {
- areas = ((AjaxComponent) uiComponent).getReRender();
- } else {
- areas = uiComponent.getAttributes().get(AJAX_REGIONS_ATTRIBUTE);
- }
-
+ Object areas = uiComponent.getAttributes().get(AJAX_REGIONS_ATTRIBUTE);
return asIdsSet(areas);
}
@@ -200,14 +192,8 @@
* @since 3.3.0
*/
public static Set<String> getAjaxAreasToProcess(UIComponent component) {
- Object areas;
+ Object areas = component.getAttributes().get(AJAX_PROCESS_ATTRIBUTE);
- if (component instanceof AjaxComponent) {
- areas = ((AjaxComponent) component).getProcess();
- } else {
- areas = component.getAttributes().get(AJAX_PROCESS_ATTRIBUTE);
- }
-
return asIdsSet(areas);
}
@@ -277,15 +263,11 @@
public static boolean isAjaxLimitRender(UIComponent component) {
boolean result = false;
- if (component instanceof AjaxComponent) {
- result = ((AjaxComponent) component).isLimitRender();
+ Object limitRenderObject = component.getAttributes().get(LIMITRENDER_ATTR_NAME);
+ if (limitRenderObject instanceof Boolean) {
+ result = ((Boolean) limitRenderObject).booleanValue();
} else {
- Object limitRenderObject = component.getAttributes().get(LIMITRENDER_ATTR_NAME);
- if (limitRenderObject instanceof Boolean) {
- result = ((Boolean) limitRenderObject).booleanValue();
- } else {
- result = Boolean.valueOf(String.valueOf(limitRenderObject));
- }
+ result = Boolean.valueOf(String.valueOf(limitRenderObject));
}
return result;
@@ -300,10 +282,6 @@
*/
//TODO nick - refactor - remove this method?
public static String getAjaxOncomplete(UIComponent component) {
- if (component instanceof AjaxComponent) {
- return ((AjaxComponent) component).getOncomplete();
- }
-
return (String) component.getAttributes().get(ONCOMPLETE_ATTR_NAME);
}
@@ -315,10 +293,6 @@
*/
//TODO nick - refactor - remove this method?
public static String getAjaxOnBeforeDomUpdate(UIComponent component) {
- if (component instanceof AjaxComponent) {
- return ((AjaxComponent) component).getOnbeforedomupdate();
- }
-
return (String) component.getAttributes().get(ONBEFOREDOMUPDATE_ATTR_NAME);
}
@@ -328,10 +302,6 @@
* @since 4.0
*/
public static Object getAjaxData(UIComponent component) {
- if (component instanceof AjaxComponent) {
- return ((AjaxComponent) component).getData();
- }
-
return component.getAttributes().get(DATA_ATTR_NAME);
}
Modified: branches/RF-9323/core/impl/src/main/java/org/ajax4jsf/context/AjaxContextImpl.java
===================================================================
--- branches/RF-9323/core/impl/src/main/java/org/ajax4jsf/context/AjaxContextImpl.java 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/core/impl/src/main/java/org/ajax4jsf/context/AjaxContextImpl.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -76,7 +76,6 @@
Object onbeforedomupdate = null;
boolean selfRender = false;
String submittedRegionClientId = null;
- ViewIdHolder viewIdHolder = null;
Integer viewSequence = new Integer(1);
Map<String, Object> responseComponentDataMap = new HashMap<String, Object>();
Map<String, Object> commonAjaxParameters = new HashMap<String, Object>();
@@ -90,7 +89,6 @@
selfRender = false;
viewSequence = new Integer(1);
submittedRegionClientId = null;
- viewIdHolder = null;
responseComponentDataMap = new HashMap<String, Object>();
commonAjaxParameters = new HashMap<String, Object>();
responseData = null;
@@ -388,20 +386,6 @@
}
/**
- * @return the vievIdHolder
- */
- public ViewIdHolder getViewIdHolder() {
- return viewIdHolder;
- }
-
- /**
- * @param viewIdHolder the vievIdHolder to set
- */
- public void setViewIdHolder(ViewIdHolder viewIdHolder) {
- this.viewIdHolder = viewIdHolder;
- }
-
- /**
* @return the responseData
*/
public Object getResponseData() {
Modified: branches/RF-9323/core/impl/src/main/java/org/richfaces/application/DefaultModule.java
===================================================================
--- branches/RF-9323/core/impl/src/main/java/org/richfaces/application/DefaultModule.java 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/core/impl/src/main/java/org/richfaces/application/DefaultModule.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -5,6 +5,8 @@
import org.richfaces.application.push.PushContextFactory;
import org.richfaces.application.push.impl.jms.PushContextFactoryImpl;
import org.richfaces.cache.Cache;
+import org.richfaces.el.GenericsIntrospectionService;
+import org.richfaces.el.GenericsIntrospectionServiceImpl;
import org.richfaces.javascript.JavaScriptService;
import org.richfaces.javascript.JavaScriptServiceImpl;
import org.richfaces.l10n.BundleLoader;
@@ -31,7 +33,7 @@
factory.setInstance(ResourceLibraryFactory.class, new ResourceLibraryFactoryImpl());
factory.setInstance(PushContextFactory.class, ServiceLoader.loadService(PushContextFactory.class, PushContextFactoryImpl.class));
factory.setInstance(JavaScriptService.class, new JavaScriptServiceImpl());
-
+ factory.setInstance(GenericsIntrospectionService.class, new GenericsIntrospectionServiceImpl());
}
}
Copied: branches/RF-9323/core/impl/src/main/java/org/richfaces/el/CapturingELResolver.java (from rev 20813, trunk/core/impl/src/main/java/org/richfaces/el/CapturingELResolver.java)
===================================================================
--- branches/RF-9323/core/impl/src/main/java/org/richfaces/el/CapturingELResolver.java (rev 0)
+++ branches/RF-9323/core/impl/src/main/java/org/richfaces/el/CapturingELResolver.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -0,0 +1,66 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * 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.el;
+
+import javax.el.ELContext;
+import javax.el.ELResolver;
+
+/**
+ * @author Nick Belaevski
+ * @since 3.3.0
+ */
+public class CapturingELResolver extends ELResolverWrapper {
+ private Object base;
+ private Object property;
+
+ public CapturingELResolver(ELResolver resolver) {
+ super(resolver);
+ }
+
+ @Override
+ public Object getValue(ELContext context, Object base, Object property) {
+ if ((base != null) && (property != null)) {
+ this.base = base;
+ this.property = property;
+ }
+
+ return super.getValue(context, base, property);
+ }
+
+ @Override
+ public Class<?> getType(ELContext context, Object base, Object property) {
+ if ((base != null) && (property != null)) {
+ this.base = base;
+ this.property = property;
+ }
+
+ return super.getType(context, base, property);
+ }
+
+ public Object getBase() {
+ return base;
+ }
+
+ public Object getProperty() {
+ return property;
+ }
+}
Copied: branches/RF-9323/core/impl/src/main/java/org/richfaces/el/GenericsIntrospectionServiceImpl.java (from rev 20813, trunk/core/impl/src/main/java/org/richfaces/el/GenericsIntrospectionServiceImpl.java)
===================================================================
--- branches/RF-9323/core/impl/src/main/java/org/richfaces/el/GenericsIntrospectionServiceImpl.java (rev 0)
+++ branches/RF-9323/core/impl/src/main/java/org/richfaces/el/GenericsIntrospectionServiceImpl.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -0,0 +1,170 @@
+/*
+ * 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.el;
+
+import java.beans.BeanInfo;
+import java.beans.IntrospectionException;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.Method;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.Collection;
+import java.util.Map;
+import java.util.ResourceBundle;
+
+import javax.el.ELContext;
+import javax.el.ValueExpression;
+import javax.faces.FacesException;
+import javax.faces.context.FacesContext;
+
+import com.google.common.base.Function;
+import com.google.common.collect.MapMaker;
+
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class GenericsIntrospectionServiceImpl implements GenericsIntrospectionService {
+
+ private static final class GenericsCacheEntry {
+
+ private Class<?> beanClass;
+
+ private Map<String, Class<?>> containerClassesMap = new MapMaker().initialCapacity(2).makeComputingMap(new Function<String, Class<?>>() {
+
+ public Class<?> apply(String input) {
+ PropertyDescriptor propertyDescriptor = getPropertyDescriptor(input);
+ return getGenericContainerClass(propertyDescriptor);
+ }
+
+ });
+
+ public GenericsCacheEntry(Class<?> beanClass) {
+ this.beanClass = beanClass;
+ }
+
+ private Class<?> resolveType(Type type) {
+ Class<?> result = Object.class;
+
+ if (type instanceof ParameterizedType) {
+ ParameterizedType parameterizedType = (ParameterizedType) type;
+ Type[] types = parameterizedType.getActualTypeArguments();
+
+ if (types != null && types.length != 0) {
+ Type actualType = types[0];
+
+ if (actualType instanceof Class) {
+ result = (Class<?>) actualType;
+ }
+ }
+ }
+
+ return result;
+ }
+
+ private Class<?> getGenericContainerClass(PropertyDescriptor pd) {
+ if (pd == null) {
+ return null;
+ }
+
+ Method readMethod = pd.getReadMethod();
+ if (readMethod == null) {
+ return null;
+ }
+
+ return resolveType(readMethod.getGenericReturnType());
+ }
+
+ private PropertyDescriptor getPropertyDescriptor(String propertyName) {
+ BeanInfo beanInfo = null;
+ try {
+ beanInfo = Introspector.getBeanInfo(beanClass);
+ } catch (IntrospectionException e) {
+ throw new FacesException(e.getMessage(), e);
+ } finally {
+ Introspector.flushFromCaches(beanClass);
+ }
+
+ if (beanInfo == null) {
+ return null;
+ }
+
+ PropertyDescriptor[] propertyDescriptorsArray = beanInfo.getPropertyDescriptors();
+ for (PropertyDescriptor pd : propertyDescriptorsArray) {
+ if (propertyName.equals(pd.getName())) {
+ return pd;
+ }
+ }
+
+ return null;
+ }
+
+ public Class<?> getContainerClass(String propertyName) {
+ return containerClassesMap.get(propertyName);
+ }
+
+ }
+
+ private final Map<Class<?>, GenericsCacheEntry> cache = new MapMaker().weakKeys().softValues().makeComputingMap(new Function<Class<?>, GenericsCacheEntry>() {
+ public GenericsCacheEntry apply(java.lang.Class<?> input) {
+ return new GenericsCacheEntry(input);
+ };
+ });
+
+ private Class<?> getGenericCollectionType(FacesContext context, Object base, String propertyName) {
+ Class<?> genericPropertyClass = null;
+
+ if ((base != null) && (propertyName != null)) {
+ Class<? extends Object> beanClass = base.getClass();
+
+ // Map and ResourceBundle have special resolvers that we doesn't support
+ if (!Map.class.isAssignableFrom(beanClass) && !ResourceBundle.class.isAssignableFrom(beanClass)) {
+ return cache.get(beanClass).getContainerClass(propertyName);
+ }
+ }
+
+ return genericPropertyClass;
+ }
+
+ public Class<?> getContainerClass(FacesContext facesContext, ValueExpression expression) {
+ ELContext initialELContext = facesContext.getELContext();
+ CapturingELResolver capturingELResolver = new CapturingELResolver(initialELContext.getELResolver());
+ Class<?> type = expression.getType(new ELContextWrapper(initialELContext, capturingELResolver));
+ Class<?> containerType = type.getComponentType();
+
+ if ((containerType == null) && (type != null)) {
+ if (Collection.class.isAssignableFrom(type)) {
+ Object base = capturingELResolver.getBase();
+ Object property = capturingELResolver.getProperty();
+
+ if ((base != null) && (property != null)) {
+ containerType = getGenericCollectionType(facesContext, base, property.toString());
+ }
+ }
+ }
+
+ return containerType;
+ }
+
+}
Modified: branches/RF-9323/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/TreeModelBean.java
===================================================================
--- branches/RF-9323/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/TreeModelBean.java 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/TreeModelBean.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -1,61 +1,45 @@
-/**
- *
+/*
+ * 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.demo.model.tree;
-import javax.faces.FacesException;
-import javax.faces.bean.ApplicationScoped;
import javax.faces.bean.ManagedBean;
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Unmarshaller;
-import javax.xml.bind.Unmarshaller.Listener;
+import javax.faces.bean.ViewScoped;
-import org.richfaces.demo.model.tree.adaptors.Entry;
-import org.richfaces.demo.model.tree.adaptors.Root;
-
/**
* @author Nick Belaevski
- * mailto:nbelaevski@exadel.com
- * created 25.07.2007
- *
+ *
*/
@ManagedBean
-@ApplicationScoped
+@ViewScoped
public class TreeModelBean {
-
- private Root root;
-
- private void initializeRoot() {
-
- try {
- JAXBContext context = JAXBContext.newInstance(Root.class);
- Unmarshaller unmarshaller = context.createUnmarshaller();
- unmarshaller.setListener(new Listener() {
- @Override
- public void afterUnmarshal(Object target, Object parent) {
- super.afterUnmarshal(target, parent);
-
- if (parent instanceof Entry) {
- ((Entry) target).setParent((Entry) parent);
- }
-
- }
- });
-
-
- root = (Root) unmarshaller.unmarshal(TreeModelBean.class.getResource("tree-model-data.xml"));
- } catch (JAXBException e) {
- throw new FacesException(e.getMessage(), e);
- }
+
+ private boolean projectIsLeaf = false;
+
+ public boolean isProjectIsLeaf() {
+ return projectIsLeaf;
}
-
- public Root getRoot() {
- if (root == null) {
- initializeRoot();
- }
-
- return root;
- }
+ public void setProjectIsLeaf(boolean projectIsLeaf) {
+ this.projectIsLeaf = projectIsLeaf;
+ }
+
}
Copied: branches/RF-9323/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/TreeModelDataBean.java (from rev 20813, trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/TreeModelDataBean.java)
===================================================================
--- branches/RF-9323/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/TreeModelDataBean.java (rev 0)
+++ branches/RF-9323/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/TreeModelDataBean.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -0,0 +1,61 @@
+/**
+ *
+ */
+package org.richfaces.demo.model.tree;
+
+import javax.faces.FacesException;
+import javax.faces.bean.ApplicationScoped;
+import javax.faces.bean.ManagedBean;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.bind.Unmarshaller.Listener;
+
+import org.richfaces.demo.model.tree.adaptors.Entry;
+import org.richfaces.demo.model.tree.adaptors.Root;
+
+/**
+ * @author Nick Belaevski
+ * mailto:nbelaevski@exadel.com
+ * created 25.07.2007
+ *
+ */
+@ManagedBean
+@ApplicationScoped
+public class TreeModelDataBean {
+
+ private Root root;
+
+ private void initializeRoot() {
+
+ try {
+ JAXBContext context = JAXBContext.newInstance(Root.class);
+ Unmarshaller unmarshaller = context.createUnmarshaller();
+ unmarshaller.setListener(new Listener() {
+ @Override
+ public void afterUnmarshal(Object target, Object parent) {
+ super.afterUnmarshal(target, parent);
+
+ if (parent instanceof Entry) {
+ ((Entry) target).setParent((Entry) parent);
+ }
+
+ }
+ });
+
+
+ root = (Root) unmarshaller.unmarshal(TreeModelDataBean.class.getResource("tree-model-data.xml"));
+ } catch (JAXBException e) {
+ throw new FacesException(e.getMessage(), e);
+ }
+ }
+
+ public Root getRoot() {
+ if (root == null) {
+ initializeRoot();
+ }
+
+ return root;
+ }
+
+}
Copied: branches/RF-9323/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/PackageKey.java (from rev 20813, trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/PackageKey.java)
===================================================================
--- branches/RF-9323/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/PackageKey.java (rev 0)
+++ branches/RF-9323/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/PackageKey.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -0,0 +1,72 @@
+/*
+ * 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.demo.model.tree.adaptors;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class PackageKey {
+
+ private String packageName;
+
+ public PackageKey(String packageName) {
+ super();
+ this.packageName = packageName;
+ }
+
+ public String getPackageName() {
+ return packageName;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((packageName == null) ? 0 : packageName.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ PackageKey other = (PackageKey) obj;
+ if (packageName == null) {
+ if (other.packageName != null) {
+ return false;
+ }
+ } else if (!packageName.equals(other.packageName)) {
+ return false;
+ }
+ return true;
+ }
+
+
+}
Copied: branches/RF-9323/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/PackageKeyConverter.java (from rev 20813, trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/PackageKeyConverter.java)
===================================================================
--- branches/RF-9323/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/PackageKeyConverter.java (rev 0)
+++ branches/RF-9323/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/PackageKeyConverter.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -0,0 +1,52 @@
+/*
+ * 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.demo.model.tree.adaptors;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+
+import com.google.common.base.Strings;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class PackageKeyConverter implements Converter {
+
+ public Object getAsObject(FacesContext context, UIComponent component, String value) {
+ if (Strings.isNullOrEmpty(value)) {
+ return null;
+ }
+
+ return new PackageKey(value);
+ }
+
+ public String getAsString(FacesContext context, UIComponent component, Object value) {
+ if (value == null) {
+ return "";
+ }
+
+ return ((PackageKey) value).getPackageName();
+ }
+
+}
Deleted: branches/RF-9323/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/SimpleRecursiveNode.java
===================================================================
--- branches/RF-9323/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/SimpleRecursiveNode.java 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/SimpleRecursiveNode.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -1,76 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, 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.demo.model.tree.adaptors;
-
-import java.util.List;
-
-import com.google.common.collect.Lists;
-
-/**
- * @author Nick Belaevski
- * @since 3.2
- */
-
-public class SimpleRecursiveNode {
-
- private SimpleRecursiveNode parent;
-
- private List<SimpleRecursiveNode> children = Lists.newArrayList();
-
- private String text;
-
- public SimpleRecursiveNode(SimpleRecursiveNode parent, String text) {
- super();
- this.parent = parent;
- if (parent != null) {
- parent.addChild(this);
- }
- this.text = text;
- }
-
- public void addChild(SimpleRecursiveNode node) {
- children.add(node);
- }
-
- public void removeChild(SimpleRecursiveNode node) {
- children.remove(node);
- }
-
- public void remove() {
- if (parent != null) {
- parent.removeChild(this);
- }
- }
-
- public SimpleRecursiveNode getParent() {
- return parent;
- }
-
- public List<SimpleRecursiveNode> getChildren() {
- return children;
- }
-
- public String getText() {
- return text;
- }
-}
Modified: branches/RF-9323/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/SourceDirectory.java
===================================================================
--- branches/RF-9323/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/SourceDirectory.java 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/SourceDirectory.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -23,9 +23,13 @@
package org.richfaces.demo.model.tree.adaptors;
import java.util.List;
+import java.util.Map;
import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlTransient;
+import com.google.common.collect.Maps;
+
/**
* @author Nick Belaevski
* mailto:nbelaevski@exadel.com
@@ -37,8 +41,19 @@
@XmlElement(name = "package")
private List<Package> packages;
- public List<Package> getPackages() {
- return packages;
+ @XmlTransient
+ private Map<PackageKey, Package> packagesMap;
+
+ public Map<PackageKey, Package> getPackages() {
+ if (packagesMap == null && packages != null) {
+ packagesMap = Maps.newLinkedHashMap();
+
+ for (Package pkg: packages) {
+ packagesMap.put(new PackageKey(pkg.getName()), pkg);
+ }
+ }
+
+ return packagesMap;
}
}
Modified: branches/RF-9323/examples/iteration-demo/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- branches/RF-9323/examples/iteration-demo/src/main/webapp/WEB-INF/faces-config.xml 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/examples/iteration-demo/src/main/webapp/WEB-INF/faces-config.xml 2010-12-27 18:59:46 UTC (rev 20814)
@@ -1,7 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
- version="2.0">
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
+ version="2.0">
+
+
+ <converter>
+ <converter-id>org.richfaces.demo.PackageKeyConverter</converter-id>
+ <converter-class>org.richfaces.demo.model.tree.adaptors.PackageKeyConverter</converter-class>
+ </converter>
</faces-config>
Modified: branches/RF-9323/examples/iteration-demo/src/main/webapp/treeModel.xhtml
===================================================================
--- branches/RF-9323/examples/iteration-demo/src/main/webapp/treeModel.xhtml 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/examples/iteration-demo/src/main/webapp/treeModel.xhtml 2010-12-27 18:59:46 UTC (rev 20814)
@@ -16,13 +16,18 @@
<h:messages id="messages" />
</a4j:outputPanel>
+ <h:form>
+ Project is leaf:
+ <h:selectBooleanCheckbox value="#{treeModelBean.projectIsLeaf}" onclick="submit()" />
+ </h:form>
+
<h:form id="form">
<it:tree id="tree" var="node" toggleType="ajax">
<it:treeNode>
<a4j:commandLink value="#{node}" action="#{node.processClick}" />
</it:treeNode>
- <it:treeModelAdaptor nodes="#{treeModelBean.root.projects}">
+ <it:treeModelAdaptor nodes="#{treeModelDataBean.root.projects}" leaf="#{treeModelBean.projectIsLeaf}">
<it:treeNode iconExpanded="/images/folder_key.png" iconCollapsed="/images/folder_key.png">
<a4j:commandLink value="#{node}" action="#{node.processClick}" />
</it:treeNode>
@@ -32,7 +37,7 @@
<a4j:commandLink value="#{node}" action="#{node.processClick}" />
</it:treeNode>
- <it:treeModelAdaptor nodes="#{node.packages}">
+ <it:treeModelAdaptor nodes="#{node.packages}" rowKeyConverter="org.richfaces.demo.PackageKeyConverter">
<it:treeModelAdaptor nodes="#{node.classes}" />
</it:treeModelAdaptor>
</it:treeModelAdaptor>
Modified: branches/RF-9323/examples/richfaces-showcase/src/main/java/org/richfaces/demo/panelmenu/PanelMenuBean.java
===================================================================
--- branches/RF-9323/examples/richfaces-showcase/src/main/java/org/richfaces/demo/panelmenu/PanelMenuBean.java 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/examples/richfaces-showcase/src/main/java/org/richfaces/demo/panelmenu/PanelMenuBean.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -29,6 +29,5 @@
public void updateCurrent(ItemChangeEvent event) {
setCurrent(event.getNewItem());
- System.out.println(event.getNewItem());
}
}
Modified: branches/RF-9323/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tables/model/slides/Picture.java
===================================================================
--- branches/RF-9323/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tables/model/slides/Picture.java 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tables/model/slides/Picture.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -1,6 +1,8 @@
package org.richfaces.demo.tables.model.slides;
-public class Picture {
+import java.io.Serializable;
+
+public class Picture implements Serializable{
private String name;
private String uri;
Modified: branches/RF-9323/examples/richfaces-showcase/src/main/webapp/richfaces/dragDrop/dragDrop.xhtml
===================================================================
--- branches/RF-9323/examples/richfaces-showcase/src/main/webapp/richfaces/dragDrop/dragDrop.xhtml 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/examples/richfaces-showcase/src/main/webapp/richfaces/dragDrop/dragDrop.xhtml 2010-12-27 18:59:46 UTC (rev 20814)
@@ -5,6 +5,39 @@
xmlns:ui="http://java.sun.com/jsf/facelets">
<ui:composition>
+ <p>The Richfaces Drag-n-Drop component suite includes three
+ components: <b>dragSource</b>, <b>dropTarget </b>and <b>dragIndicator</b>.</p>
+
+ <p><b>rich:dragSource </b>is used to point to the JSF component
+ that becomes draggable. If you want to add a draggable feature to the
+ existing component, attach dragSupport as a child component to it.</p>
+
+ <p><b>rich:dropSupport </b>is similar to the dragSupport, but it's
+ used to define the drog zone. dropSupport has a built-in Ajax support.
+ I.e. it allows to send an Ajax request and re-render the specified area
+ on a page when the Ajax response is returned back. With the <b>dropListener
+ </b>attribute you can point to a method of the backing bean that accepts <b>
+ DropEvent </b>as a parameter. This event contains information provided by <b>
+ dropValue </b>and <b>dragValue </b>attributes of dropSupport and
+ dragSupport.</p>
+
+ <p><b>rich:dragIndicator</b> is a special visual representation of
+ a dragged object. By default it creates a copy of dragged elements. But
+ the markup could be redefined(<u>not implemented in first release</u>).</p>
+
+ <p>Note: The parent component for dragSupport and dropSupport
+ should be designed to render its children and has two attribute
+ "onmouseover" and "onmouseout". You can use <a4j:outputPanel> as
+ a container if the component is not satisfy this requirements. Use
+ <a4j:outputPanel> layout="block" to wrap the component with a
+ block type layout.</p>
+
+ <p>The following example demonstrates the drag-n-drop functionality
+ on practice. The left list contains the examples of Ajax frameworks. Do
+ you know them? The demo helps you to sort them out. Drag one and drag
+ over the headers of three panels. If the draggable framework is
+ suitable for a certain framework family, it will be accepted and moved
+ from source panel to the target list.</p>
<ui:include src="#{demoNavigator.sampleIncludeURI}" />
<ui:include src="/templates/includes/source-view.xhtml">
<ui:param name="src" value="#{demoNavigator.sampleIncludeURI}" />
@@ -12,5 +45,11 @@
<ui:param name="openLabel" value="View Source" />
<ui:param name="hideLabel" value="Hide Source" />
</ui:include>
+ <p>That demo shows most important feature of the RichFaces drag and
+ drop mechanism. You could mark several different components as
+ 'draggable' and define different drag <b>type</b>'s for them via
+ attribute. Then you could add corresponding drop zones and use <b>acceptType</b>'s
+ attributes to define which drop zone will process corresponding dragged
+ elements.</p>
</ui:composition>
</html>
\ No newline at end of file
Modified: branches/RF-9323/examples/richfaces-showcase/src/main/webapp/richfaces/dragDrop/samples/dragDrop-sample.xhtml
===================================================================
--- branches/RF-9323/examples/richfaces-showcase/src/main/webapp/richfaces/dragDrop/samples/dragDrop-sample.xhtml 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/examples/richfaces-showcase/src/main/webapp/richfaces/dragDrop/samples/dragDrop-sample.xhtml 2010-12-27 18:59:46 UTC (rev 20814)
@@ -7,24 +7,17 @@
xmlns:rich="http://richfaces.org/rich">
<h:outputStylesheet>
- .panelc {
- width:25%;
- vertical-align:top;
- }
-
- .dropTargetPanel {
- width: 90%;
- }
-
+ .panelc { width:25%; }
+ .valign { vertical-align:top; }
+ .dropTargetPanel { width: 90%; }
.footerClass {
text-align: center;
padding-top: 5px;
}
</h:outputStylesheet>
-
<h:form id="form">
- <h:panelGrid columnClasses="panelc" columns="4" width="100%">
+ <h:panelGrid columnClasses="panelc valign, valign, valign, valign" columns="4" width="100%">
<rich:panel style="width:133px">
<f:facet name="header">
@@ -37,14 +30,14 @@
<a4j:outputPanel
style="width:100px;border:1px solid gray;padding:2px"
layout="block">
- <rich:dragBehavior event="mouseover"
- type="#{fm.family}" dragValue="#{fm}" />
+ <rich:dragSource type="#{fm.family}"
+ dragValue="#{fm}" />
<h:outputText value="#{fm.name}"></h:outputText>
</a4j:outputPanel>
</h:column>
<f:facet name="footer">
- <a4j:commandButton action="#{dragDropBean.reset}" value="Start Over"
- render="src,phptable,cftable,dnettable" />
+ <a4j:commandButton action="#{dragDropBean.reset}"
+ value="Start Over" render="src,phptable,cftable,dnettable" />
</f:facet>
</h:dataTable>
</rich:panel>
@@ -53,8 +46,9 @@
<f:facet name="header">
<h:outputText value="PHP Frameworks" />
</f:facet>
- <rich:dropBehavior event="mouseover" acceptedTypes="php" dropValue="PHP"
- listener="#{dragDropEventBean.processDrop}" render="phptable, src" />
+ <rich:dropTarget acceptedTypes="php" dropValue="PHP"
+ dropListener="#{dragDropEventBean.processDrop}"
+ render="phptable, src" />
<h:dataTable id="phptable" columns="1"
value="#{dragDropBean.targetPHP}" var="fm">
@@ -70,8 +64,9 @@
<f:facet name="header">
<h:outputText value=".NET Frameworks" />
</f:facet>
- <rich:dropBehavior event="mouseover" acceptedTypes="dotNet" dropValue="DNET"
- listener="#{dragDropEventBean.processDrop}" render="dnettable, src" />
+ <rich:dropTarget acceptedTypes="dotNet" dropValue="DNET"
+ dropListener="#{dragDropEventBean.processDrop}"
+ render="dnettable, src" />
<h:dataTable id="dnettable" columns="1"
value="#{dragDropBean.targetDotNet}" var="fm">
@@ -87,11 +82,12 @@
<f:facet name="header">
<h:outputText value="ColdFusion Frameworks" />
</f:facet>
- <rich:dropBehavior event="mouseover" acceptedTypes="cf" dropValue="CF"
- listener="#{dragDropEventBean.processDrop}" render="cftable, src" />
+ <rich:dropTarget acceptedTypes="cf" dropValue="CF"
+ dropListener="#{dragDropEventBean.processDrop}"
+ render="cftable, src" />
- <h:dataTable id="cftable" columns="1" value="#{dragDropBean.targetCF}"
- var="fm">
+ <h:dataTable id="cftable" columns="1"
+ value="#{dragDropBean.targetCF}" var="fm">
<h:column>
<h:outputText value="#{fm.name}"></h:outputText>
</h:column>
Modified: branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/component/UIDataAdaptor.java
===================================================================
--- branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/component/UIDataAdaptor.java 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/component/UIDataAdaptor.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -69,6 +69,7 @@
import org.ajax4jsf.model.DataVisitor;
import org.ajax4jsf.model.ExtendedDataModel;
import org.ajax4jsf.model.Range;
+import org.richfaces.cdk.annotations.Attribute;
import org.richfaces.context.ExtendedVisitContext;
import org.richfaces.log.Logger;
import org.richfaces.log.RichfacesLogger;
@@ -574,6 +575,7 @@
this.extendedDataModel = extendedDataModel;
}
+ @Attribute
public String getVar() {
return (String) getStateHelper().get(PropertyKeys.var);
}
@@ -582,6 +584,7 @@
getStateHelper().put(PropertyKeys.var, var);
}
+ @Attribute
public String getRowKeyVar() {
return (String) getStateHelper().get(PropertyKeys.rowKeyVar);
}
@@ -590,6 +593,7 @@
getStateHelper().put(PropertyKeys.rowKeyVar, rowKeyVar);
}
+ @Attribute
public String getStateVar() {
return (String) getStateHelper().get(PropertyKeys.stateVar);
}
@@ -616,6 +620,8 @@
* before rendering. By default state is reset if there are no faces messages with severity error or higher.
* @return
*/
+
+ @Attribute
public boolean isKeepSaved() {
Object value = getStateHelper().eval(PropertyKeys.keepSaved);
@@ -1298,7 +1304,7 @@
return dataVisitor.getVisitResult();
} else {
- return visitComponents(dataChildren(), visitContext, callback);
+ return visitComponents(getFacetsAndChildren(), visitContext, callback);
}
}
Modified: branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/component/UISequence.java
===================================================================
--- branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/component/UISequence.java 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/component/UISequence.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -45,6 +45,7 @@
import org.ajax4jsf.model.SequenceDataModel;
import org.ajax4jsf.model.SequenceRange;
import org.ajax4jsf.model.SequenceState;
+import org.richfaces.cdk.annotations.Attribute;
/**
* @author Nick Belaevski
@@ -139,6 +140,7 @@
return getFacesContext().getApplication().createConverter(Integer.class);
}
+ @Attribute
public int getFirst() {
return (Integer) getStateHelper().eval(PropertyKeys.first, 0);
}
@@ -148,6 +150,7 @@
updateState();
}
+ @Attribute
public int getRows() {
return (Integer) getStateHelper().eval(PropertyKeys.rows, 0);
}
@@ -157,6 +160,7 @@
updateState();
}
+ @Attribute
public Object getValue() {
return getStateHelper().eval(PropertyKeys.value);
}
@@ -166,6 +170,7 @@
getStateHelper().put(PropertyKeys.value, value);
}
+ @Attribute
public String getIterationStatusVar() {
return (String) getStateHelper().get(PropertyKeys.iterationStatusVar);
}
Modified: branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/convert/ConverterUtil.java
===================================================================
--- branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/convert/ConverterUtil.java 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/convert/ConverterUtil.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -24,6 +24,7 @@
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
+import javax.faces.convert.IntegerConverter;
import com.google.common.base.Strings;
@@ -33,8 +34,7 @@
*/
public final class ConverterUtil {
- private static final Converter STRING_CONVERTER = new Converter() {
-
+ public static final class StringConverter implements Converter {
public String getAsString(FacesContext context, UIComponent component, Object value) {
if (value == null) {
return "";
@@ -42,7 +42,7 @@
return value.toString();
}
-
+
public Object getAsObject(FacesContext context, UIComponent component, String value) {
if (Strings.isNullOrEmpty(value)) {
return null;
@@ -50,12 +50,20 @@
return value;
}
- };
+ }
+
+ private static final Converter STRING_CONVERTER = new StringConverter();
+ private static final Converter INTEGER_CONVERTER = new IntegerConverter();
+
private ConverterUtil() {}
public static Converter stringConverter() {
return STRING_CONVERTER;
}
+
+ public static Converter integerConverter() {
+ return INTEGER_CONVERTER;
+ }
}
Deleted: branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/renderkit/AjaxChildrenRenderer.java
===================================================================
--- branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/renderkit/AjaxChildrenRenderer.java 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/renderkit/AjaxChildrenRenderer.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -1,222 +0,0 @@
-/**
- * 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.renderkit;
-
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import javax.faces.component.NamingContainer;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.Messages;
-import org.ajax4jsf.component.AjaxChildrenEncoder;
-import org.ajax4jsf.component.AjaxOutput;
-import org.ajax4jsf.context.AjaxContext;
-import org.ajax4jsf.renderkit.AjaxRenderer;
-import org.richfaces.log.Logger;
-import org.richfaces.log.RichfacesLogger;
-
-/**
- * @author shura
- */
-public abstract class AjaxChildrenRenderer extends AjaxComponentRendererBase implements AjaxRenderer {
- public static final String[] SPECIAL_COMPONENTS_TYPES = {"org.ajax4jsf.Bundle" /* UILoadBundle.COMPONENT_TYPE */,
- "org.apache.myfaces.AliasBean", "org.apache.myfaces.AliasBeansScope"};
-
- private static final String SPECIAL_TYPES_PARAMETER = "org.ajax4jsf.CONTROL_COMPONENTS";
- private static final Logger LOG = RichfacesLogger.RENDERKIT.getLogger();
-
- private Set<String> specialComponentTypes = null;
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.ajax4jsf.renderkit.AjaxRenderer#encodeAjaxChildren(javax.faces.context
- * .FacesContext, javax.faces.component.UIComponent, java.lang.String,
- * java.util.Set, java.util.Set)
- */
- public void encodeAjaxChildren(FacesContext context, UIComponent component, String path, Set<String> ids,
- Set<String> renderedAreas) throws IOException {
-
- if (LOG.isDebugEnabled()) {
- LOG.debug(Messages.getMessage(Messages.ENCODE_CHILD_AJAX_INFO, path, component.getId()));
- }
-
- String currentPath = path;
-
- if (component instanceof NamingContainer) {
- currentPath += component.getId() + NamingContainer.SEPARATOR_CHAR;
-
- // Do not check children if we have no id to render under naming
- // container.
- if (AjaxContext.getCurrentInstance(context).isLimitRender() && noIdUnderPath(path, ids)) {
- return;
- }
- }
-
- for (Iterator<UIComponent> it = component.getFacetsAndChildren(); it.hasNext();) {
- UIComponent element = (UIComponent) it.next();
-
- encodeAjaxComponent(context, element, currentPath, ids, renderedAreas);
- }
- }
-
- private boolean noIdUnderPath(String path, Set<String> ids) {
-
- // Do we have an any component for the rendering under that container ?
- boolean noSuchId = true;
-
- for (String id : ids) {
- if ((null != id) && id.startsWith(path)) {
- noSuchId = false;
-
- break;
- }
- }
-
- return noSuchId;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.ajax4jsf.renderkit.AjaxRenderer#encodeAjaxComponent(javax.faces.context
- * .FacesContext, javax.faces.component.UIComponent, java.lang.String,
- * java.util.Set, java.util.Set)
- */
- public void encodeAjaxComponent(FacesContext context, UIComponent component, String currentPath, Set<String> ids,
- Set<String> renderedAreas) throws IOException {
-
- if (component.isRendered()) { // skip not-rendered components.
- boolean found = false;
- boolean limitRender = AjaxContext.getCurrentInstance(context).isLimitRender();
- String elementId = component.getId();
- String absoluteId = currentPath + elementId;
-
- if (!ids.isEmpty()) {
-
- // list for rendering may contains absolute id ( best ),
- // component Id or client ID
- // String clientId = element.getClientId(context);
- if (ids.contains(absoluteId) || ids.contains(elementId)) {
- if (LOG.isDebugEnabled()) {
- LOG.debug(Messages.getMessage(Messages.RENDER_AJAX_AREA_INFO, absoluteId));
- }
-
- // renderChild(context, element);
- found = true;
- }
- }
-
- //
- if (!found && limitRender && (component instanceof NamingContainer)
- && noIdUnderPath(absoluteId + NamingContainer.SEPARATOR_CHAR, ids)) {
- return;
- }
-
- if (!found && !limitRender && (component instanceof AjaxOutput)) {
- if (((AjaxOutput) component).isAjaxRendered()) {
-
- // renderChild(context, element);
- found = true;
- }
- }
-
- if (!found) {
- if (component instanceof AjaxChildrenEncoder) {
- ((AjaxChildrenEncoder) component).encodeAjaxChild(context, currentPath, ids, renderedAreas);
- } else {
-
- // Special case - for control components, not produced
- // html code - such as message bundles loaders,
- // MyFaces aliases etc. we call encodeBegin/end methods
- // even if components not in rendered areas.
- boolean special = isSpecialElement(context, component);
-
- if (special) {
- component.encodeBegin(context);
- }
-
- encodeAjaxChildren(context, component, currentPath, ids, renderedAreas);
-
- if (special) {
- component.encodeEnd(context);
- }
- }
- } else {
- renderedAreas.add(component.getClientId(context));
- component.encodeAll(context);
- }
- }
- }
-
- /**
- * Detect component as special control case - such as messages bundle
- * loader, alias bean components etc. Type of component get by reflection
- * from static field COMPONENT_TYPE
- *
- * @param context
- * @param component
- * @return true if encode methods must be called for this component even in
- * not-rendered parts.
- */
- private boolean isSpecialElement(FacesContext context, UIComponent component) {
- if (specialComponentTypes == null) {
- specialComponentTypes = new HashSet<String>(10);
-
- for (int i = 0; i < SPECIAL_COMPONENTS_TYPES.length; i++) {
- specialComponentTypes.add(SPECIAL_COMPONENTS_TYPES[i]);
- }
-
- String special = context.getExternalContext().getInitParameter(SPECIAL_TYPES_PARAMETER);
-
- if (null != special) {
- String[] split = special.split(",");
-
- for (int i = 0; i < split.length; i++) {
- specialComponentTypes.add(split[i]);
- }
- }
- }
-
- boolean result;
-
- try {
- String componentType = (String) component.getClass().getField("COMPONENT_TYPE").get(null);
-
- result = specialComponentTypes.contains(componentType);
- } catch (Exception e) {
-
- // exception occurs if component not have accesible COMPONENT_TYPE
- // constant
- // we assume that component not in special types.
- result = false;
- }
-
- return result;
- }
-}
Deleted: branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/renderkit/AjaxComponentRendererBase.java
===================================================================
--- branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/renderkit/AjaxComponentRendererBase.java 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/renderkit/AjaxComponentRendererBase.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -1,33 +0,0 @@
-/**
- * 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.renderkit;
-
-
-/**
- * Base class for all Ajax enabled components. Perform common task -
- * output javasript for component.
- *
- * @author shura (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:58:49 $
- */
-public abstract class AjaxComponentRendererBase extends RendererBase {
-}
Modified: branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/renderkit/util/AjaxRendererUtils.java
===================================================================
--- branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/renderkit/util/AjaxRendererUtils.java 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/renderkit/util/AjaxRendererUtils.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -28,7 +28,6 @@
import javax.faces.context.FacesContext;
import org.ajax4jsf.component.AjaxClientBehavior;
-import org.ajax4jsf.component.AjaxComponent;
import org.ajax4jsf.context.AjaxContext;
import org.ajax4jsf.javascript.JSFunctionDefinition;
import org.ajax4jsf.javascript.JSReference;
@@ -564,30 +563,7 @@
* @return clientId of status area, or <code>null</code>
*/
public static String getAjaxStatus(UIComponent component) {
- String statusId;
-
- if (component instanceof AjaxComponent) {
- statusId = ((AjaxComponent) component).getStatus();
- } else {
- statusId = (String) component.getAttributes().get(STATUS_ATTR_NAME);
- }
-
- return statusId;
-
-// if (null != statusId) {
-// UIComponent status = RendererUtils.getInstance().
-// findComponentFor(component, statusId);
-//
-// if (null != status) {
-// statusId = status
-// .getClientId(FacesContext.getCurrentInstance());
-// } else {
-// LOG.warn(Messages.getMessage(
-// Messages.AJAX_STATUS_COMPONENT_NOT_FOWND_WARNING,
-// component.getId()));
-// }
-// }
-// return statusId;
+ return (String) component.getAttributes().get(STATUS_ATTR_NAME);
}
public static String getQueueId(UIComponent component) {
@@ -612,10 +588,6 @@
//TODO nick - refactor - remove this method?
public static String getAjaxOnBegin(UIComponent component) {
- if (component instanceof AjaxComponent) {
- return ((AjaxComponent) component).getOnbegin();
- }
-
return (String) component.getAttributes().get(ONBEGIN_ATTR_NAME);
}
Modified: branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/view/facelets/RowKeyConverterRule.java
===================================================================
--- branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/view/facelets/RowKeyConverterRule.java 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/ui/common/ui/src/main/java/org/richfaces/view/facelets/RowKeyConverterRule.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -21,8 +21,6 @@
package org.richfaces.view.facelets;
-import org.richfaces.component.UIDataAdaptor;
-
import javax.faces.convert.Converter;
import javax.faces.view.facelets.FaceletContext;
import javax.faces.view.facelets.MetaRule;
@@ -30,6 +28,8 @@
import javax.faces.view.facelets.MetadataTarget;
import javax.faces.view.facelets.TagAttribute;
+import org.richfaces.component.UIDataAdaptor;
+
/**
* Apply rowKeyConverter to component
*
@@ -39,13 +39,6 @@
public class RowKeyConverterRule extends MetaRule {
public static final RowKeyConverterRule INSTANCE = new RowKeyConverterRule();
- /*
- * (non-Javadoc)
- *
- * @see com.sun.facelets.tag.MetaRule#applyRule(java.lang.String,
- * com.sun.facelets.tag.TagAttribute,
- * com.sun.facelets.tag.MetadataTarget)
- */
@Override
public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget meta) {
if (meta.isTargetInstanceOf(UIDataAdaptor.class)) {
Modified: branches/RF-9323/ui/input/ui/src/main/java/org/richfaces/component/AbstractAutocomplete.java
===================================================================
--- branches/RF-9323/ui/input/ui/src/main/java/org/richfaces/component/AbstractAutocomplete.java 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/ui/input/ui/src/main/java/org/richfaces/component/AbstractAutocomplete.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -34,6 +34,7 @@
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
+import org.richfaces.application.ServiceTracker;
import org.richfaces.cdk.annotations.Attribute;
import org.richfaces.cdk.annotations.EventName;
import org.richfaces.cdk.annotations.JsfComponent;
@@ -43,7 +44,7 @@
import org.richfaces.cdk.annotations.TagType;
import org.richfaces.context.ExtendedVisitContext;
import org.richfaces.context.ExtendedVisitContextMode;
-import org.richfaces.el.util.ELUtils;
+import org.richfaces.el.GenericsIntrospectionService;
import org.richfaces.renderkit.MetaComponentRenderer;
/**
@@ -221,7 +222,7 @@
ValueExpression expression = this.getValueExpression("value");
if (expression != null) {
- Class<?> containerClass = ELUtils.getContainerClass(context, expression);
+ Class<?> containerClass = ServiceTracker.getService(context, GenericsIntrospectionService.class).getContainerClass(context, expression);
converter = getConverterForType(context, containerClass);
}
Modified: branches/RF-9323/ui/input/ui/src/main/java/org/richfaces/renderkit/InputRendererBase.java
===================================================================
--- branches/RF-9323/ui/input/ui/src/main/java/org/richfaces/renderkit/InputRendererBase.java 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/ui/input/ui/src/main/java/org/richfaces/renderkit/InputRendererBase.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -22,20 +22,21 @@
package org.richfaces.renderkit;
-import org.richfaces.component.util.SelectUtils;
+import java.util.Map;
import javax.faces.component.UIComponent;
import javax.faces.component.UIInput;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.ConverterException;
-import java.util.Map;
+import org.richfaces.component.util.SelectUtils;
+
/**
* @author Nick Belaevski - nbelaevski(a)exadel.com
* created 23.01.2007
*/
-public class InputRendererBase extends AjaxComponentRendererBase {
+public class InputRendererBase extends RendererBase {
protected void doDecode(FacesContext context, UIComponent component) {
String clientId = component.getClientId(context);
Modified: branches/RF-9323/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSlider.js
===================================================================
--- branches/RF-9323/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSlider.js 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inputNumberSlider.js 2010-12-27 18:59:46 UTC (rev 20814)
@@ -44,13 +44,16 @@
this.element = jQuery(this.attachToDom());
this.input = this.element.children(".rf-insl-inp-cntr").children(".rf-insl-inp");
this.track = this.element.children(".rf-insl-trc-cntr").children(".rf-insl-trc");
- this.handle = this.track.children(".rf-insl-hnd, .rf-insl-hnd-dis");
+ var handleContainer = this.track.children("span");
+ this.handle = handleContainer.children(".rf-insl-hnd, .rf-insl-hnd-dis");
this.tooltip = this.element.children(".rf-insl-tt");
var value = Number(this.input.val());
if (isNaN(value)) {
value = this.minValue;
}
+ handleContainer.css("display", "block");
+ this.track.css("padding-right", this.handle.width() + "px");
this.__setValue(value, null, true);
if (!this.disabled) {
@@ -95,8 +98,8 @@
}
if (value != this.value) {
this.input.val(value);
- var left = (value - this.minValue) * (this.track.width() - this.handle.width()) / this.range;
- this.handle.css("margin-left", left + "px");
+ var left = 100 * (value - this.minValue) / this.range;
+ this.handle.css("margin-left", left + "%");
this.tooltip.text(value);
this.tooltip.setPosition(this.handle,{from: 'LT', offset: [0, 5]}); //TODO Seems offset doesn't work now.
this.value = value;
@@ -168,7 +171,7 @@
},
__mousemoveHandler: function (event) {
- var value = this.range * (event.pageX - this.track.position().left) / (this.track.width()
+ var value = this.range * (event.pageX - this.track.position().left - this.handle.width() / 2) / (this.track.width()
- this.handle.width()) + this.minValue;
value = Math.round(value / this.step) * this.step; //TODO Add normal support of float values. E.g. '0.3' should be instead of '0.30000000000000004'.
this.__setValue(value, event);
Modified: branches/RF-9323/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/select.js
===================================================================
--- branches/RF-9323/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/select.js 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/select.js 2010-12-27 18:59:46 UTC (rev 20814)
@@ -366,16 +366,18 @@
this.setValue(label);
this.hidePopup();
this.__setInputFocus();
-
- this.invokeEvent.call(this,"selectitem", document.getElementById(this.id + 'Input'));
+ this.__save();
+
+ if(this.focusValue != this.selValueInput.val() ) {
+ this.invokeEvent.call(this,"selectitem", document.getElementById(this.id + 'Input'));
+ }
},
- onblur: function(e) {
- this.hidePopup();
+ __save: function() {
var value = "";
- var label = this.defaultLabel;
- var clientItem;
+ var label = "";
var inputLabel = this.getValue();
+
if(inputLabel && inputLabel != "") {
if(this.enableManualInput) {
clientItem = this.__getClientItemFromCache(inputLabel);
@@ -387,10 +389,21 @@
label = clientItem.label;
value = clientItem.value;
}
- }
-
+ }
+
this.setValue(label);
this.selValueInput.val(value);
+ },
+
+ onblur: function(e) {
+ this.hidePopup();
+ var inputLabel = this.getValue();
+
+ if(!inputLabel || inputLabel == "") {
+ this.setValue(this.defaultLabel);
+ this.selValueInput.val("");
+ }
+
this.focused = false;
this.invokeEvent.call(this,"blur", document.getElementById(this.id + 'Input'), e);
if(this.focusValue != this.selValueInput.val() ) {
Modified: branches/RF-9323/ui/input/ui/src/main/templates/inputnumberslider.template.xml
===================================================================
--- branches/RF-9323/ui/input/ui/src/main/templates/inputnumberslider.template.xml 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/ui/input/ui/src/main/templates/inputnumberslider.template.xml 2010-12-27 18:59:46 UTC (rev 20814)
@@ -53,7 +53,9 @@
<span class="rf-insl-mx">#{component.attributes['maxValue']}</span>
</c:if>
<span class="rf-insl-trc #{component.attributes['trackClass']}">
- <span class="rf-insl-hnd#{component.attributes['disabled'] ? '-dis' : ''} #{component.attributes['handleClass']}" />
+ <span>
+ <span class="rf-insl-hnd#{component.attributes['disabled'] ? '-dis' : ''} #{component.attributes['handleClass']}" />
+ </span>
</span>
</span>
<c:if test="#{component.attributes['showArrows']}">
Modified: branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/DataScrollerUtils.java
===================================================================
--- branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/DataScrollerUtils.java 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/DataScrollerUtils.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -99,7 +99,7 @@
public static UIComponent findDataTable(AbstractDataScroller dataScroller) {
- String forAttribute = dataScroller.getForComponent();
+ String forAttribute = dataScroller.getFor();
UIComponent forComp;
if (forAttribute == null) {
forComp = dataScroller;
Modified: branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractCollapsibleSubTable.java
===================================================================
--- branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractCollapsibleSubTable.java 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractCollapsibleSubTable.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -68,7 +68,8 @@
enum PropertyKeys {
expanded
}
-
+
+ @Attribute
public boolean isExpanded() {
return (Boolean)getStateHelper().eval(PropertyKeys.expanded, true);
}
Modified: branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractCollapsibleSubTableToggler.java
===================================================================
--- branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractCollapsibleSubTableToggler.java 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractCollapsibleSubTableToggler.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -48,10 +48,6 @@
public static final String DEFAULT_EVENT = "onclick";
- enum PropertyKeys {
- forId
- }
-
@Attribute
public abstract String getExpandLabel();
@@ -66,12 +62,13 @@
@Attribute(defaultValue = DEFAULT_EVENT)
public abstract String getEvent();
-
+
+ @Attribute
public String getFor() {
- return (String)getStateHelper().eval(PropertyKeys.forId);
+ return (String)getStateHelper().eval("for");
}
public void setFor(String forId) {
- getStateHelper().put(PropertyKeys.forId, forId);
+ getStateHelper().put("for", forId);
}
}
Modified: branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataScroller.java
===================================================================
--- branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataScroller.java 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataScroller.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -91,9 +91,6 @@
@Attribute
public abstract String getLastPageMode();
- @Attribute
- public abstract String getForComponent();
-
@Attribute(defaultValue="10")
public abstract int getMaxPages();
@@ -108,7 +105,16 @@
@Attribute(defaultValue="1")
public abstract int getFastStep();
+
+ @Attribute
+ public String getFor() {
+ return (String)getStateHelper().eval("for");
+ }
+ public void setFor(String forId) {
+ getStateHelper().put("for", forId);
+ }
+
public void addScrollerListener(DataScrollerListener listener) {
addFacesListener(listener);
}
Modified: branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java
===================================================================
--- branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -22,9 +22,11 @@
package org.richfaces.component;
import java.io.IOException;
+import java.text.MessageFormat;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.Map;
import javax.el.ELContext;
import javax.el.ELException;
@@ -38,6 +40,7 @@
import javax.faces.component.visit.VisitResult;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
+import javax.faces.convert.ConverterException;
import javax.faces.event.AbortProcessingException;
import javax.faces.event.ExceptionQueuedEvent;
import javax.faces.event.ExceptionQueuedEventContext;
@@ -65,6 +68,7 @@
import org.richfaces.event.TreeToggleEvent;
import org.richfaces.event.TreeToggleListener;
import org.richfaces.event.TreeToggleSource;
+import org.richfaces.model.DeclarativeModelKey;
import org.richfaces.model.DeclarativeTreeDataModelImpl;
import org.richfaces.model.DeclarativeTreeModel;
import org.richfaces.model.SwingTreeNodeDataModelImpl;
@@ -77,6 +81,7 @@
import com.google.common.base.Strings;
import com.google.common.collect.Iterables;
import com.google.common.collect.Iterators;
+import com.google.common.collect.Maps;
/**
* @author Nick Belaevski
@@ -102,6 +107,10 @@
public static final String DEFAULT_TREE_NODE_FACET_NAME = DEFAULT_TREE_NODE_ID;
+ private static final String COMPONENT_FOR_MODEL_UNAVAILABLE = "Component is not available for model {0}";
+
+ private static final String CONVERTER_FOR_MODEL_UNAVAILABLE = "Row key converter is not available for model {0}";
+
private static final class MatchingTreeNodePredicate implements Predicate<UIComponent> {
private String type;
@@ -141,6 +150,8 @@
private transient UIComponent currentComponent = this;
+ private transient Map<String, UIComponent> declatariveModelsMap = null;
+
public AbstractTree() {
setKeepSaved(true);
setRendererType("org.richfaces.TreeRenderer");
@@ -552,7 +563,9 @@
@Override
protected void resetDataModel() {
super.resetDataModel();
+
treeRange = null;
+ declatariveModelsMap = null;
}
public TreeDataModelTuple createSnapshot() {
@@ -570,4 +583,65 @@
super.restoreChildState(facesContext);
}
+ protected UIComponent findDeclarativeModel(String modelId) {
+ if (declatariveModelsMap == null) {
+ declatariveModelsMap = Maps.newHashMap();
+ }
+
+ UIComponent adaptor = declatariveModelsMap.get(modelId);
+ if (adaptor == null) {
+ adaptor = findComponent(modelId);
+ if (adaptor != null) {
+ declatariveModelsMap.put(modelId, adaptor);
+ }
+ }
+
+ if (adaptor == null) {
+ throw new IllegalStateException(MessageFormat.format(COMPONENT_FOR_MODEL_UNAVAILABLE, modelId));
+ }
+
+ return adaptor;
+ }
+
+ public String convertDeclarativeKeyToString(FacesContext context, DeclarativeModelKey declarativeKey) throws ConverterException {
+ try {
+ UIComponent component = findDeclarativeModel(declarativeKey.getModelId());
+
+ TreeModelAdaptor adaptor = (TreeModelAdaptor) component;
+
+ Converter rowKeyConverter = adaptor.getRowKeyConverter();
+ if (rowKeyConverter == null) {
+ throw new ConverterException(MessageFormat.format(CONVERTER_FOR_MODEL_UNAVAILABLE, declarativeKey.getModelId()));
+ }
+
+ return rowKeyConverter.getAsString(context, (UIComponent) adaptor, declarativeKey.getModelKey());
+ } catch (ConverterException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new ConverterException(e.getMessage(), e);
+ }
+ }
+
+ public DeclarativeModelKey convertDeclarativeKeyFromString(FacesContext context, String modelId,
+ String modelKeyAsString) throws ConverterException {
+
+ try {
+ UIComponent component = findDeclarativeModel(modelId);
+
+ TreeModelAdaptor adaptor = (TreeModelAdaptor) component;
+
+ Converter rowKeyConverter = adaptor.getRowKeyConverter();
+ if (rowKeyConverter == null) {
+ throw new ConverterException(MessageFormat.format(CONVERTER_FOR_MODEL_UNAVAILABLE, modelId));
+ }
+
+ Object modelKey = rowKeyConverter.getAsObject(context, (UIComponent) adaptor, modelKeyAsString);
+ return new DeclarativeModelKey(modelId, modelKey);
+ } catch (ConverterException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new ConverterException(e.getMessage(), e);
+ }
+ }
+
}
Modified: branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTreeModelAdaptor.java
===================================================================
--- branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTreeModelAdaptor.java 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTreeModelAdaptor.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -21,19 +21,147 @@
*/
package org.richfaces.component;
+import java.util.Map;
+
+import javax.el.ValueExpression;
+import javax.faces.component.PartialStateHolder;
+import javax.faces.component.StateHelper;
+import javax.faces.component.StateHolder;
import javax.faces.component.UIComponentBase;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
-import org.richfaces.cdk.annotations.JsfComponent;
-import org.richfaces.cdk.annotations.Tag;
+import org.richfaces.convert.ConverterUtil;
/**
* @author Nick Belaevski
*
*/
-@JsfComponent(type = AbstractTreeModelAdaptor.COMPONENT_TYPE,
- tag = @Tag(name = "treeModelAdaptor"))
-public abstract class AbstractTreeModelAdaptor extends UIComponentBase implements TreeModelAdaptor {
+public abstract class AbstractTreeModelAdaptor extends UIComponentBase {
- public static final String COMPONENT_TYPE = "org.richfaces.TreeModelAdaptor";
+ private enum PropertyKeys {
+ rowKeyConverter, rowKeyConverterSet
+ }
+ private Converter rowKeyConverter;
+
+ public Converter getRowKeyConverter() {
+ if (this.rowKeyConverter != null) {
+ return this.rowKeyConverter;
+ }
+
+ ValueExpression converterExpression = getValueExpression(PropertyKeys.rowKeyConverter.toString());
+ if (converterExpression != null) {
+ return (Converter) converterExpression.getValue(getFacesContext().getELContext());
+ } else {
+ return null;
+ }
+ }
+
+ public void setRowKeyConverter(Converter converter) {
+ StateHelper stateHelper = getStateHelper();
+ stateHelper.put(PropertyKeys.rowKeyConverterSet, Boolean.TRUE);
+
+ this.rowKeyConverter = converter;
+ }
+
+ protected void memoizeDefaultRowKeyConverter(Object value) {
+ if (isSetRowKeyConverter()) {
+ return;
+ }
+
+ if (value instanceof Iterable<?>) {
+ setRowKeyConverter(ConverterUtil.integerConverter());
+ } else if (value instanceof Map<?, ?>) {
+ setRowKeyConverter(ConverterUtil.stringConverter());
+ }
+ }
+
+ private boolean isSetRowKeyConverter() {
+ return isLocalRowKeyConverterSet() || getValueExpression(PropertyKeys.rowKeyConverter.toString()) != null;
+ }
+
+ private boolean isLocalRowKeyConverterSet() {
+ Boolean value = (Boolean) getStateHelper().get(PropertyKeys.rowKeyConverterSet);
+ return Boolean.TRUE.equals(value);
+ }
+
+ @Override
+ public void markInitialState() {
+ super.markInitialState();
+
+ if (rowKeyConverter instanceof PartialStateHolder) {
+ ((PartialStateHolder) rowKeyConverter).markInitialState();
+ }
+ }
+
+ @Override
+ public void clearInitialState() {
+ super.clearInitialState();
+
+ if (rowKeyConverter instanceof PartialStateHolder) {
+ ((PartialStateHolder) rowKeyConverter).clearInitialState();
+ }
+ }
+
+ @Override
+ public void restoreState(FacesContext context, Object stateObject) {
+ Object[] state = (Object[]) stateObject;
+
+ super.restoreState(context, state[0]);
+
+ boolean converterHasPartialState = Boolean.TRUE.equals(state[1]);
+ Object savedConverterState = state[2];
+
+ if (converterHasPartialState) {
+ ((StateHolder) rowKeyConverter).restoreState(context, savedConverterState);
+ } else {
+ rowKeyConverter = (Converter) UIComponentBase.restoreAttachedState(context, savedConverterState);
+ }
+ }
+
+ @Override
+ public Object saveState(FacesContext context) {
+ Object parentState = super.saveState(context);
+
+ Object converterState = null;
+ boolean nullDelta = true;
+
+ boolean converterHasPartialState = false;
+
+ if (initialStateMarked()) {
+ if (!isLocalRowKeyConverterSet() && rowKeyConverter != null && rowKeyConverter instanceof PartialStateHolder) {
+ // Delta
+ StateHolder holder = (StateHolder) rowKeyConverter;
+ if (!holder.isTransient()) {
+ Object attachedState = holder.saveState(context);
+ if (attachedState != null) {
+ nullDelta = false;
+ converterState = attachedState;
+ }
+ converterHasPartialState = true;
+ } else {
+ converterState = null;
+ }
+ } else if (isLocalRowKeyConverterSet() || rowKeyConverter != null) {
+ // Full
+ converterState = saveAttachedState(context, rowKeyConverter);
+ nullDelta = false;
+ }
+
+ if (parentState == null && nullDelta) {
+ // No values
+ return null;
+ }
+ } else {
+ converterState = saveAttachedState(context, rowKeyConverter);
+ }
+
+ return new Object[] {
+ parentState,
+ converterHasPartialState,
+ converterState
+ };
+ }
+
}
Deleted: branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTreeModelRecursiveAdaptor.java
===================================================================
--- branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTreeModelRecursiveAdaptor.java 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTreeModelRecursiveAdaptor.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -1,43 +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 javax.faces.component.UIComponentBase;
-
-import org.richfaces.cdk.annotations.Attribute;
-import org.richfaces.cdk.annotations.JsfComponent;
-import org.richfaces.cdk.annotations.Tag;
-
-/**
- * @author Nick Belaevski
- *
- */
-@JsfComponent(type = AbstractTreeModelRecursiveAdaptor.COMPONENT_TYPE,
- tag = @Tag(name = "treeModelRecursiveAdaptor"))
-public abstract class AbstractTreeModelRecursiveAdaptor extends UIComponentBase implements TreeModelRecursiveAdaptor {
-
- public static final String COMPONENT_TYPE = "org.richfaces.TreeModelRecursiveAdaptor";
-
- @Attribute(defaultValue = "first")
- public abstract String getRecursionOrder();
-
-}
Modified: branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/DeclarativeTreeDataModelWalker.java
===================================================================
--- branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/DeclarativeTreeDataModelWalker.java 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/DeclarativeTreeDataModelWalker.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -66,7 +66,7 @@
}
- private void setupChildModelContext(String modelId) {
+ private void setupModelComponentContext(String modelId) {
if (currentComponent instanceof TreeModelRecursiveAdaptor && modelId.equals(currentComponent.getId())) {
//currentComponent already set
modelData = ((TreeModelRecursiveAdaptor) currentComponent).getNodes();
@@ -80,6 +80,15 @@
}
}
+ private void setupDataModelContext(Object key) {
+ if (modelData instanceof Iterable<?>) {
+ Iterable<?> iterable = (Iterable<?>) modelData;
+ data = Iterables.get(iterable, (Integer) key);
+ } else {
+ data = ((Map<?, ?>) modelData).get(key);
+ }
+ }
+
protected FacesContext getFacesContext() {
return facesContext;
}
@@ -104,7 +113,15 @@
}
try {
- walkSimpleKeys(key.getSimpleKeys());
+ for (Object simpleKey : key.getSimpleKeys()) {
+ DeclarativeModelKey declarativeKey = (DeclarativeModelKey) simpleKey;
+ if (var != null) {
+ contextMap.put(var, data);
+ }
+
+ setupModelComponentContext(declarativeKey.getModelId());
+ setupDataModelContext(declarativeKey.getModelKey());
+ }
} finally {
if (var != null) {
try {
@@ -116,35 +133,4 @@
}
}
- protected DeclarativeModelKey convertKey(Object nodes, DeclarativeModelKey declarativeModelKey) {
- return declarativeModelKey;
- }
-
- protected Object getData(Object nodes, Object key) {
- if (nodes instanceof Iterable<?>) {
- Iterable<?> iterable = (Iterable<?>) nodes;
- return Iterables.get(iterable, (Integer) key);
- } else {
- return ((Map<?, ?>) nodes).get(key);
- }
- }
-
- protected void walkSimpleKey(DeclarativeModelKey segment) {
- if (var != null) {
- contextMap.put(var, data);
- }
-
- setupChildModelContext(segment.getModelId());
-
- DeclarativeModelKey convertedKey = convertKey(modelData, segment);
- data = getData(modelData, convertedKey.getModelKey());
- }
-
- protected void walkSimpleKeys(Object[] simpleKeys) {
- for (Object simpleKey : simpleKeys) {
- DeclarativeModelKey declarativeKey = (DeclarativeModelKey) simpleKey;
- walkSimpleKey(declarativeKey);
- }
- }
-
}
Modified: branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/TreeModelAdaptor.java
===================================================================
--- branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/TreeModelAdaptor.java 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/TreeModelAdaptor.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -21,12 +21,24 @@
*/
package org.richfaces.component;
+import javax.faces.convert.Converter;
+
+import org.richfaces.cdk.annotations.Attribute;
+
/**
* @author Nick Belaevski
*
*/
public interface TreeModelAdaptor {
+ @Attribute
public Object getNodes();
+ @Attribute
+ public Converter getRowKeyConverter();
+
+ public void setRowKeyConverter(Converter converter);
+
+ public boolean isLeaf();
+
}
Modified: branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/TreeModelRecursiveAdaptor.java
===================================================================
--- branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/TreeModelRecursiveAdaptor.java 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/TreeModelRecursiveAdaptor.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -21,12 +21,15 @@
*/
package org.richfaces.component;
+import org.richfaces.cdk.annotations.Attribute;
+
/**
* @author Nick Belaevski
*
*/
public interface TreeModelRecursiveAdaptor extends TreeModelAdaptor {
+ @Attribute
public Object getRoots();
public String getRecursionOrder();
Copied: branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/UITreeModelAdaptor.java (from rev 20813, trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UITreeModelAdaptor.java)
===================================================================
--- branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/UITreeModelAdaptor.java (rev 0)
+++ branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/UITreeModelAdaptor.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -0,0 +1,69 @@
+/*
+ * 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 org.richfaces.cdk.annotations.JsfComponent;
+import org.richfaces.cdk.annotations.Tag;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+@JsfComponent(type = UITreeModelAdaptor.COMPONENT_TYPE,
+ family = UITreeModelAdaptor.COMPONENT_FAMILY,
+ tag = @Tag(name = "treeModelAdaptor", handler = "org.richfaces.view.facelets.TreeModelAdaptorHandler"))
+public class UITreeModelAdaptor extends AbstractTreeModelAdaptor implements TreeModelAdaptor {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.TreeModelAdaptor";
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.TreeModelAdaptor";
+
+ private enum PropertyKeys {
+ nodes, leaf
+ }
+
+ @Override
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
+
+ public Object getNodes() {
+ Object nodes = getStateHelper().eval(PropertyKeys.nodes);
+
+ memoizeDefaultRowKeyConverter(nodes);
+
+ return nodes;
+ }
+
+ public void setNodes(Object nodes) {
+ getStateHelper().put(PropertyKeys.nodes, nodes);
+ }
+
+ public boolean isLeaf() {
+ return (Boolean) getStateHelper().eval(PropertyKeys.leaf, false);
+ }
+
+ public void setLeaf(boolean leaf) {
+ getStateHelper().put(PropertyKeys.leaf, leaf);
+ }
+
+}
\ No newline at end of file
Copied: branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/UITreeModelRecursiveAdaptor.java (from rev 20813, trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UITreeModelRecursiveAdaptor.java)
===================================================================
--- branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/UITreeModelRecursiveAdaptor.java (rev 0)
+++ branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/component/UITreeModelRecursiveAdaptor.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -0,0 +1,81 @@
+/*
+ * 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 org.richfaces.cdk.annotations.JsfComponent;
+import org.richfaces.cdk.annotations.Tag;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+@JsfComponent(type = UITreeModelRecursiveAdaptor.COMPONENT_TYPE,
+ family = UITreeModelRecursiveAdaptor.COMPONENT_FAMILY,
+ tag = @Tag(name = "treeModelRecursiveAdaptor", handler = "org.richfaces.view.facelets.TreeModelRecursiveAdaptorHandler"))
+public class UITreeModelRecursiveAdaptor extends AbstractTreeModelAdaptor implements TreeModelRecursiveAdaptor {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.TreeModelRecursiveAdaptor";
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.TreeModelRecursiveAdaptor";
+
+ private enum PropertyKeys {
+ roots, nodes, leaf
+ }
+
+ @Override
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
+
+ public Object getRoots() {
+ Object roots = getStateHelper().eval(PropertyKeys.roots);
+
+ memoizeDefaultRowKeyConverter(roots);
+
+ return roots;
+ }
+
+ public void setRoots(Object roots) {
+ getStateHelper().put(PropertyKeys.roots, roots);
+ }
+
+ public Object getNodes() {
+ return getStateHelper().eval(PropertyKeys.nodes);
+ }
+
+ public void setNodes(Object nodes) {
+ getStateHelper().put(PropertyKeys.nodes, nodes);
+ }
+
+ public String getRecursionOrder() {
+ return null;
+ }
+
+ public boolean isLeaf() {
+ return (Boolean) getStateHelper().eval(PropertyKeys.leaf, false);
+ }
+
+ public void setLeaf(boolean leaf) {
+ getStateHelper().put(PropertyKeys.leaf, leaf);
+ }
+
+}
Modified: branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/convert/DeclarativeModelSequenceKeyConverter.java
===================================================================
--- branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/convert/DeclarativeModelSequenceKeyConverter.java 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/convert/DeclarativeModelSequenceKeyConverter.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -21,85 +21,85 @@
*/
package org.richfaces.convert;
+import static org.richfaces.convert.SequenceRowKeyConverter.SEPARATOR_SPLITTER;
+import static org.richfaces.convert.TreeConverterUtil.escape;
+import static org.richfaces.convert.TreeConverterUtil.unescape;
+import static org.richfaces.model.TreeDataModel.SEPARATOR_CHAR;
+
+import java.util.Iterator;
+import java.util.List;
+
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.ConverterException;
-import javax.faces.convert.IntegerConverter;
import org.richfaces.component.AbstractTree;
-import org.richfaces.component.DeclarativeTreeDataModelWalker;
import org.richfaces.model.DeclarativeModelKey;
import org.richfaces.model.SequenceRowKey;
+
+import com.google.common.base.Strings;
+import com.google.common.collect.Lists;
/**
* @author Nick Belaevski
*
*/
-public class DeclarativeModelSequenceKeyConverter extends SequenceRowKeyConverter<DeclarativeModelKey> {
+public class DeclarativeModelSequenceKeyConverter implements Converter {
- private final class KeyConvertingWalker extends DeclarativeTreeDataModelWalker {
+ public static final String CONVERTER_ID = "org.richfaces.DeclarativeModelSequenceKeyConverter";
+
+ public Object getAsObject(FacesContext context, UIComponent component, String value) throws ConverterException {
+ if (Strings.isNullOrEmpty(value)) {
+ return null;
+ }
+
+ Iterator<String> split = SEPARATOR_SPLITTER.split(value).iterator();
- private final FacesContext context;
-
- private DeclarativeModelKey[] convertedSimpleKeys;
-
- private int keysIdx;
+ AbstractTree tree = (AbstractTree) component;
- private KeyConvertingWalker(FacesContext context, AbstractTree rootComponent) {
- super(context, rootComponent);
- this.context = context;
- }
-
- @Override
- protected DeclarativeModelKey convertKey(Object nodes, DeclarativeModelKey declarativeModelKey) {
- DeclarativeModelKey convertedKey;
+ List<DeclarativeModelKey> declarativeKeys = Lists.newArrayList();
+
+ while (split.hasNext()) {
+ String modelId = unescape(split.next());
+ String modelKeyAsString = unescape(split.next());
- if (nodes instanceof Iterable<?>) {
- String modelKeyAsString = (String) declarativeModelKey.getModelKey();
- Object modelKey = INTEGER_CONVERTER.getAsObject(context, getRootComponent(), modelKeyAsString);
- convertedKey = new DeclarativeModelKey(declarativeModelKey.getModelId(), modelKey);
- } else {
- convertedKey = declarativeModelKey;
- }
-
- convertedSimpleKeys[keysIdx++] = convertedKey;
+ DeclarativeModelKey declarativeKey = tree.convertDeclarativeKeyFromString(context, modelId, modelKeyAsString);
- return super.convertKey(nodes, convertedKey);
+ declarativeKeys.add(declarativeKey);
}
- @Override
- public void walk(SequenceRowKey key) {
- convertedSimpleKeys = new DeclarativeModelKey[key.getSimpleKeys().length];
- keysIdx = 0;
- super.walk(key);
- }
+ return new SequenceRowKey((Object[]) declarativeKeys.toArray(new DeclarativeModelKey[declarativeKeys.size()]));
+ }
- public DeclarativeModelKey[] getConvertedSimpleKeys() {
- return convertedSimpleKeys;
+ public String getAsString(FacesContext context, UIComponent component, Object value) {
+ if (value == null) {
+ return "";
}
- }
-
- public static final String CONVERTER_ID = "org.richfaces.DeclarativeModelSequenceKeyConverter";
-
- private static final Converter INTEGER_CONVERTER = new IntegerConverter();
-
- public DeclarativeModelSequenceKeyConverter() {
- super(DeclarativeModelKey.class, new DeclarativeModelKeyConverter(ConverterUtil.stringConverter()));
- }
-
- @Override
- public Object getAsObject(FacesContext context, UIComponent component, String value) throws ConverterException {
- SequenceRowKey key = (SequenceRowKey) super.getAsObject(context, component, value);
- if (key != null) {
+ SequenceRowKey sequenceRowKey = (SequenceRowKey) value;
+
+ Object[] declarativeKeys = sequenceRowKey.getSimpleKeys();
+ AbstractTree tree = (AbstractTree) component;
+
+ StringBuilder result = new StringBuilder();
+
+ for (Object declarativeKeyObject : declarativeKeys) {
+ DeclarativeModelKey declarativeKey = (DeclarativeModelKey) declarativeKeyObject;
+ String modelId = escape(declarativeKey.getModelId());
- KeyConvertingWalker walker = new KeyConvertingWalker(context, (AbstractTree) component);
- walker.walk(key);
+ String modelKeyAsString = escape(tree.convertDeclarativeKeyToString(context, declarativeKey));
- key = new SequenceRowKey((Object[]) walker.getConvertedSimpleKeys());
+ if (result.length() != 0) {
+ result.append(SEPARATOR_CHAR);
+ }
+
+ result.append(modelId);
+
+ result.append(SEPARATOR_CHAR);
+ result.append(modelKeyAsString);
}
- return key;
+ return result.toString();
}
}
Modified: branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/convert/IntegerSequenceRowKeyConverter.java
===================================================================
--- branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/convert/IntegerSequenceRowKeyConverter.java 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/convert/IntegerSequenceRowKeyConverter.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -21,7 +21,6 @@
*/
package org.richfaces.convert;
-import javax.faces.convert.IntegerConverter;
/**
* @author Nick Belaevski
@@ -32,7 +31,7 @@
public static final String CONVERTER_ID = "org.richfaces.IntegerSequenceRowKeyConverter";
public IntegerSequenceRowKeyConverter() {
- super(Integer.class, new IntegerConverter());
+ super(Integer.class, ConverterUtil.integerConverter());
}
}
Modified: branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/convert/SequenceRowKeyConverter.java
===================================================================
--- branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/convert/SequenceRowKeyConverter.java 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/convert/SequenceRowKeyConverter.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -1,12 +1,14 @@
package org.richfaces.convert;
+import static org.richfaces.model.TreeDataModel.SEPARATOR_CHAR;
+
import java.util.List;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.ConverterException;
-import static org.richfaces.model.TreeDataModel.*;
+
import org.richfaces.model.SequenceRowKey;
import com.google.common.base.Splitter;
@@ -21,7 +23,7 @@
public class SequenceRowKeyConverter<T> implements Converter {
- private static final Splitter DOT_SPLITTER = Splitter.on(SEPARATOR_CHAR);
+ static final Splitter SEPARATOR_SPLITTER = Splitter.on(SEPARATOR_CHAR);
private Class<T> clazz;
@@ -38,7 +40,7 @@
return null;
}
- Iterable<String> split = DOT_SPLITTER.split(value);
+ Iterable<String> split = SEPARATOR_SPLITTER.split(value);
List<T> keysList = Lists.<T>newArrayList();
for (String s: split) {
Modified: branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/model/DeclarativeTreeDataModelImpl.java
===================================================================
--- branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/model/DeclarativeTreeDataModelImpl.java 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/model/DeclarativeTreeDataModelImpl.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -34,6 +34,7 @@
import org.richfaces.convert.DeclarativeModelSequenceKeyConverter;
import org.richfaces.model.iterators.DeclarativeTreeDataModelCompositeTuplesIterator;
+import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.Iterables;
@@ -45,6 +46,8 @@
private static final Converter DEFAULT_CONVERTER = new DeclarativeModelSequenceKeyConverter();
+ private static final Predicate<Object> TREE_MODEL_ADAPTOR_INSTANCE_PREDICATE = Predicates.instanceOf(TreeModelAdaptor.class);
+
private AbstractTree tree;
private UIComponent currentComponent;
@@ -60,7 +63,14 @@
public boolean isLeaf() {
UIComponent currentComponent = getCurrentComponent();
- if (currentComponent instanceof TreeModelRecursiveAdaptor) {
+
+ TreeModelAdaptor adaptor = (TreeModelAdaptor) currentComponent;
+
+ if (adaptor.isLeaf()) {
+ return true;
+ }
+
+ if (adaptor instanceof TreeModelRecursiveAdaptor) {
return false;
}
@@ -68,7 +78,7 @@
return true;
}
- return !Iterables.any(currentComponent.getChildren(), Predicates.instanceOf(TreeModelAdaptor.class));
+ return !Iterables.any(currentComponent.getChildren(), TREE_MODEL_ADAPTOR_INSTANCE_PREDICATE);
}
public Iterator<TreeDataModelTuple> children() {
Modified: branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/renderkit/SortingFilteringRowsRenderer.java
===================================================================
--- branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/renderkit/SortingFilteringRowsRenderer.java 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/renderkit/SortingFilteringRowsRenderer.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -26,6 +26,7 @@
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Map;
+import java.util.Set;
import javax.el.ELContext;
import javax.el.ELException;
@@ -94,37 +95,35 @@
}
protected void decodeSorting(FacesContext context, UIDataTableBase dataTableBase, String value) {
-
- Collection<Object> sortPriority = dataTableBase.getSortPriority();
-
- if(sortPriority == null) {
- sortPriority = new LinkedHashSet<Object>();
- }
-
+ Set<Object> sortPriority = new LinkedHashSet<Object>();
+
String[] values = value.split(SEPARATOR);
- if (Boolean.parseBoolean(values[2]) || SortMode.single.equals(dataTableBase.getSortMode())) {
+ String columnId = values[0];
+ String sortOrder = values[1];
+ boolean isClear = Boolean.parseBoolean(values[2]);
+
+ if (isClear || SortMode.single.equals(dataTableBase.getSortMode())) {
for (Iterator<UIComponent> iterator = dataTableBase.columns(); iterator.hasNext();) {
UIComponent column = iterator.next();
- if (values[0].equals(column.getId())) {
- updateSortOrder(context, column, values[1]);
- sortPriority.add(values[0]);
+ if (columnId.equals(column.getId())) {
+ updateSortOrder(context, column, sortOrder);
+ sortPriority.add(columnId);
} else {
updateAttribute(context, column, SORT_ORDER_STRING, SortOrder.unsorted);
}
}
} else {
- updateSortOrder(context, dataTableBase.findComponent(values[0]), values[1]);
- sortPriority = dataTableBase.getSortPriority();
- if (sortPriority != null) {
- sortPriority.remove(values[0]);
- sortPriority.addAll(sortPriority);
+ updateSortOrder(context, dataTableBase.findComponent(columnId), sortOrder);
+ Collection<?> priority = dataTableBase.getSortPriority();
+ if (priority != null) {
+ priority.remove(columnId);
+ sortPriority.addAll(priority);
}
- sortPriority.add(values[0]);
+ sortPriority.add(columnId);
}
-
updateAttribute(context, dataTableBase, SORT_PRIORITY_STRING, sortPriority);
- context.getPartialViewContext().getRenderIds().add(dataTableBase.getClientId(context)); // TODO Use partial re-rendering here.
- }
+ context.getPartialViewContext().getRenderIds().add(dataTableBase.getClientId(context));
+ }
private void updateSortOrder(FacesContext context, UIComponent component, String value) {
SortOrder sortOrder = SortOrder.ascending;
Modified: branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/taglib/DataScrollerHandler.java
===================================================================
--- branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/taglib/DataScrollerHandler.java 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/taglib/DataScrollerHandler.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -116,7 +116,6 @@
MetaRuleset ruleset = super.createMetaRuleset(type);
ruleset.addRule(PAGERULE);
ruleset.addRule(SCROLL_LISTENER_RULE);
- ruleset.alias("for", "forComponent");
return ruleset;
}
}
Copied: branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/view/facelets/TreeAdaptorRowKeyConverterRule.java (from rev 20813, trunk/ui/iteration/ui/src/main/java/org/richfaces/view/facelets/TreeAdaptorRowKeyConverterRule.java)
===================================================================
--- branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/view/facelets/TreeAdaptorRowKeyConverterRule.java (rev 0)
+++ branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/view/facelets/TreeAdaptorRowKeyConverterRule.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -0,0 +1,86 @@
+/*
+ * 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.view.facelets;
+
+import javax.faces.component.UIComponent;
+import javax.faces.convert.Converter;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.MetaRule;
+import javax.faces.view.facelets.Metadata;
+import javax.faces.view.facelets.MetadataTarget;
+import javax.faces.view.facelets.TagAttribute;
+
+import org.richfaces.component.TreeModelAdaptor;
+
+/**
+ */
+public class TreeAdaptorRowKeyConverterRule extends MetaRule {
+
+ public static final TreeAdaptorRowKeyConverterRule INSTANCE = new TreeAdaptorRowKeyConverterRule();
+
+ @Override
+ public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget meta) {
+ if (meta.isTargetInstanceOf(TreeModelAdaptor.class)) {
+ if ("rowKeyConverter".equals(name)) {
+ if (attribute.isLiteral()) {
+ return new StaticConverterMetadata(attribute.getValue());
+ } else {
+ return new DynamicConverterMetaData(attribute);
+ }
+ }
+ }
+
+ return null;
+ }
+
+ static final class DynamicConverterMetaData extends Metadata {
+ private final TagAttribute attribute;
+
+ public DynamicConverterMetaData(TagAttribute attribute) {
+ super();
+ this.attribute = attribute;
+ }
+
+ @Override
+ public void applyMetadata(FaceletContext ctx, Object instance) {
+ ((UIComponent) instance).setValueExpression("rowKeyConverter",
+ attribute.getValueExpression(ctx, Converter.class));
+ }
+ }
+
+ static final class StaticConverterMetadata extends Metadata {
+ private final String converterId;
+
+ public StaticConverterMetadata(String converterId) {
+ super();
+ this.converterId = converterId;
+ }
+
+ @Override
+ public void applyMetadata(FaceletContext ctx, Object instance) {
+ Converter converter = ctx.getFacesContext().getApplication().createConverter(converterId);
+
+ ((TreeModelAdaptor) instance).setRowKeyConverter(converter);
+ }
+ }
+}
Copied: branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/view/facelets/TreeModelAdaptorHandler.java (from rev 20813, trunk/ui/iteration/ui/src/main/java/org/richfaces/view/facelets/TreeModelAdaptorHandler.java)
===================================================================
--- branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/view/facelets/TreeModelAdaptorHandler.java (rev 0)
+++ branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/view/facelets/TreeModelAdaptorHandler.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -0,0 +1,44 @@
+/*
+ * 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.view.facelets;
+
+import javax.faces.view.facelets.ComponentConfig;
+import javax.faces.view.facelets.ComponentHandler;
+import javax.faces.view.facelets.MetaRuleset;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class TreeModelAdaptorHandler extends ComponentHandler {
+
+ public TreeModelAdaptorHandler(ComponentConfig config) {
+ super(config);
+ }
+
+ @Override
+ protected MetaRuleset createMetaRuleset(Class type) {
+ MetaRuleset metaRuleset = super.createMetaRuleset(type);
+ metaRuleset.addRule(TreeAdaptorRowKeyConverterRule.INSTANCE);
+ return metaRuleset;
+ }
+}
Copied: branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/view/facelets/TreeModelRecursiveAdaptorHandler.java (from rev 20813, trunk/ui/iteration/ui/src/main/java/org/richfaces/view/facelets/TreeModelRecursiveAdaptorHandler.java)
===================================================================
--- branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/view/facelets/TreeModelRecursiveAdaptorHandler.java (rev 0)
+++ branches/RF-9323/ui/iteration/ui/src/main/java/org/richfaces/view/facelets/TreeModelRecursiveAdaptorHandler.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -0,0 +1,44 @@
+/*
+ * 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.view.facelets;
+
+import javax.faces.view.facelets.ComponentConfig;
+import javax.faces.view.facelets.ComponentHandler;
+import javax.faces.view.facelets.MetaRuleset;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class TreeModelRecursiveAdaptorHandler extends ComponentHandler {
+
+ public TreeModelRecursiveAdaptorHandler(ComponentConfig config) {
+ super(config);
+ }
+
+ @Override
+ protected MetaRuleset createMetaRuleset(Class type) {
+ MetaRuleset metaRuleset = super.createMetaRuleset(type);
+ metaRuleset.addRule(TreeAdaptorRowKeyConverterRule.INSTANCE);
+ return metaRuleset;
+ }
+}
Modified: branches/RF-9323/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datatable.js
===================================================================
--- branches/RF-9323/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datatable.js 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datatable.js 2010-12-27 18:59:46 UTC (rev 20814)
@@ -27,7 +27,7 @@
var createParameters = function(type, id, arg1, arg2) {
var parameters = {};
var key = this.id + type;
- parameters[key] = ((id || "") + ":" + (arg1 || "") + ":" + (arg2 || true));
+ parameters[key] = (id + ":" + (arg1 || "") + ":" + arg2);
var eventOptions = this.options.ajaxEventOption;
for (key in eventOptions) {
Modified: branches/RF-9323/ui/iteration/ui/src/test/java/org/richfaces/renderkit/ExtendedDataTableRendererTest.java
===================================================================
--- branches/RF-9323/ui/iteration/ui/src/test/java/org/richfaces/renderkit/ExtendedDataTableRendererTest.java 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/ui/iteration/ui/src/test/java/org/richfaces/renderkit/ExtendedDataTableRendererTest.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -39,7 +39,6 @@
import org.jboss.test.faces.htmlunit.HtmlUnitEnvironment;
import org.junit.After;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.richfaces.component.AbstractExtendedDataTable;
import org.richfaces.component.SortOrder;
Modified: branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/component/AbstractToolbar.java
===================================================================
--- branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/component/AbstractToolbar.java 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/component/AbstractToolbar.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -32,7 +32,8 @@
import org.richfaces.renderkit.html.ToolbarRendererBase;
@JsfComponent(family = AbstractToolbar.COMPONENT_FAMILY, type = AbstractToolbar.COMPONENT_TYPE,
- renderer=@JsfRenderer(type = ToolbarRendererBase.RENDERER_TYPE), tag = @Tag(name="toolbar")
+ renderer=@JsfRenderer(type = ToolbarRendererBase.RENDERER_TYPE), tag = @Tag(name="toolbar"),
+ attributes = {"core-props.xml"}
)
public abstract class AbstractToolbar extends UIComponentBase {
Modified: branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/component/AbstractTooltip.java
===================================================================
--- branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/component/AbstractTooltip.java 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/component/AbstractTooltip.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -30,7 +30,6 @@
import javax.faces.component.visit.VisitResult;
import javax.faces.context.FacesContext;
-import org.richfaces.TooltipDirection;
import org.richfaces.TooltipLayout;
import org.richfaces.TooltipMode;
import org.richfaces.context.ExtendedVisitContext;
Modified: branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/component/UITooltip.java
===================================================================
--- branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/component/UITooltip.java 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/component/UITooltip.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -24,7 +24,6 @@
package org.richfaces.component;
import org.richfaces.TooltipLayout;
-import org.richfaces.TooltipDirection;
import org.richfaces.TooltipMode;
/**
Modified: branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PopupPanelBaseRenderer.java
===================================================================
--- branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PopupPanelBaseRenderer.java 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/ui/output/ui/src/main/java/org/richfaces/renderkit/html/PopupPanelBaseRenderer.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -164,7 +164,7 @@
public String getStyleIfTrimmed(UIComponent panel){
if (panel.getAttributes().get("trimOverlayedElements").equals(Boolean.TRUE)) {
- return "position: relative, z-index : 0";
+ return "position: relative; z-index : 0;";
}
return "";
}
Modified: branches/RF-9323/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml
===================================================================
--- branches/RF-9323/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml 2010-12-27 18:59:46 UTC (rev 20814)
@@ -855,7 +855,7 @@
<property>
<description></description>
<property-name>direction</property-name>
- <property-class>org.richfaces.TooltipDirection</property-class>
+ <property-class>org.richfaces.component.TooltipDirection</property-class>
</property>
<property>
<description></description>
Modified: branches/RF-9323/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml
===================================================================
--- branches/RF-9323/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml 2010-12-27 18:59:46 UTC (rev 20814)
@@ -909,7 +909,7 @@
</attribute>
<attribute>
<name>direction</name>
- <type>org.richfaces.TooltipDirection</type>
+ <type>org.richfaces.component.TooltipDirection</type>
</attribute>
<attribute>
<name>disabled</name>
Modified: branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanel.ecss
===================================================================
--- branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanel.ecss 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanel.ecss 2010-12-27 18:59:46 UTC (rev 20814)
@@ -7,6 +7,7 @@
}
.rf-cp-hdr{
+ cursor: pointer;
background-color:'#{richSkin.headerBackgroundColor}';
border-color:'#{richSkin.headerBackgroundColor}';
font-size:'#{richSkin.headerSizeFont}';
Modified: branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanel.js
===================================================================
--- branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanel.js 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/collapsiblePanel.js 2010-12-27 18:59:46 UTC (rev 20814)
@@ -52,7 +52,7 @@
];
this.options.cycledSwitching = true;
- rf.Event.bindById(this.id + ":header", "click", this.__onHeaderClick, this)
+ rf.Event.bindById(this.id + ":header", "click", this.__onHeaderClick, this);
},
switchPanel : function (to) {
Modified: branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/menu.js
===================================================================
--- branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/menu.js 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/menu.js 2010-12-27 18:59:46 UTC (rev 20814)
@@ -47,6 +47,9 @@
this), this);
rf.Event.bindById(this.id, "mouseleave", $.proxy(this.__leaveHandler,
this), this);
+ if (!rf.ui.MenuManager)
+ rf.ui.MenuManager = {};
+ this.menuManager=rf.ui.MenuManager;
};
@@ -96,7 +99,7 @@
&& !this.__isGroup(item)) {
this.invokeEvent("itemclick", rf.getDomElement(this.id),
null);
- this.hidePopup();
+ this.hide();
}
},
@@ -119,8 +122,19 @@
// }
},
+
+ show: function() {
+ this.menuManager.shutdownMenu();
+ this.__showPopup();
+ this.menuManager.addMenuId(this.id);
+ },
+
+ hide: function() {
+ this.menuManager.deletedMenuId();
+ this.__hidePopup();
+ },
- showPopup : function() {
+ __showPopup : function() {
if (!this.__isShown()) {
this.invokeEvent("show", rf.getDomElement(this.id), null);
this.popupList.show();
@@ -128,7 +142,7 @@
}
},
- hidePopup : function() {
+ __hidePopup : function() {
/*
* for (var i in this.groupList) { this.groupList[i].hide(); }
*/
@@ -155,7 +169,7 @@
___showHandler : function() {
this.showTimeoutId = window.setTimeout($.proxy(function() {
- this.showPopup();
+ this.show();
}, this), this.options.showDelay);
},
@@ -166,7 +180,7 @@
__leaveHandler : function(e) {
window.clearTimeout(this.showTimeoutId);
this.hideTimeoutId = window.setTimeout($.proxy(function() {
- this.hidePopup();
+ this.hide();
}, this), this.options.hideDelay);
},
@@ -183,4 +197,25 @@
}
};
})());
+
+ rf.ui.MenuManager = {
+ openedMenu: null,
+
+ addMenuId: function(menuId) {
+ this.openedMenu = menuId;
+
+ },
+
+ deletedMenuId: function () {
+ this.openedMenu = null;
+ },
+
+ shutdownMenu: function () {
+ if (this.openedMenu != null){
+ rf.$(rf.getDomElement(this.openedMenu)).hide();
+ }
+ this.deletedMenuId();
+ }
+
+ }
})(jQuery, RichFaces)
\ No newline at end of file
Modified: branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanel.ecss
===================================================================
--- branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanel.ecss 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanel.ecss 2010-12-27 18:59:46 UTC (rev 20814)
@@ -65,14 +65,12 @@
z-index:100;
}
-.rf-pp-cnt-scrlr {
- position : relative;
+.rf-pp-cnt-scrlr {
top : 0px;
left : 0px;
overflow : auto;
}
-.rf-pp-cnt {
- position : relative;
+.rf-pp-cnt {
padding : 10px;
color : '#{richSkin.generalTextColor}';
font-family : '#{richSkin.generalFamilyFont}';
Modified: branches/RF-9323/ui/validator/ui/src/main/java/org/richfaces/component/UIAjaxValidator.java
===================================================================
--- branches/RF-9323/ui/validator/ui/src/main/java/org/richfaces/component/UIAjaxValidator.java 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/ui/validator/ui/src/main/java/org/richfaces/component/UIAjaxValidator.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -39,8 +39,6 @@
import javax.faces.event.FacesEvent;
import javax.faces.event.PhaseId;
-import org.ajax4jsf.component.AjaxComponent;
-import org.ajax4jsf.component.AjaxSupport;
import org.ajax4jsf.context.AjaxContext;
import org.richfaces.event.ValidatorEvent;
@@ -48,7 +46,7 @@
* JSF component class
*
*/
-public abstract class UIAjaxValidator extends UIComponentBase implements AjaxComponent, AjaxSupport, AjaxContainer {
+public abstract class UIAjaxValidator extends UIComponentBase implements AjaxContainer {
public static final String COMPONENT_TYPE = "org.richfaces.AjaxValidator";
@@ -65,6 +63,8 @@
}
}
+ public abstract String getOnsubmit();
+
/**
* @param parent
* @throws FacesException
Modified: branches/RF-9323/ui/validator/ui/src/main/java/org/richfaces/component/UIGraphValidator.java
===================================================================
--- branches/RF-9323/ui/validator/ui/src/main/java/org/richfaces/component/UIGraphValidator.java 2010-12-27 16:10:14 UTC (rev 20813)
+++ branches/RF-9323/ui/validator/ui/src/main/java/org/richfaces/component/UIGraphValidator.java 2010-12-27 18:59:46 UTC (rev 20814)
@@ -38,8 +38,8 @@
import javax.faces.context.FacesContext;
import javax.faces.validator.Validator;
+import org.richfaces.el.CapturingELResolver;
import org.richfaces.el.ELContextWrapper;
-import org.richfaces.el.util.CapturingELResolver;
import org.richfaces.validator.FacesBeanValidator;
import org.richfaces.validator.GraphValidator;
import org.richfaces.validator.GraphValidatorState;
14 years, 1 month
JBoss Rich Faces SVN: r20813 - in trunk: examples/iteration-demo/src/main/webapp and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-12-27 11:10:14 -0500 (Mon, 27 Dec 2010)
New Revision: 20813
Added:
trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/TreeModelDataBean.java
Modified:
trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/TreeModelBean.java
trunk/examples/iteration-demo/src/main/webapp/treeModel.xhtml
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/TreeModelAdaptor.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UITreeModelAdaptor.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UITreeModelRecursiveAdaptor.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/model/DeclarativeTreeDataModelImpl.java
Log:
https://issues.jboss.org/browse/RF-9987
Modified: trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/TreeModelBean.java
===================================================================
--- trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/TreeModelBean.java 2010-12-27 15:50:27 UTC (rev 20812)
+++ trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/TreeModelBean.java 2010-12-27 16:10:14 UTC (rev 20813)
@@ -1,61 +1,45 @@
-/**
- *
+/*
+ * 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.demo.model.tree;
-import javax.faces.FacesException;
-import javax.faces.bean.ApplicationScoped;
import javax.faces.bean.ManagedBean;
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Unmarshaller;
-import javax.xml.bind.Unmarshaller.Listener;
+import javax.faces.bean.ViewScoped;
-import org.richfaces.demo.model.tree.adaptors.Entry;
-import org.richfaces.demo.model.tree.adaptors.Root;
-
/**
* @author Nick Belaevski
- * mailto:nbelaevski@exadel.com
- * created 25.07.2007
- *
+ *
*/
@ManagedBean
-@ApplicationScoped
+@ViewScoped
public class TreeModelBean {
-
- private Root root;
-
- private void initializeRoot() {
-
- try {
- JAXBContext context = JAXBContext.newInstance(Root.class);
- Unmarshaller unmarshaller = context.createUnmarshaller();
- unmarshaller.setListener(new Listener() {
- @Override
- public void afterUnmarshal(Object target, Object parent) {
- super.afterUnmarshal(target, parent);
-
- if (parent instanceof Entry) {
- ((Entry) target).setParent((Entry) parent);
- }
-
- }
- });
-
-
- root = (Root) unmarshaller.unmarshal(TreeModelBean.class.getResource("tree-model-data.xml"));
- } catch (JAXBException e) {
- throw new FacesException(e.getMessage(), e);
- }
+
+ private boolean projectIsLeaf = false;
+
+ public boolean isProjectIsLeaf() {
+ return projectIsLeaf;
}
-
- public Root getRoot() {
- if (root == null) {
- initializeRoot();
- }
-
- return root;
- }
+ public void setProjectIsLeaf(boolean projectIsLeaf) {
+ this.projectIsLeaf = projectIsLeaf;
+ }
+
}
Copied: trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/TreeModelDataBean.java (from rev 20790, trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/TreeModelBean.java)
===================================================================
--- trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/TreeModelDataBean.java (rev 0)
+++ trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/TreeModelDataBean.java 2010-12-27 16:10:14 UTC (rev 20813)
@@ -0,0 +1,61 @@
+/**
+ *
+ */
+package org.richfaces.demo.model.tree;
+
+import javax.faces.FacesException;
+import javax.faces.bean.ApplicationScoped;
+import javax.faces.bean.ManagedBean;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.bind.Unmarshaller.Listener;
+
+import org.richfaces.demo.model.tree.adaptors.Entry;
+import org.richfaces.demo.model.tree.adaptors.Root;
+
+/**
+ * @author Nick Belaevski
+ * mailto:nbelaevski@exadel.com
+ * created 25.07.2007
+ *
+ */
+@ManagedBean
+@ApplicationScoped
+public class TreeModelDataBean {
+
+ private Root root;
+
+ private void initializeRoot() {
+
+ try {
+ JAXBContext context = JAXBContext.newInstance(Root.class);
+ Unmarshaller unmarshaller = context.createUnmarshaller();
+ unmarshaller.setListener(new Listener() {
+ @Override
+ public void afterUnmarshal(Object target, Object parent) {
+ super.afterUnmarshal(target, parent);
+
+ if (parent instanceof Entry) {
+ ((Entry) target).setParent((Entry) parent);
+ }
+
+ }
+ });
+
+
+ root = (Root) unmarshaller.unmarshal(TreeModelDataBean.class.getResource("tree-model-data.xml"));
+ } catch (JAXBException e) {
+ throw new FacesException(e.getMessage(), e);
+ }
+ }
+
+ public Root getRoot() {
+ if (root == null) {
+ initializeRoot();
+ }
+
+ return root;
+ }
+
+}
Modified: trunk/examples/iteration-demo/src/main/webapp/treeModel.xhtml
===================================================================
--- trunk/examples/iteration-demo/src/main/webapp/treeModel.xhtml 2010-12-27 15:50:27 UTC (rev 20812)
+++ trunk/examples/iteration-demo/src/main/webapp/treeModel.xhtml 2010-12-27 16:10:14 UTC (rev 20813)
@@ -16,13 +16,18 @@
<h:messages id="messages" />
</a4j:outputPanel>
+ <h:form>
+ Project is leaf:
+ <h:selectBooleanCheckbox value="#{treeModelBean.projectIsLeaf}" onclick="submit()" />
+ </h:form>
+
<h:form id="form">
<it:tree id="tree" var="node" toggleType="ajax">
<it:treeNode>
<a4j:commandLink value="#{node}" action="#{node.processClick}" />
</it:treeNode>
- <it:treeModelAdaptor nodes="#{treeModelBean.root.projects}">
+ <it:treeModelAdaptor nodes="#{treeModelDataBean.root.projects}" leaf="#{treeModelBean.projectIsLeaf}">
<it:treeNode iconExpanded="/images/folder_key.png" iconCollapsed="/images/folder_key.png">
<a4j:commandLink value="#{node}" action="#{node.processClick}" />
</it:treeNode>
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/TreeModelAdaptor.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/TreeModelAdaptor.java 2010-12-27 15:50:27 UTC (rev 20812)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/TreeModelAdaptor.java 2010-12-27 16:10:14 UTC (rev 20813)
@@ -39,4 +39,6 @@
public void setRowKeyConverter(Converter converter);
+ public boolean isLeaf();
+
}
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UITreeModelAdaptor.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UITreeModelAdaptor.java 2010-12-27 15:50:27 UTC (rev 20812)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UITreeModelAdaptor.java 2010-12-27 16:10:14 UTC (rev 20813)
@@ -38,7 +38,7 @@
public static final String COMPONENT_FAMILY = "org.richfaces.TreeModelAdaptor";
private enum PropertyKeys {
- nodes
+ nodes, leaf
}
@Override
@@ -58,4 +58,12 @@
getStateHelper().put(PropertyKeys.nodes, nodes);
}
-}
+ public boolean isLeaf() {
+ return (Boolean) getStateHelper().eval(PropertyKeys.leaf, false);
+ }
+
+ public void setLeaf(boolean leaf) {
+ getStateHelper().put(PropertyKeys.leaf, leaf);
+ }
+
+}
\ No newline at end of file
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UITreeModelRecursiveAdaptor.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UITreeModelRecursiveAdaptor.java 2010-12-27 15:50:27 UTC (rev 20812)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UITreeModelRecursiveAdaptor.java 2010-12-27 16:10:14 UTC (rev 20813)
@@ -38,7 +38,7 @@
public static final String COMPONENT_FAMILY = "org.richfaces.TreeModelRecursiveAdaptor";
private enum PropertyKeys {
- roots, nodes
+ roots, nodes, leaf
}
@Override
@@ -70,4 +70,12 @@
return null;
}
+ public boolean isLeaf() {
+ return (Boolean) getStateHelper().eval(PropertyKeys.leaf, false);
+ }
+
+ public void setLeaf(boolean leaf) {
+ getStateHelper().put(PropertyKeys.leaf, leaf);
+ }
+
}
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/model/DeclarativeTreeDataModelImpl.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/model/DeclarativeTreeDataModelImpl.java 2010-12-27 15:50:27 UTC (rev 20812)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/model/DeclarativeTreeDataModelImpl.java 2010-12-27 16:10:14 UTC (rev 20813)
@@ -63,7 +63,14 @@
public boolean isLeaf() {
UIComponent currentComponent = getCurrentComponent();
- if (currentComponent instanceof TreeModelRecursiveAdaptor) {
+
+ TreeModelAdaptor adaptor = (TreeModelAdaptor) currentComponent;
+
+ if (adaptor.isLeaf()) {
+ return true;
+ }
+
+ if (adaptor instanceof TreeModelRecursiveAdaptor) {
return false;
}
14 years, 1 month
JBoss Rich Faces SVN: r20812 - in trunk: examples/iteration-demo/src/main/webapp and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-12-27 10:50:27 -0500 (Mon, 27 Dec 2010)
New Revision: 20812
Added:
trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/PackageKey.java
trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/PackageKeyConverter.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/view/facelets/TreeAdaptorRowKeyConverterRule.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/view/facelets/TreeModelAdaptorHandler.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/view/facelets/TreeModelRecursiveAdaptorHandler.java
Removed:
trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/SimpleRecursiveNode.java
Modified:
trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/SourceDirectory.java
trunk/examples/iteration-demo/src/main/webapp/WEB-INF/faces-config.xml
trunk/examples/iteration-demo/src/main/webapp/treeModel.xhtml
trunk/ui/common/ui/src/main/java/org/richfaces/view/facelets/RowKeyConverterRule.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTreeModelAdaptor.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/TreeModelAdaptor.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UITreeModelAdaptor.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UITreeModelRecursiveAdaptor.java
Log:
https://issues.jboss.org/browse/RF-10047
https://issues.jboss.org/browse/RF-10038
https://issues.jboss.org/browse/RF-9995
https://issues.jboss.org/browse/RF-10007
Added: trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/PackageKey.java
===================================================================
--- trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/PackageKey.java (rev 0)
+++ trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/PackageKey.java 2010-12-27 15:50:27 UTC (rev 20812)
@@ -0,0 +1,72 @@
+/*
+ * 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.demo.model.tree.adaptors;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class PackageKey {
+
+ private String packageName;
+
+ public PackageKey(String packageName) {
+ super();
+ this.packageName = packageName;
+ }
+
+ public String getPackageName() {
+ return packageName;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((packageName == null) ? 0 : packageName.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ PackageKey other = (PackageKey) obj;
+ if (packageName == null) {
+ if (other.packageName != null) {
+ return false;
+ }
+ } else if (!packageName.equals(other.packageName)) {
+ return false;
+ }
+ return true;
+ }
+
+
+}
Added: trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/PackageKeyConverter.java
===================================================================
--- trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/PackageKeyConverter.java (rev 0)
+++ trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/PackageKeyConverter.java 2010-12-27 15:50:27 UTC (rev 20812)
@@ -0,0 +1,52 @@
+/*
+ * 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.demo.model.tree.adaptors;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+
+import com.google.common.base.Strings;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class PackageKeyConverter implements Converter {
+
+ public Object getAsObject(FacesContext context, UIComponent component, String value) {
+ if (Strings.isNullOrEmpty(value)) {
+ return null;
+ }
+
+ return new PackageKey(value);
+ }
+
+ public String getAsString(FacesContext context, UIComponent component, Object value) {
+ if (value == null) {
+ return "";
+ }
+
+ return ((PackageKey) value).getPackageName();
+ }
+
+}
Deleted: trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/SimpleRecursiveNode.java
===================================================================
--- trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/SimpleRecursiveNode.java 2010-12-27 15:41:34 UTC (rev 20811)
+++ trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/SimpleRecursiveNode.java 2010-12-27 15:50:27 UTC (rev 20812)
@@ -1,76 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, 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.demo.model.tree.adaptors;
-
-import java.util.List;
-
-import com.google.common.collect.Lists;
-
-/**
- * @author Nick Belaevski
- * @since 3.2
- */
-
-public class SimpleRecursiveNode {
-
- private SimpleRecursiveNode parent;
-
- private List<SimpleRecursiveNode> children = Lists.newArrayList();
-
- private String text;
-
- public SimpleRecursiveNode(SimpleRecursiveNode parent, String text) {
- super();
- this.parent = parent;
- if (parent != null) {
- parent.addChild(this);
- }
- this.text = text;
- }
-
- public void addChild(SimpleRecursiveNode node) {
- children.add(node);
- }
-
- public void removeChild(SimpleRecursiveNode node) {
- children.remove(node);
- }
-
- public void remove() {
- if (parent != null) {
- parent.removeChild(this);
- }
- }
-
- public SimpleRecursiveNode getParent() {
- return parent;
- }
-
- public List<SimpleRecursiveNode> getChildren() {
- return children;
- }
-
- public String getText() {
- return text;
- }
-}
Modified: trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/SourceDirectory.java
===================================================================
--- trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/SourceDirectory.java 2010-12-27 15:41:34 UTC (rev 20811)
+++ trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/model/tree/adaptors/SourceDirectory.java 2010-12-27 15:50:27 UTC (rev 20812)
@@ -23,9 +23,13 @@
package org.richfaces.demo.model.tree.adaptors;
import java.util.List;
+import java.util.Map;
import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlTransient;
+import com.google.common.collect.Maps;
+
/**
* @author Nick Belaevski
* mailto:nbelaevski@exadel.com
@@ -37,8 +41,19 @@
@XmlElement(name = "package")
private List<Package> packages;
- public List<Package> getPackages() {
- return packages;
+ @XmlTransient
+ private Map<PackageKey, Package> packagesMap;
+
+ public Map<PackageKey, Package> getPackages() {
+ if (packagesMap == null && packages != null) {
+ packagesMap = Maps.newLinkedHashMap();
+
+ for (Package pkg: packages) {
+ packagesMap.put(new PackageKey(pkg.getName()), pkg);
+ }
+ }
+
+ return packagesMap;
}
}
Modified: trunk/examples/iteration-demo/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- trunk/examples/iteration-demo/src/main/webapp/WEB-INF/faces-config.xml 2010-12-27 15:41:34 UTC (rev 20811)
+++ trunk/examples/iteration-demo/src/main/webapp/WEB-INF/faces-config.xml 2010-12-27 15:50:27 UTC (rev 20812)
@@ -1,7 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
- version="2.0">
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
+ version="2.0">
+
+
+ <converter>
+ <converter-id>org.richfaces.demo.PackageKeyConverter</converter-id>
+ <converter-class>org.richfaces.demo.model.tree.adaptors.PackageKeyConverter</converter-class>
+ </converter>
</faces-config>
Modified: trunk/examples/iteration-demo/src/main/webapp/treeModel.xhtml
===================================================================
--- trunk/examples/iteration-demo/src/main/webapp/treeModel.xhtml 2010-12-27 15:41:34 UTC (rev 20811)
+++ trunk/examples/iteration-demo/src/main/webapp/treeModel.xhtml 2010-12-27 15:50:27 UTC (rev 20812)
@@ -32,7 +32,7 @@
<a4j:commandLink value="#{node}" action="#{node.processClick}" />
</it:treeNode>
- <it:treeModelAdaptor nodes="#{node.packages}">
+ <it:treeModelAdaptor nodes="#{node.packages}" rowKeyConverter="org.richfaces.demo.PackageKeyConverter">
<it:treeModelAdaptor nodes="#{node.classes}" />
</it:treeModelAdaptor>
</it:treeModelAdaptor>
Modified: trunk/ui/common/ui/src/main/java/org/richfaces/view/facelets/RowKeyConverterRule.java
===================================================================
--- trunk/ui/common/ui/src/main/java/org/richfaces/view/facelets/RowKeyConverterRule.java 2010-12-27 15:41:34 UTC (rev 20811)
+++ trunk/ui/common/ui/src/main/java/org/richfaces/view/facelets/RowKeyConverterRule.java 2010-12-27 15:50:27 UTC (rev 20812)
@@ -21,8 +21,6 @@
package org.richfaces.view.facelets;
-import org.richfaces.component.UIDataAdaptor;
-
import javax.faces.convert.Converter;
import javax.faces.view.facelets.FaceletContext;
import javax.faces.view.facelets.MetaRule;
@@ -30,6 +28,8 @@
import javax.faces.view.facelets.MetadataTarget;
import javax.faces.view.facelets.TagAttribute;
+import org.richfaces.component.UIDataAdaptor;
+
/**
* Apply rowKeyConverter to component
*
@@ -39,13 +39,6 @@
public class RowKeyConverterRule extends MetaRule {
public static final RowKeyConverterRule INSTANCE = new RowKeyConverterRule();
- /*
- * (non-Javadoc)
- *
- * @see com.sun.facelets.tag.MetaRule#applyRule(java.lang.String,
- * com.sun.facelets.tag.TagAttribute,
- * com.sun.facelets.tag.MetadataTarget)
- */
@Override
public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget meta) {
if (meta.isTargetInstanceOf(UIDataAdaptor.class)) {
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTreeModelAdaptor.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTreeModelAdaptor.java 2010-12-27 15:41:34 UTC (rev 20811)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTreeModelAdaptor.java 2010-12-27 15:50:27 UTC (rev 20812)
@@ -60,9 +60,7 @@
public void setRowKeyConverter(Converter converter) {
StateHelper stateHelper = getStateHelper();
- if (initialStateMarked()) {
- stateHelper.put(PropertyKeys.rowKeyConverterSet, Boolean.TRUE);
- }
+ stateHelper.put(PropertyKeys.rowKeyConverterSet, Boolean.TRUE);
this.rowKeyConverter = converter;
}
@@ -80,10 +78,10 @@
}
private boolean isSetRowKeyConverter() {
- return isSetLocalRowKeyConverter() || getValueExpression(PropertyKeys.rowKeyConverter.toString()) != null;
+ return isLocalRowKeyConverterSet() || getValueExpression(PropertyKeys.rowKeyConverter.toString()) != null;
}
- private boolean isSetLocalRowKeyConverter() {
+ private boolean isLocalRowKeyConverterSet() {
Boolean value = (Boolean) getStateHelper().get(PropertyKeys.rowKeyConverterSet);
return Boolean.TRUE.equals(value);
}
@@ -132,7 +130,7 @@
boolean converterHasPartialState = false;
if (initialStateMarked()) {
- if (!isSetLocalRowKeyConverter() && rowKeyConverter != null && rowKeyConverter instanceof PartialStateHolder) {
+ if (!isLocalRowKeyConverterSet() && rowKeyConverter != null && rowKeyConverter instanceof PartialStateHolder) {
// Delta
StateHolder holder = (StateHolder) rowKeyConverter;
if (!holder.isTransient()) {
@@ -145,7 +143,7 @@
} else {
converterState = null;
}
- } else if (isSetLocalRowKeyConverter() || rowKeyConverter != null) {
+ } else if (isLocalRowKeyConverterSet() || rowKeyConverter != null) {
// Full
converterState = saveAttachedState(context, rowKeyConverter);
nullDelta = false;
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/TreeModelAdaptor.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/TreeModelAdaptor.java 2010-12-27 15:41:34 UTC (rev 20811)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/TreeModelAdaptor.java 2010-12-27 15:50:27 UTC (rev 20812)
@@ -37,4 +37,6 @@
@Attribute
public Converter getRowKeyConverter();
+ public void setRowKeyConverter(Converter converter);
+
}
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UITreeModelAdaptor.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UITreeModelAdaptor.java 2010-12-27 15:41:34 UTC (rev 20811)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UITreeModelAdaptor.java 2010-12-27 15:50:27 UTC (rev 20812)
@@ -30,7 +30,7 @@
*/
@JsfComponent(type = UITreeModelAdaptor.COMPONENT_TYPE,
family = UITreeModelAdaptor.COMPONENT_FAMILY,
- tag = @Tag(name = "treeModelAdaptor"))
+ tag = @Tag(name = "treeModelAdaptor", handler = "org.richfaces.view.facelets.TreeModelAdaptorHandler"))
public class UITreeModelAdaptor extends AbstractTreeModelAdaptor implements TreeModelAdaptor {
public static final String COMPONENT_TYPE = "org.richfaces.TreeModelAdaptor";
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UITreeModelRecursiveAdaptor.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UITreeModelRecursiveAdaptor.java 2010-12-27 15:41:34 UTC (rev 20811)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UITreeModelRecursiveAdaptor.java 2010-12-27 15:50:27 UTC (rev 20812)
@@ -30,7 +30,7 @@
*/
@JsfComponent(type = UITreeModelRecursiveAdaptor.COMPONENT_TYPE,
family = UITreeModelRecursiveAdaptor.COMPONENT_FAMILY,
- tag = @Tag(name = "treeModelRecursiveAdaptor"))
+ tag = @Tag(name = "treeModelRecursiveAdaptor", handler = "org.richfaces.view.facelets.TreeModelRecursiveAdaptorHandler"))
public class UITreeModelRecursiveAdaptor extends AbstractTreeModelAdaptor implements TreeModelRecursiveAdaptor {
public static final String COMPONENT_TYPE = "org.richfaces.TreeModelRecursiveAdaptor";
Added: trunk/ui/iteration/ui/src/main/java/org/richfaces/view/facelets/TreeAdaptorRowKeyConverterRule.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/view/facelets/TreeAdaptorRowKeyConverterRule.java (rev 0)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/view/facelets/TreeAdaptorRowKeyConverterRule.java 2010-12-27 15:50:27 UTC (rev 20812)
@@ -0,0 +1,86 @@
+/*
+ * 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.view.facelets;
+
+import javax.faces.component.UIComponent;
+import javax.faces.convert.Converter;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.MetaRule;
+import javax.faces.view.facelets.Metadata;
+import javax.faces.view.facelets.MetadataTarget;
+import javax.faces.view.facelets.TagAttribute;
+
+import org.richfaces.component.TreeModelAdaptor;
+
+/**
+ */
+public class TreeAdaptorRowKeyConverterRule extends MetaRule {
+
+ public static final TreeAdaptorRowKeyConverterRule INSTANCE = new TreeAdaptorRowKeyConverterRule();
+
+ @Override
+ public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget meta) {
+ if (meta.isTargetInstanceOf(TreeModelAdaptor.class)) {
+ if ("rowKeyConverter".equals(name)) {
+ if (attribute.isLiteral()) {
+ return new StaticConverterMetadata(attribute.getValue());
+ } else {
+ return new DynamicConverterMetaData(attribute);
+ }
+ }
+ }
+
+ return null;
+ }
+
+ static final class DynamicConverterMetaData extends Metadata {
+ private final TagAttribute attribute;
+
+ public DynamicConverterMetaData(TagAttribute attribute) {
+ super();
+ this.attribute = attribute;
+ }
+
+ @Override
+ public void applyMetadata(FaceletContext ctx, Object instance) {
+ ((UIComponent) instance).setValueExpression("rowKeyConverter",
+ attribute.getValueExpression(ctx, Converter.class));
+ }
+ }
+
+ static final class StaticConverterMetadata extends Metadata {
+ private final String converterId;
+
+ public StaticConverterMetadata(String converterId) {
+ super();
+ this.converterId = converterId;
+ }
+
+ @Override
+ public void applyMetadata(FaceletContext ctx, Object instance) {
+ Converter converter = ctx.getFacesContext().getApplication().createConverter(converterId);
+
+ ((TreeModelAdaptor) instance).setRowKeyConverter(converter);
+ }
+ }
+}
Added: trunk/ui/iteration/ui/src/main/java/org/richfaces/view/facelets/TreeModelAdaptorHandler.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/view/facelets/TreeModelAdaptorHandler.java (rev 0)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/view/facelets/TreeModelAdaptorHandler.java 2010-12-27 15:50:27 UTC (rev 20812)
@@ -0,0 +1,44 @@
+/*
+ * 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.view.facelets;
+
+import javax.faces.view.facelets.ComponentConfig;
+import javax.faces.view.facelets.ComponentHandler;
+import javax.faces.view.facelets.MetaRuleset;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class TreeModelAdaptorHandler extends ComponentHandler {
+
+ public TreeModelAdaptorHandler(ComponentConfig config) {
+ super(config);
+ }
+
+ @Override
+ protected MetaRuleset createMetaRuleset(Class type) {
+ MetaRuleset metaRuleset = super.createMetaRuleset(type);
+ metaRuleset.addRule(TreeAdaptorRowKeyConverterRule.INSTANCE);
+ return metaRuleset;
+ }
+}
Added: trunk/ui/iteration/ui/src/main/java/org/richfaces/view/facelets/TreeModelRecursiveAdaptorHandler.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/view/facelets/TreeModelRecursiveAdaptorHandler.java (rev 0)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/view/facelets/TreeModelRecursiveAdaptorHandler.java 2010-12-27 15:50:27 UTC (rev 20812)
@@ -0,0 +1,44 @@
+/*
+ * 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.view.facelets;
+
+import javax.faces.view.facelets.ComponentConfig;
+import javax.faces.view.facelets.ComponentHandler;
+import javax.faces.view.facelets.MetaRuleset;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class TreeModelRecursiveAdaptorHandler extends ComponentHandler {
+
+ public TreeModelRecursiveAdaptorHandler(ComponentConfig config) {
+ super(config);
+ }
+
+ @Override
+ protected MetaRuleset createMetaRuleset(Class type) {
+ MetaRuleset metaRuleset = super.createMetaRuleset(type);
+ metaRuleset.addRule(TreeAdaptorRowKeyConverterRule.INSTANCE);
+ return metaRuleset;
+ }
+}
14 years, 1 month
JBoss Rich Faces SVN: r20811 - in trunk/ui/iteration/ui/src/main/java/org/richfaces: component and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-12-27 10:41:34 -0500 (Mon, 27 Dec 2010)
New Revision: 20811
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/DataScrollerUtils.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractCollapsibleSubTableToggler.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataScroller.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/taglib/DataScrollerHandler.java
Log:
RF-9939, RF-9944
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/DataScrollerUtils.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/DataScrollerUtils.java 2010-12-27 14:48:05 UTC (rev 20810)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/DataScrollerUtils.java 2010-12-27 15:41:34 UTC (rev 20811)
@@ -99,7 +99,7 @@
public static UIComponent findDataTable(AbstractDataScroller dataScroller) {
- String forAttribute = dataScroller.getForComponent();
+ String forAttribute = dataScroller.getFor();
UIComponent forComp;
if (forAttribute == null) {
forComp = dataScroller;
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractCollapsibleSubTableToggler.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractCollapsibleSubTableToggler.java 2010-12-27 14:48:05 UTC (rev 20810)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractCollapsibleSubTableToggler.java 2010-12-27 15:41:34 UTC (rev 20811)
@@ -48,10 +48,6 @@
public static final String DEFAULT_EVENT = "onclick";
- enum PropertyKeys {
- forId
- }
-
@Attribute
public abstract String getExpandLabel();
@@ -66,12 +62,13 @@
@Attribute(defaultValue = DEFAULT_EVENT)
public abstract String getEvent();
-
+
+ @Attribute
public String getFor() {
- return (String)getStateHelper().eval(PropertyKeys.forId);
+ return (String)getStateHelper().eval("for");
}
public void setFor(String forId) {
- getStateHelper().put(PropertyKeys.forId, forId);
+ getStateHelper().put("for", forId);
}
}
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataScroller.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataScroller.java 2010-12-27 14:48:05 UTC (rev 20810)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataScroller.java 2010-12-27 15:41:34 UTC (rev 20811)
@@ -91,9 +91,6 @@
@Attribute
public abstract String getLastPageMode();
- @Attribute
- public abstract String getForComponent();
-
@Attribute(defaultValue="10")
public abstract int getMaxPages();
@@ -108,7 +105,16 @@
@Attribute(defaultValue="1")
public abstract int getFastStep();
+
+ @Attribute
+ public String getFor() {
+ return (String)getStateHelper().eval("for");
+ }
+ public void setFor(String forId) {
+ getStateHelper().put("for", forId);
+ }
+
public void addScrollerListener(DataScrollerListener listener) {
addFacesListener(listener);
}
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/taglib/DataScrollerHandler.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/taglib/DataScrollerHandler.java 2010-12-27 14:48:05 UTC (rev 20810)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/taglib/DataScrollerHandler.java 2010-12-27 15:41:34 UTC (rev 20811)
@@ -116,7 +116,6 @@
MetaRuleset ruleset = super.createMetaRuleset(type);
ruleset.addRule(PAGERULE);
ruleset.addRule(SCROLL_LISTENER_RULE);
- ruleset.alias("for", "forComponent");
return ruleset;
}
}
14 years, 1 month
JBoss Rich Faces SVN: r20810 - in trunk/ui: iteration/ui/src/main/java/org/richfaces/component and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-12-27 09:48:05 -0500 (Mon, 27 Dec 2010)
New Revision: 20810
Modified:
trunk/ui/common/ui/src/main/java/org/richfaces/component/UIDataAdaptor.java
trunk/ui/common/ui/src/main/java/org/richfaces/component/UISequence.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractCollapsibleSubTable.java
Log:
https://jira.jboss.org/browse/RF-9937
Modified: trunk/ui/common/ui/src/main/java/org/richfaces/component/UIDataAdaptor.java
===================================================================
--- trunk/ui/common/ui/src/main/java/org/richfaces/component/UIDataAdaptor.java 2010-12-27 13:37:38 UTC (rev 20809)
+++ trunk/ui/common/ui/src/main/java/org/richfaces/component/UIDataAdaptor.java 2010-12-27 14:48:05 UTC (rev 20810)
@@ -69,6 +69,7 @@
import org.ajax4jsf.model.DataVisitor;
import org.ajax4jsf.model.ExtendedDataModel;
import org.ajax4jsf.model.Range;
+import org.richfaces.cdk.annotations.Attribute;
import org.richfaces.context.ExtendedVisitContext;
import org.richfaces.log.Logger;
import org.richfaces.log.RichfacesLogger;
@@ -574,6 +575,7 @@
this.extendedDataModel = extendedDataModel;
}
+ @Attribute
public String getVar() {
return (String) getStateHelper().get(PropertyKeys.var);
}
@@ -582,6 +584,7 @@
getStateHelper().put(PropertyKeys.var, var);
}
+ @Attribute
public String getRowKeyVar() {
return (String) getStateHelper().get(PropertyKeys.rowKeyVar);
}
@@ -590,6 +593,7 @@
getStateHelper().put(PropertyKeys.rowKeyVar, rowKeyVar);
}
+ @Attribute
public String getStateVar() {
return (String) getStateHelper().get(PropertyKeys.stateVar);
}
@@ -616,6 +620,8 @@
* before rendering. By default state is reset if there are no faces messages with severity error or higher.
* @return
*/
+
+ @Attribute
public boolean isKeepSaved() {
Object value = getStateHelper().eval(PropertyKeys.keepSaved);
Modified: trunk/ui/common/ui/src/main/java/org/richfaces/component/UISequence.java
===================================================================
--- trunk/ui/common/ui/src/main/java/org/richfaces/component/UISequence.java 2010-12-27 13:37:38 UTC (rev 20809)
+++ trunk/ui/common/ui/src/main/java/org/richfaces/component/UISequence.java 2010-12-27 14:48:05 UTC (rev 20810)
@@ -45,6 +45,7 @@
import org.ajax4jsf.model.SequenceDataModel;
import org.ajax4jsf.model.SequenceRange;
import org.ajax4jsf.model.SequenceState;
+import org.richfaces.cdk.annotations.Attribute;
/**
* @author Nick Belaevski
@@ -139,6 +140,7 @@
return getFacesContext().getApplication().createConverter(Integer.class);
}
+ @Attribute
public int getFirst() {
return (Integer) getStateHelper().eval(PropertyKeys.first, 0);
}
@@ -148,6 +150,7 @@
updateState();
}
+ @Attribute
public int getRows() {
return (Integer) getStateHelper().eval(PropertyKeys.rows, 0);
}
@@ -157,6 +160,7 @@
updateState();
}
+ @Attribute
public Object getValue() {
return getStateHelper().eval(PropertyKeys.value);
}
@@ -166,6 +170,7 @@
getStateHelper().put(PropertyKeys.value, value);
}
+ @Attribute
public String getIterationStatusVar() {
return (String) getStateHelper().get(PropertyKeys.iterationStatusVar);
}
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractCollapsibleSubTable.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractCollapsibleSubTable.java 2010-12-27 13:37:38 UTC (rev 20809)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractCollapsibleSubTable.java 2010-12-27 14:48:05 UTC (rev 20810)
@@ -68,7 +68,8 @@
enum PropertyKeys {
expanded
}
-
+
+ @Attribute
public boolean isExpanded() {
return (Boolean)getStateHelper().eval(PropertyKeys.expanded, true);
}
14 years, 1 month