Author: nbelaevski
Date: 2010-07-30 08:38:54 -0400 (Fri, 30 Jul 2010)
New Revision: 18293
Modified:
root/core/trunk/api/src/main/java/org/richfaces/skin/Skin.java
root/core/trunk/impl/src/main/java/org/richfaces/skin/AbstractSkinFactory.java
root/core/trunk/impl/src/main/java/org/richfaces/skin/CompositeSkinImpl.java
root/core/trunk/impl/src/main/java/org/richfaces/skin/SkinBean.java
root/core/trunk/impl/src/main/java/org/richfaces/skin/SkinImpl.java
Log:
Added getName() method to skins
Modified: root/core/trunk/api/src/main/java/org/richfaces/skin/Skin.java
===================================================================
--- root/core/trunk/api/src/main/java/org/richfaces/skin/Skin.java 2010-07-30 12:30:53 UTC
(rev 18292)
+++ root/core/trunk/api/src/main/java/org/richfaces/skin/Skin.java 2010-07-30 12:38:54 UTC
(rev 18293)
@@ -323,6 +323,8 @@
*/
public int hashCode(FacesContext context);
+ public String getName();
+
// Preferable parameters
/**
Modified: root/core/trunk/impl/src/main/java/org/richfaces/skin/AbstractSkinFactory.java
===================================================================
---
root/core/trunk/impl/src/main/java/org/richfaces/skin/AbstractSkinFactory.java 2010-07-30
12:30:53 UTC (rev 18292)
+++
root/core/trunk/impl/src/main/java/org/richfaces/skin/AbstractSkinFactory.java 2010-07-30
12:38:54 UTC (rev 18293)
@@ -124,7 +124,7 @@
Properties skinParams = loadProperties(name, SKINS_PATHS);
processProperties(context, skinParams);
- return new SkinImpl(skinParams);
+ return new SkinImpl(skinParams, name);
}
/**
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-30
12:30:53 UTC (rev 18292)
+++
root/core/trunk/impl/src/main/java/org/richfaces/skin/CompositeSkinImpl.java 2010-07-30
12:38:54 UTC (rev 18293)
@@ -55,6 +55,18 @@
return false;
}
+ public String getName() {
+ for (Skin skin : skinsChain) {
+ if (skin == null) {
+ continue;
+ }
+
+ return skin.getName();
+ }
+
+ throw new IllegalStateException();
+ }
+
public int hashCode(FacesContext context) {
int hash = hashCode;
Modified: root/core/trunk/impl/src/main/java/org/richfaces/skin/SkinBean.java
===================================================================
--- root/core/trunk/impl/src/main/java/org/richfaces/skin/SkinBean.java 2010-07-30
12:30:53 UTC (rev 18292)
+++ root/core/trunk/impl/src/main/java/org/richfaces/skin/SkinBean.java 2010-07-30
12:38:54 UTC (rev 18293)
@@ -163,4 +163,8 @@
public Integer getIntegerParameter(FacesContext context, String name, Object
defaultValue) {
return getSkin().getIntegerParameter(context, name, defaultValue);
}
+
+ public String getName() {
+ return getSkin().getName();
+ }
}
Modified: root/core/trunk/impl/src/main/java/org/richfaces/skin/SkinImpl.java
===================================================================
--- root/core/trunk/impl/src/main/java/org/richfaces/skin/SkinImpl.java 2010-07-30
12:30:53 UTC (rev 18292)
+++ root/core/trunk/impl/src/main/java/org/richfaces/skin/SkinImpl.java 2010-07-30
12:38:54 UTC (rev 18293)
@@ -50,6 +50,8 @@
}
}
+ private String name;
+
private MutableInteger getCounter(FacesContext context) {
Map<Object, Object> attr = context.getAttributes();
@@ -120,8 +122,9 @@
*
* @param skinName
*/
- SkinImpl(Map<Object, Object> properties) {
+ SkinImpl(Map<Object, Object> properties, String name) {
this.skinParams = properties;
+ this.name = name;
}
protected Map<Object, Object> getSkinParams() {
@@ -223,6 +226,10 @@
return containsProperty(facesContext, name);
}
+ public String getName() {
+ return name;
+ }
+
public int hashCode(FacesContext context) {
int hash = 0;
for (Map.Entry<Object, Object> entry : skinParams.entrySet()) {
@@ -243,5 +250,5 @@
return hash;
}
-
+
}