JBoss Rich Faces SVN: r5836 - in trunk/sandbox/ui/combobox/src/main: resources/org/richfaces/renderkit/html/scripts and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2008-02-05 12:57:49 -0500 (Tue, 05 Feb 2008)
New Revision: 5836
Modified:
trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/css/combobox.xcss
trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js
trunk/sandbox/ui/combobox/src/main/templates/combobox.jspx
Log:
fix combobox behavior
Modified: trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/css/combobox.xcss
===================================================================
--- trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/css/combobox.xcss 2008-02-05 17:26:40 UTC (rev 5835)
+++ trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/css/combobox.xcss 2008-02-05 17:57:49 UTC (rev 5836)
@@ -53,6 +53,11 @@
background-position:left top;
background-repeat:repeat-x;
}
+
+.rich-combobox-font-disabled {
+ color: #AAAAAA;
+
+}
.rich-combobox-list-position {
position : absolute;
top:1px;
Modified: trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js
===================================================================
--- trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js 2008-02-05 17:26:40 UTC (rev 5835)
+++ trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js 2008-02-05 17:57:49 UTC (rev 5836)
@@ -186,6 +186,7 @@
fieldBlurHandler : function(event) {
if (!this.comboList.isList) {
+ this.doNormal();
var value = this.field.value;
if (value.length == 0) {
this.applyDefaultText();
@@ -196,7 +197,6 @@
}
}
this.comboList.hideWithDelay();
- this.doNormal();
} else {
this.doActive();
}
@@ -296,6 +296,7 @@
},
applyDefaultText : function() {
+ this.field.className = this.classes.FIELD.CLASSES.DISABLED;
this.field.value = this.defaultMessage;
this.comboValue.value = "";
},
Modified: trunk/sandbox/ui/combobox/src/main/templates/combobox.jspx
===================================================================
--- trunk/sandbox/ui/combobox/src/main/templates/combobox.jspx 2008-02-05 17:26:40 UTC (rev 5835)
+++ trunk/sandbox/ui/combobox/src/main/templates/combobox.jspx 2008-02-05 17:57:49 UTC (rev 5836)
@@ -79,13 +79,16 @@
variables.setVariable("selectFirstOnUpdate", selectFirstOnUpdate);
Object value = component.getAttributes().get("value");
+ String valueStyle = "rich-combobox-font-inactive";
value = getConvertedStringValue(context, component,value);
if (value == null || value.equals("")) {
+ valueStyle = "rich-combobox-font-disabled";
value = defaultLabel;
}
variables.setVariable("value", value);
+ variables.setVariable("valueStyle", valueStyle);
- Object inputStyle = component.getAttributes().get("inputStyle");
+ Object inputStyle = component.getAttributes().get("inputStyle");
variables.setVariable("inputStyle", inputStyle);
Object inputClass = component.getAttributes().get("inputClass");
@@ -184,23 +187,9 @@
buttonIconInactive = "url('" + buttonIconInactive + "')";
}
variables.setVariable("buttonIconInactive", buttonIconInactive);
-
-
-
+
]]>
</jsp:scriptlet>
- <jsp:scriptlet>
- <![CDATA[
- if (listWidth == null) {
- ]]>
- </jsp:scriptlet>
- <style>
- </style>
- <jsp:scriptlet>
- <![CDATA[
- }
- ]]>
- </jsp:scriptlet>
<f:resource var="spacer" name="images/spacer.gif"/>
<f:resource name="org.richfaces.renderkit.images.ComboBoxListShadow"/>
<div id="control#{clientId}" class="rich-combobox-font rich-combobox #{styleClass}" style="width:#{listWidth};#{style}"
@@ -211,7 +200,7 @@
<input id="comboboxField#{clientId}"
name="comboboxField#{clientId}"
disabled="#{disabled}"
- class="rich-combobox-font-inactive rich-combobox-input-inactive #{inputDisabledClass}" type="text"
+ class="#{valueStyle} rich-combobox-input-inactive #{inputDisabledClass}" type="text"
value="#{value}"
size="#{inputSize}"
onchange="#{component.attributes['onchange']}"
16 years, 3 months
JBoss Rich Faces SVN: r5835 - trunk/sandbox/ui/progressBAR/src/main/java/org/richfaces/renderkit/html/images.
by richfaces-svn-commits@lists.jboss.org
Author: dsvyatobatsko
Date: 2008-02-05 12:26:40 -0500 (Tue, 05 Feb 2008)
New Revision: 5835
Modified:
trunk/sandbox/ui/progressBAR/src/main/java/org/richfaces/renderkit/html/images/ColorUtils.java
trunk/sandbox/ui/progressBAR/src/main/java/org/richfaces/renderkit/html/images/ProgressBarAnimatedBg.java
trunk/sandbox/ui/progressBAR/src/main/java/org/richfaces/renderkit/html/images/ProgressBarBg.java
Log:
Modified: trunk/sandbox/ui/progressBAR/src/main/java/org/richfaces/renderkit/html/images/ColorUtils.java
===================================================================
--- trunk/sandbox/ui/progressBAR/src/main/java/org/richfaces/renderkit/html/images/ColorUtils.java 2008-02-05 17:26:36 UTC (rev 5834)
+++ trunk/sandbox/ui/progressBAR/src/main/java/org/richfaces/renderkit/html/images/ColorUtils.java 2008-02-05 17:26:40 UTC (rev 5835)
@@ -29,180 +29,194 @@
*/
public abstract class ColorUtils {
- /**
- * Converts the components of a color, as specified by the default RGB
- * model, to an equivalent set of values for hue, saturation, and
- * lightness that are the three components of the HSL model.
+ /**
+ * Converts the components of a color, as specified by the default RGB
+ * model, to an equivalent set of values for hue, saturation, and lightness
+ * that are the three components of the HSL model.
*
- * @param r the red component of the color
- * @param g the green component of the color
- * @param b the blue component of the color
- * @return an array of three elements containing the hue, saturation,
- * and lightness (in that order), of the color with
- * the indicated red, green, and blue components.
- */
- public static float[] RGBtoHSL(int r, int g, int b) {
- float varR = (r / 255f);
- float varG = (g / 255f);
- float varB = (b / 255f);
+ * @param r
+ * the red component of the color
+ * @param g
+ * the green component of the color
+ * @param b
+ * the blue component of the color
+ * @return an array of three elements containing the hue, saturation, and
+ * lightness (in that order), of the color with the indicated red,
+ * green, and blue components.
+ */
+ public static float[] RGBtoHSL(int r, int g, int b) {
+ float varR = (r / 255f);
+ float varG = (g / 255f);
+ float varB = (b / 255f);
- float varMin = Math.min(varR, Math.min(varG, varB)); //Min value of RGB
- float varMax = Math.max(varR, Math.max(varG, varB)); //Max value of RGB
- float delMax = varMax - varMin; //Delta RGB value
+ float varMin = Math.min(varR, Math.min(varG, varB)); // Min value of RGB
+ float varMax = Math.max(varR, Math.max(varG, varB)); // Max value of RGB
+ float delMax = varMax - varMin; // Delta RGB value
- float h = 0;
- float s = 0;
- float l = (varMax + varMin) / 2;
+ float h = 0;
+ float s = 0;
+ float l = (varMax + varMin) / 2;
- if(delMax == 0 || l == 0) {
- s = 0;
- } else if (l == 1) {
- s = 1;
- } else if(l <= 0.5) {
- s = delMax / (2 * (1 - l));
- } else if(l > 0.5) {
- s = delMax / (2 * l);
- }
+ if (delMax == 0 || l == 0) {
+ s = 0;
+ } else if (l == 1) {
+ s = 1;
+ } else if (l <= 0.5) {
+ s = delMax / (2 * (1 - l));
+ } else if (l > 0.5) {
+ s = delMax / (2 * l);
+ }
- if(delMax == 0) {
- h = 0;
- } else if (varMax == varR && g >= b) {
- h = 60 * (varG - varB) / delMax + 0;
- } else if (varMax == varR && varG < b) {
- h = 60 * (varG - varB) / delMax + 360;
- } else if (varMax == varG) {
- h = 60 * (varB - varR) / delMax + 120;
- } else if (varMax == varB) {
- h = 60 * (varR - varG) / delMax + 240;
- }
+ if (delMax == 0) {
+ h = 0;
+ } else if (varMax == varR && g >= b) {
+ h = 60 * (varG - varB) / delMax + 0;
+ } else if (varMax == varR && varG < b) {
+ h = 60 * (varG - varB) / delMax + 360;
+ } else if (varMax == varG) {
+ h = 60 * (varB - varR) / delMax + 120;
+ } else if (varMax == varB) {
+ h = 60 * (varR - varG) / delMax + 240;
+ }
- return new float[] { h, s, l };
- }
+ return new float[] { h, s, l };
+ }
/**
- * Converts the components of a color, as specified by the HSL
- * model, to an equivalent set of values for the default RGB model.
+ * Converts the components of a color, as specified by the HSL model, to an
+ * equivalent set of values for the default RGB model.
* <p>
* The <code>saturation</code> and <code>lightness</code> components
- * should be floating-point values between zero and one
- * (numbers in the range 0.0-1.0). The <code>hue</code> component
- * can be any floating-point number. The floor of this number is
- * subtracted from it to create a fraction between 0 and 1. This
- * fractional number is then multiplied by 360 to produce the hue
- * angle in the HSB color model.
- * @param h the hue component of the color
- * @param s the saturation of the color
- * @param l the lightness of the color
- * @return the RGB value of the color with the indicated hue,
- * saturation, and lightness
+ * should be floating-point values between zero and one (numbers in the
+ * range 0.0-1.0). The <code>hue</code> component can be any
+ * floating-point number. The floor of this number is subtracted from it to
+ * create a fraction between 0 and 1. This fractional number is then
+ * multiplied by 360 to produce the hue angle in the HSB color model.
+ *
+ * @param h
+ * the hue component of the color
+ * @param s
+ * the saturation of the color
+ * @param l
+ * the lightness of the color
+ * @return the RGB value of the color with the indicated hue, saturation,
+ * and lightness
*/
- public static Color HSLtoRGB(float h, float s, float l) {
- float q;
- if (l < 0.5) {
- q = l * (1 + s);
- } else {
- q = l + s - (l * s);
- }
+ public static Color HSLtoRGB(float h, float s, float l) {
+ float q;
+ if (l < 0.5) {
+ q = l * (1 + s);
+ } else {
+ q = l + s - (l * s);
+ }
- float p = 2 * l - q;
- float hNorm = h / 360;
+ float p = 2 * l - q;
+ float hNorm = h / 360;
- float tR = hNorm + 1f/3f;
- float tG = hNorm;
- float tB = hNorm - 1f/3f;
+ float tR = hNorm + 1f / 3f;
+ float tG = hNorm;
+ float tB = hNorm - 1f / 3f;
- float r = tC2C(tR, p, q);
- float g = tC2C(tG, p, q);
- float b = tC2C(tB, p, q);
+ float r = tC2C(tR, p, q);
+ float g = tC2C(tG, p, q);
+ float b = tC2C(tB, p, q);
- return new Color(r, g, b);
- }
+ return new Color(r, g, b);
+ }
- private static float tC2C(float tC, float p, float q)
- {
- float retVal;
+ private static float tC2C(float tC, float p, float q) {
+ float retVal;
- if (tC < 0) {
- tC += 1;
+ if (tC < 0) {
+ tC += 1;
}
- if (tC > 1) {
- tC -= 1;
- }
+ if (tC > 1) {
+ tC -= 1;
+ }
- if ((6 * tC) < 1) {
- retVal = (p + (q - p) * 6 * tC);
- } else if ((2 * tC) < 1) {
- retVal = q;
- } else if ((3 * tC) < 2) {
- retVal = (p + (q - p) * 6 * (2f / 3f - tC));
- } else {
- retVal = p;
- }
+ if ((6 * tC) < 1) {
+ retVal = (p + (q - p) * 6 * tC);
+ } else if ((2 * tC) < 1) {
+ retVal = q;
+ } else if ((3 * tC) < 2) {
+ retVal = (p + (q - p) * 6 * (2f / 3f - tC));
+ } else {
+ retVal = p;
+ }
- return retVal;
- }
+ return retVal;
+ }
- /**
- * Increases/decreases brightness of the given color by the specified <code>difference</code>.
- * <p>
- * The <code>difference</code> values in the range (-1.0, 1.0): 1.0 - the brightest value;
- * -1.0 - the dimmest value.
- *
- * @param c color to adjust
- * @param difference value to be added to the current brightness
- *
- * @return a new <code>Color</code> instance with increased/decreased brightness by specified <code>difference</code>
- * @throws IllegalArgumentException if difference is outside of the range -1.0 to 1.0, inclusive
- */
- public static Color adjustBrightness(Color c, float difference) {
- if (difference < -1.0 || difference > 1.0) {
- throw new IllegalArgumentException("Difference parameter outside of expected range: " +
- "Difference parameter should be floating-point values between -1 and 1");
- }
+ /**
+ * Increases/decreases brightness of the given color by the specified
+ * <code>difference</code>.
+ * <p>
+ * The <code>difference</code> values in the range (-1.0, 1.0): 1.0 - the
+ * brightest value; -1.0 - the dimmest value.
+ *
+ * @param c
+ * color to adjust
+ * @param difference
+ * value to be added to the current brightness
+ *
+ * @return a new <code>Color</code> instance with increased/decreased
+ * brightness by specified <code>difference</code>
+ * @throws IllegalArgumentException
+ * if difference is outside of the range -1.0 to 1.0, inclusive
+ */
+ public static Color adjustBrightness(Color c, float difference) {
+ if (difference < -1.0 || difference > 1.0) {
+ throw new IllegalArgumentException("Difference parameter outside of expected range: "
+ + "Difference parameter should be floating-point values between -1 and 1");
+ }
- float[] hsb = Color.RGBtoHSB(c.getRed(), c.getGreen(), c.getBlue(), null);
- float brightness = Math.min(1.0f, Math.max(0.0f, hsb[2] + difference));
- return new Color(Color.HSBtoRGB(hsb[0], hsb[1], brightness));
- }
+ float[] hsb = Color.RGBtoHSB(c.getRed(), c.getGreen(), c.getBlue(), null);
+ float brightness = Math.min(1.0f, Math.max(0.0f, hsb[2] + difference));
+ return new Color(Color.HSBtoRGB(hsb[0], hsb[1], brightness));
+ }
- /**
- * Increases/decreases lightness of the given color by the specified <code>difference</code>.
- * <p>
- * The <code>difference</code> values in the range (-1.0, 1.0): 1.0 - the lightest value;
- * -1.0 - on the contrary.
- *
- * @param c color to adjust
- * @param difference value to be added to the current lightness
- *
- * @return a new <code>Color</code> instance with increased/decreased lightness by specified <code>difference</code>
- * @throws IllegalArgumentException if difference is outside of the range -1.0 to 1.0, inclusive
- */
- public static Color adjustLightness(Color c, float difference) {
- if (difference < -1.0 || difference > 1.0) {
- throw new IllegalArgumentException("Difference parameter outside of expected range: " +
- "Difference parameter should be floating-point values between -1 and 1");
- }
+ /**
+ * Increases/decreases lightness of the given color by the specified
+ * <code>difference</code>.
+ * <p>
+ * The <code>difference</code> values in the range (-1.0, 1.0): 1.0 - the
+ * lightest value; -1.0 - on the contrary.
+ *
+ * @param c
+ * color to adjust
+ * @param difference
+ * value to be added to the current lightness
+ *
+ * @return a new <code>Color</code> instance with increased/decreased
+ * lightness by specified <code>difference</code>
+ * @throws IllegalArgumentException
+ * if difference is outside of the range -1.0 to 1.0, inclusive
+ */
+ public static Color adjustLightness(Color c, float difference) {
+ if (difference < -1.0 || difference > 1.0) {
+ throw new IllegalArgumentException("Difference parameter outside of expected range: "
+ + "Difference parameter should be floating-point values between -1 and 1");
+ }
- float[] hsl = RGBtoHSL(c.getRed(), c.getGreen(), c.getBlue());
- float lightness = Math.min(1.0f, Math.max(0.0f, hsl[2] + difference));
- return HSLtoRGB(hsl[0], hsl[1], lightness);
- }
+ float[] hsl = RGBtoHSL(c.getRed(), c.getGreen(), c.getBlue());
+ float lightness = Math.min(1.0f, Math.max(0.0f, hsl[2] + difference));
+ return HSLtoRGB(hsl[0], hsl[1], lightness);
+ }
- /**
- * Overwrites alpha value for given color.
- *
- * @param c color to overwrite
- * @param alpha a new value of alpha
- * @return a new <code>Color</code> object with a new specified alpha value
- */
- public static Color overwriteAlpha(Color c, float alpha) {
- Color retVal = c;
- if (c != null) {
- retVal = new Color(c.getRed(), c.getGreen(), c.getBlue(),
- (int) (alpha * 255 + 0.5));
- }
- return retVal;
- }
+ /**
+ * Overwrites alpha value for given color.
+ *
+ * @param c color to overwrite
+ * @param alpha a new value of alpha
+ * @return a new <code>Color</code> object with a new specified alpha value
+ */
+ public static Color overwriteAlpha(Color c, float alpha) {
+ Color retVal = c;
+ if (c != null) {
+ retVal = new Color(c.getRed(), c.getGreen(), c.getBlue(), (int) (alpha * 255 + 0.5));
+ }
+ return retVal;
+ }
}
Modified: trunk/sandbox/ui/progressBAR/src/main/java/org/richfaces/renderkit/html/images/ProgressBarAnimatedBg.java
===================================================================
--- trunk/sandbox/ui/progressBAR/src/main/java/org/richfaces/renderkit/html/images/ProgressBarAnimatedBg.java 2008-02-05 17:26:36 UTC (rev 5834)
+++ trunk/sandbox/ui/progressBAR/src/main/java/org/richfaces/renderkit/html/images/ProgressBarAnimatedBg.java 2008-02-05 17:26:40 UTC (rev 5835)
@@ -20,6 +20,9 @@
*/
package org.richfaces.renderkit.html.images;
+import static org.richfaces.renderkit.html.images.ColorUtils.adjustLightness;
+import static org.richfaces.renderkit.html.images.ColorUtils.overwriteAlpha;
+
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GradientPaint;
@@ -40,134 +43,115 @@
public class ProgressBarAnimatedBg extends AnimationResource {
- private static int NUMBER_OF_FRAMES = 12;
- private BufferedImage mainStage;
- private Dimension frameSize = new Dimension(24, 48);
+ private static int NUMBER_OF_FRAMES = 12;
- private Color progressbarSpiralColor;
- private Color progressbarBackgroundColor;
- private Color progressbarShadowColor;
+ private BufferedImage mainStage;
- private Color progressbarShadowStartColor;
- private Color progressbarShadowEndColor;
+ private Dimension frameSize = new Dimension(24, 48);
- @Override
- protected Dimension getFrameSize(ResourceContext resourceContext) {
- return frameSize;
- }
+ private Color progressbarBasicColor;
- /**
- * @see Java2Dresource#isCacheable(ResourceContext)
- */
- public boolean isCacheable(ResourceContext ctx) {
- return true;
- }
+ private Color progressbarSpiralColor;
- @Override
- protected int getRepeat() {
- return 0;
- }
-
- @Override
- protected int getNumberOfFrames() {
- return NUMBER_OF_FRAMES;
- }
+ private Color progressbarBackgroundColor;
- @Override
- protected void paint(ResourceContext context, Graphics2D g2d, int frameIndex) {
- if (mainStage == null) {
- mainStage = createMainStage(context);
- }
- BufferedImage frame = mainStage.getSubimage(0, 48 - frameIndex * 4, frameSize.width, frameSize.height);
- g2d.drawImage(frame, null, null);
- // paint a shadow in the form of semi-transparent gradient
- g2d.setPaint(new GradientPaint(0, 0, progressbarShadowStartColor, 0, 7, progressbarShadowEndColor));
- g2d.fillRect(0, 0, frameSize.width, 7);
- }
+ private Color progressbarShadowStartColor;
- /**
- * Creates a main stage for progress bar background.
- *
- * @param context resource context
- * @return a <code>BufferedImage</code> object
- */
- private BufferedImage createMainStage(ResourceContext ctx) {
- progressbarSpiralColor = overwriteAlpha(progressbarSpiralColor, 0.38f);
- progressbarShadowStartColor = overwriteAlpha(progressbarShadowColor, 0.6f);
- progressbarShadowEndColor = overwriteAlpha(progressbarShadowColor, 0.2f);
- BufferedImage retVal = ((ImageRenderer) getRenderer(ctx)).createImage(frameSize.width, frameSize.height * 2);
- Graphics g = retVal.getGraphics();
- g.setColor(progressbarBackgroundColor);
- g.fillRect(0, 0, frameSize.width, frameSize.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);
- }
- g.dispose();
+ private Color progressbarShadowEndColor;
- return retVal;
- }
+ @Override
+ protected Dimension getFrameSize(ResourceContext resourceContext) {
+ return frameSize;
+ }
- /**
- * @see InternetResourceBase#getDataToStore(FacesContext, Object)
- */
- protected Object getDataToStore(FacesContext context, Object data) {
- byte[] retVal = null;
- if (progressbarSpiralColor == null) {
- progressbarSpiralColor = getColorValueParameter(context, "progressbarSpiralColor");
- }
- if (progressbarBackgroundColor == null) {
- progressbarBackgroundColor = getColorValueParameter(context, "progressbarBackgroundColor");
- }
- if (progressbarShadowColor == null) {
- progressbarShadowColor = getColorValueParameter(context, "progressbarShadowColor");
- }
+ /**
+ * @see Java2Dresource#isCacheable(ResourceContext)
+ */
+ public boolean isCacheable(ResourceContext ctx) {
+ return true;
+ }
- retVal = new byte[3 * 3];
- new Zipper2(retVal).addColor(progressbarSpiralColor).addColor(
- progressbarBackgroundColor).addColor(progressbarShadowColor);
+ @Override
+ protected int getRepeat() {
+ return 0;
+ }
- return retVal;
- }
+ @Override
+ protected int getNumberOfFrames() {
+ return NUMBER_OF_FRAMES;
+ }
- /**
- * @see InternetResourceBase#deserializeData(byte[])
- */
- protected Object deserializeData(byte[] objectArray) {
- if (objectArray != null) {
- Zipper2 zipper2 = new Zipper2(objectArray);
- progressbarSpiralColor = zipper2.nextColor();
- progressbarBackgroundColor = zipper2.nextColor();
- progressbarShadowColor = zipper2.nextColor();
- }
+ @Override
+ protected void paint(ResourceContext context, Graphics2D g2d, int frameIndex) {
+ if (mainStage == null) {
+ mainStage = createMainStage(context);
+ }
+ BufferedImage frame = mainStage.getSubimage(0, 48 - frameIndex * 4, frameSize.width, frameSize.height);
+ g2d.drawImage(frame, null, null);
+ // paint a shadow in the form of semi-transparent gradient
+ g2d.setPaint(new GradientPaint(0, 0, progressbarShadowStartColor, 0, 7, progressbarShadowEndColor));
+ g2d.fillRect(0, 0, frameSize.width, 7);
+ }
- return objectArray;
- }
+ /**
+ * Creates a main stage for progress bar background.
+ *
+ * @param context
+ * resource context
+ * @return a <code>BufferedImage</code> object
+ */
+ private BufferedImage createMainStage(ResourceContext ctx) {
+ progressbarBackgroundColor = progressbarBasicColor;
+ progressbarSpiralColor = adjustLightness(progressbarBasicColor, 0.15f);
+ progressbarShadowStartColor = overwriteAlpha(adjustLightness(progressbarBasicColor, 0.5f), 0.6f);
+ progressbarShadowEndColor = overwriteAlpha(adjustLightness(progressbarBasicColor, 0.1f), 0.6f);
+ BufferedImage retVal = ((ImageRenderer) getRenderer(ctx)).createImage(frameSize.width, frameSize.height * 2);
+ Graphics g = retVal.getGraphics();
+ g.setColor(progressbarBackgroundColor);
+ g.fillRect(0, 0, frameSize.width, frameSize.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);
+ }
+ g.dispose();
- private Color getColorValueParameter(FacesContext context, String name) {
- Color retVal = null;
- String color = (String) SkinFactory.getInstance().getSkin(context).getParameter(context, name);
- if (color != null && !color.trim().equals("")) {
- retVal = HtmlColor.decode(color);
- }
- return retVal;
- }
+ return retVal;
+ }
- /**
- * Overwrites alpha value for given color.
- *
- * @param c color to overwrite
- * @param alpha a new value of alpha
- * @return a new <code>Color</code> object with a new specified alpha value
- */
- private Color overwriteAlpha(Color c, float alpha) {
- Color retVal = c;
- if (c != null) {
- retVal = new Color(c.getRed(), c.getGreen(), c.getBlue(),
- (int) (alpha * 255 + 0.5));
- }
- return retVal;
- }
+ /**
+ * @see InternetResourceBase#getDataToStore(FacesContext, Object)
+ */
+ protected Object getDataToStore(FacesContext context, Object data) {
+ byte[] retVal = null;
+ if (progressbarBasicColor == null) {
+ progressbarBasicColor = getColorValueParameter(context, "selectControlColor");
+ }
+ retVal = new byte[3 * 1];
+ new Zipper2(retVal).addColor(progressbarBasicColor);
+
+ return retVal;
+ }
+
+ /**
+ * @see InternetResourceBase#deserializeData(byte[])
+ */
+ protected Object deserializeData(byte[] objectArray) {
+ if (objectArray != null) {
+ Zipper2 zipper2 = new Zipper2(objectArray);
+ progressbarBasicColor = zipper2.nextColor();
+ }
+
+ return objectArray;
+ }
+
+ private Color getColorValueParameter(FacesContext context, String name) {
+ Color retVal = null;
+ String color = (String) SkinFactory.getInstance().getSkin(context).getParameter(context, name);
+ if (color != null && !color.trim().equals("")) {
+ retVal = HtmlColor.decode(color);
+ }
+ return retVal;
+ }
+
}
Modified: trunk/sandbox/ui/progressBAR/src/main/java/org/richfaces/renderkit/html/images/ProgressBarBg.java
===================================================================
--- trunk/sandbox/ui/progressBAR/src/main/java/org/richfaces/renderkit/html/images/ProgressBarBg.java 2008-02-05 17:26:36 UTC (rev 5834)
+++ trunk/sandbox/ui/progressBAR/src/main/java/org/richfaces/renderkit/html/images/ProgressBarBg.java 2008-02-05 17:26:40 UTC (rev 5835)
@@ -20,6 +20,9 @@
*/
package org.richfaces.renderkit.html.images;
+import static org.richfaces.renderkit.html.images.ColorUtils.adjustLightness;
+import static org.richfaces.renderkit.html.images.ColorUtils.overwriteAlpha;
+
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GradientPaint;
@@ -40,127 +43,98 @@
public class ProgressBarBg extends Java2Dresource {
- private Dimension dim = new Dimension(24, 48);
+ private Dimension dim = new Dimension(24, 48);
- private Color progressbarSpiralColor;
- private Color progressbarBackgroundColor;
- private Color progressbarShadowColor;
+ private Color progressbarBasicColor;
- private Color progressbarShadowStartColor;
- private Color progressbarShadowEndColor;
+ /**
+ * <P>
+ * No args constructor.
+ * </p>
+ */
+ public ProgressBarBg() {
+ setRenderer(new PngRenderer());
+ setLastModified(new Date(InternetResourceBuilder.getInstance().getStartTime()));
+ }
- /**
- * <P>
- * No args constructor.
- * </p>
- */
- public ProgressBarBg() {
- setRenderer(new PngRenderer());
- setLastModified(new Date(InternetResourceBuilder.getInstance().getStartTime()));
- }
+ /**
+ * @see Java2Dresource#getDimensions(ResourceContext)
+ */
+ protected Dimension getDimensions(ResourceContext resourceContext) {
+ return dim;
+ }
- /**
- * @see Java2Dresource#getDimensions(ResourceContext)
- */
- protected Dimension getDimensions(ResourceContext resourceContext) {
- return dim;
- }
+ /**
+ * @see Java2Dresource#getDimensions(FacesContext, Object)
+ */
+ public Dimension getDimensions(FacesContext facesContext, Object data) {
+ return dim;
+ }
- /**
- * @see Java2Dresource#getDimensions(FacesContext, Object)
- */
- public Dimension getDimensions(FacesContext facesContext, Object data) {
- return dim;
- }
+ /**
+ * @see Java2Dresource#isCacheable(ResourceContext)
+ */
+ public boolean isCacheable(ResourceContext ctx) {
+ return true;
+ }
- /**
- * @see Java2Dresource#isCacheable(ResourceContext)
- */
- public boolean isCacheable(ResourceContext ctx) {
- return true;
- }
+ /**
+ * <P>
+ * Paints fixed progress bar background.
+ * </p>
+ */
+ protected void paint(ResourceContext context, Graphics2D g2d) {
+ Color progressbarBackgroundColor = progressbarBasicColor;
+ Color progressbarSpiralColor = adjustLightness(progressbarBasicColor, 0.15f);
+ Color progressbarShadowStartColor = overwriteAlpha(adjustLightness(progressbarBasicColor, 0.5f), 0.6f);
+ Color progressbarShadowEndColor = overwriteAlpha(adjustLightness(progressbarBasicColor, 0.1f), 0.6f);
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+ g2d.setColor(progressbarBackgroundColor);
+ g2d.fillRect(0, 0, dim.width, dim.height);
+ g2d.setColor(progressbarSpiralColor);
+ for (int k : new int[] { -24, 0, 24 }) {
+ g2d.fillPolygon(new int[] { 0, 24, 24, 0 }, new int[] { 24 + k, k, 12 + k, 36 + k }, 4);
+ }
- /**
- * <P>
- * Paints fixed progress bar background.
- * </p>
- */
- protected void paint(ResourceContext context, Graphics2D g2d) {
- progressbarSpiralColor = overwriteAlpha(progressbarSpiralColor, 0.38f);
- progressbarShadowStartColor = overwriteAlpha(progressbarShadowColor, 0.6f);
- progressbarShadowEndColor = overwriteAlpha(progressbarShadowColor, 0.2f);
- g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
- g2d.setColor(progressbarBackgroundColor);
- g2d.fillRect(0, 0, dim.width, dim.height);
- g2d.setColor(progressbarSpiralColor);
- for (int k : new int[] { -24, 0, 24 }) {
- g2d.fillPolygon(new int[] { 0, 24, 24, 0 }, new int[] { 24 + k,
- k, 12 + k, 36 + k }, 4);
- }
- //paint a shadow in the form of semi-transparent gradient
- g2d.setPaint(new GradientPaint(0, 0, progressbarShadowStartColor, 0, 7, progressbarShadowEndColor));
- g2d.fillRect(0, 0, dim.width, 7);
- }
+ // paint a shadow in the form of semi-transparent gradient
+ g2d.setPaint(new GradientPaint(0, 0, progressbarShadowStartColor, 0, 7, progressbarShadowEndColor));
+ g2d.fillRect(0, 0, dim.width, 7);
+ }
- /**
- * @see InternetResourceBase#getDataToStore(FacesContext, Object)
- */
- protected Object getDataToStore(FacesContext context, Object data) {
- byte[] retVal = null;
- if (progressbarSpiralColor == null) {
- progressbarSpiralColor = getColorValueParameter(context, "progressbarSpiralColor");
- }
- if (progressbarBackgroundColor == null) {
- progressbarBackgroundColor = getColorValueParameter(context, "progressbarBackgroundColor");
- }
- if (progressbarShadowColor == null) {
- progressbarShadowColor = getColorValueParameter(context, "progressbarShadowColor");
- }
+ /**
+ * @see InternetResourceBase#getDataToStore(FacesContext, Object)
+ */
+ protected Object getDataToStore(FacesContext context, Object data) {
+ byte[] retVal = null;
+ if (progressbarBasicColor == null) {
+ progressbarBasicColor = getColorValueParameter(context, "selectControlColor");
+ }
- retVal = new byte[3 * 3];
- new Zipper2(retVal).addColor(progressbarSpiralColor).addColor(
- progressbarBackgroundColor).addColor(progressbarShadowColor);
+ retVal = new byte[3 * 1];
+ new Zipper2(retVal).addColor(progressbarBasicColor);
- return retVal;
- }
+ return retVal;
+ }
- /**
- * @see InternetResourceBase#deserializeData(byte[])
- */
- protected Object deserializeData(byte[] objectArray) {
- if (objectArray != null) {
- Zipper2 zipper2 = new Zipper2(objectArray);
- progressbarSpiralColor = zipper2.nextColor();
- progressbarBackgroundColor = zipper2.nextColor();
- progressbarShadowColor = zipper2.nextColor();
- }
+ /**
+ * @see InternetResourceBase#deserializeData(byte[])
+ */
+ protected Object deserializeData(byte[] objectArray) {
+ if (objectArray != null) {
+ Zipper2 zipper2 = new Zipper2(objectArray);
+ progressbarBasicColor = zipper2.nextColor();
+ }
- return objectArray;
- }
+ return objectArray;
+ }
- private Color getColorValueParameter(FacesContext context, String name) {
- Color retVal = null;
- String color = (String) SkinFactory.getInstance().getSkin(context).getParameter(context, name);
- if (color != null && !color.trim().equals("")) {
- retVal = HtmlColor.decode(color);
- }
- return retVal;
- }
+ private Color getColorValueParameter(FacesContext context, String name) {
+ Color retVal = null;
+ String color = (String) SkinFactory.getInstance().getSkin(context).getParameter(context, name);
+ if (color != null && !color.trim().equals("")) {
+ retVal = HtmlColor.decode(color);
+ }
+ return retVal;
+ }
- /**
- * Overwrites alpha value for given color.
- *
- * @param c color to overwrite
- * @param alpha a new value of alpha
- * @return a new <code>Color</code> object with a new specified alpha value
- */
- private Color overwriteAlpha(Color c, float alpha) {
- Color retVal = c;
- if (c != null) {
- retVal = new Color(c.getRed(), c.getGreen(), c.getBlue(),
- (int) (alpha * 255 + 0.5));
- }
- return retVal;
- }
-
}
16 years, 3 months
JBoss Rich Faces SVN: r5834 - trunk/framework/impl/src/main/resources/META-INF/skins.
by richfaces-svn-commits@lists.jboss.org
Author: dsvyatobatsko
Date: 2008-02-05 12:26:36 -0500 (Tue, 05 Feb 2008)
New Revision: 5834
Modified:
trunk/framework/impl/src/main/resources/META-INF/skins/DEFAULT.skin.properties
Log:
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-02-05 16:45:30 UTC (rev 5833)
+++ trunk/framework/impl/src/main/resources/META-INF/skins/DEFAULT.skin.properties 2008-02-05 17:26:36 UTC (rev 5834)
@@ -62,8 +62,3 @@
calendarSpecBackgroundColor=#F1EEE9
calendarSpecTextColor=#000000
-
-#Progress bar colors
-progressbarSpiralColor=#F1F1F1
-progressbarBackgroundColor=#FF9409
-progressbarShadowColor=#FFFFFF
16 years, 3 months
JBoss Rich Faces SVN: r5833 - in trunk: ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2008-02-05 11:45:30 -0500 (Tue, 05 Feb 2008)
New Revision: 5833
Modified:
trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/utils.js
trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js
Log:
RF-2079, RF-1764, RF-1673
Modified: trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/utils.js
===================================================================
--- trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/utils.js 2008-02-05 16:42:16 UTC (rev 5832)
+++ trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/utils.js 2008-02-05 16:45:30 UTC (rev 5833)
@@ -159,6 +159,7 @@
isIE: (!window.opera && /MSIE/.test(navigator.userAgent)),
isIE6: (!window.opera && /MSIE\s*[6][\d,\.]+;/.test(navigator.userAgent)),
isSafari: /Safari/.test(navigator.userAgent),
+ isOpera: !!window.opera,
isObjectEval: (Richfaces.eval!=undefined)
};
Modified: trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js
===================================================================
--- trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js 2008-02-05 16:42:16 UTC (rev 5832)
+++ trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js 2008-02-05 16:45:30 UTC (rev 5833)
@@ -35,7 +35,6 @@
var windowRect = Richfaces.Calendar.getWindowViewport();
-
// jointPoint
var ox=baseOffset[0];
var oy=baseOffset[1];
@@ -122,20 +121,45 @@
els.position = 'absolute';
els.display = '';
- if (element.offsetParent && element.offsetParent!=document.body)
+ if (!window.opera)
{
- var parentOffset=Position.cumulativeOffset(element.offsetParent);
+ var parentOffset = element.getOffsetParent().viewportOffset();
ox -= parentOffset[0];
oy -= parentOffset[1];
+ } else if (element.offsetParent)
+ {
+ // for Opera only
+ if (element.offsetParent!=document.body)
+ {
+ var parentOffset=Position.cumulativeOffset(element.offsetParent);
+ ox -= parentOffset[0];
+ oy -= parentOffset[1];
+ ox += element.offsetParent.scrollLeft;
+ oy += element.offsetParent.scrollTop;
+ } else {
+ var parentOffset = Richfaces.Calendar.cumulativeScrollOffset(element);
+ ox += parentOffset[0];
+ oy += parentOffset[1];
+ }
}
els.display = originalDisplay;
els.position = originalPosition;
els.visibility = originalVisibility;
- element.style.left = (ox + windowRect.left) + 'px';
- element.style.top = (oy + windowRect.top) + 'px';
+ element.style.left = ox + 'px';
+ element.style.top = oy + 'px';
};
+Richfaces.Calendar.cumulativeScrollOffset = function(element) {
+ var valueT = 0, valueL = 0;
+ do {
+ valueT += element.scrollTop || 0;
+ valueL += element.scrollLeft || 0;
+ element = element.parentNode;
+ } while (element && element != document.body);
+ return Element._returnOffset(valueL, valueT);
+};
+
Richfaces.Calendar.getOffsetDimensions = function(element) {
// from prototype 1.5.0 // Pavel Yascenko
element = $(element);
@@ -1111,7 +1135,8 @@
var offsetDimBase = Richfaces.Calendar.getOffsetDimensions(base);
var offsetDimButton = Richfaces.Calendar.getOffsetDimensions(baseButton);
- var offsetTemp = Position.realOffset(baseButton);
+ var offsetTemp = (window.opera ? [0,0] : Position.realOffset(baseButton));
+ //alert("offsetBase:"+offsetBase+" offsetTemp:"+offsetTemp+' scrollTop:'+baseButton.offsetParent.scrollTop+" offsetParent:"+baseButton.offsetParent);
var o = {left: offsetBase[0]-offsetTemp[0],
top: offsetBase[1]-offsetTemp[1],
width: offsetDimBase.width,
16 years, 3 months
JBoss Rich Faces SVN: r5832 - trunk/sandbox/ui/progressBAR/src/main/java/org/richfaces/renderkit/html/images.
by richfaces-svn-commits@lists.jboss.org
Author: dsvyatobatsko
Date: 2008-02-05 11:42:16 -0500 (Tue, 05 Feb 2008)
New Revision: 5832
Added:
trunk/sandbox/ui/progressBAR/src/main/java/org/richfaces/renderkit/html/images/ColorUtils.java
Log:
Added: trunk/sandbox/ui/progressBAR/src/main/java/org/richfaces/renderkit/html/images/ColorUtils.java
===================================================================
--- trunk/sandbox/ui/progressBAR/src/main/java/org/richfaces/renderkit/html/images/ColorUtils.java (rev 0)
+++ trunk/sandbox/ui/progressBAR/src/main/java/org/richfaces/renderkit/html/images/ColorUtils.java 2008-02-05 16:42:16 UTC (rev 5832)
@@ -0,0 +1,208 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+package org.richfaces.renderkit.html.images;
+
+import java.awt.Color;
+
+/**
+ * Utility methods that are useful for color processing.
+ *
+ * @author carcasser
+ */
+public abstract class ColorUtils {
+
+ /**
+ * Converts the components of a color, as specified by the default RGB
+ * model, to an equivalent set of values for hue, saturation, and
+ * lightness that are the three components of the HSL model.
+ *
+ * @param r the red component of the color
+ * @param g the green component of the color
+ * @param b the blue component of the color
+ * @return an array of three elements containing the hue, saturation,
+ * and lightness (in that order), of the color with
+ * the indicated red, green, and blue components.
+ */
+ public static float[] RGBtoHSL(int r, int g, int b) {
+ float varR = (r / 255f);
+ float varG = (g / 255f);
+ float varB = (b / 255f);
+
+ float varMin = Math.min(varR, Math.min(varG, varB)); //Min value of RGB
+ float varMax = Math.max(varR, Math.max(varG, varB)); //Max value of RGB
+ float delMax = varMax - varMin; //Delta RGB value
+
+ float h = 0;
+ float s = 0;
+ float l = (varMax + varMin) / 2;
+
+ if(delMax == 0 || l == 0) {
+ s = 0;
+ } else if (l == 1) {
+ s = 1;
+ } else if(l <= 0.5) {
+ s = delMax / (2 * (1 - l));
+ } else if(l > 0.5) {
+ s = delMax / (2 * l);
+ }
+
+ if(delMax == 0) {
+ h = 0;
+ } else if (varMax == varR && g >= b) {
+ h = 60 * (varG - varB) / delMax + 0;
+ } else if (varMax == varR && varG < b) {
+ h = 60 * (varG - varB) / delMax + 360;
+ } else if (varMax == varG) {
+ h = 60 * (varB - varR) / delMax + 120;
+ } else if (varMax == varB) {
+ h = 60 * (varR - varG) / delMax + 240;
+ }
+
+ return new float[] { h, s, l };
+ }
+
+ /**
+ * Converts the components of a color, as specified by the HSL
+ * model, to an equivalent set of values for the default RGB model.
+ * <p>
+ * The <code>saturation</code> and <code>lightness</code> components
+ * should be floating-point values between zero and one
+ * (numbers in the range 0.0-1.0). The <code>hue</code> component
+ * can be any floating-point number. The floor of this number is
+ * subtracted from it to create a fraction between 0 and 1. This
+ * fractional number is then multiplied by 360 to produce the hue
+ * angle in the HSB color model.
+ * @param h the hue component of the color
+ * @param s the saturation of the color
+ * @param l the lightness of the color
+ * @return the RGB value of the color with the indicated hue,
+ * saturation, and lightness
+ */
+ public static Color HSLtoRGB(float h, float s, float l) {
+ float q;
+ if (l < 0.5) {
+ q = l * (1 + s);
+ } else {
+ q = l + s - (l * s);
+ }
+
+ float p = 2 * l - q;
+ float hNorm = h / 360;
+
+ float tR = hNorm + 1f/3f;
+ float tG = hNorm;
+ float tB = hNorm - 1f/3f;
+
+ float r = tC2C(tR, p, q);
+ float g = tC2C(tG, p, q);
+ float b = tC2C(tB, p, q);
+
+ return new Color(r, g, b);
+ }
+
+ private static float tC2C(float tC, float p, float q)
+ {
+ float retVal;
+
+ if (tC < 0) {
+ tC += 1;
+ }
+
+ if (tC > 1) {
+ tC -= 1;
+ }
+
+ if ((6 * tC) < 1) {
+ retVal = (p + (q - p) * 6 * tC);
+ } else if ((2 * tC) < 1) {
+ retVal = q;
+ } else if ((3 * tC) < 2) {
+ retVal = (p + (q - p) * 6 * (2f / 3f - tC));
+ } else {
+ retVal = p;
+ }
+
+ return retVal;
+ }
+
+ /**
+ * Increases/decreases brightness of the given color by the specified <code>difference</code>.
+ * <p>
+ * The <code>difference</code> values in the range (-1.0, 1.0): 1.0 - the brightest value;
+ * -1.0 - the dimmest value.
+ *
+ * @param c color to adjust
+ * @param difference value to be added to the current brightness
+ *
+ * @return a new <code>Color</code> instance with increased/decreased brightness by specified <code>difference</code>
+ * @throws IllegalArgumentException if difference is outside of the range -1.0 to 1.0, inclusive
+ */
+ public static Color adjustBrightness(Color c, float difference) {
+ if (difference < -1.0 || difference > 1.0) {
+ throw new IllegalArgumentException("Difference parameter outside of expected range: " +
+ "Difference parameter should be floating-point values between -1 and 1");
+ }
+
+ float[] hsb = Color.RGBtoHSB(c.getRed(), c.getGreen(), c.getBlue(), null);
+ float brightness = Math.min(1.0f, Math.max(0.0f, hsb[2] + difference));
+ return new Color(Color.HSBtoRGB(hsb[0], hsb[1], brightness));
+ }
+
+ /**
+ * Increases/decreases lightness of the given color by the specified <code>difference</code>.
+ * <p>
+ * The <code>difference</code> values in the range (-1.0, 1.0): 1.0 - the lightest value;
+ * -1.0 - on the contrary.
+ *
+ * @param c color to adjust
+ * @param difference value to be added to the current lightness
+ *
+ * @return a new <code>Color</code> instance with increased/decreased lightness by specified <code>difference</code>
+ * @throws IllegalArgumentException if difference is outside of the range -1.0 to 1.0, inclusive
+ */
+ public static Color adjustLightness(Color c, float difference) {
+ if (difference < -1.0 || difference > 1.0) {
+ throw new IllegalArgumentException("Difference parameter outside of expected range: " +
+ "Difference parameter should be floating-point values between -1 and 1");
+ }
+
+ float[] hsl = RGBtoHSL(c.getRed(), c.getGreen(), c.getBlue());
+ float lightness = Math.min(1.0f, Math.max(0.0f, hsl[2] + difference));
+ return HSLtoRGB(hsl[0], hsl[1], lightness);
+ }
+
+ /**
+ * Overwrites alpha value for given color.
+ *
+ * @param c color to overwrite
+ * @param alpha a new value of alpha
+ * @return a new <code>Color</code> object with a new specified alpha value
+ */
+ public static Color overwriteAlpha(Color c, float alpha) {
+ Color retVal = c;
+ if (c != null) {
+ retVal = new Color(c.getRed(), c.getGreen(), c.getBlue(),
+ (int) (alpha * 255 + 0.5));
+ }
+ return retVal;
+ }
+
+}
Property changes on: trunk/sandbox/ui/progressBAR/src/main/java/org/richfaces/renderkit/html/images/ColorUtils.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
16 years, 3 months
JBoss Rich Faces SVN: r5831 - trunk/ui/listShuttle/src/main/java/org/richfaces/renderkit.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2008-02-05 11:40:04 -0500 (Tue, 05 Feb 2008)
New Revision: 5831
Modified:
trunk/ui/listShuttle/src/main/java/org/richfaces/renderkit/ListShuttleControlsHelper.java
Log:
buttons rendering from server side
Modified: trunk/ui/listShuttle/src/main/java/org/richfaces/renderkit/ListShuttleControlsHelper.java
===================================================================
--- trunk/ui/listShuttle/src/main/java/org/richfaces/renderkit/ListShuttleControlsHelper.java 2008-02-05 16:40:01 UTC (rev 5830)
+++ trunk/ui/listShuttle/src/main/java/org/richfaces/renderkit/ListShuttleControlsHelper.java 2008-02-05 16:40:04 UTC (rev 5831)
@@ -70,6 +70,8 @@
private final static String DEFAULT_LABEL_REMOVE = "Remove";
private final static String DEFAULT_LABEL_REMOVE_ALL = "Remove All";
+ public final static String DISABLED_STYLE_PREF = "-disabled";
+
protected static final OrderingComponentRendererBase.ControlsHelper[] HELPERS = new OrderingComponentRendererBase.ControlsHelper[] {
new OrderingComponentRendererBase.ControlsHelper("copyAll", "COPY_ALL_LABEL", DEFAULT_LABEL_COPY_ALL, ListShuttleIconCopyAll.class.getName(), FACET_COPY_ALL,
"-copyall", ATTRIBUTE_CLASS_COPY_ALL_CONTROL, "",
@@ -81,7 +83,7 @@
},
new OrderingComponentRendererBase.ControlsHelper("disabledCopyAll", "COPY_ALL_LABEL", DEFAULT_LABEL_COPY_ALL, ListShuttleIconCopyAllDisabled.class.getName(), FACET_DIS_COPY_ALL,
- "-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, "-disabled",
+ "-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, DISABLED_STYLE_PREF,
DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_COPY_ALL), null, false, "copyAll".concat(OrderingComponentControlsHelper.CONTROL_LABEL_ATTRIBUTE_SUFFIX)) {
public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
@@ -99,7 +101,7 @@
},
new OrderingComponentRendererBase.ControlsHelper("disabledCopy", "COPY_LABEL", DEFAULT_LABEL_COPY, ListShuttleIconCopyDisabled.class.getName(), FACET_DIS_COPY,
- "-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, "-disabled",
+ "-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, DISABLED_STYLE_PREF,
DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_COPY), null, false, "copy".concat(OrderingComponentControlsHelper.CONTROL_LABEL_ATTRIBUTE_SUFFIX)) {
public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
@@ -117,7 +119,7 @@
},
new OrderingComponentRendererBase.ControlsHelper("disabledRemove", "REMOVE_LABEL", DEFAULT_LABEL_REMOVE, ListShuttleIconRemoveDisabled.class.getName(), FACET_DIS_REMOVE,
- "-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, "-disabled",
+ "-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, DISABLED_STYLE_PREF,
DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_REMOVE), null, false, "remove".concat(OrderingComponentControlsHelper.CONTROL_LABEL_ATTRIBUTE_SUFFIX)) {
public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
@@ -135,7 +137,7 @@
},
new OrderingComponentRendererBase.ControlsHelper("disabledRemoveAll", "REMOVE_ALL_LABEL", DEFAULT_LABEL_REMOVE_ALL, ListShuttleIconRemoveAllDisabled.class.getName(), FACET_DIS_REMOVE_ALL,
- "-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, "-disabled",
+ "-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, DISABLED_STYLE_PREF,
DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_REMOVE_ALL), null, false, "removeAll".concat(OrderingComponentControlsHelper.CONTROL_LABEL_ATTRIBUTE_SUFFIX)) {
public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
16 years, 3 months
JBoss Rich Faces SVN: r5830 - trunk/sandbox/ui/pickList/src/main/java/org/richfaces/renderkit.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2008-02-05 11:40:01 -0500 (Tue, 05 Feb 2008)
New Revision: 5830
Modified:
trunk/sandbox/ui/pickList/src/main/java/org/richfaces/renderkit/PickListRenderer.java
Log:
buttons rendering from server side
Modified: trunk/sandbox/ui/pickList/src/main/java/org/richfaces/renderkit/PickListRenderer.java
===================================================================
--- trunk/sandbox/ui/pickList/src/main/java/org/richfaces/renderkit/PickListRenderer.java 2008-02-05 16:35:03 UTC (rev 5829)
+++ trunk/sandbox/ui/pickList/src/main/java/org/richfaces/renderkit/PickListRenderer.java 2008-02-05 16:40:01 UTC (rev 5830)
@@ -387,7 +387,7 @@
} else if (helper.getDefaultText().equals(PickListControlsHelper.DEFAULT_LABEL_COPY_ALL)) {
enable = isAvailableList;
} else {
- if (helper.getButtonStyleClass().equals(OrderingComponentControlsHelper.DISABLED_STYLE_PREF)) {
+ if (helper.getButtonStyleClass().equals(ListShuttleControlsHelper.DISABLED_STYLE_PREF)) {
enable = true;
} else {
enable = false;
16 years, 3 months
JBoss Rich Faces SVN: r5829 - trunk/ui/orderingList/src/main/java/org/richfaces/renderkit.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2008-02-05 11:35:03 -0500 (Tue, 05 Feb 2008)
New Revision: 5829
Modified:
trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentControlsHelper.java
Log:
buttons rendering from server side
Modified: trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentControlsHelper.java
===================================================================
--- trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentControlsHelper.java 2008-02-05 16:34:30 UTC (rev 5828)
+++ trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/OrderingComponentControlsHelper.java 2008-02-05 16:35:03 UTC (rev 5829)
@@ -72,6 +72,8 @@
private final static String DEFAULT_LABEL_DOWN = "Down";
private final static String DEFAULT_LABEL_BOTTOM = "Last";
+ public final static String DISABLED_STYLE_PREF = "-disabled";
+
protected static final OrderingComponentRendererBase.ControlsHelper[] HELPERS = new OrderingComponentRendererBase.ControlsHelper[] {
new OrderingComponentRendererBase.ControlsHelper("top", "TOP_LABEL", DEFAULT_LABEL_TOP, OrderingListIconTop.class.getName(), FACET_TOP,
"-top", ATTRIBUTE_CLASS_TOP_CONTROL, "",
@@ -83,7 +85,7 @@
},
new OrderingComponentRendererBase.ControlsHelper("disabledTop", "TOP_LABEL", DEFAULT_LABEL_TOP, OrderingListIconTopDisabled.class.getName(), FACET_DIS_TOP,
- "-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, "-disabled",
+ "-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, DISABLED_STYLE_PREF,
DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_TOP), null, false, "top".concat(CONTROL_LABEL_ATTRIBUTE_SUFFIX)) {
public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
@@ -101,7 +103,7 @@
},
new OrderingComponentRendererBase.ControlsHelper("disabledUp", "UP_LABEL", DEFAULT_LABEL_UP, OrderingListIconUpDisabled.class.getName(), FACET_DIS_UP,
- "-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, "-disabled",
+ "-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, DISABLED_STYLE_PREF,
DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_UP), null, false, "up".concat(CONTROL_LABEL_ATTRIBUTE_SUFFIX)) {
public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
@@ -119,7 +121,7 @@
},
new OrderingComponentRendererBase.ControlsHelper("disabledDown", "DOWN_LABEL", DEFAULT_LABEL_DOWN, OrderingListIconDownDisabled.class.getName(), FACET_DIS_DOWN,
- "-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, "-disabled",
+ "-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, DISABLED_STYLE_PREF,
DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_DOWN), null, false, "down".concat(CONTROL_LABEL_ATTRIBUTE_SUFFIX)) {
public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
@@ -137,7 +139,7 @@
},
new OrderingComponentRendererBase.ControlsHelper("disabledBottom", "BOTTOM_LABEL", DEFAULT_LABEL_BOTTOM, OrderingListIconBottomDisabled.class.getName(), FACET_DIS_BOTTOM,
- "-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, "-disabled",
+ "-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, DISABLED_STYLE_PREF,
DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_BOTTOM), null, false, "bottom".concat(CONTROL_LABEL_ATTRIBUTE_SUFFIX)) {
public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
16 years, 3 months
JBoss Rich Faces SVN: r5828 - in trunk/sandbox/ui/pickList/src/main: resources/org/richfaces/renderkit/html/scripts and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2008-02-05 11:34:30 -0500 (Tue, 05 Feb 2008)
New Revision: 5828
Modified:
trunk/sandbox/ui/pickList/src/main/java/org/richfaces/renderkit/PickListControlsHelper.java
trunk/sandbox/ui/pickList/src/main/java/org/richfaces/renderkit/PickListRenderer.java
trunk/sandbox/ui/pickList/src/main/resources/org/richfaces/renderkit/html/scripts/PickList.js
Log:
buttons rendering from server side
Modified: trunk/sandbox/ui/pickList/src/main/java/org/richfaces/renderkit/PickListControlsHelper.java
===================================================================
--- trunk/sandbox/ui/pickList/src/main/java/org/richfaces/renderkit/PickListControlsHelper.java 2008-02-05 16:06:05 UTC (rev 5827)
+++ trunk/sandbox/ui/pickList/src/main/java/org/richfaces/renderkit/PickListControlsHelper.java 2008-02-05 16:34:30 UTC (rev 5828)
@@ -65,10 +65,10 @@
private final static String CONTROL_ID_REMOVE_ALL = "removeAll";
- private final static String DEFAULT_LABEL_COPY_ALL = "Copy all";
+ public final static String DEFAULT_LABEL_COPY_ALL = "Copy all";
private final static String DEFAULT_LABEL_COPY = "Copy";
private final static String DEFAULT_LABEL_REMOVE = "Remove";
- private final static String DEFAULT_LABEL_REMOVE_ALL = "Remove All";
+ public final static String DEFAULT_LABEL_REMOVE_ALL = "Remove All";
protected static final OrderingComponentRendererBase.ControlsHelper[] HELPERS = new OrderingComponentRendererBase.ControlsHelper[] {
new OrderingComponentRendererBase.ControlsHelper("copyAll", "COPY_ALL_LABEL", DEFAULT_LABEL_COPY_ALL, ListShuttleIconCopyAll.class.getName(), FACET_COPY_ALL,
@@ -91,7 +91,7 @@
},
new OrderingComponentRendererBase.ControlsHelper("copy", "COPY_LABEL", DEFAULT_LABEL_COPY, ListShuttleIconCopy.class.getName(), FACET_COPY,
"-copy", ATTRIBUTE_CLASS_COPY_CONTROL, "",
- CONTROL_ID_COPY, ATTRIBUTE_CE_ONCOPYCLICK ,true, "copy".concat(OrderingComponentControlsHelper.CONTROL_LABEL_ATTRIBUTE_SUFFIX)) {
+ CONTROL_ID_COPY, ATTRIBUTE_CE_ONCOPYCLICK ,false, "copy".concat(OrderingComponentControlsHelper.CONTROL_LABEL_ATTRIBUTE_SUFFIX)) {
public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
return true;
@@ -100,7 +100,7 @@
},
new OrderingComponentRendererBase.ControlsHelper("disabledCopy", "COPY_LABEL", DEFAULT_LABEL_COPY, ListShuttleIconCopyDisabled.class.getName(), FACET_DIS_COPY,
"-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, "-disabled",
- DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_COPY), null, false, "copy".concat(OrderingComponentControlsHelper.CONTROL_LABEL_ATTRIBUTE_SUFFIX)) {
+ DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_COPY), null, true, "copy".concat(OrderingComponentControlsHelper.CONTROL_LABEL_ATTRIBUTE_SUFFIX)) {
public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
return true;
@@ -109,7 +109,7 @@
},
new OrderingComponentRendererBase.ControlsHelper("remove", "REMOVE_LABEL", DEFAULT_LABEL_REMOVE, ListShuttleIconRemove.class.getName(), FACET_REMOVE,
"-remove", ATTRIBUTE_CLASS_REMOVE_CONTROL, "",
- CONTROL_ID_REMOVE, ATTRIBUTE_CE_ONREMOVECLICK, true, "remove".concat(OrderingComponentControlsHelper.CONTROL_LABEL_ATTRIBUTE_SUFFIX)) {
+ CONTROL_ID_REMOVE, ATTRIBUTE_CE_ONREMOVECLICK, false, "remove".concat(OrderingComponentControlsHelper.CONTROL_LABEL_ATTRIBUTE_SUFFIX)) {
public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
return true;
@@ -118,7 +118,7 @@
},
new OrderingComponentRendererBase.ControlsHelper("disabledRemove", "REMOVE_LABEL", DEFAULT_LABEL_REMOVE, ListShuttleIconRemoveDisabled.class.getName(), FACET_DIS_REMOVE,
"-disabled", ATTRIBUTE_CLASS_DISABLED_CONTROL, "-disabled",
- DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_REMOVE), null, false, "remove".concat(OrderingComponentControlsHelper.CONTROL_LABEL_ATTRIBUTE_SUFFIX)) {
+ DIS_CONTROL_ID_PREFIX.concat(CONTROL_ID_REMOVE), null, true, "remove".concat(OrderingComponentControlsHelper.CONTROL_LABEL_ATTRIBUTE_SUFFIX)) {
public boolean isRendered(FacesContext context, UIOrderingBaseComponent list) {
return true;
Modified: trunk/sandbox/ui/pickList/src/main/java/org/richfaces/renderkit/PickListRenderer.java
===================================================================
--- trunk/sandbox/ui/pickList/src/main/java/org/richfaces/renderkit/PickListRenderer.java 2008-02-05 16:06:05 UTC (rev 5827)
+++ trunk/sandbox/ui/pickList/src/main/java/org/richfaces/renderkit/PickListRenderer.java 2008-02-05 16:34:30 UTC (rev 5828)
@@ -51,6 +51,8 @@
protected static final OrderingComponentRendererBase.ControlsHelper[] SHUTTLE_HELPERS = ListShuttleControlsHelper.HELPERS;
protected final static String SHOW_LABELS_ATTRIBUTE_NAME = "showButtonLabels";
private static final String MESSAGE_BUNDLE_NAME = OrderingListRendererBase.class.getPackage().getName() + "ListShuttle";
+ private boolean isSelectedList;
+ private boolean isAvailableList;
protected List selectItemsForSelectedList(FacesContext facesContext,UIComponent uiComponent, List selectItemList, Converter converter, Set lookupSet) {
List selectItemForSelectedValues = new ArrayList(lookupSet.size());
@@ -165,7 +167,8 @@
Set lookupSet = PickListUtils.getSubmittedOrSelectedValuesAsSet(true, component, context, converter);
List selectItemsForSelectedValues = selectItemsForSelectedList(context, component, selectItemsList, converter, lookupSet); //TODO: optimaze
List selectItemsForAvailableList = selectItemsForAvailableList(context, component, selectItemsList, selectItemsForSelectedValues, converter);
-
+ isSelectedList = !selectItemsForSelectedValues.isEmpty();
+ isAvailableList = !selectItemsForAvailableList.isEmpty();
List selectItemList = null;
if (source) {
selectItemList = selectItemsForAvailableList;
@@ -376,10 +379,22 @@
ResponseWriter writer = context.getResponseWriter();
int divider = SHUTTLE_HELPERS.length / 2;
-
+ boolean enable;
for (int i = 0; i < SHUTTLE_HELPERS.length; i++) {
- encodeControlFacet(context, component, SHUTTLE_HELPERS[i], clientId, writer, true,
- "rich-list-picklist-button", " rich-picklist-control");
+ OrderingComponentRendererBase.ControlsHelper helper = SHUTTLE_HELPERS[i];
+ if (helper.getDefaultText().equals(PickListControlsHelper.DEFAULT_LABEL_REMOVE_ALL)) {
+ enable = isSelectedList;
+ } else if (helper.getDefaultText().equals(PickListControlsHelper.DEFAULT_LABEL_COPY_ALL)) {
+ enable = isAvailableList;
+ } else {
+ if (helper.getButtonStyleClass().equals(OrderingComponentControlsHelper.DISABLED_STYLE_PREF)) {
+ enable = true;
+ } else {
+ enable = false;
+ }
+ }
+ encodeControlFacet(context, component, SHUTTLE_HELPERS[i], clientId, writer, enable,
+ "rich-list-picklist-button", " rich-picklist-control");
}
}
Modified: trunk/sandbox/ui/pickList/src/main/resources/org/richfaces/renderkit/html/scripts/PickList.js
===================================================================
--- trunk/sandbox/ui/pickList/src/main/resources/org/richfaces/renderkit/html/scripts/PickList.js 2008-02-05 16:06:05 UTC (rev 5827)
+++ trunk/sandbox/ui/pickList/src/main/resources/org/richfaces/renderkit/html/scripts/PickList.js 2008-02-05 16:34:30 UTC (rev 5828)
@@ -4,7 +4,7 @@
initialize : function($super, targetList, sourceList, clientId, controlIds, switchByClick, sourceLayoutManager, targetLayoutManager, onlistchanged, valueKeeperId) {
$super(targetList, sourceList, clientId, controlIds, switchByClick, sourceLayoutManager, targetLayoutManager, onlistchanged);
this.valueKeeper = $(valueKeeperId);
- this.controlListManager();
+ //this.controlListManager();
},
moveItems : function($super, sourceComponent, targetComponent, items) {
16 years, 3 months
JBoss Rich Faces SVN: r5827 - trunk/test-applications/facelets/src/main/webapp/DataScroller.
by richfaces-svn-commits@lists.jboss.org
Author: ayanul
Date: 2008-02-05 11:06:05 -0500 (Tue, 05 Feb 2008)
New Revision: 5827
Modified:
trunk/test-applications/facelets/src/main/webapp/DataScroller/DataScroller.xhtml
Log:
http://jira.jboss.com/jira/browse/RF-1893
Modified: trunk/test-applications/facelets/src/main/webapp/DataScroller/DataScroller.xhtml
===================================================================
--- trunk/test-applications/facelets/src/main/webapp/DataScroller/DataScroller.xhtml 2008-02-05 16:04:56 UTC (rev 5826)
+++ trunk/test-applications/facelets/src/main/webapp/DataScroller/DataScroller.xhtml 2008-02-05 16:06:05 UTC (rev 5827)
@@ -3,7 +3,7 @@
<h:dataTable id="dataTableId" value="#{dataScroller.dataTable}"
var="dT" cellpadding="5px" rows="5" border="1">
<f:facet name="header">
- <rich:datascroller fastControls="#{dataScroller.fastControls}"
+ <rich:datascroller reRender="dataTableId" fastControls="#{dataScroller.fastControls}"
align="#{dataScroller.align}" rendered="#{dataScroller.render}"
limitToList="#{dataScroller.limitToList}"
renderIfSinglePage="#{dataScroller.renderIfSinglePage}"
16 years, 3 months