Author: abelevich
Date: 2011-02-09 04:42:29 -0500 (Wed, 09 Feb 2011)
New Revision: 21558
Added:
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/images/ProgressBarAnimatedBackgroundImage.java
Removed:
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarAnimatedBackgroundImage.java
Modified:
trunk/core/impl/src/main/java/org/richfaces/renderkit/html/BaseGradient.java
trunk/core/impl/src/main/java/org/richfaces/renderkit/html/images/OneColorBasedResource.java
trunk/core/impl/src/main/resources/META-INF/skins/plain.skin.properties
trunk/core/impl/src/test/resources/resources/full.css
trunk/core/impl/src/test/resources/resources/importedEL.css
trunk/core/impl/src/test/resources/resources/resource.css
trunk/ui/common/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelIconBasic.java
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/ArrowBase.java
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/AutocompleteBaseGradient.java
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/AutocompleteButtonGradient.java
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/CalendarIcon.java
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/CalendarSeparator.java
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/ComboButtonBase.java
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/ComboDisabledDownButton.java
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/ComboDownButton.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/html/images/TreeLineImage.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/html/images/TreePlusImage.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/images/ToolbarSeparatorImage.java
trunk/ui/output/ui/src/main/resources/META-INF/richfaces/resource-mappings.properties
Log:
RF-9613 glassfish throws NullPointerException when skin plain is used
Modified: trunk/core/impl/src/main/java/org/richfaces/renderkit/html/BaseGradient.java
===================================================================
---
trunk/core/impl/src/main/java/org/richfaces/renderkit/html/BaseGradient.java 2011-02-09
09:35:26 UTC (rev 21557)
+++
trunk/core/impl/src/main/java/org/richfaces/renderkit/html/BaseGradient.java 2011-02-09
09:42:29 UTC (rev 21558)
@@ -55,9 +55,9 @@
protected Integer headerGradientColor;
protected GradientType gradientType;
- private int width;
- private int height;
- private int gradientHeight;
+ private Integer width;
+ private Integer height;
+ private Integer gradientHeight;
private String baseColor;
private String gradientColor;
private boolean horizontal;
@@ -142,17 +142,17 @@
}
@ResourceParameter(defaultValue = "30")
- public final void setWidth(int width) {
+ public final void setWidth(Integer width) {
this.width = width;
}
@ResourceParameter(defaultValue = "50")
- public final void setHeight(int height) {
+ public final void setHeight(Integer height) {
this.height = height;
}
@ResourceParameter(defaultValue = "20")
- public final void setGradientHeight(int gradientHeight) {
+ public final void setGradientHeight(Integer gradientHeight) {
this.gradientHeight = gradientHeight;
}
@@ -176,24 +176,36 @@
}
public Dimension getDimension() {
- return new Dimension(getWidth(), getHeight());
+ return new Dimension(getSafeWidth(), getSafeHeight());
}
/**
* @return the gradientHeight
*/
- protected int getGradientHeight() {
+ protected Integer getGradientHeight() {
return gradientHeight;
}
- protected int getHeight() {
+ protected Integer getHeight() {
return height;
}
- protected int getWidth() {
+ protected Integer getWidth() {
return width;
}
+ protected Integer getSafeGradientHeight() {
+ return gradientHeight == null ? 0 : gradientHeight;
+ }
+
+ protected Integer getSafeHeight() {
+ return height == null ? 0 : height;
+ }
+
+ protected Integer getSafeWidth() {
+ return width == null ? 0 : width;
+ }
+
/**
* @return the baseColor
*/
@@ -240,7 +252,7 @@
* @param dim
*/
protected void paintGradient(Graphics2D g2d, Dimension dim) {
- if ((headerBackgroundColor != null || headerGradientColor != null) &&
gradientType != null) {
+ if (headerBackgroundColor != null && headerGradientColor != null
&& gradientType != null) {
BiColor biColor = new GradientType.BiColor(headerBackgroundColor,
headerGradientColor);
BiColor firstLayer = gradientType.getFirstLayerColors(biColor);
@@ -278,29 +290,62 @@
}
public void readState(FacesContext context, DataInput dataInput) throws IOException
{
- this.width = dataInput.readShort();
- this.height = dataInput.readShort();
- this.gradientHeight = dataInput.readShort();
+ this.width = readIntegerParameterAsShort(dataInput);
+ this.height = readIntegerParameterAsShort(dataInput);
+ this.gradientHeight = readIntegerParameterAsShort(dataInput);
+ this.headerBackgroundColor = readIntegerParameter(dataInput);
+ this.headerGradientColor = readIntegerParameter(dataInput);
+
this.horizontal = dataInput.readBoolean();
-
- this.headerBackgroundColor = dataInput.readInt();
- this.headerGradientColor = dataInput.readInt();
this.gradientType = GradientType.values()[dataInput.readByte()];
}
public void writeState(FacesContext context, DataOutput dataOutput) throws
IOException {
- dataOutput.writeShort((short) width);
- dataOutput.writeShort((short) height);
- dataOutput.writeShort((short) gradientHeight);
- dataOutput.writeBoolean(horizontal);
+ writeIntegerParameterAsShort(dataOutput, this.width);
+ writeIntegerParameterAsShort(dataOutput, this.height);
+ writeIntegerParameterAsShort(dataOutput, this.gradientHeight);
+ writeIntegerParameter(dataOutput, this.headerBackgroundColor);
+ writeIntegerParameter(dataOutput, this.headerGradientColor);
- dataOutput.writeInt(this.headerBackgroundColor);
- dataOutput.writeInt(this.headerGradientColor);
+ dataOutput.writeBoolean(this.horizontal);
dataOutput.writeByte((byte) this.gradientType.ordinal());
}
+ protected void writeIntegerParameterAsShort(DataOutput dataOutput, Integer parameter)
throws IOException {
+ if (parameter != null) {
+ dataOutput.writeBoolean(true);
+ dataOutput.writeShort(parameter);
+ } else {
+ dataOutput.writeBoolean(false);
+ }
+ }
+
+ protected Integer readIntegerParameterAsShort(DataInput dataInput) throws IOException
{
+ if (dataInput.readBoolean()) {
+ return (int) dataInput.readShort();
+ } else {
+ return null;
+ }
+ }
+
+ protected void writeIntegerParameter(DataOutput dataOutput, Integer parameter) throws
IOException {
+ if (parameter != null) {
+ dataOutput.writeBoolean(true);
+ dataOutput.writeInt(parameter);
+ } else {
+ dataOutput.writeBoolean(false);
+ }
+ }
+
+ protected Integer readIntegerParameter(DataInput dataInput) throws IOException {
+ if (dataInput.readBoolean()) {
+ return dataInput.readInt();
+ } else {
+ return null;
+ }
+ }
+
public boolean isTransient() {
return false;
}
-
}
Modified:
trunk/core/impl/src/main/java/org/richfaces/renderkit/html/images/OneColorBasedResource.java
===================================================================
---
trunk/core/impl/src/main/java/org/richfaces/renderkit/html/images/OneColorBasedResource.java 2011-02-09
09:35:26 UTC (rev 21557)
+++
trunk/core/impl/src/main/java/org/richfaces/renderkit/html/images/OneColorBasedResource.java 2011-02-09
09:42:29 UTC (rev 21558)
@@ -63,7 +63,12 @@
public void writeState(FacesContext context, DataOutput dataOutput) throws
IOException {
Skin skin = SkinFactory.getInstance(context).getSkin(context);
- dataOutput.writeInt(skin.getColorParameter(context, basicColorParamName));
+ Integer colorParameter = skin.getColorParameter(context, basicColorParamName);
+ if (colorParameter == null) {
+ Skin defaultSkin = SkinFactory.getInstance(context).getDefaultSkin(context);
+ colorParameter = defaultSkin.getColorParameter(context,
basicColorParamName);
+ }
+ dataOutput.writeInt(colorParameter);
}
public void readState(FacesContext context, DataInput dataInput) throws IOException
{
Modified: trunk/core/impl/src/main/resources/META-INF/skins/plain.skin.properties
===================================================================
--- trunk/core/impl/src/main/resources/META-INF/skins/plain.skin.properties 2011-02-09
09:35:26 UTC (rev 21557)
+++ trunk/core/impl/src/main/resources/META-INF/skins/plain.skin.properties 2011-02-09
09:42:29 UTC (rev 21558)
@@ -72,4 +72,5 @@
errorColor=#{null}
editorBackgroundColor=#{null}
-editBackgroundColor=#{null}
\ No newline at end of file
+editBackgroundColor=#{null}
+gradientType=plain
Modified: trunk/core/impl/src/test/resources/resources/full.css
===================================================================
--- trunk/core/impl/src/test/resources/resources/full.css 2011-02-09 09:35:26 UTC (rev
21557)
+++ trunk/core/impl/src/test/resources/resources/full.css 2011-02-09 09:42:29 UTC (rev
21558)
@@ -22,5 +22,5 @@
padding: 10px !important;
border: 1px solid green;
background-image: url(image.png);
- background: red
url(/rfRes/org.richfaces.renderkit.html.images.ButtonBackgroundImage.jsf?db=eAFjYGTg!v-f4f!bV8!-Xzl!nAkAQAgJMg__);
+ background: red
url(/rfRes/org.richfaces.renderkit.html.images.ButtonBackgroundImage.jsf?db=eAFjZGBkZOBm!P-f8f!bV88Y!185f5yBCQBPWAk3);
}
Modified: trunk/core/impl/src/test/resources/resources/importedEL.css
===================================================================
--- trunk/core/impl/src/test/resources/resources/importedEL.css 2011-02-09 09:35:26 UTC
(rev 21557)
+++ trunk/core/impl/src/test/resources/resources/importedEL.css 2011-02-09 09:42:29 UTC
(rev 21558)
@@ -22,5 +22,5 @@
padding: 10px !important;
border: 1px solid green;
background-image: url(image.png);
- background: red
url(/rfRes/org.richfaces.renderkit.html.images.ButtonBackgroundImage.jsf?db=eAFjYGTg!v-f4f!bV8!-Xzl!nAkAQAgJMg__);
+ background: red
url(/rfRes/org.richfaces.renderkit.html.images.ButtonBackgroundImage.jsf?db=eAFjZGBkZOBm!P-f8f!bV88Y!185f5yBCQBPWAk3);
}
\ No newline at end of file
Modified: trunk/core/impl/src/test/resources/resources/resource.css
===================================================================
--- trunk/core/impl/src/test/resources/resources/resource.css 2011-02-09 09:35:26 UTC (rev
21557)
+++ trunk/core/impl/src/test/resources/resources/resource.css 2011-02-09 09:42:29 UTC (rev
21558)
@@ -1,3 +1,3 @@
body {
- background: red
url(/rfRes/org.richfaces.renderkit.html.images.ButtonBackgroundImage.jsf?db=eAFjYGTg!v-f4f!bV8!-Xzl!nAkAQAgJMg__);
+ background: red
url(/rfRes/org.richfaces.renderkit.html.images.ButtonBackgroundImage.jsf?db=eAFjZGBkZOBm!P-f8f!bV88Y!185f5yBCQBPWAk3);
}
\ No newline at end of file
Modified:
trunk/ui/common/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelIconBasic.java
===================================================================
---
trunk/ui/common/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelIconBasic.java 2011-02-09
09:35:26 UTC (rev 21557)
+++
trunk/ui/common/ui/src/main/java/org/richfaces/renderkit/html/iconimages/PanelIconBasic.java 2011-02-09
09:42:29 UTC (rev 21558)
@@ -71,7 +71,12 @@
public void initialize() {
FacesContext context = FacesContext.getCurrentInstance();
Skin skin = SkinFactory.getInstance(context).getSkin(context);
- color = new Color(skin.getColorParameter(context, disabled ?
"tabDisabledTextColor" : Skin.HEADER_TEXT_COLOR));
+ Skin defaultSkin = SkinFactory.getInstance(context).getDefaultSkin(context);
+ Integer colorParameter = skin.getColorParameter(context, disabled ?
"tabDisabledTextColor" : Skin.HEADER_TEXT_COLOR);
+ if (colorParameter == null) {
+ colorParameter = defaultSkin.getColorParameter(context, disabled ?
"tabDisabledTextColor" : Skin.HEADER_TEXT_COLOR);
+ }
+ color = new Color(colorParameter);
}
public void setDisabled(boolean topIcon) {
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/ArrowBase.java
===================================================================
---
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/ArrowBase.java 2011-02-09
09:35:26 UTC (rev 21557)
+++
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/ArrowBase.java 2011-02-09
09:42:29 UTC (rev 21558)
@@ -46,7 +46,7 @@
@DynamicUserResource
public abstract class ArrowBase extends AbstractJava2DUserResource implements
StateHolderResource {
- private int color;
+ private Integer color;
private String colorName = Skin.GENERAL_TEXT_COLOR;
public ArrowBase(Dimension dimension) {
@@ -57,7 +57,12 @@
public void initialize() {
FacesContext context = FacesContext.getCurrentInstance();
Skin skin = SkinFactory.getInstance(context).getSkin(context);
+ Skin defaultSkin = SkinFactory.getInstance(context).getDefaultSkin(context);
+
this.color = skin.getColorParameter(context, colorName);
+ if (this.color == null) {
+ this.color = defaultSkin.getColorParameter(context, colorName);
+ }
}
protected final void setColorName(String colorName) {
@@ -80,5 +85,4 @@
public boolean isTransient() {
return false;
}
-
}
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/AutocompleteBaseGradient.java
===================================================================
---
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/AutocompleteBaseGradient.java 2011-02-09
09:35:26 UTC (rev 21557)
+++
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/AutocompleteBaseGradient.java 2011-02-09
09:42:29 UTC (rev 21558)
@@ -34,6 +34,7 @@
import org.richfaces.resource.AbstractJava2DUserResource;
import org.richfaces.resource.DynamicUserResource;
+import org.richfaces.resource.PostConstructResource;
import org.richfaces.resource.StateHolderResource;
import org.richfaces.skin.Skin;
import org.richfaces.skin.SkinFactory;
@@ -51,35 +52,52 @@
private String bottomColorSkinParameter;
- private Color topColor;
+ private Integer topColor;
- private Color bottomColor;
+ private Integer bottomColor;
public AutocompleteBaseGradient() {
super(DIMENSION);
}
+ @PostConstructResource
+ public void initialize() {
+ FacesContext context = FacesContext.getCurrentInstance();
+ Skin skin = SkinFactory.getInstance(context).getSkin(context);
+
+ topColor = skin.getColorParameter(context, topColorSkinParameter);
+ bottomColor = skin.getColorParameter(context, bottomColorSkinParameter);
+ }
+
public void paint(Graphics2D graphics2d) {
+ if (topColor == null || bottomColor == null) {
+ return;
+ }
Dimension dimension = getDimension();
- GradientPaint paint = new GradientPaint(0, 0, topColor, 0, dimension.height,
bottomColor);
+ GradientPaint paint = new GradientPaint(0, 0, new Color(topColor), 0,
dimension.height, new Color(bottomColor));
graphics2d.setPaint(paint);
graphics2d.fill(new Rectangle(dimension));
}
public void writeState(FacesContext context, DataOutput dataOutput) throws
IOException {
- Skin skin = SkinFactory.getInstance(context).getSkin(context);
-
- Integer topColor = skin.getColorParameter(context, topColorSkinParameter);
- Integer bottomColor = skin.getColorParameter(context, bottomColorSkinParameter);
-
- dataOutput.writeInt(topColor);
- dataOutput.writeInt(bottomColor);
+ if (topColor != null && bottomColor != null) {
+ dataOutput.writeBoolean(true);
+ dataOutput.writeInt(topColor);
+ dataOutput.writeInt(bottomColor);
+ } else {
+ dataOutput.writeBoolean(false);
+ }
}
public void readState(FacesContext context, DataInput dataInput) throws IOException
{
- topColor = new Color(dataInput.readInt());
- bottomColor = new Color(dataInput.readInt());
+ if (dataInput.readBoolean()) {
+ topColor = dataInput.readInt();
+ bottomColor = dataInput.readInt();
+ } else {
+ topColor = null;
+ bottomColor = null;
+ }
}
public boolean isTransient() {
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/AutocompleteButtonGradient.java
===================================================================
---
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/AutocompleteButtonGradient.java 2011-02-09
09:35:26 UTC (rev 21557)
+++
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/AutocompleteButtonGradient.java 2011-02-09
09:42:29 UTC (rev 21558)
@@ -33,5 +33,4 @@
setTopColorSkinParameter(Skin.HEADER_GRADIENT_COLOR);
setBottomColorSkinParameter(Skin.HEADER_BACKGROUND_COLOR);
}
-
}
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/CalendarIcon.java
===================================================================
---
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/CalendarIcon.java 2011-02-09
09:35:26 UTC (rev 21557)
+++
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/CalendarIcon.java 2011-02-09
09:42:29 UTC (rev 21558)
@@ -66,9 +66,17 @@
public final void initialize() {
FacesContext context = FacesContext.getCurrentInstance();
Skin skin = SkinFactory.getInstance(context).getSkin(context);
+ Skin defaultSkin = SkinFactory.getInstance(context).getDefaultSkin(context);
this.headerTextColor = skin.getColorParameter(context,
Skin.HEADER_BACKGROUND_COLOR);
+ if (this.headerTextColor == null) {
+ this.headerTextColor = defaultSkin.getColorParameter(context,
Skin.HEADER_BACKGROUND_COLOR);
+ }
+
this.headerBackgroundColor = skin.getColorParameter(context,
Skin.SELECT_CONTROL_COLOR);
+ if (this.headerBackgroundColor == null) {
+ this.headerBackgroundColor = defaultSkin.getColorParameter(context,
Skin.SELECT_CONTROL_COLOR);
+ }
}
public boolean isTransient() {
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/CalendarSeparator.java
===================================================================
---
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/CalendarSeparator.java 2011-02-09
09:35:26 UTC (rev 21557)
+++
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/CalendarSeparator.java 2011-02-09
09:42:29 UTC (rev 21558)
@@ -58,8 +58,12 @@
public void initialize() {
FacesContext context = FacesContext.getCurrentInstance();
Skin skin = SkinFactory.getInstance(context).getSkin(context);
+ Skin defaultSkin = SkinFactory.getInstance(context).getDefaultSkin(context);
this.headerTextColor = skin.getColorParameter(context, Skin.HEADER_TEXT_COLOR);
+ if (this.headerTextColor == null) {
+ this.headerTextColor = defaultSkin.getColorParameter(context,
Skin.HEADER_TEXT_COLOR);
+ }
}
public boolean isTransient() {
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/ComboButtonBase.java
===================================================================
---
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/ComboButtonBase.java 2011-02-09
09:35:26 UTC (rev 21557)
+++
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/ComboButtonBase.java 2011-02-09
09:42:29 UTC (rev 21558)
@@ -33,19 +33,40 @@
import org.richfaces.resource.AbstractJava2DUserResource;
import org.richfaces.resource.DynamicUserResource;
+import org.richfaces.resource.PostConstructResource;
import org.richfaces.resource.StateHolderResource;
+import org.richfaces.skin.Skin;
+import org.richfaces.skin.SkinFactory;
@DynamicUserResource
public abstract class ComboButtonBase extends AbstractJava2DUserResource implements
StateHolderResource {
private static final Dimension DIMENSION = new Dimension(15, 15);
- protected Integer arrowColor;
+ private Integer arrowColor;
+ private String colorName = Skin.GENERAL_TEXT_COLOR;
public ComboButtonBase() {
super(DIMENSION);
}
+ @PostConstructResource
+ public final void initialize() {
+ FacesContext context = FacesContext.getCurrentInstance();
+ Skin skin = SkinFactory.getInstance(context).getSkin(context);
+ Skin defaultSkin = SkinFactory.getInstance(context).getDefaultSkin(context);
+
+ this.arrowColor = skin.getColorParameter(context, Skin.TABLE_BORDER_COLOR);
+ this.arrowColor = skin.getColorParameter(context, colorName);
+ if (this.arrowColor == null) {
+ this.arrowColor = defaultSkin.getColorParameter(context, colorName);
+ }
+ }
+
+ protected final void setColorName(String colorName) {
+ this.colorName = colorName;
+ }
+
public boolean isTransient() {
return false;
}
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/ComboDisabledDownButton.java
===================================================================
---
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/ComboDisabledDownButton.java 2011-02-09
09:35:26 UTC (rev 21557)
+++
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/ComboDisabledDownButton.java 2011-02-09
09:42:29 UTC (rev 21558)
@@ -22,19 +22,11 @@
package org.richfaces.renderkit.html.images;
-import javax.faces.context.FacesContext;
-
-import org.richfaces.resource.PostConstructResource;
import org.richfaces.skin.Skin;
-import org.richfaces.skin.SkinFactory;
public class ComboDisabledDownButton extends ComboButtonBase {
- @PostConstructResource
- public final void initialize() {
- FacesContext context = FacesContext.getCurrentInstance();
- Skin skin = SkinFactory.getInstance(context).getSkin(context);
-
- this.arrowColor = skin.getColorParameter(context, Skin.TABLE_BORDER_COLOR);
+ public ComboDisabledDownButton() {
+ setColorName(Skin.TABLE_BORDER_COLOR);
}
}
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/ComboDownButton.java
===================================================================
---
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/ComboDownButton.java 2011-02-09
09:35:26 UTC (rev 21557)
+++
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/html/images/ComboDownButton.java 2011-02-09
09:42:29 UTC (rev 21558)
@@ -22,19 +22,11 @@
package org.richfaces.renderkit.html.images;
-import javax.faces.context.FacesContext;
-
-import org.richfaces.resource.PostConstructResource;
import org.richfaces.skin.Skin;
-import org.richfaces.skin.SkinFactory;
public class ComboDownButton extends ComboButtonBase {
- @PostConstructResource
- public final void initialize() {
- FacesContext context = FacesContext.getCurrentInstance();
- Skin skin = SkinFactory.getInstance(context).getSkin(context);
-
- this.arrowColor = skin.getColorParameter(context, Skin.GENERAL_TEXT_COLOR);
+ public ComboDownButton() {
+ setColorName(Skin.GENERAL_TEXT_COLOR);
}
}
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/html/images/TreeLineImage.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/html/images/TreeLineImage.java 2011-02-09
09:35:26 UTC (rev 21557)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/html/images/TreeLineImage.java 2011-02-09
09:42:29 UTC (rev 21558)
@@ -61,13 +61,16 @@
FacesContext context = FacesContext.getCurrentInstance();
Skin skin = SkinFactory.getInstance(context).getSkin(context);
+ Skin defaultSkin = SkinFactory.getInstance(context).getDefaultSkin(context);
trimColorValue = skin.getColorParameter(context, Skin.TRIM_COLOR);
+ if (trimColorValue == null) {
+ trimColorValue = defaultSkin.getColorParameter(context, Skin.TRIM_COLOR);
+ }
}
public void paint(Graphics2D g2d) {
g2d.setColor(new Color(trimColorValue));
-
g2d.drawLine(7, 0, 7, 15);
}
@@ -82,5 +85,4 @@
public boolean isTransient() {
return false;
}
-
}
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/html/images/TreePlusImage.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/html/images/TreePlusImage.java 2011-02-09
09:35:26 UTC (rev 21557)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/html/images/TreePlusImage.java 2011-02-09
09:42:29 UTC (rev 21558)
@@ -60,13 +60,21 @@
@PostConstructResource
public void init() {
+ generalColorValue = getColorParameter(Skin.GENERAL_TEXT_COLOR);
+ controlColorValue = getColorParameter(Skin.CONTROL_BACKGROUND_COLOR);
+ trimColorValue = getColorParameter(Skin.TRIM_COLOR);
+ }
+
+ protected Integer getColorParameter(String property) {
FacesContext context = FacesContext.getCurrentInstance();
-
Skin skin = SkinFactory.getInstance(context).getSkin(context);
+ Skin defaultSkin = SkinFactory.getInstance(context).getDefaultSkin(context);
- generalColorValue = skin.getColorParameter(context, Skin.GENERAL_TEXT_COLOR);
- controlColorValue = skin.getColorParameter(context,
Skin.CONTROL_BACKGROUND_COLOR);
- trimColorValue = skin.getColorParameter(context, Skin.TRIM_COLOR);
+ Integer value = skin.getColorParameter(context, property);
+ if (value == null) {
+ value = defaultSkin.getColorParameter(context, property);
+ }
+ return value;
}
protected void drawFrame(Graphics2D g2d) {
@@ -108,7 +116,7 @@
}
public void readState(FacesContext context, DataInput dataInput) throws IOException
{
- generalColorValue = dataInput.readInt();
+ generalColorValue = dataInput.readInt();
controlColorValue = dataInput.readInt();
trimColorValue = dataInput.readInt();
}
@@ -116,5 +124,4 @@
public boolean isTransient() {
return false;
}
-
}
Deleted:
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarAnimatedBackgroundImage.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarAnimatedBackgroundImage.java 2011-02-09
09:35:26 UTC (rev 21557)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ProgressBarAnimatedBackgroundImage.java 2011-02-09
09:42:29 UTC (rev 21558)
@@ -1,141 +0,0 @@
-/*
- * 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.renderkit.html;
-
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.GradientPaint;
-import java.awt.Graphics;
-import java.awt.Graphics2D;
-import java.awt.image.BufferedImage;
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-import javax.faces.context.FacesContext;
-
-import org.richfaces.renderkit.util.ColorUtils;
-import org.richfaces.resource.AbstractJava2DUserResource;
-import org.richfaces.resource.DynamicUserResource;
-import org.richfaces.resource.ImageType;
-import org.richfaces.resource.Java2DAnimatedUserResource;
-import org.richfaces.resource.StateHolderResource;
-import org.richfaces.skin.Skin;
-import org.richfaces.skin.SkinFactory;
-
-/**
- * @author Nick Belaevski
- *
- */
-//TODO - add version
-@DynamicUserResource
-public class ProgressBarAnimatedBackgroundImage extends AbstractJava2DUserResource
implements Java2DAnimatedUserResource, StateHolderResource {
-
- private static final int NUMBER_OF_FRAMES = 12;
-
- private static final Dimension DIMENSION = new Dimension(24, 48);
-
- private int frameNumber = 0;
-
- private Color basicColor;
-
- public ProgressBarAnimatedBackgroundImage() {
- super(ImageType.GIF, DIMENSION);
- }
-
- public boolean isLooped() {
- return true;
- }
-
- public int getFrameDelay() {
- return 1000;
- }
-
- public void startFramesSequence() {
- frameNumber = 0;
- }
-
- public boolean hasNextFrame() {
- return frameNumber < NUMBER_OF_FRAMES;
- }
-
- /**
- * Creates a main stage for progress bar background.
- *
- * @param context
- * resource context
- * @return a <code>BufferedImage</code> object
- */
- private BufferedImage createMainStage() {
- Color progressbarBackgroundColor = basicColor;
- Color progressbarSpiralColor = ColorUtils.adjustLightness(basicColor, 0.2f);
-
- Dimension dimension = getDimension();
- BufferedImage retVal = getImageType().createImage(dimension.width,
dimension.height * 2);
- Graphics g = retVal.getGraphics();
- try {
- g.setColor(progressbarBackgroundColor);
- g.fillRect(0, 0, dimension.width, dimension.height * 2);
- g.setColor(progressbarSpiralColor);
- for (int k : new int[] { -24, 0, 24, 48, 72 }) {
- g.fillPolygon(new int[] { 0, 24, 24, 0 }, new int[] { 24 + k, k, 12 + k,
36 + k }, 4);
- }
- } finally {
- if (g != null) {
- g.dispose();
- }
- }
-
- return retVal;
- }
-
- public void paint(Graphics2D g2d) {
- frameNumber++;
-
- Dimension dimension = getDimension();
-
- BufferedImage mainStage = createMainStage();
- BufferedImage frame = mainStage.getSubimage(0, 48 - frameNumber * 2,
dimension.width, dimension.height);
- g2d.drawImage(frame, null, null);
- Color progressbarShadowStartColor =
ColorUtils.overwriteAlpha(ColorUtils.adjustLightness(basicColor, 0.7f), 0.6f);
- Color progressbarShadowEndColor =
ColorUtils.overwriteAlpha(ColorUtils.adjustLightness(basicColor, 0.3f), 0.6f);
- // paint a shadow in the form of semi-transparent gradient
- g2d.setPaint(new GradientPaint(0, 0, progressbarShadowStartColor, 0, 7,
progressbarShadowEndColor));
- g2d.fillRect(0, 0, dimension.width, 7);
- }
-
- public boolean isTransient() {
- return false;
- }
-
- public void writeState(FacesContext context, DataOutput dataOutput) throws
IOException {
- // TODO Auto-generated method stub
- Skin skin = SkinFactory.getInstance(context).getSkin(context);
- Integer color = skin.getColorParameter(context, Skin.SELECT_CONTROL_COLOR);
- dataOutput.writeInt(color.intValue());
- }
-
- public void readState(FacesContext context, DataInput dataInput) throws IOException
{
- basicColor = new Color(dataInput.readInt());
- }
-
-}
Added:
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/images/ProgressBarAnimatedBackgroundImage.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/images/ProgressBarAnimatedBackgroundImage.java
(rev 0)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/images/ProgressBarAnimatedBackgroundImage.java 2011-02-09
09:42:29 UTC (rev 21558)
@@ -0,0 +1,150 @@
+/*
+ * 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.renderkit.html.images;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.GradientPaint;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.image.BufferedImage;
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+
+import javax.faces.context.FacesContext;
+
+import org.richfaces.renderkit.util.ColorUtils;
+import org.richfaces.resource.AbstractJava2DUserResource;
+import org.richfaces.resource.DynamicUserResource;
+import org.richfaces.resource.ImageType;
+import org.richfaces.resource.Java2DAnimatedUserResource;
+import org.richfaces.resource.PostConstructResource;
+import org.richfaces.resource.StateHolderResource;
+import org.richfaces.skin.Skin;
+import org.richfaces.skin.SkinFactory;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+//TODO - add version
+@DynamicUserResource
+public class ProgressBarAnimatedBackgroundImage extends AbstractJava2DUserResource
implements Java2DAnimatedUserResource, StateHolderResource {
+
+ private static final int NUMBER_OF_FRAMES = 12;
+
+ private static final Dimension DIMENSION = new Dimension(24, 48);
+
+ private int frameNumber = 0;
+
+ private Integer basicColor;
+
+ public ProgressBarAnimatedBackgroundImage() {
+ super(ImageType.GIF, DIMENSION);
+ }
+
+ public boolean isLooped() {
+ return true;
+ }
+
+ public int getFrameDelay() {
+ return 1000;
+ }
+
+ public void startFramesSequence() {
+ frameNumber = 0;
+ }
+
+ public boolean hasNextFrame() {
+ return frameNumber < NUMBER_OF_FRAMES;
+ }
+
+ @PostConstructResource
+ public void initialize() {
+ FacesContext context = FacesContext.getCurrentInstance();
+ Skin skin = SkinFactory.getInstance(context).getSkin(context);
+ Skin defaultSkin = SkinFactory.getInstance(context).getDefaultSkin(context);
+ basicColor = skin.getColorParameter(context, Skin.SELECT_CONTROL_COLOR);
+ if (basicColor == null) {
+ basicColor = defaultSkin.getColorParameter(context,
Skin.SELECT_CONTROL_COLOR);
+ }
+ }
+
+ /**
+ * Creates a main stage for progress bar background.
+ *
+ * @param context
+ * resource context
+ * @return a <code>BufferedImage</code> object
+ */
+ private BufferedImage createMainStage() {
+ Color progressbarBackgroundColor = new Color(basicColor);
+ Color progressbarSpiralColor =
ColorUtils.adjustLightness(progressbarBackgroundColor, 0.2f);
+
+ Dimension dimension = getDimension();
+ BufferedImage retVal = getImageType().createImage(dimension.width,
dimension.height * 2);
+ Graphics g = retVal.getGraphics();
+ try {
+ g.setColor(progressbarBackgroundColor);
+ g.fillRect(0, 0, dimension.width, dimension.height * 2);
+ g.setColor(progressbarSpiralColor);
+ for (int k : new int[] { -24, 0, 24, 48, 72 }) {
+ g.fillPolygon(new int[] { 0, 24, 24, 0 }, new int[] { 24 + k, k, 12 + k,
36 + k }, 4);
+ }
+ } finally {
+ if (g != null) {
+ g.dispose();
+ }
+ }
+
+ return retVal;
+ }
+
+ public void paint(Graphics2D g2d) {
+ frameNumber++;
+
+ Dimension dimension = getDimension();
+
+ BufferedImage mainStage = createMainStage();
+ BufferedImage frame = mainStage.getSubimage(0, 48 - frameNumber * 2,
dimension.width, dimension.height);
+ g2d.drawImage(frame, null, null);
+ Color progressbarBackgroundColor = new Color(basicColor);
+ Color progressbarShadowStartColor =
ColorUtils.overwriteAlpha(ColorUtils.adjustLightness(progressbarBackgroundColor, 0.7f),
0.6f);
+ Color progressbarShadowEndColor =
ColorUtils.overwriteAlpha(ColorUtils.adjustLightness(progressbarBackgroundColor, 0.3f),
0.6f);
+ // paint a shadow in the form of semi-transparent gradient
+ g2d.setPaint(new GradientPaint(0, 0, progressbarShadowStartColor, 0, 7,
progressbarShadowEndColor));
+ g2d.fillRect(0, 0, dimension.width, 7);
+ }
+
+ public boolean isTransient() {
+ return false;
+ }
+
+ public void writeState(FacesContext context, DataOutput dataOutput) throws
IOException {
+ dataOutput.writeInt(basicColor);
+ }
+
+ public void readState(FacesContext context, DataInput dataInput) throws IOException
{
+ basicColor = dataInput.readInt();
+ }
+}
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/images/ToolbarSeparatorImage.java
===================================================================
---
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/images/ToolbarSeparatorImage.java 2011-02-09
09:35:26 UTC (rev 21557)
+++
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/images/ToolbarSeparatorImage.java 2011-02-09
09:42:29 UTC (rev 21558)
@@ -19,32 +19,32 @@
public abstract class ToolbarSeparatorImage implements Java2DUserResource,
StateHolderResource {
- private int headerBackgroundColor;
- private int separatorHeight;
- private int headerGradientColor;
+ private Integer headerBackgroundColor;
+ private Integer separatorHeight;
+ private Integer headerGradientColor;
- public int getHeaderBackgroundColor() {
+ public Integer getHeaderBackgroundColor() {
return headerBackgroundColor;
}
- public void setHeaderBackgroundColor(int bgColor) {
+ public void setHeaderBackgroundColor(Integer bgColor) {
this.headerBackgroundColor = bgColor;
}
- public int getSeparatorHeight() {
+ public Integer getSeparatorHeight() {
return separatorHeight;
}
@ResourceParameter(defaultValue = "9")
- public void setSeparatorHeight(int separatorHeight) {
+ public void setSeparatorHeight(Integer separatorHeight) {
this.separatorHeight = separatorHeight;
}
- public int getHeaderGradientColor() {
+ public Integer getHeaderGradientColor() {
return headerGradientColor;
}
- public void setHeaderGradientColor(int headerGradientColor) {
+ public void setHeaderGradientColor(Integer headerGradientColor) {
this.headerGradientColor = headerGradientColor;
}
@@ -95,5 +95,9 @@
tmp = (String) defaultSkin.getParameter(context, skinParameter);
}
this.setHeaderGradientColor(Color.decode(tmp == null ? "#CCCCFF" :
tmp).getRGB());
+
+ if (getSeparatorHeight() == null) {
+ setSeparatorHeight(0);
+ }
}
}
Modified:
trunk/ui/output/ui/src/main/resources/META-INF/richfaces/resource-mappings.properties
===================================================================
---
trunk/ui/output/ui/src/main/resources/META-INF/richfaces/resource-mappings.properties 2011-02-09
09:35:26 UTC (rev 21557)
+++
trunk/ui/output/ui/src/main/resources/META-INF/richfaces/resource-mappings.properties 2011-02-09
09:42:29 UTC (rev 21558)
@@ -19,7 +19,7 @@
org.richfaces.images\:actRightTabBg.png=org.richfaces.renderkit.html.BaseGradient\
{width=26, height=5, baseColorParam=generalBackgroundColor,
gradientColorParam=tabBackgroundColor, horizontal=true}
-org.richfaces.images\:pbAniBg.gif=org.richfaces.renderkit.html.ProgressBarAnimatedBackgroundImage
+org.richfaces.images\:pbAniBg.gif=org.richfaces.renderkit.html.images.ProgressBarAnimatedBackgroundImage
org.richfaces.images\:menu_list_bg.gif=org.richfaces.renderkit.html.BaseGradient\
{width=22, height=3, baseColorParam=additionalBackgroundColor,
gradientColorParam=tabBackgroundColor, horizontal=true}