Author: nbelaevski
Date: 2008-04-25 12:31:12 -0400 (Fri, 25 Apr 2008)
New Revision: 8198
Modified:
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
Log:
http://jira.jboss.com/jira/browse/RF-3227
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-25
16:03:44 UTC (rev 8197)
+++
trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/BaseGradient.java 2008-04-25
16:31:12 UTC (rev 8198)
@@ -150,7 +150,7 @@
BiColor firstLayer = type.getFirstLayerColors(biColor);
BiColor secondLayer = type.getSecondLayerColors(biColor);
- Dimension dim = getDimensions(resourceContext);
+ Dimension dim = getDimensions(null, dataToStore);
if (horizontal) {
//x -> y, y -> x
@@ -158,21 +158,28 @@
dim.setSize(dim.height, dim.width);
}
+ int localGradientHeight = this.gradientHeight;
+ if (localGradientHeight < 0) {
+ localGradientHeight = dim.height;
+ }
+
Rectangle2D rect = new Rectangle2D.Float(
0,
0,
dim.width,
dim.height);
- drawGradient(g2d, rect, firstLayer, gradientHeight);
+ drawGradient(g2d, rect, firstLayer, localGradientHeight);
+ int smallGradientHeight = localGradientHeight / 2;
+
rect = new Rectangle2D.Float(
0,
0,
dim.width,
- gradientHeight / 2);
+ smallGradientHeight);
- drawGradient(g2d, rect, secondLayer, gradientHeight / 2);
+ drawGradient(g2d, rect, secondLayer, smallGradientHeight);
}
}
}
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-25
16:03:44 UTC (rev 8197)
+++
trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/BaseControlBackgroundImage.java 2008-04-25
16:31:12 UTC (rev 8198)
@@ -43,7 +43,7 @@
private static final Dimension DIMENSION = new Dimension(1, 1);
public BaseControlBackgroundImage(String baseColor, String gradientColor, int width)
{
- super(width, 1, baseColor, gradientColor);
+ super(width, -1, baseColor, gradientColor);
}
public Dimension getDimensions(FacesContext facesContext, Object data) {
@@ -89,7 +89,9 @@
@Override
protected void saveData(FacesContext context,
org.richfaces.renderkit.html.BaseGradient.Data data, Object parameterData) {
super.saveData(context, data, parameterData);
- ((Data) data).setHeight(getHeight(context));
+ Data d = ((Data) data);
+ d.setGradientType(GradientType.PLAIN);
+ d.setHeight(getHeight(context));
}
protected void restoreData(org.richfaces.renderkit.html.BaseGradient.Data data,
Zipper2 zipper2) {