JBoss Rich Faces SVN: r8151 - trunk/test-applications/facelets/src/main/java/util/data.
by richfaces-svn-commits@lists.jboss.org
Author: ayanul
Date: 2008-04-25 04:29:13 -0400 (Fri, 25 Apr 2008)
New Revision: 8151
Modified:
trunk/test-applications/facelets/src/main/java/util/data/Data.java
Log:
add serialVersionUID
Modified: trunk/test-applications/facelets/src/main/java/util/data/Data.java
===================================================================
--- trunk/test-applications/facelets/src/main/java/util/data/Data.java 2008-04-25 08:24:57 UTC (rev 8150)
+++ trunk/test-applications/facelets/src/main/java/util/data/Data.java 2008-04-25 08:29:13 UTC (rev 8151)
@@ -4,6 +4,10 @@
import java.util.Random;
public class Data implements Serializable{
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
public static final String[] statusIcon = {"/pics/error.gif", "/pics/fatal.gif", "/pics/info.gif", "/pics/passed.gif", "/pics/warn.gif"};
public static final String[] status = {"error", "fatal", "info", "passed", "warn"};
16 years, 8 months
JBoss Rich Faces SVN: r8150 - trunk/test-applications/facelets/src/main/webapp/SortingAndFiltering.
by richfaces-svn-commits@lists.jboss.org
Author: mvitenkov
Date: 2008-04-25 04:24:57 -0400 (Fri, 25 Apr 2008)
New Revision: 8150
Modified:
trunk/test-applications/facelets/src/main/webapp/SortingAndFiltering/SortingAndFiltering.xhtml
Log:
"multi" sortMode instead of "multy"
Modified: trunk/test-applications/facelets/src/main/webapp/SortingAndFiltering/SortingAndFiltering.xhtml
===================================================================
--- trunk/test-applications/facelets/src/main/webapp/SortingAndFiltering/SortingAndFiltering.xhtml 2008-04-25 08:16:44 UTC (rev 8149)
+++ trunk/test-applications/facelets/src/main/webapp/SortingAndFiltering/SortingAndFiltering.xhtml 2008-04-25 08:24:57 UTC (rev 8150)
@@ -156,7 +156,7 @@
<h:outputText value="sortMode" />
<h:selectOneRadio value="#{sortingAndFiltering.sortMode}" onchange="submit();">
<f:selectItem itemLabel="single" itemValue="single" />
- <f:selectItem itemLabel="multy" itemValue="multy" />
+ <f:selectItem itemLabel="multi" itemValue="multi" />
</h:selectOneRadio>
<h:outputText value="selfSorted" />
16 years, 8 months
JBoss Rich Faces SVN: r8149 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: msorokin
Date: 2008-04-25 04:16:44 -0400 (Fri, 25 Apr 2008)
New Revision: 8149
Modified:
trunk/docs/userguide/en/src/main/docbook/included/calendar.xml
Log:
http://jira.jboss.com/jira/browse/RF-2329
Corrected wording
Modified: trunk/docs/userguide/en/src/main/docbook/included/calendar.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/calendar.xml 2008-04-25 07:54:26 UTC (rev 8148)
+++ trunk/docs/userguide/en/src/main/docbook/included/calendar.xml 2008-04-25 08:16:44 UTC (rev 8149)
@@ -103,11 +103,11 @@
</emphasis> attribute isn't available in the popup mode.</para>
<para>The <emphasis role="bold">
<property><rich:calendar></property>
- </emphasis> component ables to render pages of days in two modes. Switching mode could be
+ </emphasis> component can render pages of days in two modes. A mode could be
defined with the <emphasis>
<property>"mode"</property>
- </emphasis> attribute with two possible parameters: ajax and client. Default value is set to
- the "client".</para>
+ </emphasis> attribute with two possible parameters: "ajax" and "client". Default value is
+ "client".</para>
<itemizedlist>
<listitem>
<para>Ajax</para>
16 years, 8 months
JBoss Rich Faces SVN: r8148 - in trunk/test-applications/qa: Suite and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: tkuprevich
Date: 2008-04-25 03:54:26 -0400 (Fri, 25 Apr 2008)
New Revision: 8148
Added:
trunk/test-applications/qa/Test Reports/3.2.1/
trunk/test-applications/qa/Test Reports/3.2.1/DailyReportCR1tkuprevich.xls
Modified:
trunk/test-applications/qa/Performance Suite/Performance Test Suite Blank 3.2.0 (1).doc
trunk/test-applications/qa/Test Reports/DailyReportTemplate.xls
Log:
Modified: trunk/test-applications/qa/Performance Suite/Performance Test Suite Blank 3.2.0 (1).doc
===================================================================
(Binary files differ)
Added: trunk/test-applications/qa/Test Reports/3.2.1/DailyReportCR1tkuprevich.xls
===================================================================
(Binary files differ)
Property changes on: trunk/test-applications/qa/Test Reports/3.2.1/DailyReportCR1tkuprevich.xls
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/test-applications/qa/Test Reports/DailyReportTemplate.xls
===================================================================
(Binary files differ)
16 years, 8 months
JBoss Rich Faces SVN: r8147 - trunk/framework/impl/src/main/java/org/richfaces/skin.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-04-24 20:52:13 -0400 (Thu, 24 Apr 2008)
New Revision: 8147
Modified:
trunk/framework/impl/src/main/java/org/richfaces/skin/AbstractChainableSkinImpl.java
trunk/framework/impl/src/main/java/org/richfaces/skin/BasicSkinImpl.java
Log:
Skins code refactored
Modified: trunk/framework/impl/src/main/java/org/richfaces/skin/AbstractChainableSkinImpl.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/skin/AbstractChainableSkinImpl.java 2008-04-25 00:25:03 UTC (rev 8146)
+++ trunk/framework/impl/src/main/java/org/richfaces/skin/AbstractChainableSkinImpl.java 2008-04-25 00:52:13 UTC (rev 8147)
@@ -43,7 +43,7 @@
}
protected Skin getBaseSkin(FacesContext context) {
- Object object = getSkinParams().get(Skin.baseSkin);
+ Object object = getLocalParameter(context, Skin.baseSkin);
boolean base = isBase();
Skin skin = null;
@@ -82,7 +82,7 @@
}
}
- return getValueReference(context, object);
+ return object;
}
protected boolean containsProperty(FacesContext context, String name, int[] singleInt) {
@@ -110,13 +110,13 @@
protected Object resolveSkinParameter(FacesContext context, String name) {
int[] singleInt = new int[] {0};
- Object resolvedParameter = resolveSkinParameter(context, name, singleInt);
+ Object resolvedParameter = getValueReference(context, resolveSkinParameter(context, name, singleInt));
while (resolvedParameter instanceof String) {
String string = (String) resolvedParameter;
if (string.length() > 0 && string.charAt(0) == '&') {
singleInt[0]++;
- resolvedParameter = resolveSkinParameter(context, string.substring(1), singleInt);
+ resolvedParameter = getValueReference(context, resolveSkinParameter(context, string.substring(1), singleInt));
if (resolvedParameter == null) {
throw new FacesException(Messages.getMessage(
Messages.SKIN_ILLEGAL_REFERENCE, name));
Modified: trunk/framework/impl/src/main/java/org/richfaces/skin/BasicSkinImpl.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/skin/BasicSkinImpl.java 2008-04-25 00:25:03 UTC (rev 8146)
+++ trunk/framework/impl/src/main/java/org/richfaces/skin/BasicSkinImpl.java 2008-04-25 00:52:13 UTC (rev 8147)
@@ -56,10 +56,6 @@
this.skinParams = properties;
}
- protected Map<String, Object> getSkinParams() {
- return skinParams;
- }
-
/* (non-Javadoc)
* @see org.richfaces.skin.Skin#getRenderKitId(javax.faces.context.FacesContext)
*/
@@ -85,6 +81,10 @@
return value;
}
+ protected Object getLocalParameter(FacesContext context, String name) {
+ return getValueReference(context, skinParams.get(name));
+ }
+
protected Object resolveSkinParameter(FacesContext context, String name) {
return skinParams.get(name);
}
16 years, 8 months
JBoss Rich Faces SVN: r8146 - trunk/framework/test/src/test/java/org/richfaces/skin.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-04-24 20:25:03 -0400 (Thu, 24 Apr 2008)
New Revision: 8146
Modified:
trunk/framework/test/src/test/java/org/richfaces/skin/SkinTestCase.java
Log:
Skin inheritance implemented
Modified: trunk/framework/test/src/test/java/org/richfaces/skin/SkinTestCase.java
===================================================================
--- trunk/framework/test/src/test/java/org/richfaces/skin/SkinTestCase.java 2008-04-25 00:24:48 UTC (rev 8145)
+++ trunk/framework/test/src/test/java/org/richfaces/skin/SkinTestCase.java 2008-04-25 00:25:03 UTC (rev 8146)
@@ -292,7 +292,7 @@
assertNotNull("Null skin!",skin);
// test properties
int hash = skin.hashCode(mockContext);
- assertTrue(params.containsKey(SkinImpl.REQUEST_HASH_CODES_MAP_PARAMETER));
+ assertTrue(params.containsKey(BasicSkinImpl.REQUEST_HASH_CODES_MAP_PARAMETER));
assertEquals(hash,skin.hashCode(mockContext));
params.clear();
assertEquals(hash,skin.hashCode(mockContext));
16 years, 8 months
JBoss Rich Faces SVN: r8145 - trunk/framework/impl/src/main/java/org/richfaces/skin.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-04-24 20:24:48 -0400 (Thu, 24 Apr 2008)
New Revision: 8145
Added:
trunk/framework/impl/src/main/java/org/richfaces/skin/AbstractChainableSkinImpl.java
trunk/framework/impl/src/main/java/org/richfaces/skin/BaseSkinImpl.java
trunk/framework/impl/src/main/java/org/richfaces/skin/BasicSkinImpl.java
Modified:
trunk/framework/impl/src/main/java/org/richfaces/skin/SkinFactoryImpl.java
trunk/framework/impl/src/main/java/org/richfaces/skin/SkinImpl.java
Log:
Skin inheritance implemented
Added: trunk/framework/impl/src/main/java/org/richfaces/skin/AbstractChainableSkinImpl.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/skin/AbstractChainableSkinImpl.java (rev 0)
+++ trunk/framework/impl/src/main/java/org/richfaces/skin/AbstractChainableSkinImpl.java 2008-04-25 00:24:48 UTC (rev 8145)
@@ -0,0 +1,140 @@
+/**
+ * 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.skin;
+
+import java.util.Map;
+
+import javax.faces.FacesException;
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.Messages;
+
+/**
+ * @author nick belaevski
+ * @since 3.2
+ */
+
+public abstract class AbstractChainableSkinImpl extends BasicSkinImpl {
+
+ protected SkinFactoryImpl factory;
+
+ AbstractChainableSkinImpl(Map properties, SkinFactoryImpl factory) {
+ super(properties);
+ this.factory = factory;
+ }
+
+ protected Skin getBaseSkin(FacesContext context) {
+ Object object = getSkinParams().get(Skin.baseSkin);
+ boolean base = isBase();
+ Skin skin = null;
+
+ if (object != null) {
+ skin = factory.getSkinByName(context, object, base);
+ }
+
+ if (skin == null) {
+ if (base) {
+ skin = factory.getDefaultSkin(context);
+ } else {
+ skin = factory.getBaseSkin(context);
+ }
+ }
+
+ return skin;
+ }
+
+ protected Object resolveSkinParameter(FacesContext context, String name, int[] singleInt) {
+ Object object = super.resolveSkinParameter(context, name);
+ if (object == null) {
+ Skin baseSkin = getBaseSkin(context);
+ if (baseSkin != null) {
+ if (baseSkin instanceof AbstractChainableSkinImpl) {
+ AbstractChainableSkinImpl skinImpl = (AbstractChainableSkinImpl) baseSkin;
+
+ if (singleInt[0]++ > 1000) {
+ throw new FacesException(Messages.getMessage(
+ Messages.SKIN_CYCLIC_REFERENCE, name));
+ }
+
+ object = skinImpl.resolveSkinParameter(context, name, singleInt);
+ } else {
+ object = baseSkin.getParameter(context, name);
+ }
+ }
+ }
+
+ return getValueReference(context, object);
+ }
+
+ protected boolean containsProperty(FacesContext context, String name, int[] singleInt) {
+ boolean contains = super.containsProperty(name);
+ if (!contains) {
+ Skin baseSkin = getBaseSkin(context);
+ if (baseSkin != null) {
+ if (baseSkin instanceof AbstractChainableSkinImpl) {
+ AbstractChainableSkinImpl skinImpl = (AbstractChainableSkinImpl) baseSkin;
+
+ if (singleInt[0]++ > 1000) {
+ throw new FacesException(Messages.getMessage(
+ Messages.SKIN_CYCLIC_REFERENCE, name));
+ }
+
+ contains = skinImpl.containsProperty(context, name, singleInt);
+ } else {
+ contains = baseSkin.containsProperty(name);
+ }
+ }
+ }
+
+ return contains;
+ }
+
+ protected Object resolveSkinParameter(FacesContext context, String name) {
+ int[] singleInt = new int[] {0};
+ Object resolvedParameter = resolveSkinParameter(context, name, singleInt);
+
+ while (resolvedParameter instanceof String) {
+ String string = (String) resolvedParameter;
+ if (string.length() > 0 && string.charAt(0) == '&') {
+ singleInt[0]++;
+ resolvedParameter = resolveSkinParameter(context, string.substring(1), singleInt);
+ if (resolvedParameter == null) {
+ throw new FacesException(Messages.getMessage(
+ Messages.SKIN_ILLEGAL_REFERENCE, name));
+ }
+ } else {
+ break;
+ }
+ }
+
+ return resolvedParameter;
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.skin.Skin#containsProperty(java.lang.String)
+ */
+ public boolean containsProperty(String name) {
+ return containsProperty(FacesContext.getCurrentInstance(), name, new int[] {0});
+ }
+
+ protected abstract boolean isBase();
+}
Added: trunk/framework/impl/src/main/java/org/richfaces/skin/BaseSkinImpl.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/skin/BaseSkinImpl.java (rev 0)
+++ trunk/framework/impl/src/main/java/org/richfaces/skin/BaseSkinImpl.java 2008-04-25 00:24:48 UTC (rev 8145)
@@ -0,0 +1,42 @@
+/**
+ * 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.skin;
+
+import java.util.Map;
+
+/**
+ * @author nick belaevski
+ * @since 3.2
+ */
+
+public class BaseSkinImpl extends AbstractChainableSkinImpl {
+
+ BaseSkinImpl(Map properties, SkinFactoryImpl factory) {
+ super(properties, factory);
+ }
+
+ @Override
+ protected boolean isBase() {
+ return true;
+ }
+
+}
Added: trunk/framework/impl/src/main/java/org/richfaces/skin/BasicSkinImpl.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/skin/BasicSkinImpl.java (rev 0)
+++ trunk/framework/impl/src/main/java/org/richfaces/skin/BasicSkinImpl.java 2008-04-25 00:24:48 UTC (rev 8145)
@@ -0,0 +1,157 @@
+/**
+ * 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.skin;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+import javax.el.ValueExpression;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+
+/**
+ * Singleton ( in respect as collection of different skins ) for produce
+ * instances properties for all used skins.
+ *
+ * @author shura (latest modification by $Author: alexsmirnov $)
+ * @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:59:41 $
+ *
+ */
+public class BasicSkinImpl implements Skin {
+
+ public static final String RENDER_KIT_PARAMETER = "render.kit";
+
+ public static final String REQUEST_HASH_CODES_MAP_PARAMETER = "org.ajax4jsf.skin.HASH_CODES_MAP";
+
+ private Map<String, Object> skinParams = new HashMap<String, Object>();
+
+ /**
+ * Skin can instantiate only by factory method.
+ *
+ * @param skinName
+ */
+ BasicSkinImpl(Map properties) {
+ this.skinParams = properties;
+ }
+
+ protected Map<String, Object> getSkinParams() {
+ return skinParams;
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.skin.Skin#getRenderKitId(javax.faces.context.FacesContext)
+ */
+ public String getRenderKitId(FacesContext context) {
+ return (String) getValueReference(context, resolveSkinParameter(context, RENDER_KIT_PARAMETER));
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.skin.Skin#getParameter(javax.faces.context.FacesContext, java.lang.String)
+ */
+ public Object getParameter(FacesContext context, String name) {
+ return getValueReference(context, resolveSkinParameter(context, name));
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.skin.Skin#getParameter(javax.faces.context.FacesContext, java.lang.String, java.lang.String, java.lang.Object)
+ */
+ public Object getParameter(FacesContext context, String name, Object defaultValue) {
+ Object value = getValueReference(context, resolveSkinParameter(context, name));
+ if(null == value){
+ value = defaultValue;
+ }
+ return value;
+ }
+
+ protected Object resolveSkinParameter(FacesContext context, String name) {
+ return skinParams.get(name);
+ }
+
+ protected Skin getBaseSkin(FacesContext context) {
+ return null;
+ }
+
+ /**
+ * Calculate concrete value for property - if it stored as @see ValueBinding ,
+ * return interpreted value.
+ * @param context
+ * @param property
+ * @return
+ */
+ protected Object getValueReference(FacesContext context, Object property) {
+ if (property instanceof ValueExpression) {
+ ValueExpression value = (ValueExpression) property;
+ return value.getValue(context.getELContext());
+ }
+ return property;
+ }
+
+
+ public String toString() {
+ return this.getClass().getSimpleName() + ": " + skinParams.toString();
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.skin.Skin#hashCode(javax.faces.context.FacesContext)
+ */
+ public int hashCode(FacesContext context) {
+ ExternalContext externalContext = context.getExternalContext();
+ Map<String, Object> requestMap = externalContext.getRequestMap();
+ ConcurrentMap<Skin, Integer> map;
+ synchronized (requestMap) {
+ map = (ConcurrentMap<Skin, Integer>) requestMap.get(REQUEST_HASH_CODES_MAP_PARAMETER);
+ if (map == null) {
+ map = new ConcurrentHashMap<Skin, Integer>();
+ requestMap.put(REQUEST_HASH_CODES_MAP_PARAMETER, map);
+ }
+ }
+
+ Integer requestCode = (Integer) map.get(this);
+ if(null == requestCode){
+ int hash = 0;
+ for (Iterator iter = skinParams.keySet().iterator(); iter.hasNext();) {
+ String key = (String) iter.next();
+ Object parameter = getParameter(context,key);
+ hash = 31*hash + key.hashCode();
+ hash = 31*hash + (parameter != null ? parameter.hashCode() : 0);
+ }
+
+ Skin baseSkin = getBaseSkin(context);
+ if (baseSkin != null) {
+ hash = 31*hash + baseSkin.hashCode(context);
+ }
+
+ requestCode = new Integer(hash);
+ // store hash for this skin as request-skope parameter - not calculate on next calls for same request
+ map.putIfAbsent(this, requestCode);
+ }
+ return requestCode.intValue();
+ }
+
+ public boolean containsProperty(String name) {
+ return skinParams.containsKey(name);
+ }
+
+}
Modified: trunk/framework/impl/src/main/java/org/richfaces/skin/SkinFactoryImpl.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/skin/SkinFactoryImpl.java 2008-04-24 21:44:19 UTC (rev 8144)
+++ trunk/framework/impl/src/main/java/org/richfaces/skin/SkinFactoryImpl.java 2008-04-25 00:24:48 UTC (rev 8145)
@@ -31,6 +31,8 @@
import java.util.Properties;
import java.util.Map.Entry;
+import javax.el.ELContext;
+import javax.el.ExpressionFactory;
import javax.faces.FacesException;
import javax.faces.FactoryFinder;
import javax.faces.application.Application;
@@ -87,6 +89,9 @@
private static final String[] DEFAULT_CONFIGURATION_PATHS = { "META-INF/skins/DEFAULT.configuration.properties" };
private Map skins = Collections.synchronizedMap(new HashMap());
+ private Map baseSkins = Collections.synchronizedMap(new HashMap());
+ private Map sourceProperties = Collections.synchronizedMap(new HashMap());
+
private Properties defaultSkinProperties = null;
private String skinName = null;
private ValueBinding skinBinding = null;
@@ -98,7 +103,7 @@
private static final String A4J_SKIN_PARAMETER = "org.ajax4jsf.SKIN";
- protected Skin getSkinByName(Object currentSkinOrName) {
+ protected Skin getSkinByName(FacesContext facesContext, Object currentSkinOrName, boolean isBase) {
if (null == currentSkinOrName) {
throw new SkinNotFoundException(Messages
.getMessage(Messages.NULL_SKIN_NAME_ERROR));
@@ -108,7 +113,9 @@
return (Skin) currentSkinOrName;
}
String currentSkinName = currentSkinOrName.toString();
- Skin currentSkin = (Skin) skins.get(currentSkinName);
+
+ Map skinsMap = (isBase ? baseSkins : skins);
+ Skin currentSkin = (Skin) skinsMap.get(currentSkinName);
// LAZY creation for skins, since, in case of EL expressions
// for skin name, we don't can know all names of existing skins.
if (currentSkin == null) {
@@ -116,27 +123,27 @@
log.debug(Messages.getMessage(Messages.CREATE_SKIN_INFO,
currentSkinName));
}
- currentSkin = buildSkin(currentSkinName, getDefaultSkinProperties());
- skins.put(currentSkinName, currentSkin);
+ currentSkin = buildSkin(facesContext, currentSkinName, isBase);
+ skinsMap.put(currentSkinName, currentSkin);
}
return currentSkin;
}
public Skin getDefaultSkin(FacesContext context) {
- return getSkinByName(DEFAULT_SKIN_NAME);
+ return getSkinByName(context, DEFAULT_SKIN_NAME, false);
}
public Skin getSkin(FacesContext context) {
// TODO - cache skin for current thread ? or for current Faces Lifecycle
// Phase ?
Object currentSkinOrName = getSkinOrName(context, false);
- return getSkinByName(currentSkinOrName);
+ return getSkinByName(context, currentSkinOrName, false);
}
public Skin getBaseSkin(FacesContext context) {
Object currentSkinOrName = getSkinOrName(context, true);
- return getSkinByName(currentSkinOrName);
+ return getSkinByName(context, currentSkinOrName, true);
}
protected Properties getDefaultSkinProperties() {
@@ -249,31 +256,20 @@
}
}
- private void processProperties(Map<Object, Object> properties) {
+ private void processProperties(FacesContext context, Map<Object, Object> properties) {
+ ELContext elContext = context.getELContext();
// replace all EL-expressions by prepared ValueBinding ?
ApplicationFactory factory = (ApplicationFactory) FactoryFinder
.getFactory(FactoryFinder.APPLICATION_FACTORY);
Application app = factory.getApplication();
for (Entry<Object, Object> entry : properties.entrySet()) {
- String propertyName = (String) entry.getKey();
Object propertyObject = entry.getValue();
if (propertyObject instanceof String) {
String property = (String) propertyObject;
- int count = 0;
- while (property.startsWith("&")) {
- property = (String) properties.get(property.substring(1));
- if (null == property) {
- throw new FacesException(Messages.getMessage(
- Messages.SKIN_ILLEGAL_REFERENCE, propertyName));
- }
- if (count++ > 1000) {
- throw new FacesException(Messages.getMessage(
- Messages.SKIN_CYCLIC_REFERENCE, propertyName));
- }
- }
if (ELUtils.isValueReference(property)) {
- entry.setValue(app.createValueBinding(property));
+ ExpressionFactory expressionFactory = app.getExpressionFactory();
+ entry.setValue(expressionFactory.createValueExpression(elContext, property, Object.class));
} else {
entry.setValue(property);
}
@@ -287,47 +283,32 @@
* append in content to default properties. First, get it from
* META-INF/skins/ , next - from root package. for any place search order
* determined by {@link java.lang.ClassLoader } realisation.
- *
* @param name
* name for builded skin.
* @param defaultProperties
+ *
* @return skin instance for current name
* @throws SkinNotFoundException -
* if no skin properies found for name.
*/
- protected Skin buildSkin(String name, Properties defaultProperties)
+ protected Skin buildSkin(FacesContext context, String name, boolean isBase)
throws SkinNotFoundException {
- String baseSkinName = name;
- int counter = 0;
-
- Map<Object, Object> result = new HashMap<Object, Object>();
- do {
- Map<Object, Object> skinParams = loadProperties(baseSkinName, SKINS_PATHS);
- for (Entry<Object, Object> entry : skinParams.entrySet()) {
- Object key = entry.getKey();
- if (!result.containsKey(key)) {
- result.put(key, entry.getValue());
- }
- }
-
- baseSkinName = (String) skinParams.get(Skin.baseSkin);
-
- if (counter++ > 1000) {
- throw new IllegalStateException("Cyclic base skin!");
- }
-
- } while (baseSkinName != null);
-
- for (Entry<Object, Object> entry : defaultProperties.entrySet()) {
- if (!result.containsKey(entry.getKey())) {
- result.put(entry.getKey(), entry.getValue());
- }
+ Map<Object, Object> skinParams = (Map<Object, Object>) sourceProperties.get(name);
+ if (skinParams == null) {
+ skinParams = loadProperties(name, SKINS_PATHS);
+ processProperties(context, skinParams);
+ skinParams = Collections.unmodifiableMap(skinParams);
+ sourceProperties.put(name, skinParams);
}
- processProperties(result);
-
- return new SkinImpl(result);
+ if (DEFAULT_SKIN_NAME.equals(name)) {
+ return new BasicSkinImpl(skinParams);
+ } else if (isBase) {
+ return new BaseSkinImpl(skinParams, this);
+ } else {
+ return new SkinImpl(skinParams, this);
+ }
}
/**
Modified: trunk/framework/impl/src/main/java/org/richfaces/skin/SkinImpl.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/skin/SkinImpl.java 2008-04-24 21:44:19 UTC (rev 8144)
+++ trunk/framework/impl/src/main/java/org/richfaces/skin/SkinImpl.java 2008-04-25 00:24:48 UTC (rev 8145)
@@ -21,131 +21,20 @@
package org.richfaces.skin;
-import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-import javax.faces.context.ExternalContext;
-import javax.faces.context.FacesContext;
-import javax.faces.el.ValueBinding;
/**
- * Singleton ( in respect as collection of different skins ) for produce
- * instances properties for all used skins.
- *
- * @author shura (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:59:41 $
- *
+ * @author nick belaevski
+ * @since 3.2
*/
-public class SkinImpl implements Skin {
+public class SkinImpl extends AbstractChainableSkinImpl {
+ SkinImpl(Map properties, SkinFactoryImpl factory) {
+ super(properties, factory);
+ }
- public static final String RENDER_KIT_PARAMETER = "render.kit";
-
- public static final String REQUEST_HASH_CODES_MAP_PARAMETER = "org.ajax4jsf.skin.HASH_CODES_MAP";
-
- private Map skinParams = new HashMap();
-
-
- /**
- * Skin can instantiate only by factory method.
- *
- * @param skinName
- */
- SkinImpl(Map properties) {
- skinParams = properties;
- }
-
-
- /* (non-Javadoc)
- * @see org.richfaces.skin.Skin#getRenderKitId(javax.faces.context.FacesContext)
- */
- public String getRenderKitId(FacesContext context) {
- return (String) getValueReference(context,skinParams.get(RENDER_KIT_PARAMETER));
- }
-
- /* (non-Javadoc)
- * @see org.richfaces.skin.Skin#getParameter(javax.faces.context.FacesContext, java.lang.String)
- */
- public Object getParameter(FacesContext context, String name) {
- return getValueReference(context,skinParams.get(name));
- }
-
- /* (non-Javadoc)
- * @see org.richfaces.skin.Skin#getParameter(javax.faces.context.FacesContext, java.lang.String, java.lang.String, java.lang.Object)
- */
- public Object getParameter(FacesContext context, String name, Object defaultValue) {
- Object value = getValueReference(context, skinParams.get(name));
- if(null == value){
- value = defaultValue;
- }
- return value;
- }
-
-
- /**
- * Calculate concrete value for property - if it stored as @see ValueBinding ,
- * return interpreted value.
- * @param context
- * @param property
- * @return
- */
- private Object getValueReference(FacesContext context, Object property) {
- if (property instanceof ValueBinding) {
- ValueBinding value = (ValueBinding) property;
- return value.getValue(context);
- }
- return property;
- }
-
-
- public String toString() {
- return skinParams.toString();
- }
-
-
- /* (non-Javadoc)
- * @see org.richfaces.skin.Skin#containsProperty(java.lang.String)
- */
- public boolean containsProperty(String name) {
- // TODO Auto-generated method stub
- return skinParams.containsKey(name);
- }
-
-
- /* (non-Javadoc)
- * @see org.richfaces.skin.Skin#hashCode(javax.faces.context.FacesContext)
- */
- public int hashCode(FacesContext context) {
- ExternalContext externalContext = context.getExternalContext();
- Map<String, Object> requestMap = externalContext.getRequestMap();
- ConcurrentMap<Skin, Integer> map;
- synchronized (requestMap) {
- map = (ConcurrentMap<Skin, Integer>) requestMap.get(REQUEST_HASH_CODES_MAP_PARAMETER);
- if (map == null) {
- map = new ConcurrentHashMap<Skin, Integer>();
- requestMap.put(REQUEST_HASH_CODES_MAP_PARAMETER, map);
- }
- }
-
- Integer requestCode = (Integer) map.get(this);
- if(null == requestCode){
- int hash = 0;
- for (Iterator iter = skinParams.keySet().iterator(); iter.hasNext();) {
- String key = (String) iter.next();
- Object parameter = getParameter(context,key);
- hash = 31*hash + key.hashCode();
- hash = 31*hash + (parameter != null ? parameter.hashCode() : 0);
- }
- requestCode = new Integer(hash);
- // store hash for this skin as request-skope parameter - not calculate on next calls for same request
- map.putIfAbsent(this, requestCode);
- }
- return requestCode.intValue();
- }
-
-
-
+ protected boolean isBase() {
+ return false;
+ }
}
16 years, 8 months
JBoss Rich Faces SVN: r8144 - in trunk: framework/impl/src/main/java/org/ajax4jsf/component and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2008-04-24 17:44:19 -0400 (Thu, 24 Apr 2008)
New Revision: 8144
Added:
trunk/framework/api/src/main/java/org/ajax4jsf/component/IterationStateHolder.java
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/component/UIDataAdaptor.java
trunk/samples/richfaces-demo/src/main/webapp/richfaces/toolTip/examples/withTable.xhtml
trunk/ui/dataTable/src/main/config/component/dataList.xml
trunk/ui/dataTable/src/main/config/component/dataTable.xml
Log:
fix http://jira.jboss.com/jira/browse/RF-3054
Added: trunk/framework/api/src/main/java/org/ajax4jsf/component/IterationStateHolder.java
===================================================================
--- trunk/framework/api/src/main/java/org/ajax4jsf/component/IterationStateHolder.java (rev 0)
+++ trunk/framework/api/src/main/java/org/ajax4jsf/component/IterationStateHolder.java 2008-04-24 21:44:19 UTC (rev 8144)
@@ -0,0 +1,29 @@
+/**
+ *
+ */
+package org.ajax4jsf.component;
+
+import javax.faces.component.EditableValueHolder;
+import javax.faces.component.UIData;
+
+/**
+ * In the original {@link UIData} component, only state for a {@link EditableValueHolder} component saved for an iteration.
+ * In the Richfaces, we also save state for a components implemented this interface.
+ * @author asmirnov
+ *
+ */
+public interface IterationStateHolder {
+
+ /**
+ * Get component state for a current iteration.
+ * @return request-scope component state. Details are subject for a component implementation
+ */
+ public Object getIterationState();
+
+ /**
+ * Restore component state from previsious saved value.
+ * @param state request-scope component state. Details are subject for a component implementation
+ */
+ public void setIterationState( Object state);
+
+}
Property changes on: trunk/framework/api/src/main/java/org/ajax4jsf/component/IterationStateHolder.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/component/UIDataAdaptor.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/component/UIDataAdaptor.java 2008-04-24 19:13:10 UTC (rev 8143)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/component/UIDataAdaptor.java 2008-04-24 21:44:19 UTC (rev 8144)
@@ -98,14 +98,7 @@
Iterator<UIComponent> childIterator = dataChildren();
while (childIterator.hasNext()) {
UIComponent component = childIterator.next();
- // Special case for a Standard UIColumn component.
- if (component instanceof UIColumn ) {
- for (UIComponent child : component.getChildren() ) {
- processComponent(context, child, argument);
- }
- } else {
processComponent(context, component, argument);
- }
}
}
@@ -909,27 +902,29 @@
private void saveChildState(FacesContext faces, UIComponent c,
Map<String, SavedState> childState) {
- if (c instanceof EditableValueHolder && !c.isTransient()) {
+ if (!c.isTransient() && (c instanceof EditableValueHolder||c instanceof IterationStateHolder)) {
String clientId = c.getClientId(faces);
SavedState ss = childState.get(clientId);
if (ss == null) {
ss = new SavedState();
childState.put(clientId, ss);
}
- ss.populate((EditableValueHolder) c);
+ if (c instanceof EditableValueHolder) {
+ ss.populate((EditableValueHolder) c);
+ }
+ if(c instanceof IterationStateHolder){
+ ss.populate((IterationStateHolder) c);
+ }
}
-
// continue hack
Iterator<UIComponent> itr = c.getChildren().iterator();
while (itr.hasNext()) {
saveChildState(faces, (UIComponent) itr.next(), childState);
}
- if (!(c instanceof UIColumn || c instanceof Column)) {
itr = c.getFacets().values().iterator();
while (itr.hasNext()) {
saveChildState(faces, (UIComponent) itr.next(), childState);
}
- }
}
/**
@@ -963,15 +958,20 @@
c.setId(id);
// hack
- if (c instanceof EditableValueHolder) {
- EditableValueHolder evh = (EditableValueHolder) c;
+ if (c instanceof EditableValueHolder || c instanceof IterationStateHolder) {
String clientId = c.getClientId(faces);
SavedState ss = childState.get(clientId);
- if (ss != null) {
+ if (ss == null) {
+ ss=NullState;
+ }
+ if (c instanceof EditableValueHolder) {
+ EditableValueHolder evh = (EditableValueHolder) c;
ss.apply(evh);
- } else {
- NullState.apply(evh);
}
+ if (c instanceof IterationStateHolder) {
+ IterationStateHolder ish = (IterationStateHolder) c;
+ ss.apply(ish);
+ }
}
// continue hack
@@ -979,12 +979,10 @@
while (itr.hasNext()) {
restoreChildState(faces, (UIComponent) itr.next(), childState);
}
- if (!(c instanceof UIColumn || c instanceof Column)) {
- itr = c.getFacets().values().iterator();
+ itr = c.getFacets().values().iterator();
while (itr.hasNext()) {
restoreChildState(faces, (UIComponent) itr.next(), childState);
}
- }
}
/**
@@ -1225,6 +1223,8 @@
private final static class SavedState implements Serializable {
private Object submittedValue;
+
+ private Object iterationState;
private static final long serialVersionUID = 2920252657338389849L;
@@ -1266,6 +1266,14 @@
this.localValueSet = localValueSet;
}
+ public Object getIterationState() {
+ return iterationState;
+ }
+
+ public void setIterationState(Object iterationState) {
+ this.iterationState = iterationState;
+ }
+
public String toString() {
return ("submittedValue: " + submittedValue + " value: " + value
+ " localValueSet: " + localValueSet);
@@ -1278,12 +1286,21 @@
this.localValueSet = evh.isLocalValueSet();
}
+
+ public void populate(IterationStateHolder ish) {
+ this.iterationState = ish.getIterationState();
+ }
+
public void apply(EditableValueHolder evh) {
evh.setValue(this.value);
evh.setValid(this.valid);
evh.setSubmittedValue(this.submittedValue);
evh.setLocalValueSet(this.localValueSet);
}
+
+ public void apply(IterationStateHolder ish) {
+ ish.setIterationState(this.iterationState);
+ }
}
Modified: trunk/samples/richfaces-demo/src/main/webapp/richfaces/toolTip/examples/withTable.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/toolTip/examples/withTable.xhtml 2008-04-24 19:13:10 UTC (rev 8143)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/toolTip/examples/withTable.xhtml 2008-04-24 21:44:19 UTC (rev 8144)
@@ -44,8 +44,8 @@
</style>
<h:form>
- <rich:dataTable value="#{toolTipData.vehicles}" width="400"
- var="vehicle" rowKeyVar="row">
+ <rich:dataTable value="#{data.mounths}" width="400"
+ var="item" rowKeyVar="row">
<rich:column>
<f:facet name="header">
<h:outputText value="##" />
@@ -54,56 +54,35 @@
</rich:column>
<rich:column>
<f:facet name="header">
- <h:outputText value="Make" />
+ <h:outputText value="Mounth" />
</f:facet>
<a4j:outputPanel layout="block">
<rich:toolTip direction="top-right" mode="ajax" showDelay="300"
- styleClass="tooltip" layout="block">
+ styleClass="tooltip" layout="block">
+ <!--
<a4j:actionparam name="key" value="#{row}"
assignTo="#{toolTipData.currentVehicleIndex}" />
-
+ -->
<h:panelGrid columns="4">
<f:facet name="header">
- <h:outputText value="Vehicle details:" />
+ <h:outputText value="details:" />
</f:facet>
- <h:outputText value="make:" />
- <h:outputText value="#{vehicle.make}" styleClass="tooltipData" />
- <h:outputText value="model:" />
- <h:outputText value="#{vehicle.model}" styleClass="tooltipData" />
- <h:outputText value="year:" />
- <h:outputText value="#{vehicle.year}" styleClass="tooltipData" />
- <h:outputText value="milage:" />
- <h:outputText value="#{vehicle.milage}" styleClass="tooltipData" />
- <h:outputText value="zip:" />
- <h:outputText value="#{vehicle.zip}" styleClass="tooltipData" />
- <h:outputText value="listed:" />
- <h:outputText value="#{vehicle.listed}" styleClass="tooltipData">
- <f:convertDateTime dateStyle="short" />
- </h:outputText>
+ <h:outputText value="Mounth:" />
+ <h:outputText value="#{item.mounth}" styleClass="tooltipData" />
+ <h:outputText value="price:" />
+ <h:outputText value="#{item.price}" styleClass="tooltipData" />
<f:facet name="footer">
<h:panelGroup>
- <h:outputText value="vin: " />
- <h:outputText value="#{vehicle.vin}" styleClass="tooltipData" />
+ <h:outputText value="Total: " />
+ <h:outputText value="#{item.total}" styleClass="tooltipData" />
</h:panelGroup>
</f:facet>
</h:panelGrid>
</rich:toolTip>
- <h:outputText id="make" value="#{vehicle.make}"/>
+ <h:outputText id="make" value="#{item.mounth}"/>
</a4j:outputPanel>
</rich:column>
- <rich:column>
- <f:facet name="header">
- <h:outputText value="Model" />
- </f:facet>
- <h:outputText value="#{vehicle.model}" />
- </rich:column>
- <rich:column>
- <f:facet name="header">
- <h:outputText value="Year" />
- </f:facet>
- <h:outputText value="#{vehicle.year}" />
- </rich:column>
</rich:dataTable>
</h:form>
Modified: trunk/ui/dataTable/src/main/config/component/dataList.xml
===================================================================
--- trunk/ui/dataTable/src/main/config/component/dataList.xml 2008-04-24 19:13:10 UTC (rev 8143)
+++ trunk/ui/dataTable/src/main/config/component/dataList.xml 2008-04-24 21:44:19 UTC (rev 8144)
@@ -129,11 +129,12 @@
&html_universal_attributes;
&spec_table_attributes;
- <property>
- <name>rowKeyConverter</name>
- <classname>java.lang.String</classname>
- <description>Converter for a row key object</description>
- </property>
+ <property>
+ <name>rowKeyConverter</name>
+ <classname>javax.faces.convert.Converter</classname>
+ <description>Converter for a RowKey object.
+ </description>
+ </property>
<property>
<name>rowKey</name>
@@ -261,13 +262,13 @@
<name>headerClass</name>
<classname>java.lang.String</classname>
</property>
+ <property>
+ <name>rowKeyConverter</name>
+ <classname>javax.faces.convert.Converter</classname>
+ <description>Converter for a RowKey object.
+ </description>
+ </property>
<property>
- <name>rowKeyConverter</name>
- <classname>java.lang.String</classname>
- <description>Converter for a row key object</description>
- </property>
-
- <property>
<name>rowKey</name>
<classname>java.lang.Object</classname>
<description>RowKey is a representation of an identifier for a specific data row</description>
Modified: trunk/ui/dataTable/src/main/config/component/dataTable.xml
===================================================================
--- trunk/ui/dataTable/src/main/config/component/dataTable.xml 2008-04-24 19:13:10 UTC (rev 8143)
+++ trunk/ui/dataTable/src/main/config/component/dataTable.xml 2008-04-24 21:44:19 UTC (rev 8144)
@@ -209,5 +209,11 @@
<name>summary</name>
<classname>java.lang.Object</classname>
</property>
+ <property>
+ <name>rowKeyConverter</name>
+ <classname>javax.faces.convert.Converter</classname>
+ <description>Converter for a RowKey object.
+ </description>
+ </property>
</component>
</components>
16 years, 8 months
JBoss Rich Faces SVN: r8143 - trunk/test-applications/jsp/src/main/java/scrollableDataTable.
by richfaces-svn-commits@lists.jboss.org
Author: ayanul
Date: 2008-04-24 15:13:10 -0400 (Thu, 24 Apr 2008)
New Revision: 8143
Modified:
trunk/test-applications/jsp/src/main/java/scrollableDataTable/ScrollableDataTable.java
Log:
set timeout=0(default)
Modified: trunk/test-applications/jsp/src/main/java/scrollableDataTable/ScrollableDataTable.java
===================================================================
--- trunk/test-applications/jsp/src/main/java/scrollableDataTable/ScrollableDataTable.java 2008-04-24 19:13:06 UTC (rev 8142)
+++ trunk/test-applications/jsp/src/main/java/scrollableDataTable/ScrollableDataTable.java 2008-04-24 19:13:10 UTC (rev 8143)
@@ -44,7 +44,7 @@
data = new ArrayList<Data>();
first = 0;
rendered = true;
- timeout = 500;
+ timeout = 0;
height = "400px";
limitToList = false;
bypassUpdates = false;
16 years, 8 months
JBoss Rich Faces SVN: r8142 - trunk/test-applications/facelets/src/main/java/scrollableDataTable.
by richfaces-svn-commits@lists.jboss.org
Author: ayanul
Date: 2008-04-24 15:13:06 -0400 (Thu, 24 Apr 2008)
New Revision: 8142
Modified:
trunk/test-applications/facelets/src/main/java/scrollableDataTable/ScrollableDataTable.java
Log:
set timeout=0(default)
Modified: trunk/test-applications/facelets/src/main/java/scrollableDataTable/ScrollableDataTable.java
===================================================================
--- trunk/test-applications/facelets/src/main/java/scrollableDataTable/ScrollableDataTable.java 2008-04-24 18:54:53 UTC (rev 8141)
+++ trunk/test-applications/facelets/src/main/java/scrollableDataTable/ScrollableDataTable.java 2008-04-24 19:13:06 UTC (rev 8142)
@@ -44,7 +44,7 @@
data = new ArrayList<Data>();
first = 0;
rendered = true;
- timeout = 500;
+ timeout = 0;
height = "400px";
limitToList = false;
bypassUpdates = false;
16 years, 8 months