Author: nbelaevski
Date: 2010-08-12 08:18:20 -0400 (Thu, 12 Aug 2010)
New Revision: 18586
Modified:
trunk/core/impl/src/main/java/org/richfaces/renderkit/html/images/BaseControlBackgroundImage.java
trunk/core/impl/src/main/java/org/richfaces/renderkit/html/images/GradientAlignment.java
trunk/core/impl/src/main/java/org/richfaces/renderkit/html/images/GradientType.java
trunk/core/impl/src/test/java/org/richfaces/renderkit/html/images/GradientEnumsTest.java
Log:
https://jira.jboss.org/browse/RF-8879
Modified:
trunk/core/impl/src/main/java/org/richfaces/renderkit/html/images/BaseControlBackgroundImage.java
===================================================================
---
trunk/core/impl/src/main/java/org/richfaces/renderkit/html/images/BaseControlBackgroundImage.java 2010-08-12
12:08:35 UTC (rev 18585)
+++
trunk/core/impl/src/main/java/org/richfaces/renderkit/html/images/BaseControlBackgroundImage.java 2010-08-12
12:18:20 UTC (rev 18586)
@@ -68,7 +68,7 @@
this.height = stream.readInt();
//TODO - create a special method?
- this.gradientType = GradientType.PLAIN;
+ this.gradientType = GradientType.plain;
}
public Integer getHeight(FacesContext context, String parameterName) {
Modified:
trunk/core/impl/src/main/java/org/richfaces/renderkit/html/images/GradientAlignment.java
===================================================================
---
trunk/core/impl/src/main/java/org/richfaces/renderkit/html/images/GradientAlignment.java 2010-08-12
12:08:35 UTC (rev 18585)
+++
trunk/core/impl/src/main/java/org/richfaces/renderkit/html/images/GradientAlignment.java 2010-08-12
12:18:20 UTC (rev 18586)
@@ -22,6 +22,7 @@
package org.richfaces.renderkit.html.images;
import static java.lang.Math.max;
+
import java.util.Locale;
/**
@@ -31,7 +32,7 @@
* @since 3.2
*/
public enum GradientAlignment {
- TOP {
+ top {
@Override
public int getBottomRectangleHeight(int imageHeight, int gradientHeight) {
return max(imageHeight - gradientHeight, 0);
@@ -41,7 +42,7 @@
return 0;
}
},
- MIDDLE {
+ middle {
@Override
public int getBottomRectangleHeight(int imageHeight, int gradientHeight) {
return max((imageHeight - gradientHeight) / 2, 0);
@@ -51,7 +52,7 @@
return getBottomRectangleHeight(imageHeight, gradientHeight);
}
},
- BOTTOM {
+ bottom {
@Override
public int getBottomRectangleHeight(int imageHeight, int gradientHeight) {
return 0;
@@ -64,10 +65,10 @@
public static final GradientAlignment getByParameter(String string) {
if ((string == null) || (string.length() == 0)) {
- return MIDDLE;
+ return middle;
}
- return GradientAlignment.valueOf(string.toUpperCase(Locale.US));
+ return GradientAlignment.valueOf(string.toLowerCase(Locale.US));
}
public abstract int getTopRectangleHeight(int imageHeight, int gradientHeight);
Modified:
trunk/core/impl/src/main/java/org/richfaces/renderkit/html/images/GradientType.java
===================================================================
---
trunk/core/impl/src/main/java/org/richfaces/renderkit/html/images/GradientType.java 2010-08-12
12:08:35 UTC (rev 18585)
+++
trunk/core/impl/src/main/java/org/richfaces/renderkit/html/images/GradientType.java 2010-08-12
12:18:20 UTC (rev 18586)
@@ -21,7 +21,7 @@
package org.richfaces.renderkit.html.images;
-import java.awt.*;
+import java.awt.Color;
import java.util.Locale;
/**
@@ -30,7 +30,7 @@
* created 16.04.2008
*/
public enum GradientType {
- GLASS {
+ glass {
@Override
public BiColor getFirstLayerColors(BiColor biColor) {
Color bottomColor = biColor.getBottomColor();
@@ -57,7 +57,7 @@
}
}
},
- PLASTIC {
+ plastic {
@Override
public BiColor getFirstLayerColors(BiColor biColor) {
Color bottomColor = biColor.getBottomColor();
@@ -84,7 +84,7 @@
}
}
},
- PLAIN {
+ plain {
@Override
public BiColor getFirstLayerColors(BiColor biColor) {
if ((biColor.getBottomColor() != null) && (biColor.getTopColor() !=
null)) {
@@ -104,10 +104,10 @@
public static final GradientType getByParameter(String string) {
if ((string == null) || (string.length() == 0)) {
- return PLAIN;
+ return plain;
}
- return GradientType.valueOf(string.toUpperCase(Locale.US));
+ return GradientType.valueOf(string.toLowerCase(Locale.US));
}
public abstract BiColor getFirstLayerColors(BiColor biColor);
Modified:
trunk/core/impl/src/test/java/org/richfaces/renderkit/html/images/GradientEnumsTest.java
===================================================================
---
trunk/core/impl/src/test/java/org/richfaces/renderkit/html/images/GradientEnumsTest.java 2010-08-12
12:08:35 UTC (rev 18585)
+++
trunk/core/impl/src/test/java/org/richfaces/renderkit/html/images/GradientEnumsTest.java 2010-08-12
12:18:20 UTC (rev 18586)
@@ -38,10 +38,10 @@
}
public void testAlignment() throws Exception {
-
GradientAlignment.MIDDLE.equals(GradientAlignment.getByParameter("middle"));
+
GradientAlignment.middle.equals(GradientAlignment.getByParameter("middle"));
}
public void testType() throws Exception {
- GradientType.PLAIN.equals(GradientType.getByParameter("plain"));
+ GradientType.plain.equals(GradientType.getByParameter("plain"));
}
}