[richfaces-svn-commits] JBoss Rich Faces SVN: r18518 - in trunk/core: impl/src/main/java/org/ajax4jsf/context and 4 other directories.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Mon Aug 9 13:46:25 EDT 2010


Author: nbelaevski
Date: 2010-08-09 13:46:24 -0400 (Mon, 09 Aug 2010)
New Revision: 18518

Added:
   trunk/core/impl/src/main/java/org/richfaces/resource/ExternalStaticResource.java
Modified:
   trunk/core/api/src/main/java/org/richfaces/resource/ResourceFactory.java
   trunk/core/impl/src/main/java/org/ajax4jsf/context/ContextInitParameters.java
   trunk/core/impl/src/main/java/org/richfaces/resource/ResourceFactoryImpl.java
   trunk/core/impl/src/main/java/org/richfaces/skin/CompositeSkinImpl.java
   trunk/core/impl/src/main/java/org/richfaces/skin/SkinFactoryImpl.java
   trunk/core/impl/src/test/java/org/richfaces/skin/SkinTestCase.java
   trunk/core/impl/src/test/resources/META-INF/skins/dynatest_base.skin.properties
   trunk/core/impl/src/test/resources/META-INF/skins/style_base.skin.properties
Log:
Skin updates
Mapping for static resources 

Modified: trunk/core/api/src/main/java/org/richfaces/resource/ResourceFactory.java
===================================================================
--- trunk/core/api/src/main/java/org/richfaces/resource/ResourceFactory.java	2010-08-09 16:39:18 UTC (rev 18517)
+++ trunk/core/api/src/main/java/org/richfaces/resource/ResourceFactory.java	2010-08-09 17:46:24 UTC (rev 18518)
@@ -32,6 +32,10 @@
 
     public static final String STATIC_RESOURCE_MAPPINGS = "META-INF/richfaces/static-resource-mappings.properties";
 
+    public static final String SKINNED_RESOURCE_PREFIX = "%skin%/";
+    
+    //TODO implement resource mappings
+    
     public abstract Resource createResource(String resourceName, String libraryName, String contentType);
 
     public abstract Resource createResource(FacesContext context, ResourceCodecData resourceData);

Modified: trunk/core/impl/src/main/java/org/ajax4jsf/context/ContextInitParameters.java
===================================================================
--- trunk/core/impl/src/main/java/org/ajax4jsf/context/ContextInitParameters.java	2010-08-09 16:39:18 UTC (rev 18517)
+++ trunk/core/impl/src/main/java/org/ajax4jsf/context/ContextInitParameters.java	2010-08-09 17:46:24 UTC (rev 18518)
@@ -69,6 +69,10 @@
     public static final String SKIN = "org.richfaces.skin";
     public static final String BASE_SKIN = "org.richfaces.baseSkin";
     
+    public static final String STATIC_RESOURCE_LOCATION = "org.richfaces.staticResourceLocation";
+    
+    public static final String STATIC_RESOURCE_LOCATION_VARIABLE = "resourceLocation";
+
     private static final String[] RESOURCES_TTL_ARRAY = { RESOURCES_TTL };
     private static final String[] RESOURCES_CACHE_SIZE_ARRAY = { RESOURCES_CACHE_SIZE };
     
@@ -143,6 +147,10 @@
         return evaluateInitParameter(context, BASE_SKIN);
     }
 
