Author: nbelaevski
Date: 2007-06-07 18:14:41 -0400 (Thu, 07 Jun 2007)
New Revision: 1089
Modified:
trunk/richfaces/common/src/main/java/org/richfaces/renderkit/html/BaseGradient.java
trunk/richfaces/common/src/main/resources/META-INF/skins/plain.skin.properties
trunk/richfaces/tabPanel/src/main/java/org/richfaces/renderkit/images/TabStripeImage.java
Log:
Better "plain" skin handling
Modified:
trunk/richfaces/common/src/main/java/org/richfaces/renderkit/html/BaseGradient.java
===================================================================
---
trunk/richfaces/common/src/main/java/org/richfaces/renderkit/html/BaseGradient.java 2007-06-07
19:37:01 UTC (rev 1088)
+++
trunk/richfaces/common/src/main/java/org/richfaces/renderkit/html/BaseGradient.java 2007-06-07
22:14:41 UTC (rev 1089)
@@ -39,7 +39,6 @@
import org.ajax4jsf.framework.skin.Skin;
import org.ajax4jsf.framework.skin.SkinFactory;
import org.ajax4jsf.framework.util.HtmlColor;
-import org.ajax4jsf.framework.util.HtmlDimensions;
/**
* @author Nick Belaevski - nbelaevski(a)exadel.com
@@ -165,9 +164,9 @@
protected Object getDataToStore(FacesContext context, Object data) {
if (baseColor == null) {
- return new Data(context,data);
+ return new Data(context);
} else {
- return new Data(context,data,baseColor,gradientColor);
+ return new Data(context, baseColor, gradientColor);
}
}
@@ -180,20 +179,35 @@
public Data() {
}
- protected Data(FacesContext context, Object data) {
- this.headerBackgroundColor = getColorValueParameter(context, data,
Skin.headerBackgroundColor);
- this.headerGradientColor = getColorValueParameter(context, data,
"headerGradientColor");
+ protected Data(FacesContext context) {
+ this(context, Skin.headerBackgroundColor, "headerGradientColor");
}
- protected Data(FacesContext context, Object data, String baseColor, String
gradientColor) {
- this.headerBackgroundColor = getColorValueParameter(context, data, baseColor);
- this.headerGradientColor = getColorValueParameter(context, data, gradientColor);
+ protected Data(FacesContext context, String baseColor, String gradientColor) {
+ this.headerBackgroundColor = getColorValueParameter(context, baseColor, false);
+ this.headerGradientColor = getColorValueParameter(context, gradientColor, false);
+
+ if (!(this.headerBackgroundColor == null && this.headerGradientColor == null))
{
+ if (this.headerBackgroundColor == null) {
+ this.headerBackgroundColor = getColorValueParameter(context, baseColor, true);
+ }
+
+ if (this.headerGradientColor == null) {
+ this.headerGradientColor = getColorValueParameter(context, gradientColor, true);
+ }
+ }
}
- private Integer getColorValueParameter(FacesContext context, Object data, String name)
{
- Skin skin = SkinFactory.getInstance().getSkin(context);
+ private Integer getColorValueParameter(FacesContext context, String name, boolean
useDefault) {
+ Skin skin;
+ if (useDefault) {
+ skin = SkinFactory.getInstance().getDefaultSkin(context);
+ } else {
+ skin = SkinFactory.getInstance().getSkin(context);
+ }
+
String tmp = (String) skin.getParameter(context,name);
- if (tmp!=null) {
+ if (tmp!=null && tmp.length() == 0) {
return new Integer(HtmlColor.decode(tmp).getRGB());
} else {
return null;
Modified: trunk/richfaces/common/src/main/resources/META-INF/skins/plain.skin.properties
===================================================================
---
trunk/richfaces/common/src/main/resources/META-INF/skins/plain.skin.properties 2007-06-07
19:37:01 UTC (rev 1088)
+++
trunk/richfaces/common/src/main/resources/META-INF/skins/plain.skin.properties 2007-06-07
22:14:41 UTC (rev 1089)
@@ -1,50 +1,50 @@
#Colors
headerBackgroundColor=
-headerGradientColor=
-headerTextColor=
-headerWeightFont=
+headerGradientColor=#{null}
+headerTextColor=#{null}
+headerWeightFont=#{null}
-generalBackgroundColor=
-generalTextColor=
-generalSizeFont=
-generalFamilyFont=
+generalBackgroundColor=#{null}
+generalTextColor=#{null}
+generalSizeFont=#{null}
+generalFamilyFont=#{null}
-controlTextColor=
-controlBackgroundColor=
-additionalBackgroundColor=
+controlTextColor=#{null}
+controlBackgroundColor=#{null}
+additionalBackgroundColor=#{null}
-shadowBackgroundColor=
-shadowOpacity=
+shadowBackgroundColor=#{null}
+shadowOpacity=#{null}
-panelBorderColor=
-subBorderColor=
+panelBorderColor=#{null}
+subBorderColor=#{null}
-tabBackgroundColor=
-tabDisabledTextColor=
+tabBackgroundColor=#{null}
+tabDisabledTextColor=#{null}
-trimColor=
+trimColor=#{null}
-tipBackgroundColor=
-tipBorderColor=
+tipBackgroundColor=#{null}
+tipBorderColor=#{null}
-selectControlColor=
+selectControlColor=#{null}
-generalLinkColor=
-hoverLinkColor=
-visitedLinkColor=
+generalLinkColor=#{null}
+hoverLinkColor=#{null}
+visitedLinkColor=#{null}
# Fonts
-headerSizeFont=
-headerFamilyFont=
+headerSizeFont=#{null}
+headerFamilyFont=#{null}
-tabSizeFont=
-tabFamilyFont=
+tabSizeFont=#{null}
+tabFamilyFont=#{null}
-buttonSizeFont=
-buttonFamilyFont=
+buttonSizeFont=#{null}
+buttonFamilyFont=#{null}
-tableBackgroundColor=
-tableFooterBackgroundColor=
-tableSubfooterBackgroundColor=
-tableBorderColor=
\ No newline at end of file
+tableBackgroundColor=#{null}
+tableFooterBackgroundColor=#{null}
+tableSubfooterBackgroundColor=#{null}
+tableBorderColor=#{null}
\ No newline at end of file
Modified:
trunk/richfaces/tabPanel/src/main/java/org/richfaces/renderkit/images/TabStripeImage.java
===================================================================
---
trunk/richfaces/tabPanel/src/main/java/org/richfaces/renderkit/images/TabStripeImage.java 2007-06-07
19:37:01 UTC (rev 1088)
+++
trunk/richfaces/tabPanel/src/main/java/org/richfaces/renderkit/images/TabStripeImage.java 2007-06-07
22:14:41 UTC (rev 1089)
@@ -54,8 +54,13 @@
protected Object getDataToStore(FacesContext context, Object data) {
Skin skin = SkinFactory.getInstance().getSkin(context);
-
- String color = (String) skin.getParameter(context,
"panelBorderColor");
+ String colorParameterName = "panelBorderColor";
+ String color = (String) skin.getParameter(context, colorParameterName);
+ if (color == null || color.length() == 0) {
+ Skin defaultSkin = SkinFactory.getInstance().getDefaultSkin(context);
+ return new Integer(HtmlColor.decode(
+ (String) defaultSkin.getParameter(context, colorParameterName)).getRGB());
+ }
return new Integer(HtmlColor.decode(color).getRGB());
}