Author: nbelaevski
Date: 2010-07-22 11:33:47 -0400 (Thu, 22 Jul 2010)
New Revision: 18197
Added:
root/core/trunk/impl/src/main/java/org/richfaces/skin/SkinFactoryPreRenderViewListener.java
Modified:
root/core/trunk/impl/src/main/java/org/richfaces/skin/CompositeSkinImpl.java
root/core/trunk/impl/src/main/java/org/richfaces/skin/SkinFactoryImpl.java
root/core/trunk/impl/src/main/resources/META-INF/faces-config.xml
Log:
Skin system refactoring
Modified: root/core/trunk/impl/src/main/java/org/richfaces/skin/CompositeSkinImpl.java
===================================================================
---
root/core/trunk/impl/src/main/java/org/richfaces/skin/CompositeSkinImpl.java 2010-07-22
13:49:01 UTC (rev 18196)
+++
root/core/trunk/impl/src/main/java/org/richfaces/skin/CompositeSkinImpl.java 2010-07-22
15:33:47 UTC (rev 18197)
@@ -26,7 +26,7 @@
/**
* @author nick belaevski
*/
-final class CompositeSkinImpl implements Skin {
+final class CompositeSkinImpl extends AbstractSkin {
private int hashCode = 0;
@@ -103,20 +103,4 @@
return parameterValue;
}
- /* (non-Javadoc)
- * @see org.richfaces.skin.Skin#getColorParameter(javax.faces.context.FacesContext,
java.lang.String)
- */
- public Integer getColorParameter(FacesContext context, String name) {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.richfaces.skin.Skin#getColorParameter(javax.faces.context.FacesContext,
java.lang.String, java.lang.Object)
- */
- public Integer getColorParameter(FacesContext context, String name, Object
defaultValue) {
- // TODO Auto-generated method stub
- return null;
- }
-
}
Modified: root/core/trunk/impl/src/main/java/org/richfaces/skin/SkinFactoryImpl.java
===================================================================
--- root/core/trunk/impl/src/main/java/org/richfaces/skin/SkinFactoryImpl.java 2010-07-22
13:49:01 UTC (rev 18196)
+++ root/core/trunk/impl/src/main/java/org/richfaces/skin/SkinFactoryImpl.java 2010-07-22
15:33:47 UTC (rev 18197)
@@ -165,6 +165,11 @@
return skin;
}
+ static void clearSkinCaches(FacesContext context) {
+ context.getAttributes().remove(BASE_SKIN_KEY);
+ context.getAttributes().remove(SKIN_KEY);
+ }
+
// protected Properties getDefaultSkinProperties() {
// if (defaultSkinProperties == null) {
// defaultSkinProperties =
loadProperties(DEFAULT_SKIN_NAME,DEFAULT_SKIN_PATHS);
Added:
root/core/trunk/impl/src/main/java/org/richfaces/skin/SkinFactoryPreRenderViewListener.java
===================================================================
---
root/core/trunk/impl/src/main/java/org/richfaces/skin/SkinFactoryPreRenderViewListener.java
(rev 0)
+++
root/core/trunk/impl/src/main/java/org/richfaces/skin/SkinFactoryPreRenderViewListener.java 2010-07-22
15:33:47 UTC (rev 18197)
@@ -0,0 +1,43 @@
+/*
+ * 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.skin;
+
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.SystemEvent;
+import javax.faces.event.SystemEventListener;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class SkinFactoryPreRenderViewListener implements SystemEventListener {
+
+ public void processEvent(SystemEvent event) throws AbortProcessingException {
+ SkinFactoryImpl.clearSkinCaches(FacesContext.getCurrentInstance());
+ }
+
+ public boolean isListenerForSource(Object source) {
+ return true;
+ }
+
+}
Modified: root/core/trunk/impl/src/main/resources/META-INF/faces-config.xml
===================================================================
--- root/core/trunk/impl/src/main/resources/META-INF/faces-config.xml 2010-07-22 13:49:01
UTC (rev 18196)
+++ root/core/trunk/impl/src/main/resources/META-INF/faces-config.xml 2010-07-22 15:33:47
UTC (rev 18197)
@@ -19,6 +19,10 @@
-->
<!-- state-manager>org.ajax4jsf.application.AjaxStateManager</state-manager
-->
<el-resolver>org.richfaces.skin.SkinPropertiesELResolver</el-resolver>
+ <system-event-listener>
+
<system-event-listener-class>org.richfaces.skin.SkinFactoryPreRenderViewListener</system-event-listener-class>
+
<system-event-class>javax.faces.event.PreRenderViewEvent</system-event-class>
+ </system-event-listener>
</application>
<!-- lifecycle>
<phase-listener>org.ajax4jsf.event.AjaxPhaseListener</phase-listener>