+    public static String getStaticResourceLocation(FacesContext context) {
+        return (String) evaluateInitParameter(context, STATIC_RESOURCE_LOCATION);
+    }
+    
     static int getInteger(FacesContext context, String[] paramNames, int defaultValue) {
         String initParameter = getInitParameter(context, paramNames);
 

Added: trunk/core/impl/src/main/java/org/richfaces/resource/ExternalStaticResource.java
===================================================================
--- trunk/core/impl/src/main/java/org/richfaces/resource/ExternalStaticResource.java	                        (rev 0)
+++ trunk/core/impl/src/main/java/org/richfaces/resource/ExternalStaticResource.java	2010-08-09 17:46:24 UTC (rev 18518)
@@ -0,0 +1,107 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.resource;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Map;
+
+import javax.faces.application.Resource;
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.context.ContextInitParameters;
+import org.richfaces.skin.SkinFactory;
+
+import com.google.common.base.Joiner;
+
+/**
+ * @author Nick Belaevski
+ * 
+ */
+public class ExternalStaticResource extends Resource {
+
+    private static final Joiner RESOURCE_PATH_JOINER = Joiner.on('/').skipNulls();
+    
+    private String location;
+    
+    private boolean skinDependent;
+
+    public ExternalStaticResource(String location, boolean skinDependent) {
+        super();
+        this.location = location;
+        this.skinDependent = skinDependent;
+    }
+
+    private String getResourceLocation(FacesContext facesContext) {
+        String skinName = null;
+        
+        if (skinDependent) {
+            SkinFactory skinFactory = SkinFactory.getInstance(facesContext);
+            skinName = skinFactory.getSkin(facesContext).getName();
+        }
+        
+        return RESOURCE_PATH_JOINER.join(skinName, location);
+    }
+    
+    @Override
+    public InputStream getInputStream() throws IOException {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public Map<String, String> getResponseHeaders() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public String getRequestPath() {
+        FacesContext facesContext = FacesContext.getCurrentInstance();
+        Map<String, Object> requestMap = facesContext.getExternalContext().getRequestMap();
+        Object resourceVarValue = requestMap.get(ContextInitParameters.STATIC_RESOURCE_LOCATION_VARIABLE);
+        try {
+            String resourceLocation = getResourceLocation(facesContext);
+
+            requestMap.put(ContextInitParameters.STATIC_RESOURCE_LOCATION_VARIABLE, resourceLocation);
+            
+            //TODO pass via ViewHandler?
+            return ContextInitParameters.getStaticResourceLocation(facesContext);
+        } finally {
+            requestMap.remove(ContextInitParameters.STATIC_RESOURCE_LOCATION_VARIABLE);
+            if (resourceVarValue != null) {
+                requestMap.put(ContextInitParameters.STATIC_RESOURCE_LOCATION_VARIABLE, resourceVarValue);
+            }
+        }
+    }
+
+    @Override
+    public URL getURL() {
+        //TODO - review
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public boolean userAgentNeedsUpdate(FacesContext context) {
+        throw new UnsupportedOperationException();
+    }
+
+}

Modified: trunk/core/impl/src/main/java/org/richfaces/resource/ResourceFactoryImpl.java
===================================================================
--- trunk/core/impl/src/main/java/org/richfaces/resource/ResourceFactoryImpl.java	2010-08-09 16:39:18 UTC (rev 18517)
+++ trunk/core/impl/src/main/java/org/richfaces/resource/ResourceFactoryImpl.java	2010-08-09 17:46:24 UTC (rev 18518)
@@ -35,10 +35,10 @@
 
 import org.richfaces.application.DependencyInjector;
 import org.richfaces.application.ServiceTracker;
-import org.richfaces.skin.SkinFactory;
 import org.richfaces.util.PropertiesUtil;
 import org.richfaces.util.Util;
 
+import com.google.common.base.Joiner;
 import com.google.common.collect.Maps;
 
 /**
@@ -47,75 +47,110 @@
  */
 public class ResourceFactoryImpl implements ResourceFactory {
 
-    private static final String SKINNED_RESOURCE_PREFIX = "%skin%/";
-
+    private static final Joiner RESOURCE_QUALIFIER_JOINER = Joiner.on(':').skipNulls();
+    
     private static final ResourceLogger LOGGER = ResourceLogger.INSTANCE;
 
-    private static class ResourceLocator {
-        
-        private String resourcePath;
-        
-        public ResourceLocator(String resourcePath) {
-            super();
-            this.resourcePath = resourcePath;
+    private static class ExternalStaticResourceFactory {
+
+        private String resourceName;
+
+        private String libraryName;
+
+        private String resourceLocation;
+
+        private boolean skinDependent;
+
+        public Resource createResource() {
+            FacesContext facesContext = FacesContext.getCurrentInstance();
+            ExternalStaticResource resource = new ExternalStaticResource(resourceLocation, skinDependent);
+            
+            resource.setResourceName(resourceName);
+            resource.setLibraryName(libraryName);
+            resource.setContentType(facesContext.getExternalContext().getMimeType(resourceLocation));
+            
+            return resource;
         }
 
-        public String locateResource(FacesContext facesContext) {
-            return resourcePath;
+        public void setResourceName(String resourceName) {
+            this.resourceName = resourceName;
         }
-        
-    }
 
-    private static final class SkinResourceLocator extends ResourceLocator {
-        
-        public SkinResourceLocator(String resourcePath) {
-            super(resourcePath);
+        public void setLibraryName(String libraryName) {
+            this.libraryName = libraryName;
         }
 
-        @Override
-        public String locateResource(FacesContext facesContext) {
-            SkinFactory skinFactory = SkinFactory.getInstance(facesContext);
+        public void setResourceLocation(String resourceLocation) {
+            this.resourceLocation = resourceLocation;
+        }
 
-            String skinName = skinFactory.getSkin(facesContext).getName();
-            return skinName + '/' + super.locateResource(facesContext);
+        public void setSkinDependent(boolean skinDependent) {
+            this.skinDependent = skinDependent;
         }
     }
-    
+
     private ResourceHandler defaultHandler;
-    
-    private Map<String, ResourceLocator> resourceLocatorsMap; 
-    
+
+    private Map<String, ExternalStaticResourceFactory> externalStaticResourceFactories;
+
     public ResourceFactoryImpl(ResourceHandler defaultHandler) {
         super();
         this.defaultHandler = defaultHandler;
+
+        initializeExternalResourcesMap();
+    }
+
+    private String getResourceNameFromQualifier(String qualifier) {
+        int idx = qualifier.lastIndexOf(':');
+        if (idx < 0) {
+            return qualifier;
+        }
         
-        initializeResourceLocatorsMap();
+        return qualifier.substring(idx + 1);
     }
+    
+    private String getLibraryNameFromQualifier(String qualifier) {
+        int idx = qualifier.lastIndexOf(':');
+        if (idx < 0) {
+            return null;
+        }
+        
+        return qualifier.substring(0, idx);
+    }
 
-    private void initializeResourceLocatorsMap() {
-        resourceLocatorsMap = Maps.newHashMap();
-        
+    private String getResourceQualifier(String resourceName, String libraryName) {
+        return RESOURCE_QUALIFIER_JOINER.join(libraryName, resourceName);
+    }
+    
+    private void initializeExternalResourcesMap() {
+        externalStaticResourceFactories = Maps.newHashMap();
+
         Properties properties = new Properties();
-        PropertiesUtil.loadProperties(properties, "META-INF/resources/org.richfaces/resource-mappings.properties");
-        
+        PropertiesUtil.loadProperties(properties, ResourceFactory.STATIC_RESOURCE_MAPPINGS);
+
         Set<Entry<Object, Object>> entries = properties.entrySet();
         for (Entry<Object, Object> entry : entries) {
-            String resourceKey = (String) entry.getKey();
-            
-            ResourceLocator resourceLocator;
-            String resourcePath = (String) entry.getValue();
-            if (resourcePath.startsWith(SKINNED_RESOURCE_PREFIX)) {
-                resourceLocator = new SkinResourceLocator(resourcePath.substring(SKINNED_RESOURCE_PREFIX.length()));
-            } else {
-                resourceLocator = new ResourceLocator(resourcePath);
+            String resourceQualifier = (String) entry.getKey();
+
+            String resourceLocation = (String) entry.getValue();
+            boolean skinDependent = false;
+            if (resourceLocation.startsWith(SKINNED_RESOURCE_PREFIX)) {
+                resourceLocation = resourceLocation.substring(SKINNED_RESOURCE_PREFIX.length());
+                skinDependent = true;
             }
             
-            resourceLocatorsMap.put(resourceKey, resourceLocator);
+            ExternalStaticResourceFactory factory = new ExternalStaticResourceFactory();
+            factory.setResourceLocation(resourceLocation);
+            factory.setSkinDependent(skinDependent);
+            factory.setResourceName(getResourceNameFromQualifier(resourceQualifier));
+            factory.setLibraryName(getLibraryNameFromQualifier(resourceQualifier));
+
+            externalStaticResourceFactories.put(resourceQualifier, factory);
         }
-        
-        resourceLocatorsMap = Collections.unmodifiableMap(resourceLocatorsMap);
+
+        externalStaticResourceFactories = Collections.unmodifiableMap(externalStaticResourceFactories);
     }
-    
+
     private String extractParametersFromResourceName(String resourceName) {
         if (!(resourceName.lastIndexOf("?") != -1)) {
             return resourceName;
@@ -128,17 +163,17 @@
         if (sourceResource != null) {
             return new CompiledCSSResource(sourceResource);
         }
-        
+
         return null;
     }
-    
+
     protected void injectProperties(Object resource, Map<String, String> parameters) {
         FacesContext facesContext = FacesContext.getCurrentInstance();
 
         Map<Object, Object> attributes = facesContext.getAttributes();
         try {
             attributes.put(ResourceParameterELResolver.CONTEXT_ATTRIBUTE_NAME, parameters);
-            ServiceTracker.getService(DependencyInjector.class).inject(facesContext,resource);
+            ServiceTracker.getService(DependencyInjector.class).inject(facesContext, resource);
         } finally {
             attributes.remove(ResourceParameterELResolver.CONTEXT_ATTRIBUTE_NAME);
         }
@@ -146,7 +181,7 @@
 
     /**
      * Should be called only if {@link #isResourceExists(String)} returns <code>true</code>
-     *
+     * 
      * @param resourceName
      * @return
      */
@@ -163,26 +198,27 @@
                 DynamicResource annotation = loadedClass.getAnnotation(DynamicResource.class);
                 legitimateResource = (annotation != null);
                 if (legitimateResource) {
-                    LOGGER.debug(
-                        MessageFormat.format("Dynamic resource annotation is present on resource class {0}", resourceName));
+                    LOGGER.debug(MessageFormat.format("Dynamic resource annotation is present on resource class {0}",
+                        resourceName));
                 } else {
-                    LOGGER.debug(
-                        MessageFormat.format("Dynamic resource annotation is not present on resource class {0}", resourceName));
+                    LOGGER.debug(MessageFormat.format(
+                        "Dynamic resource annotation is not present on resource class {0}", resourceName));
                 }
 
                 if (!legitimateResource) {
                     // TODO resource marker extension name?
-                    URL resourceMarkerUrl = contextClassLoader.getResource("META-INF/" + resourceName + ".resource.properties");
+                    URL resourceMarkerUrl = contextClassLoader.getResource("META-INF/" + resourceName
+                        + ".resource.properties");
 
                     legitimateResource = resourceMarkerUrl != null;
 
                     if (LOGGER.isDebugEnabled()) {
                         if (legitimateResource) {
-                            LOGGER.debug(
-                                MessageFormat.format("Marker file for {0} resource found in classpath", resourceName));
+                            LOGGER.debug(MessageFormat.format("Marker file for {0} resource found in classpath",
+                                resourceName));
                         } else {
-                            LOGGER.debug(
-                                MessageFormat.format("Marker file for {0} resource does not exist", resourceName));
+                            LOGGER.debug(MessageFormat.format("Marker file for {0} resource does not exist",
+                                resourceName));
                         }
                     }
                 }
@@ -209,22 +245,24 @@
 
                     resource.setResourceName(resourceName);
                     if (LOGGER.isDebugEnabled()) {
-                        LOGGER.debug(MessageFormat.format("Successfully created instance of {0} resource",
-                            resourceName));
+                        LOGGER.debug(MessageFormat
+                            .format("Successfully created instance of {0} resource", resourceName));
                     }
                 }
             } catch (ClassNotFoundException e) {
-                //do nothing
+                // do nothing
             } catch (Exception e) {
-                LOGGER.logResourceProblem(FacesContext.getCurrentInstance(), e, "Error creating resource {0}", resourceName);
+                LOGGER.logResourceProblem(FacesContext.getCurrentInstance(), e, "Error creating resource {0}",
+                    resourceName);
             } catch (LinkageError e) {
-                LOGGER.logResourceProblem(FacesContext.getCurrentInstance(), e, "Error creating resource {0}", resourceName);
+                LOGGER.logResourceProblem(FacesContext.getCurrentInstance(), e, "Error creating resource {0}",
+                    resourceName);
             }
         }
 
         return resource;
     }
-    
+
     public Resource createResource(FacesContext context, ResourceCodecData resourceData) {
         String resourceName = resourceData.getResourceName();
 
@@ -246,14 +284,11 @@
             String requestedVersion = resourceData.getVersion();
 
             if (LOGGER.isDebugEnabled()) {
-                LOGGER.debug(
-                    MessageFormat.format(
-                        "Client requested {0} version of resource, server has {1} version",
-                        String.valueOf(requestedVersion), String.valueOf(existingVersion)));
+                LOGGER.debug(MessageFormat.format("Client requested {0} version of resource, server has {1} version",
+                    String.valueOf(requestedVersion), String.valueOf(existingVersion)));
             }
 
-            if ((existingVersion != null) && (requestedVersion != null)
-                && !existingVersion.equals(requestedVersion)) {
+            if ((existingVersion != null) && (requestedVersion != null) && !existingVersion.equals(requestedVersion)) {
                 LOGGER.logResourceProblem(context, null, "Resource {0} of version {1} was not found", resourceName,
                     requestedVersion);
                 return null;
@@ -269,27 +304,33 @@
                 LOGGER.debug("Resource state data decoded as null");
             }
         }
-        
+
         Util.restoreResourceState(context, resource, decodedData);
-        
+
         return resource;
     }
-    
+
     public Resource createResource(String resourceName, String libraryName, String contentType) {
+        String resourceQualifier = getResourceQualifier(resourceName, libraryName);
+        ExternalStaticResourceFactory externalStaticResourceFactory = externalStaticResourceFactories.get(resourceQualifier);
+        if (externalStaticResourceFactory != null) {
+            return externalStaticResourceFactory.createResource();
+        }
+        
         Resource result = null;
         Map<String, String> params = Util.parseResourceParameters(resourceName);
         resourceName = extractParametersFromResourceName(resourceName);
         if (resourceName.endsWith(".ecss")) {
-            //TODO nick - params?
+            // TODO nick - params?
             result = createCompiledCSSResource(resourceName, libraryName);
         } else {
-            //TODO nick - libraryName as package name?
+            // TODO nick - libraryName as package name?
             if ((resourceName != null) && ((libraryName == null) || (libraryName.length() == 0))) {
                 result = createHandlerDependentResource(resourceName, params);
             }
         }
-    
+
         return result;
     }
-    
+
 }

Modified: trunk/core/impl/src/main/java/org/richfaces/skin/CompositeSkinImpl.java
===================================================================
--- trunk/core/impl/src/main/java/org/richfaces/skin/CompositeSkinImpl.java	2010-08-09 16:39:18 UTC (rev 18517)
+++ trunk/core/impl/src/main/java/org/richfaces/skin/CompositeSkinImpl.java	2010-08-09 17:46:24 UTC (rev 18518)
@@ -21,16 +21,35 @@
 
 package org.richfaces.skin;
 
+import java.util.Arrays;
+import java.util.List;
+
 import javax.faces.context.FacesContext;
 
+import com.google.common.base.Function;
+import com.google.common.base.Joiner;
+import com.google.common.collect.Iterables;
+
 /**
  * @author nick belaevski
  */
 final class CompositeSkinImpl extends AbstractSkin {
 
+    private static final Joiner DASH_JOINER = Joiner.on('-').skipNulls();
+    
+    private static final Function<Skin, String> SKIN_NAME_FUNCTION = new Function<Skin, String>() {
+        public String apply(Skin from) {
+            if (from == null) {
+                return null;
+            }
+            
+            return from.getName();
+        };
+    };
+    
     private int hashCode = 0;
     
-    private Skin[] skinsChain;
+    private List<Skin> skinsChain;
     
     /**
      * @param properties
@@ -38,7 +57,7 @@
     CompositeSkinImpl(Skin... skinsChain) {
         // TODO Auto-generated constructor stub
         
-        this.skinsChain = skinsChain;
+        this.skinsChain = Arrays.asList(skinsChain);
     }
 
     public boolean containsProperty(String name) {
@@ -56,15 +75,7 @@
     }
 
     public String getName() {
-        for (Skin skin : skinsChain) {
-            if (skin == null) {
-                continue;
-            }
-        
-            return skin.getName();
-        }
-
-        throw new IllegalStateException();
+        return DASH_JOINER.join(Iterables.transform(skinsChain, SKIN_NAME_FUNCTION));
     }
 
     public int hashCode(FacesContext context) {

Modified: trunk/core/impl/src/main/java/org/richfaces/skin/SkinFactoryImpl.java
===================================================================
--- trunk/core/impl/src/main/java/org/richfaces/skin/SkinFactoryImpl.java	2010-08-09 16:39:18 UTC (rev 18517)
+++ trunk/core/impl/src/main/java/org/richfaces/skin/SkinFactoryImpl.java	2010-08-09 17:46:24 UTC (rev 18518)
@@ -64,9 +64,13 @@
         if (skin == null) {
             Skin mainSkin = getSkinOrName(context, false);
             Skin baseSkin = getSkinOrName(context, true);
-            Skin defaultSkin = getDefaultSkin(context);
             
-            skin = new CompositeSkinImpl(mainSkin, baseSkin, defaultSkin);
+            if (mainSkin != null || baseSkin != null) {
+                skin = new CompositeSkinImpl(mainSkin, baseSkin);
+            } else {
+                skin = new CompositeSkinImpl(getDefaultSkin(context));
+            }
+
             context.getAttributes().put(SKIN_KEY, skin);
         }
         
@@ -77,9 +81,13 @@
         Skin skin = (Skin) context.getAttributes().get(BASE_SKIN_KEY);
         if (skin == null) {
             Skin baseSkin = getSkinOrName(context, true);
-            Skin defaultSkin = getDefaultSkin(context);
-            
-            skin = new CompositeSkinImpl(baseSkin, defaultSkin);
+
+            if (baseSkin != null) {
+                skin = new CompositeSkinImpl(baseSkin);
+            } else {
+                skin = new CompositeSkinImpl(getDefaultSkin(context));
+            }
+
             context.getAttributes().put(BASE_SKIN_KEY, skin);
         }
         

Modified: trunk/core/impl/src/test/java/org/richfaces/skin/SkinTestCase.java
===================================================================
--- trunk/core/impl/src/test/java/org/richfaces/skin/SkinTestCase.java	2010-08-09 16:39:18 UTC (rev 18517)
+++ trunk/core/impl/src/test/java/org/richfaces/skin/SkinTestCase.java	2010-08-09 17:46:24 UTC (rev 18518)
@@ -129,7 +129,7 @@
     /*
      * Test method for 'org.richfaces.skin.SkinFactory.getSkin(FacesContext)'
      */
-    @SkinParameters(skinName = "test")
+    @SkinParameters(skinName = "test", baseSkinName = "DEFAULT")
     public void testSkinReferences() {
         SkinFactory factory = SkinFactory.getInstance();
 
@@ -280,6 +280,20 @@
      */
     public void testGetSkinName() {}
 
+    @SkinParameters(skinName = "plain")
+    public void testPlainSkin() throws Exception {
+        SkinFactory factory = (SkinFactory) SkinFactory.getInstance();
+
+        assertNull(factory.getSkin(facesContext).getParameter(facesContext, Skin.GENERAL_BACKGROUND_COLOR));
+    }
+    
+    @SkinParameters(baseSkinName = "plain")
+    public void testPlainSkinBase() throws Exception {
+        SkinFactory factory = (SkinFactory) SkinFactory.getInstance();
+
+        assertNull(factory.getBaseSkin(facesContext).getParameter(facesContext, Skin.GENERAL_BACKGROUND_COLOR));
+    }
+
     @Retention(RetentionPolicy.RUNTIME)
     @Target(ElementType.METHOD)
     private @interface SkinParameters {

Modified: trunk/core/impl/src/test/resources/META-INF/skins/dynatest_base.skin.properties
===================================================================
--- trunk/core/impl/src/test/resources/META-INF/skins/dynatest_base.skin.properties	2010-08-09 16:39:18 UTC (rev 18517)
+++ trunk/core/impl/src/test/resources/META-INF/skins/dynatest_base.skin.properties	2010-08-09 17:46:24 UTC (rev 18518)
@@ -1 +1,2 @@
+baseSkin=DEFAULT
 customFormColor=#AAA

Modified: trunk/core/impl/src/test/resources/META-INF/skins/style_base.skin.properties
===================================================================
--- trunk/core/impl/src/test/resources/META-INF/skins/style_base.skin.properties	2010-08-09 16:39:18 UTC (rev 18517)
+++ trunk/core/impl/src/test/resources/META-INF/skins/style_base.skin.properties	2010-08-09 17:46:24 UTC (rev 18518)
@@ -1,3 +1,4 @@
+baseSkin=DEFAULT
 intermediateTextColor=green.intermediate
 intermediateTextSizeBase=10px
 additionalBaseTextColor=&textColor



More information about the richfaces-svn-commits mailing list