Author: nbelaevski
Date: 2007-06-07 17:55:30 -0400 (Thu, 07 Jun 2007)
New Revision: 255
Modified:
trunk/framework/src/main/java/org/ajax4jsf/framework/skin/SkinFactory.java
trunk/framework/src/main/java/org/ajax4jsf/framework/skin/SkinFactoryImpl.java
trunk/framework/src/main/java/org/ajax4jsf/framework/skin/SkinImpl.java
Log:
- getDefaultSkin() method added
- hashCode() in SkinImpl fixed to handle null-valued parameters properly
Modified: trunk/framework/src/main/java/org/ajax4jsf/framework/skin/SkinFactory.java
===================================================================
--- trunk/framework/src/main/java/org/ajax4jsf/framework/skin/SkinFactory.java 2007-06-06
22:25:16 UTC (rev 254)
+++ trunk/framework/src/main/java/org/ajax4jsf/framework/skin/SkinFactory.java 2007-06-07
21:55:30 UTC (rev 255)
@@ -122,6 +122,13 @@
}
/**
+ * Get default {@link Skin} implementation.
+ * @param context
+ * @return
+ */
+ public abstract Skin getDefaultSkin(FacesContext context);
+
+ /**
* Get current {@link Skin} implementation.
* @param context
* @return
Modified: trunk/framework/src/main/java/org/ajax4jsf/framework/skin/SkinFactoryImpl.java
===================================================================
---
trunk/framework/src/main/java/org/ajax4jsf/framework/skin/SkinFactoryImpl.java 2007-06-06
22:25:16 UTC (rev 254)
+++
trunk/framework/src/main/java/org/ajax4jsf/framework/skin/SkinFactoryImpl.java 2007-06-07
21:55:30 UTC (rev 255)
@@ -84,10 +84,7 @@
private ValueBinding skinBinding = null;
private static final Log log = LogFactory.getLog(SkinFactoryImpl.class);
- public Skin getSkin(FacesContext context) {
- // TODO - cache skin for current thread ? or for current Faces Lifecycle
- // Phase ?
- Object currentSkinOrName = getSkinOrName(context);
+ protected Skin getSkinByName(Object currentSkinOrName) {
if (null == currentSkinOrName) {
throw new SkinNotFoundException(Messages
.getMessage(Messages.NULL_SKIN_NAME_ERROR));
@@ -112,6 +109,17 @@
return currentSkin;
}
+ public Skin getDefaultSkin(FacesContext context) {
+ return getSkinByName(DEFAULT_SKIN_NAME);
+ }
+
+ public Skin getSkin(FacesContext context) {
+ // TODO - cache skin for current thread ? or for current Faces Lifecycle
+ // Phase ?
+ Object currentSkinOrName = getSkinOrName(context);
+ return getSkinByName(currentSkinOrName);
+ }
+
protected Properties getDefaultSkinProperties() {
if (defaultSkinProperties == null) {
defaultSkinProperties = loadDefaultProperties(DEFAULT_SKIN_PROPERTIES_RESOURCE);
Modified: trunk/framework/src/main/java/org/ajax4jsf/framework/skin/SkinImpl.java
===================================================================
--- trunk/framework/src/main/java/org/ajax4jsf/framework/skin/SkinImpl.java 2007-06-06
22:25:16 UTC (rev 254)
+++ trunk/framework/src/main/java/org/ajax4jsf/framework/skin/SkinImpl.java 2007-06-07
21:55:30 UTC (rev 255)
@@ -121,7 +121,8 @@
int hash = 0;
for (Iterator iter = skinParams.keySet().iterator(); iter.hasNext();) {
String key = (String) iter.next();
- hash = 31*hash + getParameter(context,key).hashCode();
+ Object parameter = getParameter(context,key);
+ 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
Show replies by date