JBoss Rich Faces SVN: r8877 - trunk/ui/separator/src/test/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2008-06-03 06:39:29 -0400 (Tue, 03 Jun 2008)
New Revision: 8877
Modified:
trunk/ui/separator/src/test/java/org/richfaces/component/SeparatorComponentTest.java
Log:
Modified: trunk/ui/separator/src/test/java/org/richfaces/component/SeparatorComponentTest.java
===================================================================
--- trunk/ui/separator/src/test/java/org/richfaces/component/SeparatorComponentTest.java 2008-06-03 00:53:59 UTC (rev 8876)
+++ trunk/ui/separator/src/test/java/org/richfaces/component/SeparatorComponentTest.java 2008-06-03 10:39:29 UTC (rev 8877)
@@ -114,36 +114,71 @@
}
public void testRenderImage() throws Exception {
-
+ InternetResourceBuilder builder = ResourceBuilderImpl.getInstance();
+
ui.setLineType(SeparatorRendererBase.LINE_TYPE_BEVEL);
renderView();
- ImageInfo info = getImageResource("org.richfaces.renderkit.html.images.BevelSeparatorImage");
- assertNotNull(info);
+ InternetResource resource = builder.getResource("org.richfaces.renderkit.html.images.BevelSeparatorImage");
+ assertNotNull(resource);
+ String uri = "http:" + resource.getUri(facesContext, ui);
+ Page page = webClient.getPage(uri);
+ assertTrue(page.getWebResponse().getStatusCode() == HttpServletResponse.SC_OK);
+ ImageInfo info = new ImageInfo();
+ info.setInput(page.getWebResponse().getContentAsStream());
+ //image recognizable?
+ assertTrue(info.check());
assertEquals(ImageInfo.FORMAT_GIF, info.getFormat());
ui.setLineType(SeparatorRendererBase.LINE_TYPE_SOLID);
renderView();
- info = getImageResource("org.richfaces.renderkit.html.images.SimpleSeparatorImage");
- assertNotNull(info);
+ resource = builder.getResource("org.richfaces.renderkit.html.images.SimpleSeparatorImage");
+ assertNotNull(resource);
+ uri = "http:" + resource.getUri(facesContext, ui);
+ page = webClient.getPage(uri);
+ assertTrue(page.getWebResponse().getStatusCode() == HttpServletResponse.SC_OK);
+ info = new ImageInfo();
+ info.setInput(page.getWebResponse().getContentAsStream());
+ //image recognizable?
+ assertTrue(info.check());
assertEquals(ImageInfo.FORMAT_GIF, info.getFormat());
-
ui.setLineType(SeparatorRendererBase.LINE_TYPE_DOTTED);
renderView();
- info = getImageResource("org.richfaces.renderkit.html.images.SimpleSeparatorImage");
- assertNotNull(info);
+ resource = builder.getResource("org.richfaces.renderkit.html.images.SimpleSeparatorImage");
+ assertNotNull(resource);
+ uri = "http:" + resource.getUri(facesContext, ui);
+ page = webClient.getPage(uri);
+ assertTrue(page.getWebResponse().getStatusCode() == HttpServletResponse.SC_OK);
+ info = new ImageInfo();
+ info.setInput(page.getWebResponse().getContentAsStream());
+ //image recognizable?
+ assertTrue(info.check());
assertEquals(ImageInfo.FORMAT_GIF, info.getFormat());
ui.setLineType(SeparatorRendererBase.LINE_TYPE_DASHED);
renderView();
- info = getImageResource("org.richfaces.renderkit.html.images.SimpleSeparatorImage");
- assertNotNull(info);
+ resource = builder.getResource("org.richfaces.renderkit.html.images.SimpleSeparatorImage");
+ assertNotNull(resource);
+ uri = "http:" + resource.getUri(facesContext, ui);
+ page = webClient.getPage(uri);
+ assertTrue(page.getWebResponse().getStatusCode() == HttpServletResponse.SC_OK);
+ info = new ImageInfo();
+ info.setInput(page.getWebResponse().getContentAsStream());
+ //image recognizable?
+ assertTrue(info.check());
assertEquals(ImageInfo.FORMAT_GIF, info.getFormat());
ui.setLineType(SeparatorRendererBase.LINE_TYPE_DOUBLE);
renderView();
- info = getImageResource("org.richfaces.renderkit.html.images.SimpleSeparatorImage");
- assertNotNull(info);
+ resource = builder.getResource("org.richfaces.renderkit.html.images.SimpleSeparatorImage");
+ assertNotNull(resource);
+ uri = "http:" + resource.getUri(facesContext, ui);
+ page = webClient.getPage(uri);
+ assertTrue(page.getWebResponse().getStatusCode() == HttpServletResponse.SC_OK);
+ info = new ImageInfo();
+ info.setInput(page.getWebResponse().getContentAsStream());
+ //image recognizable?
+ assertTrue(info.check());
assertEquals(ImageInfo.FORMAT_GIF, info.getFormat());
}
}
16 years, 7 months
JBoss Rich Faces SVN: r8876 - in trunk: framework/impl/src/main/java/org/ajax4jsf/application and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2008-06-02 20:53:59 -0400 (Mon, 02 Jun 2008)
New Revision: 8876
Modified:
trunk/cdk/generator/pom.xml
trunk/framework/impl/src/main/java/org/ajax4jsf/application/AjaxStateManager.java
trunk/framework/impl/src/main/java/org/ajax4jsf/context/AjaxContextImpl.java
trunk/framework/test/src/test/java/org/ajax4jsf/application/AjaxStateManagerTest.java
Log:
http://jira.jboss.com/jira/browse/RF-3604 fixed
Modified: trunk/cdk/generator/pom.xml
===================================================================
--- trunk/cdk/generator/pom.xml 2008-06-02 17:46:39 UTC (rev 8875)
+++ trunk/cdk/generator/pom.xml 2008-06-03 00:53:59 UTC (rev 8876)
@@ -1,87 +1,93 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>cdk</artifactId>
- <groupId>org.richfaces</groupId>
- <version>3.2.2-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.richfaces.cdk</groupId>
- <artifactId>generator</artifactId>
- <version>3.2.2-SNAPSHOT</version>
- <name>Java Server Faces component generator</name>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <inherited>true</inherited>
- <configuration>
- <source>1.5</source>
- <target>1.5</target>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.1</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>ant</groupId>
- <artifactId>ant</artifactId>
- <version>1.6.5</version>
- </dependency>
- <dependency>
- <groupId>velocity</groupId>
- <artifactId>velocity-dep</artifactId>
- <version>1.4</version>
- </dependency>
- <dependency>
- <groupId>commons-beanutils</groupId>
- <artifactId>commons-beanutils</artifactId>
- <version>1.6</version>
- </dependency>
- <dependency>
- <groupId>commons-digester</groupId>
- <artifactId>commons-digester</artifactId>
- <version>1.5</version>
- </dependency>
- <dependency>
- <groupId>javax.faces</groupId>
- <artifactId>jsf-api</artifactId>
- <version>1.2_03</version>
- </dependency>
- <dependency>
- <groupId>javax.servlet.jsp</groupId>
- <artifactId>jsp-api</artifactId>
- <version>2.1</version>
- </dependency>
- <dependency>
- <groupId>javax.el</groupId>
- <artifactId>el-api</artifactId>
- <version>1.0</version>
- </dependency>
- <dependency>
- <groupId>el-impl</groupId>
- <artifactId>el-impl</artifactId>
- <version>1.0</version>
- </dependency>
- <dependency>
- <groupId>qdox</groupId>
- <artifactId>qdox</artifactId>
- <version>1.6</version>
- </dependency>
- <dependency>
- <groupId>cglib</groupId>
- <artifactId>cglib</artifactId>
- <version>2.1_3</version>
- </dependency>
- <dependency>
- <groupId>wutka</groupId>
- <artifactId>dtdparser</artifactId>
- <version>1.21</version>
- </dependency>
- </dependencies>
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <parent>
+ <artifactId>cdk</artifactId>
+ <groupId>org.richfaces</groupId>
+ <version>3.2.2-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>generator</artifactId>
+ <version>3.2.2-SNAPSHOT</version>
+ <name>Java Server Faces component generator</name>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <inherited>true</inherited>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant</artifactId>
+ <version>1.6.5</version>
+ </dependency>
+ <dependency>
+ <groupId>velocity</groupId>
+ <artifactId>velocity-dep</artifactId>
+ <version>1.4</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-beanutils</groupId>
+ <artifactId>commons-beanutils</artifactId>
+ <version>1.6</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-digester</groupId>
+ <artifactId>commons-digester</artifactId>
+ <version>1.5</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <version>1.2_03</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet.jsp</groupId>
+ <artifactId>jsp-api</artifactId>
+ <version>2.1</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ <version>1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>el-impl</groupId>
+ <artifactId>el-impl</artifactId>
+ <version>1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>qdox</groupId>
+ <artifactId>qdox</artifactId>
+ <version>1.6</version>
+ </dependency>
+ <dependency>
+ <groupId>cglib</groupId>
+ <artifactId>cglib</artifactId>
+ <version>2.1_3</version>
+ </dependency>
+ <dependency>
+ <groupId>wutka</groupId>
+ <artifactId>dtdparser</artifactId>
+ <version>1.21</version>
+ </dependency>
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <version>2.8.1</version>
+ </dependency>
+ </dependencies>
</project>
\ No newline at end of file
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/application/AjaxStateManager.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/application/AjaxStateManager.java 2008-06-02 17:46:39 UTC (rev 8875)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/application/AjaxStateManager.java 2008-06-03 00:53:59 UTC (rev 8876)
@@ -23,13 +23,16 @@
import java.io.IOException;
import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
+import javax.faces.FacesException;
import javax.faces.FactoryFinder;
import javax.faces.application.StateManager;
+import javax.faces.application.StateManager.SerializedView;
import javax.faces.component.UIComponentBase;
import javax.faces.component.UIViewRoot;
import javax.faces.context.ExternalContext;
@@ -49,6 +52,7 @@
*/
public class AjaxStateManager extends StateManager {
+
private final class SeamStateManagerWrapper extends StateManager {
protected Object getComponentStateToSave(FacesContext arg0) {
// do nothing
@@ -79,11 +83,17 @@
}
@SuppressWarnings("deprecation")
- public SerializedView saveSerializedView(FacesContext arg0) {
+ public SerializedView saveSerializedView(FacesContext context) {
// delegate to enclosed class method.
- return buildSerializedView(arg0);
+ Object[] viewState = buildViewState(context);
+ return new SerializedView(viewState[0],viewState[1]);
}
+ @Override
+ public Object saveView(FacesContext context) {
+ // TODO Auto-generated method stub
+ return buildViewState(context);
+ }
@SuppressWarnings("deprecation")
public void writeState(FacesContext arg0, SerializedView arg1)
throws IOException {
@@ -95,11 +105,11 @@
public static final int DEFAULT_NUMBER_OF_VIEWS = 16;
+ public static final String AJAX_VIEW_SEQUENCE = AjaxStateManager.class.getName()
+ + ".AJAX_VIEW_SEQUENCE";
+ public static final String VIEW_SEQUENCE = AjaxStateManager.class.getName()
+ + ".VIEW_SEQUENCE";
- public static final String VIEW_SEQUENCE = AjaxStateManager.class
- .getName()
- + ".VIEW_SEQUENCE";
-
private final StateManager parent;
private StateManager seamStateManager;
@@ -108,7 +118,9 @@
private static final Log _log = LogFactory.getLog(AjaxStateManager.class);
- public static final String VIEW_SEQUENCE_ATTRIBUTE = AjaxStateManager.class.getName()+".view_sequence";
+ public static final String VIEW_SEQUENCE_ATTRIBUTE = AjaxStateManager.class
+ .getName()
+ + ".view_sequence";
/**
* @param parent
@@ -127,7 +139,8 @@
}
try {
Class<? extends StateManager> seamStateManagerClass = classLoader
- .loadClass("org.jboss.seam.jsf.SeamStateManager").asSubclass(StateManager.class);
+ .loadClass("org.jboss.seam.jsf.SeamStateManager")
+ .asSubclass(StateManager.class);
Constructor<? extends StateManager> constructor = seamStateManagerClass
.getConstructor(STATE_MANAGER_ARGUMENTS);
seamStateManager = constructor
@@ -161,7 +174,8 @@
*/
protected Object getTreeStructureToSave(FacesContext context) {
TreeStructureNode treeStructure = new TreeStructureNode();
- treeStructure.apply(context, context.getViewRoot(), new HashSet<String>());
+ treeStructure.apply(context, context.getViewRoot(),
+ new HashSet<String>());
return treeStructure;
}
@@ -193,10 +207,65 @@
* @see javax.faces.application.StateManager#writeState(javax.faces.context.FacesContext,
* javax.faces.application.StateManager.SerializedView)
*/
+ public void writeState(FacesContext context, Object state)
+ throws IOException {
+ RenderKit renderKit = getRenderKit(context);
+ ResponseStateManager responseStateManager = renderKit
+ .getResponseStateManager();
+ Object[] stateArray = getStateArray( state );
+ if(null == stateArray[0] && null == stateArray[1]){
+ // Myfaces https://issues.apache.org/jira/browse/MYFACES-1753 hack.
+ stateArray=new Object[]{getLogicalViewId(context),null};
+ }
+ responseStateManager.writeState(context, stateArray);
+ if (_log.isDebugEnabled()) {
+ _log.debug("Write view state to the response");
+ }
+ }
+
+ /**
+ * @param context
+ * @param state
+ * @param responseStateManager
+ * @throws IOException
+ * @throws FacesException
+ */
+ private Object[] getStateArray(Object state) throws IOException,
+ FacesException {
+ if (null != state && state.getClass().isArray()
+ && state.getClass().getComponentType().equals(Object.class)) {
+ Object stateArray[] = (Object[]) state;
+ if (2 == stateArray.length) {
+ return stateArray;
+ } else {
+ throw new FacesException("Unexpected length of the state object array "+stateArray.length);
+ }
+ } else {
+ throw new FacesException("Unexpected type of the state "+state.getClass().getName());
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.application.StateManager#writeState(javax.faces.context.FacesContext,
+ * javax.faces.application.StateManager.SerializedView)
+ */
@SuppressWarnings("deprecation")
public void writeState(FacesContext context, SerializedView state)
throws IOException {
- parent.writeState(context, state);
+ RenderKit renderKit = getRenderKit(context);
+ ResponseStateManager responseStateManager = renderKit
+ .getResponseStateManager();
+ Object[] stateArray;
+ if(null == state.getState() && null == state.getStructure()){
+ // MyFaces https://issues.apache.org/jira/browse/MYFACES-1753 hack
+ stateArray = new Object[]{getLogicalViewId(context),null};
+ } else {
+ stateArray = new Object[] {
+ state.getStructure(),state.getState() };
+ }
+ responseStateManager.writeState(context, stateArray);
if (_log.isDebugEnabled()) {
_log.debug("Write view state to the response");
}
@@ -208,7 +277,6 @@
* @see javax.faces.application.StateManager#restoreView(javax.faces.context.FacesContext,
* java.lang.String, java.lang.String)
*/
- @SuppressWarnings("deprecation")
public UIViewRoot restoreView(FacesContext context, String viewId,
String renderKitId) {
UIViewRoot viewRoot = null;
@@ -216,20 +284,18 @@
renderKitId).getResponseStateManager();
TreeStructureNode treeStructure = null;
Object[] state = null;
+ Object[] serializedView = null;
if (isSavingStateInClient(context)) {
- treeStructure = (TreeStructureNode) responseStateManager
- .getTreeStructureToRestore(context, viewId);
- // viewRoot = parent.restoreView(context, viewId, renderKitId);
- state = (Object[]) responseStateManager
- .getComponentStateToRestore(context);
+ serializedView = (Object[]) responseStateManager.getState(context,
+ viewId);
} else {
- Object[] serializedView = restoreStateFromSession(context, viewId,
+ serializedView = restoreStateFromSession(context, viewId,
renderKitId);
- if (null != serializedView) {
- treeStructure = (TreeStructureNode) serializedView[0];
- state = (Object[]) serializedView[1];
- }
}
+ if (null != serializedView) {
+ treeStructure = (TreeStructureNode) serializedView[0];
+ state = (Object[]) serializedView[1];
+ }
if (null != treeStructure) {
viewRoot = (UIViewRoot) treeStructure.restore(componentLoader);
if (null != viewRoot && null != state) {
@@ -251,34 +317,44 @@
@SuppressWarnings("deprecation")
public SerializedView saveSerializedView(FacesContext context) {
+ Object[] stateViewArray;
if (null == seamStateManager) {
- return buildSerializedView(context);
+ stateViewArray = buildViewState(context);
} else {
// Delegate save method to seam State Manager.
- return seamStateManager.saveSerializedView(context);
+ stateViewArray=(Object[]) seamStateManager.saveView(context);
}
+ return new SerializedView(stateViewArray[0],stateViewArray[1]);
}
+ @Override
+ public Object saveView(FacesContext context) {
+ if (null == seamStateManager) {
+ return buildViewState(context);
+ } else {
+ // Delegate save method to seam State Manager.
+ return seamStateManager.saveView(context);
+ }
+ }
/**
* @param context
* @return
*/
- @SuppressWarnings("deprecation")
- protected SerializedView buildSerializedView(FacesContext context) {
- SerializedView serializedView = null;
+ protected Object[] buildViewState(FacesContext context) {
+ Object[] viewStateArray = null;
UIViewRoot viewRoot = context.getViewRoot();
- if (null !=viewRoot && !viewRoot.isTransient()) {
+ if (null != viewRoot && !viewRoot.isTransient()) {
TreeStructureNode treeStructure = (TreeStructureNode) getTreeStructureToSave(context);
Object state = getComponentStateToSave(context);
if (isSavingStateInClient(context)) {
- serializedView = new SerializedView(treeStructure, state);
+ viewStateArray = new Object[]{treeStructure, state};
} else {
- serializedView = saveStateInSession(context, treeStructure,
+ viewStateArray = saveStateInSession(context, treeStructure,
state);
}
}
- return serializedView;
+ return viewStateArray;
}
/**
@@ -287,16 +363,15 @@
* @param state
* @return
*/
- @SuppressWarnings("deprecation")
- protected SerializedView saveStateInSession(FacesContext context,
+ protected Object[] saveStateInSession(FacesContext context,
Object treeStructure, Object state) {
- SerializedView serializedView;
+ Object[] serializedView;
UIViewRoot viewRoot = context.getViewRoot();
StateHolder stateHolder = getStateHolder(context);
String id = getLogicalViewId(context);
stateHolder.saveState(viewRoot.getViewId(), id, new Object[] {
treeStructure, state });
- serializedView = new SerializedView(id, null);
+ serializedView = new Object[]{id, null};
return serializedView;
}
@@ -309,17 +384,21 @@
}
protected Object getAdditionalState(FacesContext context) {
- Map<String, Object> keepAliveBeans=new HashMap<String, Object>();
- Map<String, Object> requestMap = context.getExternalContext().getRequestMap();
- // Save all objects form request map wich marked by @KeepAlive annotations
+ Map<String, Object> keepAliveBeans = new HashMap<String, Object>();
+ Map<String, Object> requestMap = context.getExternalContext()
+ .getRequestMap();
+ // Save all objects form request map wich marked by @KeepAlive
+ // annotations
for (Entry<String, Object> requestEntry : requestMap.entrySet()) {
Object bean = requestEntry.getValue();
- // check value for a NULL - http://jira.jboss.com/jira/browse/RF-3576
- if (null != bean && bean.getClass().isAnnotationPresent(KeepAlive.class)) {
+ // check value for a NULL -
+ // http://jira.jboss.com/jira/browse/RF-3576
+ if (null != bean
+ && bean.getClass().isAnnotationPresent(KeepAlive.class)) {
keepAliveBeans.put(requestEntry.getKey(), bean);
}
}
- if(keepAliveBeans.size()>0){
+ if (keepAliveBeans.size() > 0) {
return UIComponentBase.saveAttachedState(context, keepAliveBeans);
} else {
return null;
@@ -328,10 +407,12 @@
@SuppressWarnings("unchecked")
protected void restoreAdditionalState(FacesContext context, Object state) {
- if(null != state){
+ if (null != state) {
// Append all saved beans to the request map.
- Map beansMap = (Map) UIComponentBase.restoreAttachedState(context, state);
- Map<String, Object> requestMap = context.getExternalContext().getRequestMap();
+ Map beansMap = (Map) UIComponentBase.restoreAttachedState(context,
+ state);
+ Map<String, Object> requestMap = context.getExternalContext()
+ .getRequestMap();
for (Object key : beansMap.keySet()) {
requestMap.put((String) key, beansMap.get(key));
}
@@ -340,6 +421,7 @@
/**
* Restore logical view id from request.
+ *
* @param context
* @param viewId
* @param renderKitId
@@ -352,26 +434,27 @@
.getResponseStateManager().getTreeStructureToRestore(context,
viewId);
if (null != id) {
- context.getExternalContext().getRequestMap().put(VIEW_SEQUENCE, id);
+ context.getExternalContext().getRequestMap().put(AJAX_VIEW_SEQUENCE, id);
}
return id;
}
/**
- * Return logical Id for current request view state. For a faces requests, generate sequence numbers.
- * For a ajax request, attempt to re-use id from request submit.
+ * Return logical Id for current request view state. For a faces requests,
+ * generate sequence numbers. For a ajax request, attempt to re-use id from
+ * request submit.
+ *
* @param context
* @return
*/
protected String getLogicalViewId(FacesContext context) {
AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
ExternalContext externalContext = context.getExternalContext();
- if (ajaxContext.isAjaxRequest()) {
- Object id = externalContext.getRequestMap().get(
- VIEW_SEQUENCE);
- if (null != id) {
- return id.toString();
- }
+ Object id=null;
+ Map<String, Object> requestMap = externalContext.getRequestMap();
+ id = requestMap.get(ajaxContext.isAjaxRequest()?AJAX_VIEW_SEQUENCE:VIEW_SEQUENCE);
+ if (null != id) {
+ return id.toString();
}
// Store sequence in session, to avoyd claster configuration problem
// see https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=662
@@ -379,8 +462,9 @@
int viewSequence;
synchronized (session) {
Map<String, Object> sessionMap = externalContext.getSessionMap();
- Integer sequence = (Integer) sessionMap.get(VIEW_SEQUENCE_ATTRIBUTE);
- if(null != sequence){
+ Integer sequence = (Integer) sessionMap
+ .get(VIEW_SEQUENCE_ATTRIBUTE);
+ if (null != sequence) {
viewSequence = sequence.intValue();
} else {
viewSequence = 0;
@@ -390,9 +474,24 @@
}
sessionMap.put(VIEW_SEQUENCE_ATTRIBUTE, new Integer(viewSequence));
}
- return UIViewRoot.UNIQUE_ID_PREFIX + ((int) viewSequence);
+ String logicalViewId = UIViewRoot.UNIQUE_ID_PREFIX + ((int) viewSequence);
+ // Store new viewId in the request parameters, to avoid re-increments in the same request.
+ requestMap.put(VIEW_SEQUENCE,logicalViewId);
+ return logicalViewId;
}
+ protected RenderKit getRenderKit(FacesContext context) {
+ String renderKitId = null;
+ UIViewRoot viewRoot = context.getViewRoot();
+ if (null != viewRoot) {
+ renderKitId = viewRoot.getRenderKitId();
+ }
+ if (null == renderKitId) {
+ renderKitId = context.getApplication().getViewHandler()
+ .calculateRenderKitId(context);
+ }
+ return getRenderKit(context, renderKitId);
+ }
protected RenderKit getRenderKit(FacesContext context, String renderKitId) {
RenderKit renderKit = context.getRenderKit();
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/context/AjaxContextImpl.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/context/AjaxContextImpl.java 2008-06-02 17:46:39 UTC (rev 8875)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/context/AjaxContextImpl.java 2008-06-03 00:53:59 UTC (rev 8876)
@@ -498,12 +498,11 @@
}
}
- @SuppressWarnings("deprecation")
public void saveViewState(FacesContext context) throws IOException {
ResponseWriter writer = context.getResponseWriter();
StateManager stateManager = context.getApplication().getStateManager();
- SerializedView serializedView = stateManager
- .saveSerializedView(context);
+ Object serializedView = stateManager
+ .saveView(context);
if (null != serializedView && null != writer) {
StringWriter bufWriter = new StringWriter();
ResponseWriter tempWriter;
Modified: trunk/framework/test/src/test/java/org/ajax4jsf/application/AjaxStateManagerTest.java
===================================================================
--- trunk/framework/test/src/test/java/org/ajax4jsf/application/AjaxStateManagerTest.java 2008-06-02 17:46:39 UTC (rev 8875)
+++ trunk/framework/test/src/test/java/org/ajax4jsf/application/AjaxStateManagerTest.java 2008-06-03 00:53:59 UTC (rev 8876)
@@ -114,9 +114,9 @@
public void testGetNextViewId() {
Object nextViewId = ajaxStateManager.getLogicalViewId(facesContext);
Object expected = ajaxStateManager.getLogicalViewId(facesContext);
- assertFalse(expected.equals(nextViewId));
+ assertTrue(expected.equals(nextViewId));
ajaxContext.setAjaxRequest(true);
- request.setAttribute(AjaxStateManager.VIEW_SEQUENCE, expected);
+ request.setAttribute(AjaxStateManager.AJAX_VIEW_SEQUENCE, expected);
nextViewId = ajaxStateManager.getLogicalViewId(facesContext);
assertEquals(expected, nextViewId);
}
16 years, 7 months
JBoss Rich Faces SVN: r8875 - in trunk/ui/scrollableDataTable/src/main: templates/org/richfaces and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2008-06-02 13:46:39 -0400 (Mon, 02 Jun 2008)
New Revision: 8875
Modified:
trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableBaseRenderer.java
trunk/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table-header-cell.jspx
trunk/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table.jspx
Log:
RF-3606
Modified: trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableBaseRenderer.java
===================================================================
--- trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableBaseRenderer.java 2008-06-02 16:47:39 UTC (rev 8874)
+++ trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableBaseRenderer.java 2008-06-02 17:46:39 UTC (rev 8875)
@@ -157,7 +157,6 @@
variables.setVariable("cell_index", new Integer(cell_index));
variables.setVariable("sepOffset", new Integer(sepOffset));
variables.setVariable("headerColumnClass", state.getColumnClass());
- variables.setVariable("columnWidth", width);
Boolean sorting = getColumnSorting(state.getGrid(), column.getId());
if (sorting != null) {
if (sorting.booleanValue()) {
@@ -173,6 +172,22 @@
headerCellTemplate.encodeEnd(context, column);
}
};
+
+ private final ColumnVisitor styleRenderer = new ColumnVisitor(){
+
+ public int visit(FacesContext context, UIComponent column, ResponseWriter writer, ScrollableDataTableRendererState state) throws IOException {
+
+ int cell_index = state.getCellIndex();
+ String widthPx = getColumnWidth(column);
+ widthPx = getFormattedWidth(widthPx);
+ int width = Integer.parseInt(widthPx);
+
+ writer.writeText(".dr-sdt-c-" + cell_index + " {", "width");
+ writer.writeText("width: " + width + "px;", "width");
+ writer.writeText("}", "width");
+ return 0;
+ }
+ };
private final ColumnVisitor headerRenderer = new ColumnVisitor() {
@@ -544,6 +559,11 @@
ColumnWalker.iterateOverColumns(context, grid, headerCellRenderer, writer, state);
}
+ public void renderStyle(FacesContext context, UIScrollableDataTable grid) throws IOException {
+ ScrollableDataTableRendererState state = ScrollableDataTableRendererState.getRendererState(context);
+ ColumnWalker.iterateOverColumns(context, grid, styleRenderer, context.getResponseWriter(), state);
+ }
+
public void renderFooters(FacesContext context, UIScrollableDataTable grid, boolean isFrozen) throws IOException{
ResponseWriter writer = context.getResponseWriter();
Modified: trunk/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table-header-cell.jspx
===================================================================
--- trunk/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table-header-cell.jspx 2008-06-02 16:47:39 UTC (rev 8874)
+++ trunk/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table-header-cell.jspx 2008-06-02 17:46:39 UTC (rev 8875)
@@ -21,13 +21,6 @@
}
</jsp:scriptlet>
- <style>
- <!--
- .dr-sdt-c-#{cell_index} {
- width: #{columnWidth}px;
- }
- -->
- </style>
<vcp:body/>
Modified: trunk/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table.jspx
===================================================================
--- trunk/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table.jspx 2008-06-02 16:47:39 UTC (rev 8874)
+++ trunk/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table.jspx 2008-06-02 17:46:39 UTC (rev 8875)
@@ -89,7 +89,13 @@
<div id="#{clientId}:cs" class="dr-sdt-hsplit" style="display: none;"/>
<div id="#{clientId}_GridHeaderTemplate" class="dr-sdt-inlinebox" style="#{hStyle}; width: #{component.attributes['width']};">
<iframe id="#{clientId}:hs" class="dr-sdt-substrate" src="javascript:\'\'" scrolling="no" frameborder="0" > <br/> </iframe>
- <div style="display: block; left: 0px; top: 0px; width: #{sumWidth}px;">
+ <div style="display: block; left: 0px; top: 0px; width: #{sumWidth}px;">
+ <style>
+ <f:call name="renderStyle" />
+ .dr-sdt-c-f {
+ width: 0px;
+ }
+ </style>
<span class="dr-sdt-tmplbox dr-sdt-fb" id="#{clientId}:header:FrozenBox">
<table cellpadding="0" cellspacing="0" style="border-collapse:collapse;">
<thead>
@@ -114,13 +120,6 @@
]]>
</jsp:scriptlet>
<th class="dr-sdt-hc dr-sdt-c-f rich-sdt-header-cell">
- <style>
- <!--
- .dr-sdt-c-f {
- width: 0px;
- }
- -->
- </style>
<div class="dr-sdt-cbody" />
</th>
</tr>
16 years, 7 months
JBoss Rich Faces SVN: r8874 - trunk/ui.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-06-02 12:47:39 -0400 (Mon, 02 Jun 2008)
New Revision: 8874
Modified:
trunk/ui/pom.xml
Log:
UI tests failure causes build failure
Modified: trunk/ui/pom.xml
===================================================================
--- trunk/ui/pom.xml 2008-06-02 10:50:18 UTC (rev 8873)
+++ trunk/ui/pom.xml 2008-06-02 16:47:39 UTC (rev 8874)
@@ -10,7 +10,6 @@
<packaging>pom</packaging>
<name>RichFaces Components</name>
<properties>
- <maven.test.failure.ignore>true</maven.test.failure.ignore>
<!-- -->
</properties>
<build>
16 years, 7 months
JBoss Rich Faces SVN: r8872 - management/design/treeTable.
by richfaces-svn-commits@lists.jboss.org
Author: ilya_shaikovsky
Date: 2008-06-02 06:49:49 -0400 (Mon, 02 Jun 2008)
New Revision: 8872
Added:
management/design/treeTable/funcspec/
Log:
treeTable documents moved here
Copied: management/design/treeTable/funcspec (from rev 8854, trunk/ui/treeTable/design/funcspec)
16 years, 7 months
JBoss Rich Faces SVN: r8871 - management/design.
by richfaces-svn-commits@lists.jboss.org
Author: ilya_shaikovsky
Date: 2008-06-02 06:49:10 -0400 (Mon, 02 Jun 2008)
New Revision: 8871
Added:
management/design/treeTable/
Log:
treeTable folder
16 years, 7 months
JBoss Rich Faces SVN: r8870 - management/design/tooltip.
by richfaces-svn-commits@lists.jboss.org
Author: ilya_shaikovsky
Date: 2008-06-02 06:47:54 -0400 (Mon, 02 Jun 2008)
New Revision: 8870
Added:
management/design/tooltip/funcspec/
Log:
tooltip documents moved here
Copied: management/design/tooltip/funcspec (from rev 8854, trunk/ui/tooltip/design/funcspec)
16 years, 7 months