Author: abelevich
Date: 2008-01-09 10:52:55 -0500 (Wed, 09 Jan 2008)
New Revision: 5226
Added:
trunk/sandbox/ui/combobox/src/main/java/org/richfaces/renderkit/images/ComboBoxArrowImageDisable.java
Removed:
trunk/sandbox/ui/combobox/src/main/java/org/richfaces/renderkit/images/ComboBoxDisableInputGradient.java
Modified:
trunk/sandbox/ui/combobox/src/main/java/org/richfaces/renderkit/images/ComboBoxArrowImage.java
trunk/sandbox/ui/combobox/src/main/java/org/richfaces/renderkit/images/ComboBoxButtonGradient.java
trunk/sandbox/ui/combobox/src/main/java/org/richfaces/renderkit/images/ComboBoxButtonPressGradient.java
Log:
new images
Modified:
trunk/sandbox/ui/combobox/src/main/java/org/richfaces/renderkit/images/ComboBoxArrowImage.java
===================================================================
---
trunk/sandbox/ui/combobox/src/main/java/org/richfaces/renderkit/images/ComboBoxArrowImage.java 2008-01-09
15:20:59 UTC (rev 5225)
+++
trunk/sandbox/ui/combobox/src/main/java/org/richfaces/renderkit/images/ComboBoxArrowImage.java 2008-01-09
15:52:55 UTC (rev 5226)
@@ -24,6 +24,15 @@
*/
public class ComboBoxArrowImage extends Java2Dresource{
+
+ protected static final String ICON_COLOR = "generalTextColor";
+ protected static final String BACKGROUND_COLOR = "tabBackgroundColor";
+ protected static final String BORDER_COLOR = "generalBackgroundColor";
+
+ protected static final String DISABLED_ICON_COLOR = "tabDisabledTextColor";
+ protected static final String DISABLED_BACKGROUND_COLOR =
"tabBackgroundColor";
+ protected static final String DISABLED_BORDER_COLOR =
"generalBackgroundColor";
+
private static final Dimension dimensions = new Dimension(15, 15);
public ComboBoxArrowImage() {
@@ -42,33 +51,94 @@
if (objectArray == null) {
return null;
}
- return new Integer(new Zipper2(objectArray).nextIntColor());
+ Zipper2 zipper = new Zipper2(objectArray);
+ return new Color[] {zipper.nextColor(), zipper.nextColor(), zipper.nextColor()};
+ }
+
+ protected Object getDataToStore(FacesContext context, Object data) {
+ return storeData(context, ICON_COLOR, BACKGROUND_COLOR, BORDER_COLOR);
}
- protected Object getDataToStore(FacesContext context, Object data) {
+ protected Object storeData(FacesContext context, String colorSkinParam, String
backgroundSkinParam, String borderSkinParam) {
+
Skin skin = SkinFactory.getInstance().getSkin(context);
- String skinParameter = "generalTextColor";
- String headerTextColor = (String) skin.getParameter(context, skinParameter);
- if (null == headerTextColor || "".equals(headerTextColor)) {
- Skin defaultSkin = SkinFactory.getInstance().getDefaultSkin(context);
- headerTextColor = (String) defaultSkin.getParameter(context, skinParameter);
+ Skin defaultSkin = SkinFactory.getInstance().getDefaultSkin(context);
+
+ byte [] ret = new byte[9];
+
+ Color color = null;
+ Zipper2 zipper = new Zipper2(ret);
+
+ String color1 = (String) skin.getParameter(context, colorSkinParam);
+
+ if (null == color1 || "".equals(color1)) {
+ color1 = (String) defaultSkin.getParameter(context, colorSkinParam);
+ }
+
+ if (color1 == null) {
+ color1 = "#FFFFFF";
}
+
+ color = HtmlColor.decode(color1);
+
+ zipper.addColor(color);
+
+ String color2 = (String) skin.getParameter(context, backgroundSkinParam);
+ if (null == color2 || "".equals(color2))
+ color2 = (String) defaultSkin.getParameter(context, backgroundSkinParam);
+
+ if (color2 == null) {
+ color2 = "#000000";
+ }
+
+ color = HtmlColor.decode(color2);
+ zipper.addColor(color);
+
+ String color3 = (String) skin.getParameter(context, borderSkinParam);
+ if (null == color3 || "".equals(color3))
+ color3 = (String) defaultSkin.getParameter(context, backgroundSkinParam);
+
+ if (color3 == null) {
+ color3 = "#000000";
+ }
+
+ color = HtmlColor.decode(color3);
+ zipper.addColor(color);
+
+ return ret;
+ }
- int intValue = HtmlColor.decode( headerTextColor == null ?
"#000000":headerTextColor ).getRGB();
- byte[] ret = new byte[3];
- new Zipper2(ret).addColor(intValue);
+ protected void paint(ResourceContext context, Graphics2D g2d) {
+ Color [] data = (Color[]) restoreData(context);
+ Color textColor = data[0];
+// Color backgroundColor = data[1];
+ Color borderColor = data[2];
- return ret;
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_OFF);
+ g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL,
RenderingHints.VALUE_STROKE_NORMALIZE);
+ g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING,
RenderingHints.VALUE_COLOR_RENDER_QUALITY);
+ g2d.setRenderingHint(RenderingHints.KEY_DITHERING,
RenderingHints.VALUE_DITHER_DISABLE);
+ g2d.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION,
RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
+ g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BICUBIC);
+ g2d.setRenderingHint(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
+
+ if (textColor != null && borderColor != null && g2d != null) {
+
+ g2d.setColor(textColor);
+ g2d.translate(7, 5);
+ paintBaseTriangle(g2d);
+ g2d.translate(-7, -5);
+
+ g2d.setColor(borderColor);
+ g2d.drawLine(4, 5, 10, 5);
+ g2d.drawLine(11, 6, 7, 10);
+ g2d.drawLine(7, 10, 3, 6);
+ }
}
- protected void paint(ResourceContext context, Graphics2D g2d) {
- Integer color = (Integer) restoreData(context);
- g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
- g2d.setColor(new Color(color.intValue()));
- g2d.drawLine(4,5,10,5);
- g2d.drawLine(5,6,9,6);
- g2d.drawLine(6,7,8,7);
- g2d.drawLine(7,8,7,8);
+ protected void paintBaseTriangle(Graphics2D g2d) {
+ for (int i = 0; i < 7; i++) {
+ g2d.drawLine(-3 + i, 1, -3 + i, 1 + (i < 4 ? i : 6 - i));
+ }
}
-
}
Added:
trunk/sandbox/ui/combobox/src/main/java/org/richfaces/renderkit/images/ComboBoxArrowImageDisable.java
===================================================================
---
trunk/sandbox/ui/combobox/src/main/java/org/richfaces/renderkit/images/ComboBoxArrowImageDisable.java
(rev 0)
+++
trunk/sandbox/ui/combobox/src/main/java/org/richfaces/renderkit/images/ComboBoxArrowImageDisable.java 2008-01-09
15:52:55 UTC (rev 5226)
@@ -0,0 +1,19 @@
+/**
+ *
+ */
+package org.richfaces.renderkit.images;
+
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Anton Belevich
+ * @since 3.2.0
+ * ComboBox disable arrow image renderer
+ *
+ */
+public class ComboBoxArrowImageDisable extends ComboBoxArrowImage{
+
+ protected Object storeData(FacesContext context, String colorSkinParam, String
backgroundSkinParam, String borderSkinParam) {
+ return super.storeData(context, DISABLED_ICON_COLOR, BACKGROUND_COLOR,
DISABLED_BORDER_COLOR);
+ }
+}
Modified:
trunk/sandbox/ui/combobox/src/main/java/org/richfaces/renderkit/images/ComboBoxButtonGradient.java
===================================================================
---
trunk/sandbox/ui/combobox/src/main/java/org/richfaces/renderkit/images/ComboBoxButtonGradient.java 2008-01-09
15:20:59 UTC (rev 5225)
+++
trunk/sandbox/ui/combobox/src/main/java/org/richfaces/renderkit/images/ComboBoxButtonGradient.java 2008-01-09
15:52:55 UTC (rev 5226)
@@ -4,6 +4,7 @@
package org.richfaces.renderkit.images;
import org.richfaces.renderkit.html.BaseGradient;
+import org.richfaces.skin.Skin;
/**
* @author Anton Belevich
@@ -12,6 +13,6 @@
*/
public class ComboBoxButtonGradient extends BaseGradient {
public ComboBoxButtonGradient() {
- super(30,50 , 20,"generalBackgroundColor", "tabBackgroundColor");
+ super(8, 18, 9,Skin.generalBackgroundColor, "tabBackgroundColor");
}
}
Modified:
trunk/sandbox/ui/combobox/src/main/java/org/richfaces/renderkit/images/ComboBoxButtonPressGradient.java
===================================================================
---
trunk/sandbox/ui/combobox/src/main/java/org/richfaces/renderkit/images/ComboBoxButtonPressGradient.java 2008-01-09
15:20:59 UTC (rev 5225)
+++
trunk/sandbox/ui/combobox/src/main/java/org/richfaces/renderkit/images/ComboBoxButtonPressGradient.java 2008-01-09
15:52:55 UTC (rev 5226)
@@ -4,15 +4,16 @@
package org.richfaces.renderkit.images;
import org.richfaces.renderkit.html.BaseGradient;
+import org.richfaces.skin.Skin;
/**
* @author Anton Belevich
- *
+ * @since 3.2.0
*/
public class ComboBoxButtonPressGradient extends BaseGradient{
public ComboBoxButtonPressGradient() {
- super(30,50 , 20, "tabBackgroundColor","generalBackgroundColor");
+ super(7,15 , 9, "tabBackgroundColor",Skin.generalBackgroundColor);
}
}
Deleted:
trunk/sandbox/ui/combobox/src/main/java/org/richfaces/renderkit/images/ComboBoxDisableInputGradient.java
===================================================================
---
trunk/sandbox/ui/combobox/src/main/java/org/richfaces/renderkit/images/ComboBoxDisableInputGradient.java 2008-01-09
15:20:59 UTC (rev 5225)
+++
trunk/sandbox/ui/combobox/src/main/java/org/richfaces/renderkit/images/ComboBoxDisableInputGradient.java 2008-01-09
15:52:55 UTC (rev 5226)
@@ -1,15 +0,0 @@
-/**
- *
- */
-package org.richfaces.renderkit.images;
-
-import org.richfaces.renderkit.html.BaseGradient;
-
-
-/**
- * @author Anton Belevich
- *
- */
-public class ComboBoxDisableInputGradient extends BaseGradient {
-
-}