Author: nbelaevski
Date: 2008-04-17 15:32:43 -0400 (Thu, 17 Apr 2008)
New Revision: 7908
Added:
trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/GradientType.java
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/util/Zipper2.java
trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/BaseGradient.java
trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/BaseControlBackgroundImage.java
trunk/framework/impl/src/main/java/org/richfaces/skin/SkinImpl.java
trunk/framework/impl/src/main/resources/META-INF/skins/DEFAULT.skin.properties
trunk/framework/impl/src/main/resources/META-INF/skins/NULL.skin.properties
trunk/framework/impl/src/main/resources/META-INF/skins/blueSky.skin.properties
trunk/framework/impl/src/main/resources/META-INF/skins/classic.skin.properties
trunk/framework/impl/src/main/resources/META-INF/skins/deepMarine.skin.properties
trunk/framework/impl/src/main/resources/META-INF/skins/emeraldTown.skin.properties
trunk/framework/impl/src/main/resources/META-INF/skins/japanCherry.skin.properties
trunk/framework/impl/src/main/resources/META-INF/skins/ruby.skin.properties
trunk/framework/impl/src/main/resources/META-INF/skins/wine.skin.properties
trunk/framework/impl/src/test/java/org/ajax4jsf/util/Zipper2Test.java
Log:
Support for gradient types added
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/util/Zipper2.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/util/Zipper2.java 2008-04-17 19:31:04
UTC (rev 7907)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/util/Zipper2.java 2008-04-17 19:32:43
UTC (rev 7908)
@@ -43,6 +43,12 @@
this.buffer = buffer;
}
+ public Zipper2(byte[] buffer, int offest) {
+ super();
+ this.buffer = buffer;
+ this.offset = offest;
+ }
+
public Zipper2 addByte(byte b) {
buffer[offset++] = b;
return this;
@@ -73,6 +79,14 @@
return this;
}
+ public Zipper2 addBytes(byte[] bs) {
+ if (bs != null) {
+ System.arraycopy(bs, 0, buffer, offset, bs.length);
+ }
+
+ return this;
+ }
+
public byte nextByte() {
return buffer[offset++];
}
@@ -102,6 +116,14 @@
return i;
}
+ public byte[] nextBytes() {
+ byte[] bs = new byte[buffer.length - offset];
+ System.arraycopy(buffer, offset, bs, 0, buffer.length - offset);
+ offset = buffer.length;
+
+ return bs;
+ }
+
public boolean hasMore() {
return offset < buffer.length;
}
Modified:
trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/BaseGradient.java
===================================================================
---
trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/BaseGradient.java 2008-04-17
19:31:04 UTC (rev 7907)
+++
trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/BaseGradient.java 2008-04-17
19:32:43 UTC (rev 7908)
@@ -32,12 +32,14 @@
import javax.faces.context.FacesContext;
-import org.ajax4jsf.resource.GifRenderer;
import org.ajax4jsf.resource.InternetResourceBuilder;
import org.ajax4jsf.resource.Java2Dresource;
+import org.ajax4jsf.resource.PngRenderer;
import org.ajax4jsf.resource.ResourceContext;
import org.ajax4jsf.util.HtmlColor;
import org.ajax4jsf.util.Zipper2;
+import org.richfaces.renderkit.html.images.GradientType;
+import org.richfaces.renderkit.html.images.GradientType.BiColor;
import org.richfaces.skin.Skin;
import org.richfaces.skin.SkinFactory;
@@ -61,7 +63,7 @@
this.height = height;
this.gradientHeight = gradientHeight;
- setRenderer(new GifRenderer());
+ setRenderer(new PngRenderer());
setLastModified(new Date(InternetResourceBuilder.getInstance().getStartTime()));
}
@@ -134,95 +136,141 @@
protected Dimension getDimensions(ResourceContext resourceContext) {
return getDimensions(null, restoreData(resourceContext));
}
+
+ private void drawGradient(Graphics2D g2d, Rectangle2D rectangle, BiColor colors, int
height, boolean horizontal) {
+ if (colors != null) {
+ GradientPaint gragient;
+ if (horizontal) {
+ gragient = new GradientPaint(0, 0, colors.getTopColor(), height, 0,
colors.getBottomColor());
+ } else {
+ gragient = new GradientPaint(0, 0, colors.getTopColor(), 0, height,
colors.getBottomColor());
+ }
+ g2d.setPaint(gragient);
+ g2d.fill(rectangle);
+ }
+ }
+
protected void paint(ResourceContext resourceContext, Graphics2D g2d) {
- g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
- g2d.setRenderingHint(RenderingHints.KEY_DITHERING,
RenderingHints.VALUE_DITHER_ENABLE);
- g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING,
RenderingHints.VALUE_COLOR_RENDER_QUALITY);
- Data dataToStore = (Data) restoreData(resourceContext);
- if (dataToStore != null && dataToStore.headerBackgroundColor!=null &&
dataToStore.headerGradientColor!=null) {
- Color baseColor = new Color(dataToStore.headerBackgroundColor.intValue());
- Dimension dim =getDimensions(resourceContext);
- Rectangle2D rect =
- new Rectangle2D.Float(
- 0,
- 0,
- dim.width,
- dim.height);
- int gradStart = 0;
- int gradEnd = gradientHeight;
- Color alternateColor = new Color(dataToStore.headerGradientColor.intValue());
- GradientPaint gragient;
- if (horizontal) {
- gragient = new GradientPaint(gradStart, 0, baseColor, gradEnd, 0,
alternateColor);
- } else {
- gragient = new GradientPaint(0, gradStart, baseColor, 0, gradEnd,
alternateColor);
- }
- g2d.setPaint(gragient);
- g2d.fill(rect);
- }
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
+ g2d.setRenderingHint(RenderingHints.KEY_DITHERING,
RenderingHints.VALUE_DITHER_ENABLE);
+
+ g2d.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION,
RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
+ g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING,
RenderingHints.VALUE_COLOR_RENDER_QUALITY);
+ g2d.setRenderingHint(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
+
+ Data dataToStore = (Data) restoreData(resourceContext);
+ if (dataToStore != null && dataToStore.headerBackgroundColor!=null
&& dataToStore.headerGradientColor!=null) {
+ Color baseColor = new Color(dataToStore.headerBackgroundColor.intValue());
+ Color alternateColor = new Color(dataToStore.headerGradientColor.intValue());
+ BiColor biColor = new GradientType.BiColor(baseColor, alternateColor);
+
+ GradientType type = dataToStore.gradientType;
+ BiColor firstLayer = type.getFirstLayerColors(biColor);
+ BiColor secondLayer = type.getSecondLayerColors(biColor);
+
+ Dimension dim = getDimensions(resourceContext);
+ Rectangle2D rect =
+ new Rectangle2D.Float(
+ 0,
+ 0,
+ dim.width,
+ dim.height);
+
+ drawGradient(g2d, rect, firstLayer, gradientHeight, horizontal);
+ drawGradient(g2d, rect, secondLayer, gradientHeight / 2, horizontal);
+ }
}
+ protected void restoreData(Data data, Zipper2 zipper2) {
+ data.headerBackgroundColor = new Integer(zipper2.nextIntColor());
+ data.headerGradientColor = new Integer(zipper2.nextIntColor());
+ data.gradientType = GradientType.values()[zipper2.nextByte()];
+ }
+
protected Object deserializeData(byte[] objectArray) {
- Data data = new Data();
- if (objectArray != null) {
- Zipper2 zipper2 = new Zipper2(objectArray);
- data.headerBackgroundColor = new Integer(zipper2.nextIntColor());
- data.headerGradientColor = new Integer(zipper2.nextIntColor());
+ Data data = createData();
+ if (objectArray != null) {
+ Zipper2 zipper2 = new Zipper2(objectArray);
+ restoreData(data, zipper2);
+ }
+
+ return data;
+ }
+
+ protected Data createData() {
+ return new Data();
+ }
+
+ private void saveData(FacesContext context, Data data, String baseColor, String
gradientColor) {
+ data.headerBackgroundColor = getColorValueParameter(context, baseColor, false);
+ data.headerGradientColor = getColorValueParameter(context, gradientColor, false);
+
+ if (!(data.headerBackgroundColor == null && data.headerGradientColor ==
null)) {
+ if (data.headerBackgroundColor == null) {
+ data.headerBackgroundColor = getColorValueParameter(context, baseColor, true);
}
- return data;
+ if (data.headerGradientColor == null) {
+ data.headerGradientColor = getColorValueParameter(context, gradientColor, true);
+ }
+ }
+
+ data.gradientType = GradientType.getBySkinParameter(getValueParameter(context,
Skin.gradientType));
}
+ protected void saveData(FacesContext context, Data data) {
+ if (baseColor == null) {
+ saveData(context, data, Skin.headerBackgroundColor, "headerGradientColor");
+ } else {
+ saveData(context, data, baseColor, gradientColor);
+ }
+ }
+
protected Object getDataToStore(FacesContext context, Object data) {
- if (baseColor == null) {
- return new Data(context).toByteArray();
- } else {
- return new Data(context, baseColor, gradientColor).toByteArray();
- }
+ Data dataObject = createData();
+ saveData(context, dataObject);
+
+ return dataObject.toByteArray();
}
public boolean isCacheable() {
return true;
}
- protected static class Data implements Serializable {
- public Data() {
- }
- protected Data(FacesContext context) {
- this(context, Skin.headerBackgroundColor, "headerGradientColor");
- }
+ protected String getValueParameter(FacesContext context, String name) {
+ SkinFactory skinFactory = SkinFactory.getInstance();
- protected Data(FacesContext context, String baseColor, String gradientColor) {
- this.headerBackgroundColor = getColorValueParameter(context, baseColor, false);
- this.headerGradientColor = getColorValueParameter(context, gradientColor, false);
+ Skin skin = skinFactory.getSkin(context);
+ String value = (String) skin.getParameter(context, name);
+
+ if (value == null || value.length() == 0) {
+ skin = skinFactory.getDefaultSkin(context);
+ value = (String) skin.getParameter(context, name);
+ }
+
+ return value;
+ }
- 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);
- }
- }
+ protected 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 && tmp.length() != 0) {
+ return new Integer(HtmlColor.decode(tmp).getRGB());
+ } else {
+ return null;
+ }
+ }
- 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 && tmp.length() != 0) {
- return new Integer(HtmlColor.decode(tmp).getRGB());
- } else {
- return null;
- }
+ protected static class Data implements Serializable {
+ public Data() {
}
/**
@@ -231,10 +279,13 @@
private static final long serialVersionUID = 1732700513743861250L;
protected Integer headerBackgroundColor;
protected Integer headerGradientColor;
+ protected GradientType gradientType;
+
public byte[] toByteArray() {
- if (headerBackgroundColor != null && headerGradientColor != null) {
- byte[] ret = new byte[6];
- new
Zipper2(ret).addColor(headerBackgroundColor.intValue()).addColor(headerGradientColor.intValue());
+ if (headerBackgroundColor != null && headerGradientColor != null &&
gradientType != null) {
+ byte[] ret = new byte[7];
+ new
Zipper2(ret).addColor(headerBackgroundColor.intValue()).addColor(headerGradientColor.intValue()).
+ addByte((byte) gradientType.ordinal());
return ret;
} else {
return null;
Modified:
trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/BaseControlBackgroundImage.java
===================================================================
---
trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/BaseControlBackgroundImage.java 2008-04-17
19:31:04 UTC (rev 7907)
+++
trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/BaseControlBackgroundImage.java 2008-04-17
19:32:43 UTC (rev 7908)
@@ -21,24 +21,13 @@
package org.richfaces.renderkit.html.images;
-import java.awt.Color;
import java.awt.Dimension;
-import java.awt.GradientPaint;
-import java.awt.Graphics2D;
-import java.awt.RenderingHints;
-import java.awt.geom.Rectangle2D;
-import java.io.Serializable;
-import java.util.Date;
import javax.faces.context.FacesContext;
-import org.ajax4jsf.resource.GifRenderer;
-import org.ajax4jsf.resource.InternetResourceBuilder;
-import org.ajax4jsf.resource.Java2Dresource;
-import org.ajax4jsf.resource.ResourceContext;
-import org.ajax4jsf.util.HtmlColor;
import org.ajax4jsf.util.HtmlDimensions;
import org.ajax4jsf.util.Zipper2;
+import org.richfaces.renderkit.html.BaseGradient;
import org.richfaces.skin.Skin;
import org.richfaces.skin.SkinFactory;
@@ -49,56 +38,23 @@
* @since 3.2
*/
-public class BaseControlBackgroundImage extends Java2Dresource {
+public class BaseControlBackgroundImage extends BaseGradient {
private static final Dimension DIMENSION = new Dimension(1, 1);
- private String baseColor;
-
- private String gradientColor;
-
- private int width;
-
public BaseControlBackgroundImage(String baseColor, String gradientColor, int width)
{
- super();
-
- this.baseColor = baseColor;
- this.gradientColor = gradientColor;
- this.width = width;
-
- setRenderer(new GifRenderer());
- setLastModified(new Date(InternetResourceBuilder.getInstance().getStartTime()));
+ super(width, 1, baseColor, gradientColor);
}
public Dimension getDimensions(FacesContext facesContext, Object data) {
- Data d = (Data) data;
- if (d != null) {
- return new Dimension(width, d.height.intValue());
+ Data data2 = (Data) data;
+ if (data != null) {
+ return new Dimension(super.getDimensions(facesContext, data).width,
data2.height);
} else {
return DIMENSION;
}
}
- protected Dimension getDimensions(ResourceContext resourceContext) {
- return getDimensions(null, restoreData(resourceContext));
- }
-
- protected void paint(ResourceContext resourceContext, Graphics2D g2d) {
- g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
- g2d.setRenderingHint(RenderingHints.KEY_DITHERING,
RenderingHints.VALUE_DITHER_ENABLE);
- g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING,
RenderingHints.VALUE_COLOR_RENDER_QUALITY);
- Data dataToStore = (Data) restoreData(resourceContext);
- if (dataToStore != null && dataToStore.headerBackgroundColor != null
&& dataToStore.headerGradientColor != null) {
- Color baseColor = new Color(dataToStore.headerBackgroundColor.intValue());
- Dimension dim = getDimensions(resourceContext);
- Rectangle2D rect = new Rectangle2D.Float(0, 0, dim.width, dim.height);
- Color alternateColor = new
Color(dataToStore.headerGradientColor.intValue());
- GradientPaint gragient = new GradientPaint(0, 0, baseColor, 0, dim.height,
alternateColor);
- g2d.setPaint(gragient);
- g2d.fill(rect);
- }
- }
-
protected final Integer getHeight(FacesContext context, String heightParamName) {
SkinFactory skinFactory = SkinFactory.getInstance();
Skin skin = skinFactory.getSkin(context);
@@ -120,92 +76,43 @@
return getHeight(context, Skin.generalSizeFont);
}
- protected Object deserializeData(byte[] objectArray) {
- Data data = new Data();
- if (objectArray != null) {
- Zipper2 zipper2 = new Zipper2(objectArray);
- data.headerBackgroundColor = new Integer(zipper2.nextIntColor());
- data.headerGradientColor = new Integer(zipper2.nextIntColor());
- data.height = new Integer(zipper2.nextInt());
- }
- return data;
+ public boolean isCacheable() {
+ return true;
}
-
- protected Object getDataToStore(FacesContext context, Object data) {
- Integer h = getHeight(context);
- if (baseColor == null) {
- return new Data(context, h).toByteArray();
- } else {
- return new Data(context, baseColor, gradientColor, h).toByteArray();
- }
+
+ @Override
+ protected org.richfaces.renderkit.html.BaseGradient.Data createData() {
+ return new Data();
}
+
+ @Override
+ protected void saveData(FacesContext context,
org.richfaces.renderkit.html.BaseGradient.Data data) {
+ super.saveData(context, data);
+ ((Data) data).height = getHeight(context);
+ }
- public boolean isCacheable() {
- return true;
+ protected void restoreData(org.richfaces.renderkit.html.BaseGradient.Data data,
Zipper2 zipper2) {
+ ((Data) data).height = zipper2.nextInt();
+ super.restoreData(data, zipper2);
}
+
+ protected static class Data extends BaseGradient.Data {
- protected static class Data implements Serializable {
- public Data() {
- }
+ /**
+ *
+ */
+ private static final long serialVersionUID = -1499766195614003931L;
- protected Data(FacesContext context, Integer height) {
- this(context, Skin.headerBackgroundColor, "headerGradientColor",
height);
- }
+ protected Integer height;
+
+ @Override
+ public byte[] toByteArray() {
+ byte[] bs = super.toByteArray();
+ byte[] result = new byte[bs.length + 4];
+ new Zipper2(result).addInt(height).addBytes(bs);
- protected Data(FacesContext context, String baseColor, String gradientColor,
Integer height) {
- this.headerBackgroundColor = getColorValueParameter(context, baseColor,
false);
- this.headerGradientColor = getColorValueParameter(context, gradientColor,
false);
- this.height = height;
-
- 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, 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 && tmp.length() != 0) {
- return new Integer(HtmlColor.decode(tmp).getRGB());
- } else {
- return null;
- }
- }
-
- /**
- *
- */
- private static final long serialVersionUID = 1732700513743861250L;
-
- protected Integer headerBackgroundColor;
-
- protected Integer headerGradientColor;
-
- protected Integer height;
-
- public byte[] toByteArray() {
- if (headerBackgroundColor != null && headerGradientColor != null) {
- byte[] ret = new byte[10];
- new
Zipper2(ret).addColor(headerBackgroundColor.intValue()).addColor(headerGradientColor.intValue())
- .addInt(height);
- return ret;
- } else {
- return null;
- }
- }
- }
-
+ return result;
+ }
+ };
}
Added:
trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/GradientType.java
===================================================================
---
trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/GradientType.java
(rev 0)
+++
trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/GradientType.java 2008-04-17
19:32:43 UTC (rev 7908)
@@ -0,0 +1,130 @@
+/**
+ *
+ */
+package org.richfaces.renderkit.html.images;
+
+import java.awt.Color;
+
+/**
+ * @author Nick Belaevski
+ * mailto:nbelaevski@exadel.com
+ * created 16.04.2008
+ *
+ */
+public enum GradientType {
+
+ GLASS {
+
+ @Override
+ public BiColor getFirstLayerColors(BiColor biColor) {
+// Color topColor = biColor.getTopColor();
+//
+// float[] hsb = Color.RGBtoHSB(topColor.getRed(), topColor.getGreen(),
topColor.getBlue(), null);
+//
+// hsb[2] = 0.2f * hsb[2] + 80; //(hsb[2] * 2) / 10 + 80;
+// hsb[1] = 0.5f * hsb[1];
+//
+// Color bottomColor = new Color(Color.HSBtoRGB(hsb[0], hsb[1], hsb[2]));
+//
+// return new BiColor(topColor, bottomColor);
+
+ Color bottomColor = biColor.getBottomColor();
+
+ float[] hsb = Color.RGBtoHSB(bottomColor.getRed(), bottomColor.getGreen(),
bottomColor.getBlue(), null);
+
+ hsb[2] = 0.2f * hsb[2] + 0.80f; //(hsb[2] * 2) / 10 + 80;
+ hsb[1] = 0.5f * hsb[1];
+
+ Color topColor = new Color(Color.HSBtoRGB(hsb[0], hsb[1], hsb[2]));
+
+ return new BiColor(bottomColor, topColor);
+ }
+
+ @Override
+ public BiColor getSecondLayerColors(BiColor biColor) {
+ return WHITE;
+ }
+
+ },
+
+ PLASTIC {
+
+ @Override
+ public BiColor getFirstLayerColors(BiColor biColor) {
+ Color bottomColor = biColor.getBottomColor();
+
+ float[] hsb = Color.RGBtoHSB(bottomColor.getRed(), bottomColor.getGreen(),
bottomColor.getBlue(), null);
+
+ hsb[2] = 0.25f * hsb[2] + 0.75f; //(100 - hsb[2]) * 0.75f + hsb[2];
+ hsb[1] = 0.75f * hsb[1];
+
+ Color topColor = new Color(Color.HSBtoRGB(hsb[0], hsb[1], hsb[2]));
+
+ return new BiColor(topColor, bottomColor);
+ }
+
+ @Override
+ public BiColor getSecondLayerColors(BiColor biColor) {
+ return WHITE;
+ }
+
+ },
+
+ PLAIN {
+
+ @Override
+ public BiColor getFirstLayerColors(BiColor biColor) {
+ return biColor;
+ }
+
+ @Override
+ public BiColor getSecondLayerColors(BiColor biColor) {
+ return null;
+ }
+
+ };
+
+ public static final GradientType getBySkinParameter(String string) {
+ if (string == null || string.length() == 0) {
+ return PLAIN;
+ }
+
+ return GradientType.valueOf(string.toUpperCase());
+ }
+
+ public abstract BiColor getFirstLayerColors(BiColor biColor);
+ public abstract BiColor getSecondLayerColors(BiColor biColor);
+
+ private static final BiColor WHITE = new BiColor(new Color(0xff, 0xff, 0xff, (int)
(0.65f * 0xff)),
+ new Color(0xff, 0xff, 0xff, (int) (0.20f * 0xff)));
+
+ public static class BiColor {
+ private Color topColor;
+ private Color bottomColor;
+
+ public BiColor(Color topColor, Color bottomColor) {
+ super();
+
+ if (topColor == null || bottomColor == null) {
+ throw new NullPointerException("Color is null!");
+ }
+
+ this.topColor = topColor;
+ this.bottomColor = bottomColor;
+ }
+
+ public Color getTopColor() {
+ return topColor;
+ }
+
+ public Color getBottomColor() {
+ return bottomColor;
+ }
+
+ @Override
+ public String toString() {
+ return "BiColor: [" + topColor + " -> " + bottomColor +
"]";
+ }
+ };
+
+}
Modified: trunk/framework/impl/src/main/java/org/richfaces/skin/SkinImpl.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/skin/SkinImpl.java 2008-04-17
19:31:04 UTC (rev 7907)
+++ trunk/framework/impl/src/main/java/org/richfaces/skin/SkinImpl.java 2008-04-17
19:32:43 UTC (rev 7908)
@@ -28,8 +28,6 @@
import javax.faces.context.FacesContext;
import javax.faces.el.ValueBinding;
-import org.richfaces.skin.Skin;
-
/**
* Singleton ( in respect as collection of different skins ) for produce
* instances properties for all used skins.
Modified: trunk/framework/impl/src/main/resources/META-INF/skins/DEFAULT.skin.properties
===================================================================
---
trunk/framework/impl/src/main/resources/META-INF/skins/DEFAULT.skin.properties 2008-04-17
19:31:04 UTC (rev 7907)
+++
trunk/framework/impl/src/main/resources/META-INF/skins/DEFAULT.skin.properties 2008-04-17
19:32:43 UTC (rev 7908)
@@ -68,4 +68,7 @@
warningBackgroundColor=#FF0000
editorBackgroundColor=#F1F1F1
-editBackgroundColor=#FEFFDA
\ No newline at end of file
+editBackgroundColor=#FEFFDA
+
+#Gradients
+gradientType=plain
Modified: trunk/framework/impl/src/main/resources/META-INF/skins/NULL.skin.properties
===================================================================
--- trunk/framework/impl/src/main/resources/META-INF/skins/NULL.skin.properties 2008-04-17
19:31:04 UTC (rev 7907)
+++ trunk/framework/impl/src/main/resources/META-INF/skins/NULL.skin.properties 2008-04-17
19:32:43 UTC (rev 7908)
@@ -69,4 +69,7 @@
warningBackgroundColor=#FF0000
editorBackgroundColor=#F1F1F1
-editBackgroundColor=#FEFFDA
\ No newline at end of file
+editBackgroundColor=#FEFFDA
+
+#Gradients
+gradientType=plain
Modified: trunk/framework/impl/src/main/resources/META-INF/skins/blueSky.skin.properties
===================================================================
---
trunk/framework/impl/src/main/resources/META-INF/skins/blueSky.skin.properties 2008-04-17
19:31:04 UTC (rev 7907)
+++
trunk/framework/impl/src/main/resources/META-INF/skins/blueSky.skin.properties 2008-04-17
19:32:43 UTC (rev 7908)
@@ -69,4 +69,7 @@
warningBackgroundColor=#FF0000
editorBackgroundColor=#F1F1F1
-editBackgroundColor=#FEFFDA
\ No newline at end of file
+editBackgroundColor=#FEFFDA
+
+#Gradients
+gradientType=plain
Modified: trunk/framework/impl/src/main/resources/META-INF/skins/classic.skin.properties
===================================================================
---
trunk/framework/impl/src/main/resources/META-INF/skins/classic.skin.properties 2008-04-17
19:31:04 UTC (rev 7907)
+++
trunk/framework/impl/src/main/resources/META-INF/skins/classic.skin.properties 2008-04-17
19:32:43 UTC (rev 7908)
@@ -68,4 +68,7 @@
warningBackgroundColor=#FF0000
editorBackgroundColor=#F1F1F1
-editBackgroundColor=#FEFFDA
\ No newline at end of file
+editBackgroundColor=#FEFFDA
+
+#Gradients
+gradientType=plain
Modified:
trunk/framework/impl/src/main/resources/META-INF/skins/deepMarine.skin.properties
===================================================================
---
trunk/framework/impl/src/main/resources/META-INF/skins/deepMarine.skin.properties 2008-04-17
19:31:04 UTC (rev 7907)
+++
trunk/framework/impl/src/main/resources/META-INF/skins/deepMarine.skin.properties 2008-04-17
19:32:43 UTC (rev 7908)
@@ -68,3 +68,6 @@
editorBackgroundColor=#F1F1F1
editBackgroundColor=#FEFFDA
+
+#Gradients
+gradientType=plain
Modified:
trunk/framework/impl/src/main/resources/META-INF/skins/emeraldTown.skin.properties
===================================================================
---
trunk/framework/impl/src/main/resources/META-INF/skins/emeraldTown.skin.properties 2008-04-17
19:31:04 UTC (rev 7907)
+++
trunk/framework/impl/src/main/resources/META-INF/skins/emeraldTown.skin.properties 2008-04-17
19:32:43 UTC (rev 7908)
@@ -68,3 +68,6 @@
editorBackgroundColor=#F1F1F1
editBackgroundColor=#FEFFDA
+
+#Gradients
+gradientType=glass
Modified:
trunk/framework/impl/src/main/resources/META-INF/skins/japanCherry.skin.properties
===================================================================
---
trunk/framework/impl/src/main/resources/META-INF/skins/japanCherry.skin.properties 2008-04-17
19:31:04 UTC (rev 7907)
+++
trunk/framework/impl/src/main/resources/META-INF/skins/japanCherry.skin.properties 2008-04-17
19:32:43 UTC (rev 7908)
@@ -69,3 +69,7 @@
editorBackgroundColor=#F1F1F1
editBackgroundColor=#FEFFDA
+
+#Gradients
+gradientType=plain
+
Modified: trunk/framework/impl/src/main/resources/META-INF/skins/ruby.skin.properties
===================================================================
--- trunk/framework/impl/src/main/resources/META-INF/skins/ruby.skin.properties 2008-04-17
19:31:04 UTC (rev 7907)
+++ trunk/framework/impl/src/main/resources/META-INF/skins/ruby.skin.properties 2008-04-17
19:32:43 UTC (rev 7908)
@@ -69,3 +69,6 @@
editorBackgroundColor=#F1F1F1
editBackgroundColor=#FEFFDA
+
+#Gradients
+gradientType=plastic
Modified: trunk/framework/impl/src/main/resources/META-INF/skins/wine.skin.properties
===================================================================
--- trunk/framework/impl/src/main/resources/META-INF/skins/wine.skin.properties 2008-04-17
19:31:04 UTC (rev 7907)
+++ trunk/framework/impl/src/main/resources/META-INF/skins/wine.skin.properties 2008-04-17
19:32:43 UTC (rev 7908)
@@ -70,3 +70,5 @@
editorBackgroundColor=#F1F1F1
editBackgroundColor=#FEFFDA
+#Gradients
+gradientType=plain
Modified: trunk/framework/impl/src/test/java/org/ajax4jsf/util/Zipper2Test.java
===================================================================
--- trunk/framework/impl/src/test/java/org/ajax4jsf/util/Zipper2Test.java 2008-04-17
19:31:04 UTC (rev 7907)
+++ trunk/framework/impl/src/test/java/org/ajax4jsf/util/Zipper2Test.java 2008-04-17
19:32:43 UTC (rev 7908)
@@ -22,6 +22,7 @@
package org.ajax4jsf.util;
import java.awt.Color;
+import java.util.Arrays;
import junit.framework.TestCase;
@@ -86,4 +87,12 @@
assertEquals(0xBD4812F9, zipper2.nextInt());
}
+ public void testBytes() throws Exception {
+ byte[] b = new byte[6];
+ byte[] bs = new byte[] {(byte) 0x98, (byte) 0x63};
+ new Zipper2(b).addInt(0x08FECDB6).addBytes(bs);
+ Zipper2 zipper2 = new Zipper2(b);
+ assertEquals(0x08FECDB6, zipper2.nextInt());
+ assertTrue(Arrays.equals(bs, zipper2.nextBytes()));
+ }
}