JBoss Ajax4JSF SVN: r194 - trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/application.
by ajax4jsf-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2007-05-14 18:54:21 -0400 (Mon, 14 May 2007)
New Revision: 194
Added:
trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/application/PortletStates.java
Log:
Added: trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/application/PortletStates.java
===================================================================
--- trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/application/PortletStates.java (rev 0)
+++ trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/application/PortletStates.java 2007-05-14 22:54:21 UTC (rev 194)
@@ -0,0 +1,18 @@
+/**
+ *
+ */
+package org.ajax4jsf.portlet.application;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+import javax.portlet.PortletMode;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class PortletStates implements Serializable {
+ private String lastMode;
+ private Map states = new HashMap();
+}
17 years, 7 months
JBoss Ajax4JSF SVN: r193 - trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/application.
by ajax4jsf-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2007-05-14 18:53:12 -0400 (Mon, 14 May 2007)
New Revision: 193
Modified:
trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/application/PortalStateManager.java
trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/application/PortletViewState.java
Log:
Modified: trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/application/PortalStateManager.java
===================================================================
--- trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/application/PortalStateManager.java 2007-05-14 22:39:06 UTC (rev 192)
+++ trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/application/PortalStateManager.java 2007-05-14 22:53:12 UTC (rev 193)
@@ -74,7 +74,7 @@
stateMap = (Map) sessionMap.get(VIEW_STATES_MAP);
if(null == stateMap){
stateMap = new LRUMap();
- sessionMap.put(VIEW_STATES_MAP, sessionMap);
+ sessionMap.put(VIEW_STATES_MAP, stateMap);
}
}
return stateMap;
Modified: trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/application/PortletViewState.java
===================================================================
--- trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/application/PortletViewState.java 2007-05-14 22:39:06 UTC (rev 192)
+++ trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/application/PortletViewState.java 2007-05-14 22:53:12 UTC (rev 193)
@@ -23,6 +23,7 @@
private Map messages = new HashMap();
private UIViewRoot viewRoot;
+ private String viewId;
public void save(FacesContext facesContext){
UIViewRoot viewRoot = facesContext.getViewRoot();
17 years, 7 months
JBoss Ajax4JSF SVN: r192 - trunk/framework/src/main/java/org/ajax4jsf/framework/resource.
by ajax4jsf-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2007-05-14 18:39:06 -0400 (Mon, 14 May 2007)
New Revision: 192
Modified:
trunk/framework/src/main/java/org/ajax4jsf/framework/resource/ResourceBuilderImpl.java
trunk/framework/src/main/java/org/ajax4jsf/framework/resource/UserResource.java
Log:
fix AJSF-57 ( hidde attributes )
AJSF-60 Memory leak at the resource data encrypt/decript.
AJSF-61 Fix expires/last modified caching control for a resources renderer
Modified: trunk/framework/src/main/java/org/ajax4jsf/framework/resource/ResourceBuilderImpl.java
===================================================================
--- trunk/framework/src/main/java/org/ajax4jsf/framework/resource/ResourceBuilderImpl.java 2007-05-14 22:37:42 UTC (rev 191)
+++ trunk/framework/src/main/java/org/ajax4jsf/framework/resource/ResourceBuilderImpl.java 2007-05-14 22:39:06 UTC (rev 192)
@@ -559,6 +559,7 @@
int totalOut = compressor.deflate(compressed);
byte[] zipsrc = new byte[totalOut];
System.arraycopy(compressed, 0, zipsrc, 0, totalOut);
+ compressor.end();
return codec.encode(zipsrc);
} catch (Exception e) {
throw new FacesException("Error encode resource data", e);
@@ -572,9 +573,9 @@
byte[] uncompressed = new byte[zipsrc.length * 5];
decompressor.setInput(zipsrc);
int totalOut = decompressor.inflate(uncompressed);
- decompressor.end();
byte[] out = new byte[totalOut];
System.arraycopy(uncompressed, 0, out, 0, totalOut);
+ decompressor.end();
return out;
} catch (Exception e) {
throw new FacesException("Error decode resource data", e);
Modified: trunk/framework/src/main/java/org/ajax4jsf/framework/resource/UserResource.java
===================================================================
--- trunk/framework/src/main/java/org/ajax4jsf/framework/resource/UserResource.java 2007-05-14 22:37:42 UTC (rev 191)
+++ trunk/framework/src/main/java/org/ajax4jsf/framework/resource/UserResource.java 2007-05-14 22:39:06 UTC (rev 192)
@@ -79,7 +79,7 @@
dataToStore.expires = UIComponentBase.saveAttachedState(context,expires);
}
ValueBinding lastModified = component.getValueBinding("lastModified");
- if (null != expires) {
+ if (null != lastModified) {
dataToStore.modified = UIComponentBase.saveAttachedState(context,lastModified);
}
}
17 years, 7 months
JBoss Ajax4JSF SVN: r191 - trunk/test/src/test/java/org/ajax4jsf/framework/resource.
by ajax4jsf-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2007-05-14 18:37:42 -0400 (Mon, 14 May 2007)
New Revision: 191
Added:
trunk/test/src/test/java/org/ajax4jsf/framework/resource/ParametersEncodingTestCase.java
Log:
fix AJSF-57 ( hidde attributes )
AJSF-60 Memory leak at the resource data encrypt/decript.
AJSF-61 Fix expires/last modified caching control for a resources renderer
Added: trunk/test/src/test/java/org/ajax4jsf/framework/resource/ParametersEncodingTestCase.java
===================================================================
--- trunk/test/src/test/java/org/ajax4jsf/framework/resource/ParametersEncodingTestCase.java (rev 0)
+++ trunk/test/src/test/java/org/ajax4jsf/framework/resource/ParametersEncodingTestCase.java 2007-05-14 22:37:42 UTC (rev 191)
@@ -0,0 +1,47 @@
+package org.ajax4jsf.framework.resource;
+
+import java.util.Arrays;
+
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+
+public class ParametersEncodingTestCase extends AbstractAjax4JsfTestCase {
+
+ private ResourceBuilderImpl builder;
+
+ private byte[] data = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 };
+
+ public ParametersEncodingTestCase(String arg0) {
+ super(arg0);
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+ builder = new ResourceBuilderImpl();
+ }
+
+ public void tearDown() throws Exception {
+ builder = null;
+ super.tearDown();
+ }
+
+ public final void testEncrypt() {
+ byte[] bs = builder.encrypt(data);
+ byte[] bs2 = builder.decrypt(bs);
+ assertTrue(Arrays.equals(data, bs2));
+ }
+
+ public final void testDecryptLeak() {
+ byte[] bs = {};
+ for (int i = 0; i < 10000; i++) {
+ bs = builder.encrypt(data);
+
+ }
+ byte[] bs2={};
+ for (int i = 0; i < 10000; i++) {
+ bs2 = builder.decrypt(bs);
+
+ }
+ assertTrue(Arrays.equals(data, bs2));
+ }
+
+}
17 years, 7 months
JBoss Ajax4JSF SVN: r190 - trunk/framework/src/main/config/component.
by ajax4jsf-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2007-05-14 18:36:23 -0400 (Mon, 14 May 2007)
New Revision: 190
Modified:
trunk/framework/src/main/config/component/form.xml
trunk/framework/src/main/config/component/repeat.xml
trunk/framework/src/main/config/component/support.xml
Log:
fix AJSF-57 ( hidde attributes )
AJSF-60 Memory leak at the resource data encrypt/decript.
AJSF-61 Fix expires/last modified caching control for a resources renderer
Modified: trunk/framework/src/main/config/component/form.xml
===================================================================
--- trunk/framework/src/main/config/component/form.xml 2007-05-14 21:41:10 UTC (rev 189)
+++ trunk/framework/src/main/config/component/form.xml 2007-05-14 22:36:23 UTC (rev 190)
@@ -58,6 +58,9 @@
<classname>java.lang.String</classname>
<description>The flag indicating whether or not this form should prepend its id to its descendent id during the clientId generation process. If this flag is not set, the default value is true.</description>
</property>
+ <property disabled="true">
+ <name>submitted</name>
+ </property>
</component>
<component generate="false">
<name>javax.faces.HtmlCommandLink</name>
Modified: trunk/framework/src/main/config/component/repeat.xml
===================================================================
--- trunk/framework/src/main/config/component/repeat.xml 2007-05-14 21:41:10 UTC (rev 189)
+++ trunk/framework/src/main/config/component/repeat.xml 2007-05-14 22:36:23 UTC (rev 190)
@@ -43,11 +43,6 @@
&ui_data_attributes;
&ui_component_attributes;
<property>
- <name>varState</name>
- <classname>java.lang.String</classname>
- <description>varState</description>
- </property>
- <property>
<name>componentState</name>
<classname>java.lang.String</classname>
<description>It defines EL-binding for a component state for saving or redefinition.</description>
Modified: trunk/framework/src/main/config/component/support.xml
===================================================================
--- trunk/framework/src/main/config/component/support.xml 2007-05-14 21:41:10 UTC (rev 189)
+++ trunk/framework/src/main/config/component/support.xml 2007-05-14 22:36:23 UTC (rev 190)
@@ -109,6 +109,9 @@
<name>value</name>
<classname>java.lang.Object</classname>
</property>
+ <property disabled="true">
+ <name>parentProperties</name>
+ </property>
<property>
<name>ignoreDupResponses</name>
<classname>boolean</classname>
17 years, 7 months
JBoss Ajax4JSF SVN: r187 - in trunk/cdk/maven-cdk-plugin/src/main/resources: templates12 and 1 other directory.
by ajax4jsf-svn-commits@lists.jboss.org
Author: dbiatenia
Date: 2007-05-11 13:28:10 -0400 (Fri, 11 May 2007)
New Revision: 187
Modified:
trunk/cdk/maven-cdk-plugin/src/main/resources/templates/tld.vm
trunk/cdk/maven-cdk-plugin/src/main/resources/templates12/tld.vm
Log:
Bug AJSF-24
Modified: trunk/cdk/maven-cdk-plugin/src/main/resources/templates/tld.vm
===================================================================
--- trunk/cdk/maven-cdk-plugin/src/main/resources/templates/tld.vm 2007-05-11 10:55:00 UTC (rev 186)
+++ trunk/cdk/maven-cdk-plugin/src/main/resources/templates/tld.vm 2007-05-11 17:28:10 UTC (rev 187)
@@ -11,6 +11,9 @@
#if(${library.taglib.displayName})
<display-name>${library.taglib.displayName}</display-name>
#end
+#if(${library.description})
+ <description>${library.description}</description>
+#end
#if(${library.taglib.validatorClass})
<validator>
<validator-class>${library.taglib.validatorClass}</validator-class>
Modified: trunk/cdk/maven-cdk-plugin/src/main/resources/templates12/tld.vm
===================================================================
--- trunk/cdk/maven-cdk-plugin/src/main/resources/templates12/tld.vm 2007-05-11 10:55:00 UTC (rev 186)
+++ trunk/cdk/maven-cdk-plugin/src/main/resources/templates12/tld.vm 2007-05-11 17:28:10 UTC (rev 187)
@@ -3,7 +3,7 @@
<taglib xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="${library.taglib.jspVersion}">
- <tlib-version>${library.taglib.tlibVersion}</tlib-version>
+<tlib-version>${library.taglib.tlibVersion}</tlib-version>
#if(${library.taglib.shortName})
<short-name>${library.taglib.shortName}</short-name>
#end
@@ -11,6 +11,9 @@
#if(${library.taglib.displayName})
<display-name>${library.taglib.displayName}</display-name>
#end
+#if(${library.description})
+ <description>${library.description}</description>
+#end
#if(${library.taglib.validatorClass})
<validator>
<validator-class>${library.taglib.validatorClass}</validator-class>
17 years, 7 months
JBoss Ajax4JSF SVN: r186 - trunk/cdk/generator/src/main/resources/META-INF/schema/entities.
by ajax4jsf-svn-commits@lists.jboss.org
Author: vkukharchuk
Date: 2007-05-11 06:55:00 -0400 (Fri, 11 May 2007)
New Revision: 186
Modified:
trunk/cdk/generator/src/main/resources/META-INF/schema/entities/ui_data_attributes.ent
Log:
Modified: trunk/cdk/generator/src/main/resources/META-INF/schema/entities/ui_data_attributes.ent
===================================================================
--- trunk/cdk/generator/src/main/resources/META-INF/schema/entities/ui_data_attributes.ent 2007-05-08 01:59:47 UTC (rev 185)
+++ trunk/cdk/generator/src/main/resources/META-INF/schema/entities/ui_data_attributes.ent 2007-05-11 10:55:00 UTC (rev 186)
@@ -18,8 +18,8 @@
<name>var</name>
<classname>java.lang.String</classname>
<description>
- A request-scope attribute under which the data object for the
- current row is exposed when iterating
+ A request-scope attribute via which the data object for the
+ current row will be used when iterating.
</description>
</property>
<property disabled="true">
17 years, 7 months
JBoss Ajax4JSF SVN: r185 - tags.
by ajax4jsf-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2007-05-07 21:59:47 -0400 (Mon, 07 May 2007)
New Revision: 185
Added:
tags/1_1_1_rc2/
Log:
Copied: tags/1_1_1_rc2 (from rev 184, trunk)
17 years, 7 months
JBoss Ajax4JSF SVN: r184 - in trunk: a4j-portlet/src/main/java/org/ajax4jsf/portlet/application and 3 other directories.
by ajax4jsf-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2007-05-07 21:18:42 -0400 (Mon, 07 May 2007)
New Revision: 184
Added:
trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/application/PortalStateManager.java
trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/application/PortletViewState.java
Removed:
trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/PortletViewState.java
Modified:
trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/AjaxFacesPortlet.java
trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/application/PortletViewHandler.java
trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/context/AbstractExternalContext.java
trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/renderkit/portlet/PortletAjaxViewRootRenderer.java
trunk/samples/tomahawkCompability/src/main/webapp/pages/tabbedPanel.jsp
Log:
start implementation of the special Portlet state manager.
Modified: trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/AjaxFacesPortlet.java
===================================================================
--- trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/AjaxFacesPortlet.java 2007-05-07 22:57:59 UTC (rev 183)
+++ trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/AjaxFacesPortlet.java 2007-05-08 01:18:42 UTC (rev 184)
@@ -28,6 +28,7 @@
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import org.ajax4jsf.framework.ajax.AjaxContext;
+import org.ajax4jsf.portlet.application.PortletViewState;
import org.ajax4jsf.portlet.context.AbstractExternalContext;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -165,6 +166,7 @@
restoreView(facesContext);
AjaxContext ajaxContext = AjaxContext.getCurrentInstance(facesContext);
ajaxContext.getCommonAjaxParameters().put(AbstractExternalContext.ACTION__PARAMETER, facesContext.getApplication().getViewHandler().getActionURL(facesContext, facesContext.getViewRoot().getViewId()));
+ ajaxContext.getCommonAjaxParameters().put(AbstractExternalContext.PORTLET_MODE_PARAMETER,request.getPortletMode().toString());
render(facesContext);
writer.println("</div>");
PortletSession portletSession = request.getPortletSession(true);
Deleted: trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/PortletViewState.java
===================================================================
--- trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/PortletViewState.java 2007-05-07 22:57:59 UTC (rev 183)
+++ trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/PortletViewState.java 2007-05-08 01:18:42 UTC (rev 184)
@@ -1,103 +0,0 @@
-/**
- *
- */
-package org.ajax4jsf.portlet;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import javax.faces.application.FacesMessage;
-import javax.faces.component.UIViewRoot;
-import javax.faces.context.FacesContext;
-
-/**
- * @author asmirnov
- *
- */
-public class PortletViewState {
-
- public static final String SAVED_VIEW_ATTRIBUTE = PortletViewState.class.getName();
-
- private Map messages = new HashMap();
- private UIViewRoot viewRoot;
-
- public void save(FacesContext facesContext){
- UIViewRoot viewRoot = facesContext.getViewRoot();
- setViewRoot(viewRoot);
- Iterator idsWithMessages = facesContext.getClientIdsWithMessages();
- while (idsWithMessages.hasNext()) {
- String id = (String) idsWithMessages.next();
- Iterator messages = facesContext.getMessages(id);
- while (messages.hasNext()) {
- FacesMessage message = (FacesMessage) messages.next();
- addMessage(id, message);
- }
- }
-// facesContext.getExternalContext().getSessionMap().put(PortletViewState.SAVED_VIEW_ATTRIBUTE, this);
- }
-
- public void restore(FacesContext facesContext) {
- facesContext.setViewRoot(getViewRoot());
- Iterator idsWithMessages = getClientIdsWithMessages();
- while (idsWithMessages.hasNext()) {
- String id = (String) idsWithMessages.next();
- Iterator messages = getMessages(id);
- while (messages.hasNext()) {
- FacesMessage message = (FacesMessage) messages.next();
- facesContext.addMessage(id, message);
- }
- }
-
- }
-
- /**
- * @return the _messages
- */
- public Map getMessages() {
- return messages;
- }
- /**
- * @param _messages the _messages to set
- */
- public void setMessages(Map _messages) {
- this.messages = _messages;
- }
- /**
- * @return the _viewRoot
- */
- public UIViewRoot getViewRoot() {
- return viewRoot;
- }
- /**
- * @param root the _viewRoot to set
- */
- public void setViewRoot(UIViewRoot root) {
- viewRoot = root;
- }
-
- public void addMessage(String clientId, FacesMessage message) {
- List list = (List) messages.get(clientId);
- if (list == null) {
- list = new ArrayList();
- messages.put(clientId, list);
- }
- list.add(message);
- }
-
- public Iterator getClientIdsWithMessages() {
- return (messages.keySet().iterator());
- }
-
- public Iterator getMessages(String clientId) {
- List list = (List) messages.get(clientId);
- if (list != null) {
- return (list.iterator());
- } else {
- return (Collections.EMPTY_LIST.iterator());
- }
- }
-
-}
Added: trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/application/PortalStateManager.java
===================================================================
--- trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/application/PortalStateManager.java (rev 0)
+++ trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/application/PortalStateManager.java 2007-05-08 01:18:42 UTC (rev 184)
@@ -0,0 +1,83 @@
+/**
+ *
+ */
+package org.ajax4jsf.portlet.application;
+
+import java.io.IOException;
+import java.util.Map;
+import javax.faces.FactoryFinder;
+import javax.faces.application.StateManager;
+import javax.faces.application.StateManager.SerializedView;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import javax.faces.render.RenderKit;
+import javax.faces.render.RenderKitFactory;
+import javax.faces.render.ResponseStateManager;
+import org.ajax4jsf.framework.ajax.AjaxStateManager;
+import org.apache.commons.collections.map.LRUMap;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class PortalStateManager extends AjaxStateManager {
+
+ private static final String VIEW_STATES_MAP = PortalStateManager.class.getName();
+ /**
+ *
+ */
+ public PortalStateManager(StateManager parentStateManager) {
+ super(parentStateManager);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.application.StateManager#restoreView(javax.faces.context.FacesContext, java.lang.String, java.lang.String)
+ */
+ public UIViewRoot restoreView(FacesContext context, String viewId,
+ String renderKitId) {
+ UIViewRoot viewRoot = null;
+ if(isSavingStateInClient(context)){
+ viewRoot = super.restoreView(context, viewId, renderKitId);
+ }
+ // TODO - implement portal-specific view state.
+ return viewRoot;
+
+ }
+
+ public SerializedView saveSerializedView(FacesContext context) {
+ SerializedView serializedView = null;
+ if(isSavingStateInClient(context)){
+ serializedView = super.saveSerializedView(context);
+ }
+ // TODO - implement portal-specific view state saving.
+ return serializedView;
+ }
+
+ public void writeState(FacesContext context, SerializedView state) throws IOException {
+ String renderKitId = context.getViewRoot().getRenderKitId();
+ RenderKit renderKit = context.getRenderKit();
+ if(null == renderKit){
+ RenderKitFactory renderKitFactory = (RenderKitFactory) FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY);
+ renderKit = renderKitFactory.getRenderKit(context, renderKitId);
+ }
+ ResponseStateManager responseStateManager = renderKit.getResponseStateManager();
+ responseStateManager.writeState(context, state);
+ }
+
+ private Map getStatesMap(FacesContext context){
+ Map stateMap;
+ ExternalContext externalContext = context.getExternalContext();
+ Map sessionMap = externalContext.getSessionMap();
+ Object session = externalContext.getSession(false);
+ synchronized (session) {
+ stateMap = (Map) sessionMap.get(VIEW_STATES_MAP);
+ if(null == stateMap){
+ stateMap = new LRUMap();
+ sessionMap.put(VIEW_STATES_MAP, sessionMap);
+ }
+ }
+ return stateMap;
+ }
+
+}
Modified: trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/application/PortletViewHandler.java
===================================================================
--- trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/application/PortletViewHandler.java 2007-05-07 22:57:59 UTC (rev 183)
+++ trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/application/PortletViewHandler.java 2007-05-08 01:18:42 UTC (rev 184)
@@ -13,7 +13,6 @@
import javax.portlet.RenderResponse;
import org.ajax4jsf.framework.ajax.AjaxContext;
import org.ajax4jsf.framework.ajax.AjaxViewHandler;
-import org.ajax4jsf.portlet.PortletViewState;
import org.ajax4jsf.portlet.context.AbstractExternalContext;
/**
@@ -56,7 +55,7 @@
RenderResponse renderResponse = (RenderResponse) response;
PortletURL portletURL = renderResponse.createActionURL();
portletURL.setParameter(AbstractExternalContext.VIEW_ID_PARAMETER, context.getViewRoot().getViewId());
- portletURL.setParameter(AbstractExternalContext.NAMESPACE_PARAMETER, renderResponse.getNamespace());
+// portletURL.setParameter(AbstractExternalContext.NAMESPACE_PARAMETER, renderResponse.getNamespace());
return portletURL.toString();
} else if(null!=portalActionURL){
return portalActionURL;
Added: trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/application/PortletViewState.java
===================================================================
--- trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/application/PortletViewState.java (rev 0)
+++ trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/application/PortletViewState.java 2007-05-08 01:18:42 UTC (rev 184)
@@ -0,0 +1,103 @@
+/**
+ *
+ */
+package org.ajax4jsf.portlet.application;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class PortletViewState {
+
+ public static final String SAVED_VIEW_ATTRIBUTE = PortletViewState.class.getName();
+
+ private Map messages = new HashMap();
+ private UIViewRoot viewRoot;
+
+ public void save(FacesContext facesContext){
+ UIViewRoot viewRoot = facesContext.getViewRoot();
+ setViewRoot(viewRoot);
+ Iterator idsWithMessages = facesContext.getClientIdsWithMessages();
+ while (idsWithMessages.hasNext()) {
+ String id = (String) idsWithMessages.next();
+ Iterator messages = facesContext.getMessages(id);
+ while (messages.hasNext()) {
+ FacesMessage message = (FacesMessage) messages.next();
+ addMessage(id, message);
+ }
+ }
+// facesContext.getExternalContext().getSessionMap().put(PortletViewState.SAVED_VIEW_ATTRIBUTE, this);
+ }
+
+ public void restore(FacesContext facesContext) {
+ facesContext.setViewRoot(getViewRoot());
+ Iterator idsWithMessages = getClientIdsWithMessages();
+ while (idsWithMessages.hasNext()) {
+ String id = (String) idsWithMessages.next();
+ Iterator messages = getMessages(id);
+ while (messages.hasNext()) {
+ FacesMessage message = (FacesMessage) messages.next();
+ facesContext.addMessage(id, message);
+ }
+ }
+
+ }
+
+ /**
+ * @return the _messages
+ */
+ public Map getMessages() {
+ return messages;
+ }
+ /**
+ * @param _messages the _messages to set
+ */
+ public void setMessages(Map _messages) {
+ this.messages = _messages;
+ }
+ /**
+ * @return the _viewRoot
+ */
+ public UIViewRoot getViewRoot() {
+ return viewRoot;
+ }
+ /**
+ * @param root the _viewRoot to set
+ */
+ public void setViewRoot(UIViewRoot root) {
+ viewRoot = root;
+ }
+
+ public void addMessage(String clientId, FacesMessage message) {
+ List list = (List) messages.get(clientId);
+ if (list == null) {
+ list = new ArrayList();
+ messages.put(clientId, list);
+ }
+ list.add(message);
+ }
+
+ public Iterator getClientIdsWithMessages() {
+ return (messages.keySet().iterator());
+ }
+
+ public Iterator getMessages(String clientId) {
+ List list = (List) messages.get(clientId);
+ if (list != null) {
+ return (list.iterator());
+ } else {
+ return (Collections.EMPTY_LIST.iterator());
+ }
+ }
+
+}
Modified: trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/context/AbstractExternalContext.java
===================================================================
--- trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/context/AbstractExternalContext.java 2007-05-07 22:57:59 UTC (rev 183)
+++ trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/context/AbstractExternalContext.java 2007-05-08 01:18:42 UTC (rev 184)
@@ -104,6 +104,7 @@
*/
public static final String NAMESPACE_PARAMETER ="org.ajax4jsf.portlet.NAMESPACE";
public static final String ACTION__PARAMETER = "org.ajax4jsf.portlet.ACTION_URL";
+ public static final Object PORTLET_MODE_PARAMETER = "org.ajax4jsf.portlet.MODE";
// TODO - optimization.
private Map applicationMap;
Modified: trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/renderkit/portlet/PortletAjaxViewRootRenderer.java
===================================================================
--- trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/renderkit/portlet/PortletAjaxViewRootRenderer.java 2007-05-07 22:57:59 UTC (rev 183)
+++ trunk/a4j-portlet/src/main/java/org/ajax4jsf/portlet/renderkit/portlet/PortletAjaxViewRootRenderer.java 2007-05-08 01:18:42 UTC (rev 184)
@@ -8,6 +8,7 @@
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import org.ajax4jsf.framework.ajax.AjaxContext;
+import org.ajax4jsf.framework.renderer.AjaxContainerRenderer;
import org.ajax4jsf.framework.renderer.AjaxRendererUtils;
import org.ajax4jsf.framework.renderer.AjaxViewRootRenderer;
import org.ajax4jsf.framework.renderer.RendererUtils.HTML;
@@ -21,7 +22,7 @@
protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
Object namespace = context.getExternalContext().getRequestParameterMap().get(AbstractExternalContext.NAMESPACE_PARAMETER);
- Object ajaxRequestParameter = context.getExternalContext().getRequestParameterMap().get(AbstractExternalContext.NAMESPACE_PARAMETER);
+ Object ajaxRequestParameter = context.getExternalContext().getRequestParameterMap().get(AjaxContainerRenderer.AJAX_PARAMETER_NAME);
if(!ajaxContext.isAjaxRequest() && null !=namespace && null != ajaxRequestParameter){
// Navigation case, encode portlet window marker
writer.startElement(HTML.DIV_ELEM, component);
@@ -34,7 +35,7 @@
super.doEncodeEnd(writer, context, component);
AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
Object namespace = context.getExternalContext().getRequestParameterMap().get(AbstractExternalContext.NAMESPACE_PARAMETER);
- Object ajaxRequestParameter = context.getExternalContext().getRequestParameterMap().get(AbstractExternalContext.NAMESPACE_PARAMETER);
+ Object ajaxRequestParameter = context.getExternalContext().getRequestParameterMap().get(AjaxContainerRenderer.AJAX_PARAMETER_NAME);
if(!ajaxContext.isAjaxRequest() && null !=namespace && null != ajaxRequestParameter){
// Navigation case, encode portlet window marker
writer.endElement(HTML.DIV_ELEM);
Modified: trunk/samples/tomahawkCompability/src/main/webapp/pages/tabbedPanel.jsp
===================================================================
--- trunk/samples/tomahawkCompability/src/main/webapp/pages/tabbedPanel.jsp 2007-05-07 22:57:59 UTC (rev 183)
+++ trunk/samples/tomahawkCompability/src/main/webapp/pages/tabbedPanel.jsp 2007-05-08 01:18:42 UTC (rev 184)
@@ -31,7 +31,7 @@
</a4j:form>
<h2>Same form without user-provided ID</h2>
<f:subview id="subview">
- <a4j:form ajaxSubmit="true" reRender="counterB">
+ <a4j:form ajaxSubmit="true" reRender="counterB" onsubmit="alert('onsubmit');">
<h:panelGrid columns="2" border="1">
<h:commandButton action="#{beanB.inc}" value="Increment" />
<h:commandLink value="Decrement" action="#{beanB.dec}"></h:commandLink>
17 years, 7 months
JBoss Ajax4JSF SVN: r183 - trunk/framework/src/main/javascript/ajaxjsf.
by ajax4jsf-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2007-05-07 18:57:59 -0400 (Mon, 07 May 2007)
New Revision: 183
Modified:
trunk/framework/src/main/javascript/ajaxjsf/JSFAJAX.js
Log:
Fix AJSF-59 , double call 'onsubmit' in a a4j:form
Modified: trunk/framework/src/main/javascript/ajaxjsf/JSFAJAX.js
===================================================================
--- trunk/framework/src/main/javascript/ajaxjsf/JSFAJAX.js 2007-05-07 21:04:16 UTC (rev 182)
+++ trunk/framework/src/main/javascript/ajaxjsf/JSFAJAX.js 2007-05-07 22:57:59 UTC (rev 183)
@@ -484,6 +484,7 @@
LOG.debug("Form submitted by button "+A4J._formInput.id);
opt.control = A4J._formInput;
A4J._formInput = null;
+ opt.submitByForm=true;
}
A4J.AJAX.Submit(containerId,form,null,opt);
}
@@ -570,7 +571,7 @@
};
};
// TODO - test for null of form object
- if(form && form.onsubmit) {
+ if(!options.submitByForm && form && form.onsubmit) {
LOG.debug("Form have onsubmit function, call it" );
if( form.onsubmit() == false ){
return false;
17 years, 7 months