JBoss Rich Faces SVN: r5414 - in trunk/sandbox/ui/progressBAR/src: main/java/org/richfaces/renderkit and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-01-16 08:50:02 -0500 (Wed, 16 Jan 2008)
New Revision: 5414
Modified:
trunk/sandbox/ui/progressBAR/src/main/config/component/progressBar.xml
trunk/sandbox/ui/progressBAR/src/main/java/org/richfaces/renderkit/AbstractProgressBarRenderer.java
trunk/sandbox/ui/progressBAR/src/main/resources/org/richfaces/renderkit/html/js/progressBar.js
trunk/sandbox/ui/progressBAR/src/main/templates/org/richfaces/progressBar.jspx
trunk/sandbox/ui/progressBAR/src/test/java/org/richfaces/sandbox/ProgressBarComponentTest.java
Log:
Implementing changes made in component spec.
Modified: trunk/sandbox/ui/progressBAR/src/main/config/component/progressBar.xml
===================================================================
--- trunk/sandbox/ui/progressBAR/src/main/config/component/progressBar.xml 2008-01-16 13:39:33 UTC (rev 5413)
+++ trunk/sandbox/ui/progressBAR/src/main/config/component/progressBar.xml 2008-01-16 13:50:02 UTC (rev 5414)
@@ -34,6 +34,23 @@
<description>Attributes defines AJAX or CLIENT modes for component</description>
<defaultvalue><![CDATA["ajax"]]></defaultvalue>
</property>
+ <property>
+ <name>minValue</name>
+ <classname>java.lang.Object</classname>
+ <description>Min value when initial state should be rendered</description>
+ <defaultvalue>0</defaultvalue>
+ </property>
+ <property>
+ <name>maxValue</name>
+ <classname>java.lang.Object</classname>
+ <description>Max value after whose complete state should be rendered</description>
+ <defaultvalue>100</defaultvalue>
+ </property>
+ <property>
+ <name>progressVar</name>
+ <classname>java.lang.String</classname>
+ <description>Attribute which should provide access to value of the component on the client</description>
+ </property>
<property>
<name>styleClass</name>
<classname>java.lang.String</classname>
@@ -50,6 +67,16 @@
<description>CSS class that defines style for remained part of progress bar</description>
</property>
<property>
+ <name>initialClass</name>
+ <classname>java.lang.String</classname>
+ <description>CSS class that defines style for initial state of the component</description>
+ </property>
+ <property>
+ <name>finishClass</name>
+ <classname>java.lang.String</classname>
+ <description>CSS class that defines style for complete state of the component</description>
+ </property>
+ <property>
<name>determined</name>
<classname>boolean</classname>
<description>Attribute defines if component should render percent value</description>
Modified: trunk/sandbox/ui/progressBAR/src/main/java/org/richfaces/renderkit/AbstractProgressBarRenderer.java
===================================================================
--- trunk/sandbox/ui/progressBAR/src/main/java/org/richfaces/renderkit/AbstractProgressBarRenderer.java 2008-01-16 13:39:33 UTC (rev 5413)
+++ trunk/sandbox/ui/progressBAR/src/main/java/org/richfaces/renderkit/AbstractProgressBarRenderer.java 2008-01-16 13:50:02 UTC (rev 5414)
@@ -12,6 +12,9 @@
import java.util.Map;
import java.util.Set;
+import javax.el.ELContext;
+import javax.el.ValueExpression;
+import javax.el.VariableMapper;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
@@ -26,6 +29,8 @@
import org.ajax4jsf.renderkit.RendererUtils.HTML;
import org.richfaces.component.UIProgressBar;
+import sun.management.counter.Variability;
+
/**
* Abstract progress bar renderer
*
@@ -84,37 +89,11 @@
component.getClientId(context)).append("')");
}
script.append(";\n");
- // script.append(getPercentValueScript(component));
writer.writeText(script.toString(), null);
writer.endElement(HTML.SCRIPT_ELEM);
writer.endElement(HTML.SPAN_ELEM);
}
- // private StringBuffer getPercentValueScript(UIComponent component)
- // throws IOException {
- // StringBuffer script = new StringBuffer();
- // ComponentVariables variables = ComponentsVariableResolver.getVariables(
- // this, component);
- // String percent = getPercent(component);
- // return script;
- //
- // }
-
- // TODO do not encode content twice, use node cloning on client
- // TODO provide client script with percent value
- public String encodePersent(FacesContext context, UIComponent component)
- throws IOException {
- Boolean determinedAttr = (Boolean) component.getAttributes().get(
- "determined");
- if (determinedAttr != null && determinedAttr.booleanValue()) {
- String percent = getPercent(component);
- if (percent != null) {
- return percent + "%";
- }
- }
- return "";
- }
-
/**
* Methods encodes start facet of progress bar component
*
@@ -129,8 +108,13 @@
Object data) throws IOException {
Boolean isAjax = Boolean.parseBoolean((String) data);
String clientId = component.getClientId(context);
+ String initialClass = (String) component.getAttributes().get(
+ "initialClass");
+ String style = (String) component.getAttributes().get("style");
ResponseWriter writer = context.getResponseWriter();
writer.startElement(HTML.DIV_ELEM, component);
+ getUtils().writeAttribute(writer, HTML.class_ATTRIBUTE, initialClass);
+ getUtils().writeAttribute(writer, "style", style);
writer.writeAttribute(HTML.id_ATTRIBUTE, (isAjax ? clientId : clientId
+ ":initialState"), null);
@@ -145,6 +129,27 @@
}
+ /**
+ * Sets up the progressVar page attribute
+ * @param context - facesContext
+ * @param component - component instance
+ * @param value - percent value
+ */
+ public void setProgressVar(FacesContext context, UIComponent component,
+ Object value) {
+ Number persent = getNumber(value);
+ String progresssVar = (String) component.getAttributes().get(
+ "progressVar");
+ Map attrs = context.getExternalContext().getRequestMap();
+ attrs.put(progresssVar, persent);
+ }
+
+ /**
+ * Encodes progress state of component
+ * @param context - faces context
+ * @param component - component instance
+ * @throws IOException
+ */
public void encodeProgressState(FacesContext context, UIComponent component)
throws IOException {
ResponseWriter writer = context.getResponseWriter();
@@ -153,9 +158,11 @@
this, component);
Number value = (Number) variables.getVariable("percent");
String width = String.valueOf(value.intValue());
- String percent = encodePersent(context, component);
String style = (String) component.getAttributes().get("style");
- Boolean permanent = (Boolean) component.getAttributes().get("permanent");
+ Boolean permanent = (Boolean) component.getAttributes()
+ .get("permanent");
+ Boolean determined = (Boolean) component.getAttributes().get(
+ "determined");
if (!(permanent != null && permanent.booleanValue())) {
@@ -174,7 +181,9 @@
getUtils().writeAttribute(writer, "id", clientId + ":remain");
getUtils().writeAttribute(writer, "style", style);
- writer.write(percent);
+ if (determined.booleanValue()) {
+ renderChildren(context, component);
+ }
writer.endElement("div");
writer.startElement("div", component);
@@ -190,17 +199,24 @@
getUtils().writeAttribute(writer, "id", clientId + ":complete");
getUtils().writeAttribute(writer, "style", style);
- writer.write(percent);
+ if (determined.booleanValue()) {
+ renderChildren(context, component);
+ }
writer.endElement("div");
writer.endElement("div");
} else {
writer.startElement("div", component);
- getUtils().writeAttribute(writer, "class","rich-progress-bar-permanent");
+ getUtils().writeAttribute(writer, "class",
+ "rich-progress-bar-permanent");
getUtils().writeAttribute(writer, "style", style + " width: 100%");
writer.endElement("div");
}
}
+
+ private void encodeChildrenComponents (FacesContext context, UIComponent component) {
+
+ }
/**
* Methods encodes finish facet of progress bar component
@@ -232,11 +248,16 @@
String clientId = (isAjax) ? component.getClientId(context) : component
.getClientId(context)
+ ":completedState";
+ String finishClass = (String) component.getAttributes().get(
+ "finishClass");
+ String style = (String) component.getAttributes().get("style");
ResponseWriter writer = context.getResponseWriter();
writer.startElement(HTML.DIV_ELEM, component);
writer.writeAttribute(HTML.id_ATTRIBUTE, clientId, null);
+ getUtils().writeAttribute(writer, HTML.class_ATTRIBUTE, finishClass);
+ getUtils().writeAttribute(writer, "style", style);
- UIComponent completed = component.getFacet("completed");
+ UIComponent completed = component.getFacet("complete");
if (completed != null) {
renderChild(context, completed);
}
@@ -244,19 +265,25 @@
}
- private String getPercent(UIComponent component) {
- ComponentVariables variables = ComponentsVariableResolver.getVariables(
- this, component);
- String result = "0";
- Object percent = variables.getVariable("percent");
- if (percent != null) {
+ /**
+ * Converts value attr to number value
+ * @param v - value attr
+ * @return result
+ */
+ public Number getNumber(Object v) {
+ Number result = new Integer(0);
+ if (v != null) {
try {
- Number n = (Number) percent;
- if (n instanceof BigDecimal || n instanceof Double
- || n instanceof Float) {
- result = String.valueOf(n.floatValue());
- } else if (n instanceof Integer) {
- result = String.valueOf(n.intValue());
+ if (v instanceof String) {
+ result = Double.parseDouble((String) v);
+ } else {
+ Number n = (Number) v;
+ if (n instanceof BigDecimal || n instanceof Double
+ || n instanceof Float) {
+ result = n.floatValue();
+ } else if (n instanceof Integer) {
+ result = n.intValue();
+ }
}
} catch (Exception e) {
// TODO: handle exception
@@ -288,5 +315,23 @@
poll.setSubmitted(submitted);
return submitted;
}
+
+
+ /* (non-Javadoc)
+ * @see javax.faces.render.Renderer#getRendersChildren()
+ */
+ @Override
+ public boolean getRendersChildren() {
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.renderkit.AjaxCommandRendererBase#encodeChildren(javax.faces.context.FacesContext, javax.faces.component.UIComponent)
+ */
+ @Override
+ public void encodeChildren(FacesContext context, UIComponent component)
+ throws IOException {
+ return; // We don't need to render children !
+ }
}
Modified: trunk/sandbox/ui/progressBAR/src/main/resources/org/richfaces/renderkit/html/js/progressBar.js
===================================================================
--- trunk/sandbox/ui/progressBAR/src/main/resources/org/richfaces/renderkit/html/js/progressBar.js 2008-01-16 13:39:33 UTC (rev 5413)
+++ trunk/sandbox/ui/progressBAR/src/main/resources/org/richfaces/renderkit/html/js/progressBar.js 2008-01-16 13:50:02 UTC (rev 5414)
@@ -23,7 +23,8 @@
if (val.indexOf("%") < 0)
val = val + "%";
}
- if (p > 100) { this.switchMode("completed"); return; }
+ var max = $(this.id + ":max").value;
+ if ( parseFloat(p) >= parseFloat(max)) { this.switchMode("completed"); return; }
if ($(this.id + ":progressState") != null)
{
Modified: trunk/sandbox/ui/progressBAR/src/main/templates/org/richfaces/progressBar.jspx
===================================================================
--- trunk/sandbox/ui/progressBAR/src/main/templates/org/richfaces/progressBar.jspx 2008-01-16 13:39:33 UTC (rev 5413)
+++ trunk/sandbox/ui/progressBAR/src/main/templates/org/richfaces/progressBar.jspx 2008-01-16 13:50:02 UTC (rev 5414)
@@ -21,10 +21,10 @@
if (!mode.equalsIgnoreCase("client") && !mode.equalsIgnoreCase("ajax")) {
throw new IOException("Mode attribute should have 'client' or 'ajax' value");
}
+ Number minValue = getNumber(component.getAttributes().get("minValue"));
+ Number maxValue = getNumber(component.getAttributes().get("maxValue"));
boolean isAjax = ("ajax".equalsIgnoreCase(mode));
- Boolean enabled = (Boolean) component.getAttributes().get("enabled");
- Number value = (Number)component.getAttributes().get("value");
- Integer percent = value.intValue();
+ Number value = getNumber(component.getAttributes().get("value"));
variables.setVariable("percent",value);
variables.setVariable("style",(String)component.getAttributes().get("style"));
variables.setVariable("styleClass",(String)component.getAttributes().get("styleClass"));
@@ -36,9 +36,10 @@
<jsp:scriptlet>
<![CDATA[
if (isAjax) {
-if (!enabled && percent == 0) {
+setProgressVar(context, component, value);
+if (value.doubleValue() < minValue.doubleValue()) {
encodeInitialState(context, component, "true");
-} else if (!enabled && percent >= 100 ) {
+} else if (value.doubleValue() >= maxValue.doubleValue() ) {
encodeCompletedState(context, component, "true");
} else {
]]>
@@ -53,7 +54,7 @@
}else {
]]>
</jsp:scriptlet>
-<div id="#{clientId}">
+<div id="#{clientId}" style="#{style}">
<div id="#{clientId}:progressState" class="rich-progress-bar #{styleClass}" style="#{style}">
<f:call name="encodeProgressState" />
</div>
@@ -63,6 +64,8 @@
<f:call name="encodeCompletedState">
<f:parameter value="false"/>
</f:call>
+ <input type="hidden" id="#{clientId}:min" value="#{component.attributes['minValue']}" />
+ <input type="hidden" id="#{clientId}:max" value="#{component.attributes['maxValue']}" />
<script>
var pr = new ProgressBar('#{clientId}');
pr.init();
Modified: trunk/sandbox/ui/progressBAR/src/test/java/org/richfaces/sandbox/ProgressBarComponentTest.java
===================================================================
--- trunk/sandbox/ui/progressBAR/src/test/java/org/richfaces/sandbox/ProgressBarComponentTest.java 2008-01-16 13:39:33 UTC (rev 5413)
+++ trunk/sandbox/ui/progressBAR/src/test/java/org/richfaces/sandbox/ProgressBarComponentTest.java 2008-01-16 13:50:02 UTC (rev 5414)
@@ -1,14 +1,18 @@
package org.richfaces.sandbox;
+import javax.el.ValueExpression;
import javax.faces.component.UIForm;
+import javax.faces.component.UIOutput;
import javax.faces.component.html.HtmlForm;
import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+import org.ajax4jsf.tests.MockValueExpression;
import org.richfaces.component.UIProgressBar;
import com.gargoylesoftware.htmlunit.html.DomText;
import com.gargoylesoftware.htmlunit.html.HtmlElement;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.sun.corba.se.spi.legacy.connection.GetEndPointInfoAgainException;
/**
* Unit test for Progress bar component.
@@ -20,6 +24,9 @@
/** Progress bar component */
private UIProgressBar progressBar = null;
+
+ /** Child component for progres bar */
+ private UIOutput output = null;
/**
* TODO Description goes here.
@@ -49,7 +56,16 @@
progressBar.setId("prgs");
progressBar.setValue(50);
progressBar.setInterval(1000);
+ progressBar.getAttributes().put("progressVar", "persent");
+ MockValueExpression expression = new MockValueExpression("50%");
+ ValueExpression exp = application.getExpressionFactory()
+ .createValueExpression(facesContext.getELContext(), "#{persent}", Object.class);
+ output = (UIOutput)application.createComponent("javax.faces.Output");
+ output.setValueExpression("value", expression);
+
+ progressBar.getChildren().add(output);
+
form.getChildren().add(progressBar);
}
16 years, 12 months
JBoss Rich Faces SVN: r5413 - trunk/framework/impl/src/main/resources/META-INF/skins.
by richfaces-svn-commits@lists.jboss.org
Author: dsvyatobatsko
Date: 2008-01-16 08:39:33 -0500 (Wed, 16 Jan 2008)
New Revision: 5413
Modified:
trunk/framework/impl/src/main/resources/META-INF/skins/DEFAULT.skin.properties
Log:
adjusted animated gif generation for progressbar in accordance with the given mockup
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-01-16 13:39:28 UTC (rev 5412)
+++ trunk/framework/impl/src/main/resources/META-INF/skins/DEFAULT.skin.properties 2008-01-16 13:39:33 UTC (rev 5413)
@@ -64,8 +64,6 @@
calendarSpecTextColor=#000000
#Progress bar colors
-progressbarSpiralColor=#FF9409
-progressbarBackgroundColor=#FAB761
-progressbarShadowStartColor=#FAD9AD
-progressbarShadowEndColor=#FAC786
-
+progressbarSpiralColor=#F1F1F1
+progressbarBackgroundColor=#FF9409
+progressbarShadowColor=#FFFFFF
16 years, 12 months
JBoss Rich Faces SVN: r5412 - trunk/sandbox/ui/progressBAR/src/main/java/org/richfaces/renderkit/html/images.
by richfaces-svn-commits@lists.jboss.org
Author: dsvyatobatsko
Date: 2008-01-16 08:39:28 -0500 (Wed, 16 Jan 2008)
New Revision: 5412
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/ProgressBarBg.java
Log:
adjusted animated gif generation for progressbar in accordance with the given mockup
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-01-16 13:31:05 UTC (rev 5411)
+++ trunk/sandbox/ui/progressBAR/src/main/java/org/richfaces/renderkit/html/images/ProgressBarAnimatedBg.java 2008-01-16 13:39:28 UTC (rev 5412)
@@ -20,7 +20,6 @@
*/
package org.richfaces.renderkit.html.images;
-import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GradientPaint;
@@ -31,6 +30,8 @@
import javax.faces.context.FacesContext;
import org.ajax4jsf.resource.AnimationResource;
+import org.ajax4jsf.resource.ImageRenderer;
+import org.ajax4jsf.resource.InternetResourceBase;
import org.ajax4jsf.resource.Java2Dresource;
import org.ajax4jsf.resource.ResourceContext;
import org.ajax4jsf.util.HtmlColor;
@@ -45,6 +46,8 @@
private Color progressbarSpiralColor;
private Color progressbarBackgroundColor;
+ private Color progressbarShadowColor;
+
private Color progressbarShadowStartColor;
private Color progressbarShadowEndColor;
@@ -73,24 +76,26 @@
@Override
protected void paint(ResourceContext context, Graphics2D g2d, int frameIndex) {
if (mainStage == null) {
- mainStage = createMainStage();
+ 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.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f));
g2d.fillRect(0, 0, frameSize.width, 7);
}
/**
* Creates a main stage for progress bar background.
*
+ * @param context resource context
* @return a <code>BufferedImage</code> object
*/
- private BufferedImage createMainStage() {
- BufferedImage retVal = new BufferedImage(frameSize.width,
- frameSize.height * 2, BufferedImage.TYPE_INT_ARGB);
+ 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);
@@ -104,6 +109,9 @@
return retVal;
}
+ /**
+ * @see InternetResourceBase#getDataToStore(FacesContext, Object)
+ */
protected Object getDataToStore(FacesContext context, Object data) {
byte[] retVal = null;
if (progressbarSpiralColor == null) {
@@ -112,35 +120,32 @@
if (progressbarBackgroundColor == null) {
progressbarBackgroundColor = getColorValueParameter(context, "progressbarBackgroundColor");
}
- if (progressbarShadowStartColor == null) {
- progressbarShadowStartColor = getColorValueParameter(context, "progressbarShadowStartColor");
+ if (progressbarShadowColor == null) {
+ progressbarShadowColor = getColorValueParameter(context, "progressbarShadowColor");
}
- if (progressbarShadowEndColor == null) {
- progressbarShadowEndColor = getColorValueParameter(context, "progressbarShadowEndColor");
- }
- retVal = new byte[3 * 4];
+ retVal = new byte[3 * 3];
new Zipper2(retVal).addColor(progressbarSpiralColor).addColor(
- progressbarBackgroundColor).addColor(
- progressbarShadowStartColor)
- .addColor(progressbarShadowEndColor);
+ progressbarBackgroundColor).addColor(progressbarShadowColor);
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();
- progressbarShadowStartColor = zipper2.nextColor();
- progressbarShadowEndColor = zipper2.nextColor();
+ progressbarShadowColor = zipper2.nextColor();
}
return objectArray;
}
- private Color getColorValueParameter(FacesContext context, String name) {
+ 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("")) {
@@ -149,4 +154,20 @@
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;
+ }
+
}
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-01-16 13:31:05 UTC (rev 5411)
+++ trunk/sandbox/ui/progressBAR/src/main/java/org/richfaces/renderkit/html/images/ProgressBarBg.java 2008-01-16 13:39:28 UTC (rev 5412)
@@ -20,7 +20,6 @@
*/
package org.richfaces.renderkit.html.images;
-import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GradientPaint;
@@ -30,6 +29,7 @@
import javax.faces.context.FacesContext;
+import org.ajax4jsf.resource.InternetResourceBase;
import org.ajax4jsf.resource.InternetResourceBuilder;
import org.ajax4jsf.resource.Java2Dresource;
import org.ajax4jsf.resource.PngRenderer;
@@ -44,6 +44,8 @@
private Color progressbarSpiralColor;
private Color progressbarBackgroundColor;
+ private Color progressbarShadowColor;
+
private Color progressbarShadowStartColor;
private Color progressbarShadowEndColor;
@@ -84,6 +86,9 @@
* </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);
@@ -94,10 +99,12 @@
}
//paint a shadow in the form of semi-transparent gradient
g2d.setPaint(new GradientPaint(0, 0, progressbarShadowStartColor, 0, 7, progressbarShadowEndColor));
- g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f));
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) {
@@ -106,29 +113,26 @@
if (progressbarBackgroundColor == null) {
progressbarBackgroundColor = getColorValueParameter(context, "progressbarBackgroundColor");
}
- if (progressbarShadowStartColor == null) {
- progressbarShadowStartColor = getColorValueParameter(context, "progressbarShadowStartColor");
+ if (progressbarShadowColor == null) {
+ progressbarShadowColor = getColorValueParameter(context, "progressbarShadowColor");
}
- if (progressbarShadowEndColor == null) {
- progressbarShadowEndColor = getColorValueParameter(context, "progressbarShadowEndColor");
- }
- retVal = new byte[3 * 4];
+ retVal = new byte[3 * 3];
new Zipper2(retVal).addColor(progressbarSpiralColor).addColor(
- progressbarBackgroundColor).addColor(
- progressbarShadowStartColor)
- .addColor(progressbarShadowEndColor);
+ progressbarBackgroundColor).addColor(progressbarShadowColor);
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();
- progressbarShadowStartColor = zipper2.nextColor();
- progressbarShadowEndColor = zipper2.nextColor();
+ progressbarShadowColor = zipper2.nextColor();
}
return objectArray;
@@ -143,4 +147,20 @@
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, 12 months
JBoss Rich Faces SVN: r5411 - trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/css.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2008-01-16 08:31:05 -0500 (Wed, 16 Jan 2008)
New Revision: 5411
Modified:
trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/css/combobox.xcss
Log:
apply new borders
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-01-16 13:28:18 UTC (rev 5410)
+++ trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/css/combobox.xcss 2008-01-16 13:31:05 UTC (rev 5411)
@@ -44,15 +44,7 @@
border : 1px solid;
background-position:left top;
background-repeat:repeat-x;
-} /*panelBorderColor*/
-
-
-/*.rich-combobox-list {
- z-index: 1000;
- overflow: auto;
- white-space:nowrap;
-}*/
-
+}
.rich-combobox-list-position {
position : absolute;
top:-1px;
@@ -60,9 +52,9 @@
}
.rich-combobox-list-decoration {
- border : 1px solid #BED6F8 /*panelBorderColor*/;
+ border : 1px solid #BED6F8;
padding : 0px;
- background : #FFFFFF; /*tableBackgroundColor*/
+ background : #FFFFFF;
}
.rich-combobox-list-scroll {
@@ -73,16 +65,14 @@
.rich-combobox-list-cord {
position : relative;
font-size : 0px;
-}/*DDL is hidden!!!!!*/
+}
.rich-combobox-item {
padding : 2px;
white-space : nowrap;
- /*width: 100%; */
display: block;
}
-
.rich-combobox-item-selected {
padding : 1px;
border : 1px dotted;
@@ -164,7 +154,6 @@
background : center no-repeat; cursor : pointer;
}
-
]]>
</f:verbatim>
@@ -211,7 +200,7 @@
<u:selector name=".rich-combobox-button-icon-inactive">
<u:style name="background-image">
- <f:resource f:key="org.richfaces.renderkit.images.ComboBoxArrowImageDisable" />
+ <f:resource f:key="org.richfaces.renderkit.images.ComboBoxArrowImage" />
</u:style>
</u:selector>
@@ -244,9 +233,9 @@
</u:selector>
<u:selector name=".rich-combobox-font-inactive">
- <u:style name="color" skin="tabDisabledTextColor"/>
- <u:style name="font-family" skin="headerFamilyFont"/>
- <u:style name="font-size" skin="headerSizeFont"/>
+ <u:style name="font-size" skin="generalSizeFont"/>
+ <u:style name="font-family" skin="generalFamilyFont"/>
+ <u:style name="color" skin="generalTextColor"/>
</u:selector>
<u:selector name=".rich-combobox-input">
@@ -254,6 +243,8 @@
<f:resource f:key="org.richfaces.renderkit.images.ComboBoxInputGradient" />
</u:style>
<u:style name="border-color" skin="panelBorderColor"/>
+ <u:style name="border-bottom-color" skin="additionalBackgroundColor"/>
+ <u:style name="border-right-color" skin="additionalBackgroundColor"/>
</u:selector>
<u:selector name=".rich-combobox-input-disabled">
@@ -261,7 +252,12 @@
</u:selector>
<u:selector name=".rich-combobox-input-inactive">
- <u:style name="border-color" skin="tabBackgroundColor"/>
+ <u:style name="background-image">
+ <f:resource f:key="org.richfaces.renderkit.images.ComboBoxInputGradient" />
+ </u:style>
+ <u:style name="border-color" skin="panelBorderColor"/>
+ <u:style name="border-bottom-color" skin="additionalBackgroundColor"/>
+ <u:style name="border-right-color" skin="additionalBackgroundColor"/>
</u:selector>
<u:selector name=".rich-combobox-item">
16 years, 12 months
JBoss Rich Faces SVN: r5410 - trunk/framework/impl/src/main/javascript/ajaxjsf and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: sergeyhalipov
Date: 2008-01-16 08:28:18 -0500 (Wed, 16 Jan 2008)
New Revision: 5410
Modified:
branches/3.1.x/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js
trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js
Log:
http://jira.jboss.com/jira/browse/RF-1487
Modified: branches/3.1.x/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js
===================================================================
--- branches/3.1.x/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js 2008-01-16 13:01:37 UTC (rev 5409)
+++ branches/3.1.x/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js 2008-01-16 13:28:18 UTC (rev 5410)
@@ -905,7 +905,9 @@
if (!window.data) {
window.data = data;
} else {
- Object.extend(window.data, data);
+ for (property in data) {
+ window.data[property] = data[property];
+ }
}
window.eval(newscript);
} catch(e){
Modified: trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js
===================================================================
--- trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js 2008-01-16 13:01:37 UTC (rev 5409)
+++ trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js 2008-01-16 13:28:18 UTC (rev 5410)
@@ -999,7 +999,9 @@
if (!window.data) {
window.data = data;
} else {
- Object.extend(window.data, data);
+ for (property in data) {
+ window.data[property] = data[property];
+ }
}
if (event) {
var target = event.target ? event.target : event.srcElement;
16 years, 12 months
JBoss Rich Faces SVN: r5409 - trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2008-01-16 08:01:37 -0500 (Wed, 16 Jan 2008)
New Revision: 5409
Modified:
trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js
Log:
vertical positioning is corrected
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-01-16 12:03:07 UTC (rev 5408)
+++ trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js 2008-01-16 13:01:37 UTC (rev 5409)
@@ -104,7 +104,6 @@
},
buttonMouseOutHandler : function(e) {
- window.status = "mouseout";
var classCss = this.classes.BUTTON.CLASSES;
var iconStyles = this.classes.BUTTONICON.STYLE;
@@ -483,7 +482,6 @@
},
setWidth : function(width) {
- //var positionElem = this.listParent.childNodes[1];
var positionElem = this.listParent.childNodes[0];
var combobox = this.listParent.parentNode;
@@ -497,7 +495,7 @@
setPosition : function(fieldTop, fieldLeft, fieldHeight) {
var docHeight = Richfaces.getDocumentHeight();
var comBottom = fieldTop + fieldHeight;
- var listHeight = this.listParent.style.height;
+ var listHeight = this.list.style.height;
var top = -4;
if (parseInt(listHeight) > (docHeight - comBottom)) {
16 years, 12 months
JBoss Rich Faces SVN: r5408 - branches/3.1.x/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: sergeyhalipov
Date: 2008-01-16 07:03:07 -0500 (Wed, 16 Jan 2008)
New Revision: 5408
Modified:
branches/3.1.x/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js
Log:
http://jira.jboss.com/jira/browse/RF-1456
Modified: branches/3.1.x/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js
===================================================================
--- branches/3.1.x/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js 2008-01-16 11:57:13 UTC (rev 5407)
+++ branches/3.1.x/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js 2008-01-16 12:03:07 UTC (rev 5408)
@@ -1111,7 +1111,7 @@
refresh:function(){
/*LOG.a4j_debug("rebinding " + $H(this).inspect());*/
var obj = $(this.objectId);
- if(obj){
+ if (obj && obj.tagName) {
Event.stopObserving(obj, this.eventname, this.handler);
Event.observe(obj, this.eventname, this.handler);
return true;
16 years, 12 months
JBoss Rich Faces SVN: r5407 - in branches/3.1.x/ui/contextMenu/src/main: java/org/richfaces/renderkit/html and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: sergeyhalipov
Date: 2008-01-16 06:57:13 -0500 (Wed, 16 Jan 2008)
New Revision: 5407
Modified:
branches/3.1.x/ui/contextMenu/src/main/java/org/richfaces/component/UIContextMenu.java
branches/3.1.x/ui/contextMenu/src/main/java/org/richfaces/renderkit/html/ContextMenuRendererBase.java
branches/3.1.x/ui/contextMenu/src/main/resources/org/richfaces/renderkit/html/scripts/context-menu.js
Log:
http://jira.jboss.com/jira/browse/RF-1456
Modified: branches/3.1.x/ui/contextMenu/src/main/java/org/richfaces/component/UIContextMenu.java
===================================================================
--- branches/3.1.x/ui/contextMenu/src/main/java/org/richfaces/component/UIContextMenu.java 2008-01-16 11:37:45 UTC (rev 5406)
+++ branches/3.1.x/ui/contextMenu/src/main/java/org/richfaces/component/UIContextMenu.java 2008-01-16 11:57:13 UTC (rev 5407)
@@ -42,4 +42,7 @@
public abstract void setDisableDefaultMenu(boolean b);
+ public abstract void setShowDelay(Integer showDelay);
+ public abstract Integer getShowDelay();
+
}
Modified: branches/3.1.x/ui/contextMenu/src/main/java/org/richfaces/renderkit/html/ContextMenuRendererBase.java
===================================================================
--- branches/3.1.x/ui/contextMenu/src/main/java/org/richfaces/renderkit/html/ContextMenuRendererBase.java 2008-01-16 11:37:45 UTC (rev 5406)
+++ branches/3.1.x/ui/contextMenu/src/main/java/org/richfaces/renderkit/html/ContextMenuRendererBase.java 2008-01-16 11:57:13 UTC (rev 5407)
@@ -110,7 +110,8 @@
writer.startElement("script", component);
writer.writeText("new Richfaces.ContextMenu('", null);
writer.writeText(component.getClientId(context), null);
- writer.writeText("',", null);
+ writer.writeText("', ", null);
+ writer.writeText(menu.getShowDelay() + ", ", null);
writeScriptBody(context, component, true);
writer.writeText(")", null);
writer.writeText(getClientAttachmentOptions(context, menu), null);
Modified: branches/3.1.x/ui/contextMenu/src/main/resources/org/richfaces/renderkit/html/scripts/context-menu.js
===================================================================
--- branches/3.1.x/ui/contextMenu/src/main/resources/org/richfaces/renderkit/html/scripts/context-menu.js 2008-01-16 11:37:45 UTC (rev 5406)
+++ branches/3.1.x/ui/contextMenu/src/main/resources/org/richfaces/renderkit/html/scripts/context-menu.js 2008-01-16 11:57:13 UTC (rev 5407)
@@ -3,13 +3,14 @@
Richfaces.ContextMenu.prototype = {
- initialize: function(id, evaluator, options) {
+ initialize: function(id, delay, evaluator, options) {
this.options = options || {};
this.id = id;
this.evaluator = evaluator;
$(id).component = this;
this.doShow = this.show;
this.doHide = this.hide;
+ this.delay = delay;
},
attachToParent : function(id, event, context) {
@@ -40,8 +41,8 @@
show: function(event, context) {
this.construct(context);
event.parameters = context;
- new RichFaces.Menu.DelayedContextMenu(this.id + "_menu", event).show();
- //Event.stop(event||window.event);
+ var delayedMenu = new RichFaces.Menu.DelayedContextMenu(this.id + "_menu", event);
+ window.setTimeout(delayedMenu.show, this.delay);
},
construct: function(context) {
16 years, 12 months
JBoss Rich Faces SVN: r5406 - in branches/3.1.x/ui: menu-components/src/main/resources/org/richfaces/renderkit/html/scripts and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: sergeyhalipov
Date: 2008-01-16 06:37:45 -0500 (Wed, 16 Jan 2008)
New Revision: 5406
Modified:
branches/3.1.x/ui/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java
branches/3.1.x/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js
Log:
http://jira.jboss.com/jira/browse/RF-1498
Modified: branches/3.1.x/ui/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java
===================================================================
--- branches/3.1.x/ui/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java 2008-01-16 10:00:28 UTC (rev 5405)
+++ branches/3.1.x/ui/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java 2008-01-16 11:37:45 UTC (rev 5406)
@@ -66,6 +66,7 @@
subMenuOptions.addEventHandler("onopen");
subMenuOptions.addEventHandler("onclose");
subMenuOptions.addOption("direction");
+ subMenuOptions.addOption("highlightParent", Boolean.TRUE);
function.addParameter(subMenuOptions);
function.appendScript(buffer);
Modified: branches/3.1.x/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js
===================================================================
--- branches/3.1.x/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js 2008-01-16 10:00:28 UTC (rev 5405)
+++ branches/3.1.x/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js 2008-01-16 11:37:45 UTC (rev 5406)
@@ -1068,6 +1068,7 @@
this.hideDelay=menuLayer.hideDelay;
}
+ this.highlightParent = options.highlightParent;
return this;
},
16 years, 12 months
JBoss Rich Faces SVN: r5405 - management/design/progressBar.
by richfaces-svn-commits@lists.jboss.org
Author: ilya_shaikovsky
Date: 2008-01-16 05:00:28 -0500 (Wed, 16 Jan 2008)
New Revision: 5405
Modified:
management/design/progressBar/Func-Spec-ProgressBar.doc
Log:
Modified: management/design/progressBar/Func-Spec-ProgressBar.doc
===================================================================
(Binary files differ)
16 years, 12 months