JBoss Rich Faces SVN: r5645 - 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-25 13:22:06 -0500 (Fri, 25 Jan 2008)
New Revision: 5645
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/css/progressBar.xcss
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
Log:
Progress bar component refactoring
Modified: trunk/sandbox/ui/progressBAR/src/main/config/component/progressBar.xml
===================================================================
--- trunk/sandbox/ui/progressBAR/src/main/config/component/progressBar.xml 2008-01-25 17:15:29 UTC (rev 5644)
+++ trunk/sandbox/ui/progressBAR/src/main/config/component/progressBar.xml 2008-01-25 18:22:06 UTC (rev 5645)
@@ -84,18 +84,6 @@
<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>
- <defaultvalue>true</defaultvalue>
- </property>
- <property>
- <name>permanent</name>
- <classname>boolean</classname>
- <description>Attribute defines background should be permanent</description>
- <defaultvalue>false</defaultvalue>
- </property>
- <property>
<name>reRenderAfterComplete</name>
<classname>java.lang.String</classname>
<description>Set of componets to rerender after completion</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-25 17:15:29 UTC (rev 5644)
+++ trunk/sandbox/ui/progressBAR/src/main/java/org/richfaces/renderkit/AbstractProgressBarRenderer.java 2008-01-25 18:22:06 UTC (rev 5645)
@@ -24,6 +24,7 @@
import org.ajax4jsf.context.AjaxContextImpl;
import org.ajax4jsf.javascript.JSFunction;
import org.ajax4jsf.javascript.JSFunctionDefinition;
+import org.ajax4jsf.javascript.JSReference;
import org.ajax4jsf.javascript.ScriptUtils;
import org.ajax4jsf.renderkit.AjaxRendererUtils;
import org.ajax4jsf.renderkit.ComponentVariables;
@@ -46,8 +47,10 @@
/** Expression for params string split */
private static final String SPLIT_EXPRS = "[;,]";
+ /** Request parameter name containing component state to render */
private static final String FORCE_STATE_PARAM = "forceState";
+ /** Ajax function performing polling */
private static final String AJAX_POLL_FUNCTION = "A4J.AJAX.Poll";
/*
@@ -73,11 +76,10 @@
Map params = request.getParameterMap();
if (params.containsKey(FORCE_STATE_PARAM)) {
ajaxContext.addComponentToAjaxRender(uiComponent);
- String [] str = (String [])params.get(FORCE_STATE_PARAM);
+ String[] str = (String[]) params.get(FORCE_STATE_PARAM);
for (String s : str) {
- uiComponent.getAttributes().put(FORCE_STATE_PARAM,s);
+ uiComponent.getAttributes().put(FORCE_STATE_PARAM, s);
}
-
} else if (percent.doubleValue() < maxValue.doubleValue()
&& params.containsKey("percent")) {
ajaxContext.removeRenderedArea(uiComponent
@@ -99,7 +101,7 @@
}
/**
- * TODO Description goes here.
+ * Render progress state forced from javascript
* @param state
* @param context
* @param component
@@ -118,7 +120,7 @@
}
/**
- * TODO Description goes here.
+ * Gets state forced from javascript
* @param component
* @return
*/
@@ -131,7 +133,6 @@
/**
* Returns ajax response data
- *
* @param uiComponent
* @param percent
* @return
@@ -143,9 +144,15 @@
buffer.append(percent);
buffer.append(",");
- buffer.append("data:");
- buffer.append(percent);
+ buffer.append("interval:");
+ buffer.append(progressBar.getInterval());
buffer.append(",");
+
+ if (progressBar.getAttributes().get("style") != null) {
+ buffer.append("style:");
+ buffer.append(progressBar.getAttributes().get("style"));
+ buffer.append(",");
+ }
boolean enabled = (Boolean) uiComponent.getAttributes().get("enabled");
buffer.append("enabled:");
@@ -158,11 +165,6 @@
.getAttributes().get("remainClass"));
addStyles2Responce(buffer, "styleClass", (String) uiComponent
.getAttributes().get("styleClass"));
- addStyles2Responce(buffer, "initialClass", (String) uiComponent
- .getAttributes().get("initialClass"));
- addStyles2Responce(buffer, "finishClass", (String) uiComponent
- .getAttributes().get("finishClass"));
-
return buffer.toString();
}
@@ -220,26 +222,8 @@
JSFunction function = AjaxRendererUtils.buildAjaxFunction(
component, context, AJAX_POLL_FUNCTION);
- Map options = AjaxRendererUtils.buildEventOptions(context,
- component);
- Integer interval = new Integer(progressBar.getInterval());
- options.put("pollId", clientId);
- options.put("pollinterval", interval);
- Map parameters = (Map) options.get("parameters");
- parameters.put("percent", "percent");
- options.put("oncomplete", getOnComplete(clientId, progressBar,
- context, writer, options));
- pollScript.append("ProgressBar.Pollers['" + clientId
- + "']['options'] = " + ScriptUtils.toScript(options)
- + ";\n");
- Object onsubmit = component.getAttributes().get("onsubmit");
- if (null != onsubmit) {
- JSFunctionDefinition onsubmitFunction = new JSFunctionDefinition();
- onsubmitFunction.addToBody(onsubmit);
- options.put("onsubmit", onsubmitFunction);
- }
-
- function.addParameter(options);
+ function.addParameter(new JSReference("ProgressBar.Pollers['"
+ + clientId + "']['options']"));
function.appendScript(script);
pollScript.append(script);
@@ -253,7 +237,8 @@
}
/**
- * TODO Description goes here.
+ * Encodes script for label rendering in client
+ *
* @param context
* @param component
* @throws IOException
@@ -273,7 +258,8 @@
}
/**
- * TODO Description goes here.
+ * Encode initial javascript
+ *
* @param context
* @param component
* @throws IOException
@@ -281,44 +267,72 @@
public void encodeInitialScript(FacesContext context, UIComponent component)
throws IOException {
ResponseWriter writer = context.getResponseWriter();
-
+ UIProgressBar progressBar = (UIProgressBar) component;
+ AjaxContext ajaxContext = AjaxContextImpl.getCurrentInstance(context);
writer.startElement(HTML.SPAN_ELEM, component);
writer.startElement(HTML.SCRIPT_ELEM, component);
StringBuffer script = new StringBuffer();
String clientId = component.getClientId(context);
- String containerId = ((UIComponent)AjaxRendererUtils.findAjaxContainer(context, component)).getClientId(context);
- String formId = ((UIComponent)AjaxRendererUtils.getNestingForm(component)).getClientId(context);
- String mode = (String)component.getAttributes().get("mode");
- Integer minValue = (Integer)component.getAttributes().get("minValue");
- Integer maxValue = (Integer)component.getAttributes().get("maxValue");
-
- script.append("new ProgressBar().init('")
- .append(clientId)
- .append("','")
- .append(containerId)
- .append("','")
- .append(formId)
- .append("','")
- .append(mode)
- .append("',")
- .append(minValue)
- .append(",")
- .append(maxValue)
- .append(",");
+ String containerId = ((UIComponent) AjaxRendererUtils
+ .findAjaxContainer(context, component)).getClientId(context);
+ String formId = ((UIComponent) AjaxRendererUtils
+ .getNestingForm(component)).getClientId(context);
+ String mode = (String) component.getAttributes().get("mode");
+ Integer minValue = (Integer) component.getAttributes().get("minValue");
+ Integer maxValue = (Integer) component.getAttributes().get("maxValue");
+
+ script.append("new ProgressBar().init('").append(clientId)
+ .append("','").append(containerId).append("','").append(formId)
+ .append("','").append(mode).append("',").append(minValue)
+ .append(",").append(maxValue).append(",");
writer.write(script.toString());
writeScriptBody(context, component, true);
script = new StringBuffer();
script.append(",");
script.append(ScriptUtils.toScript(getParametersMap(component)));
+ script.append(",");
+ script.append(ScriptUtils.toScript(buildAjaxOptions(clientId,
+ progressBar, context)));
+ String progressVar = (String)component.getAttributes().get("progressVar");
+ if (progressVar != null) {
+ script.append(",'");
+ script.append(progressVar);
+ script.append("'");
+ }else {
+ script.append(",null");
+ }
+
script.append(");\n");
writer.write(script.toString());
-
+
writer.endElement(HTML.SCRIPT_ELEM);
writer.endElement(HTML.SPAN_ELEM);
}
/**
+ * Creates options map for AJAX requests
+ *
+ * @param clientId
+ * @param progressBar
+ * @param context
+ * @return
+ */
+ private Map buildAjaxOptions(String clientId, UIProgressBar progressBar,
+ FacesContext context) {
+ Map options = AjaxRendererUtils.buildEventOptions(context, progressBar);
+ Integer interval = new Integer(progressBar.getInterval());
+ options.put("pollId", clientId);
+ options.put("pollinterval", interval);
+ Map parameters = (Map) options.get("parameters");
+ parameters.put("percent", "percent");
+ options
+ .put("oncomplete",
+ getOnComplete(clientId, progressBar, context));
+ return options;
+ }
+
+ /**
* Check if component mode is AJAX
*
* @param component
@@ -340,8 +354,7 @@
* @return
*/
public JSFunctionDefinition getOnComplete(String clientId,
- UIProgressBar component, FacesContext context,
- ResponseWriter writer, Map options) {
+ UIProgressBar component, FacesContext context) {
JSFunctionDefinition functionDefinition = new JSFunctionDefinition();
functionDefinition.addParameter("request");
functionDefinition.addParameter("event");
@@ -385,6 +398,7 @@
if (initial != null) {
renderChild(context, initial);
}
+ encodeInitialScript(context, component);
if (isAjaxMode(component)) {
encodePollScript(context, component);
}
@@ -393,27 +407,8 @@
}
/**
- * Sets up the progressVar page attribute
+ * Encodes progress state of the component
*
- * @param context -
- * facesContext
- * @param component -
- * component instance
- * @param value -
- * percent value
- */
- public void setProgressVar(FacesContext context, UIComponent component,
- Number persent) {
- String progresssVar = (String) component.getAttributes().get(
- "progressVar");
- if (progresssVar != null) {
- Map attrs = context.getExternalContext().getRequestMap();
- attrs.put(progresssVar, persent);
- }
- }
-
- /**
- * TODO Description goes here.
* @param context
* @param component
* @throws IOException
@@ -440,7 +435,7 @@
}
/**
- * Encodes progress state of component
+ * Encodes html of component
*
* @param context -
* faces context
@@ -458,56 +453,41 @@
String width = String.valueOf(value.intValue());
String style = (String) component.getAttributes().get("style");
- Boolean permanent = (Boolean) component.getAttributes()
- .get("permanent");
- if (!(permanent != null && permanent.booleanValue())) {
- String completeClass = (String) component.getAttributes().get(
- "completeClass");
+ String completeClass = (String) component.getAttributes().get(
+ "completeClass");
- String remainClass = (String) component.getAttributes().get(
- "remainClass");
+ String remainClass = (String) component.getAttributes().get(
+ "remainClass");
- writer.startElement("div", component);
- getUtils().writeAttribute(writer, "class",
- remainClass + " rich-progress-bar-base");
- getUtils().writeAttribute(writer, "id", clientId + ":remain");
- getUtils().writeAttribute(writer, "style", style);
+ writer.startElement("div", component);
+ getUtils().writeAttribute(writer, "class",
+ remainClass + " rich-progress-bar-base");
+ getUtils().writeAttribute(writer, "id", clientId + ":remain");
+ getUtils().writeAttribute(writer, "style", style);
- writer.endElement("div");
- writer.startElement("div", component);
- getUtils().writeAttribute(writer, "class",
- "rich-progress-bar-uploaded");
- getUtils().writeAttribute(writer, "id", clientId + ":upload");
- getUtils().writeAttribute(
- writer,
- "style",
- (style != null ? style + ";" : "") + " width: " + width
- + "%;");
+ writer.endElement("div");
+ writer.startElement("div", component);
+ getUtils()
+ .writeAttribute(writer, "class", "rich-progress-bar-uploaded");
+ getUtils().writeAttribute(writer, "id", clientId + ":upload");
+ getUtils().writeAttribute(writer, "style",
+ (style != null ? style + ";" : "") + " width: " + width + "%;");
- writer.startElement("div", component);
- getUtils().writeAttribute(writer, "class",
- completeClass + " rich-progress-bar-base");
- getUtils().writeAttribute(writer, "id", clientId + ":complete");
- getUtils().writeAttribute(writer, "style", style);
+ writer.startElement("div", component);
+ getUtils().writeAttribute(writer, "class",
+ completeClass + " rich-progress-bar-base");
+ getUtils().writeAttribute(writer, "id", clientId + ":complete");
+ getUtils().writeAttribute(writer, "style", style);
- writer.endElement("div");
+ writer.endElement("div");
- writer.endElement("div");
+ writer.endElement("div");
- if (isAjaxMode(component)) {
- encodePollScript(context, component);
- }
- } else {
- writer.startElement("div", component);
- getUtils().writeAttribute(writer, "class",
- "rich-progress-bar-permanent");
- getUtils().writeAttribute(writer, "style", style + " width: 100%");
- writer.endElement("div");
- if (isAjaxMode(component)) {
- encodePollScript(context, component);
- }
+ if (isAjaxMode(component)) {
+ encodePollScript(context, component);
}
+
}
/**
@@ -532,7 +512,6 @@
}
return map;
}
-
return null;
}
@@ -549,20 +528,19 @@
public void encodeCompletedState(FacesContext context, UIComponent component)
throws IOException {
boolean isAjax = isAjaxMode(component);
- if (isAjax) {
- Object rerenderAfterComplete = component.getAttributes().get(
- "reRenderAfterComplete");
- Set ajaxRegions = AjaxRendererUtils.asSet(rerenderAfterComplete);
+ Object rerenderAfterComplete = component.getAttributes().get(
+ "reRenderAfterComplete");
+ Set ajaxRegions = AjaxRendererUtils.asSet(rerenderAfterComplete);
- if (ajaxRegions != null) {
- for (Iterator iter = ajaxRegions.iterator(); iter.hasNext();) {
- String id = iter.next().toString();
- AjaxContext ajaxContext = AjaxContext
- .getCurrentInstance(context);
- ajaxContext.addComponentToAjaxRender(component, id);
- }
+ if (ajaxRegions != null) {
+ for (Iterator iter = ajaxRegions.iterator(); iter.hasNext();) {
+ String id = iter.next().toString();
+ AjaxContext ajaxContext = AjaxContext
+ .getCurrentInstance(context);
+ ajaxContext.addComponentToAjaxRender(component, id);
}
}
+
String clientId = component.getClientId(context);
String finishClass = (String) component.getAttributes().get(
"finishClass");
@@ -577,6 +555,7 @@
if (completed != null) {
renderChild(context, completed);
}
+ encodeInitialScript(context, component);
if (isAjax) {
writer.startElement(HTML.SPAN_ELEM, component);
writer.startElement(HTML.SCRIPT_ELEM, component);
@@ -648,7 +627,7 @@
@Override
public void encodeChildren(FacesContext context, UIComponent component)
throws IOException {
- ;
+ ; // We should not render children
}
/*
@@ -660,7 +639,7 @@
@Override
public void doEncodeChildren(ResponseWriter writer, FacesContext context,
UIComponent component) throws IOException {
- ;
+ ; // We should not render children
}
}
Modified: trunk/sandbox/ui/progressBAR/src/main/resources/org/richfaces/renderkit/html/css/progressBar.xcss
===================================================================
--- trunk/sandbox/ui/progressBAR/src/main/resources/org/richfaces/renderkit/html/css/progressBar.xcss 2008-01-25 17:15:29 UTC (rev 5644)
+++ trunk/sandbox/ui/progressBAR/src/main/resources/org/richfaces/renderkit/html/css/progressBar.xcss 2008-01-25 18:22:06 UTC (rev 5645)
@@ -8,25 +8,30 @@
<f:verbatim>
-.rich-progress-bar-uploaded{overflow : hidden; position : absolute; border : 0px solid #cccccc; height : 16px;}
+.rich-progress-bar-uploaded{overflow : hidden; position : absolute; border : 0px solid ; height : 16px;}
.rich-progress-bar{position : relative; margin-bottom : 2px; height : 16px; width : 200px}
.rich-progress-bar-base{text-align : center; position : absolute; height : 16px; width : 200px; font-weight : bold;}
-.rich-progress-bar-remained{background : #F1F1F1; border : 1px solid #cccccc; color : #000000;}
-.rich-progress-bar-completed{background : #FF9409; color : #FFFFFF;; background-repeat : repeat-x; repeat-y;}
-.rich-progress-bar-permanent{background : #FF9409; color : #FFFFFF;; background-repeat : repeat-x; repeat-y; height : 16px; width : 200px;}
+.rich-progress-bar-remained{border : 1px solid; color : #000000;}
+.rich-progress-bar-completed{background-repeat : repeat-x; repeat-y;}
</f:verbatim>
- <u:selector name=".rich-progress-bar-completed">
- <u:style name="background-image">
- <f:resource f:key="org.richfaces.renderkit.html.images.ProgressBarBg" />
- </u:style>
+ <u:selector name=".rich-progress-bar-remained">
+ <u:style name="background-color" skin="controlBackgroundColor" />
+ <u:style name="border-color" skin="panelBorderColor" />
+ <u:style name="text-color" skin="controlTextColor" />
</u:selector>
+
+ <u:selector name=".rich-progress-bar-uploaded">
+ <u:style name="border-color" skin="panelBorderColor" />
+ </u:selector>
+
+ <u:selector name=".rich-progress-bar-completed">
+ <u:style name="background-image">
+ <f:resource f:key="org.richfaces.renderkit.html.images.ProgressBarBg" />
+ </u:style>
+ <u:style name="background-color" skin="selectControlColor" />
+ <u:style name="text-color" skin="controlBackgroundColor" />
+ </u:selector>
- <u:selector name=".rich-progress-bar-permanent">
- <u:style name="background-image">
- <f:resource f:key="org.richfaces.renderkit.html.images.ProgressBarAnimatedBg" />
- </u:style>
- </u:selector>
-
</f:template>
\ No newline at end of file
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-25 17:15:29 UTC (rev 5644)
+++ trunk/sandbox/ui/progressBAR/src/main/resources/org/richfaces/renderkit/html/js/progressBar.js 2008-01-25 18:22:06 UTC (rev 5645)
@@ -6,11 +6,9 @@
if (arguments.length > 0) {
var id = arguments[0];
this.id = id;
- this.maxValue = ProgressBar.Pollers[id]['maxValue'];
- this.minValue = ProgressBar.Pollers[id]['minValue'];
}
},
- init: function (id, containerId, formId, mode, minValue, maxValue, label , context) {
+ init: function (id, containerId, formId, mode, minValue, maxValue, label , context, options, progressVar) {
ProgressBar.Pollers[id] = {};
ProgressBar.Pollers[id]['containerId'] = containerId;
ProgressBar.Pollers[id]['formId'] = formId;
@@ -19,6 +17,8 @@
ProgressBar.Pollers[id]['maxValue'] = maxValue;
ProgressBar.Pollers[id]['label'] = label;
ProgressBar.Pollers[id]['context'] = context;
+ ProgressBar.Pollers[id]['options'] = options;
+ ProgressBar.Pollers[id]['progressVar'] = progressVar;
},
getValue: function () {
var d = $(this.id + ":upload");
@@ -67,15 +67,27 @@
},
updateComponent: function (k,v) {
switch (k) {
+ case "style" : this.updateStyle(v); break;
case "percent" : this.value = v; break;
case "enabled" : if (v == "false") { this.disable(); }; break;
case "completeClass" : this.updateClassName($(this.id + ":complete"), v, "rich-progress-bar-base"); break;
case "remainClass" : this.updateClassName($(this.id + ":remain"), v, "rich-progress-bar-base"); break;
case "styleClass" : this.updateClassName($(this.id), v, "rich-progress-bar"); break;
- case "initialClass" : break;
- case "finishClass" : break;
+ case "interval" : if (ProgressBar.Pollers[this.id]['options']['pollinterval'] != v) ProgressBar.Pollers[this.id]['options']['pollinterval'] = v; break;
}
},
+ updateStyle: function (style) {
+ var d = $(this.id);
+ if (d.style != style) {
+ d.style = style;
+ d = $(this.id + ":remain");
+ if (d) d.style = style;
+ d = $(this.id + ":complete");
+ if (d) d.style = style;
+ d = $(this.id + ":upload");
+ if (d) d.style = style;
+ }
+ },
updateClassName: function (o, newName, defaultClass) {
if (o.className) {
if (o.className.indexOf(newName) < 0){
@@ -83,16 +95,32 @@
}
}
},
- renderLabel: function () {
+ getContext: function () {
var context = ProgressBar.Pollers[this.id]['context'];
context['minValue'] = ProgressBar.Pollers[this.id]['minValue'];
context['maxValue'] = ProgressBar.Pollers[this.id]['maxValue'];
context['value'] = (this.value ? this.value : this.getValue());
+ context[ProgressBar.Pollers[this.id]['progressVar']] = context['value'];
+ return context;
+ },
+ renderLabel: function () {
+ var context = this.getContext();
var markup = ProgressBar.Pollers[this.id]['label'];
var html = markup.invoke('getContent', context).join('');
$(this.id + ":remain").innerHTML = $(this.id + ":complete").innerHTML = html;
},
+ interpolate: function (placeholders, context) {
+ for(var k in context) {
+ var v = context[k];
+ var regexp = new RegExp("\\{" + k + "\\}", "g");
+ placeholders = placeholders.replace(regexp, v);
+ }
+ return placeholders;
+ },
setLabel: function (str) {
+ var lbl = this.interpolate(str, this.getContext());
+ if (lbl)
+ $(this.id + ":remain").innerHTML = $(this.id + ":complete").innerHTML = lbl;
},
getMode: function () {
return ProgressBar.Pollers[this.id]['mode'];
@@ -100,6 +128,9 @@
getMaxValue: function () {
return ProgressBar.Pollers[this.id]['maxValue'];
},
+ getMinValue: function () {
+ return ProgressBar.Pollers[this.id]['minValue'];
+ },
isAjaxMode: function () {
return (this.getMode() == "ajax");
},
@@ -110,9 +141,15 @@
val = val + "%";
}
- if ( parseFloat(p) >= parseFloat(this.getMaxValue())) {
+ if ( parseFloat(p) < parseFloat(this.getMinValue())) {
if (!this.isAjaxMode()) {
- //this.switchMode("completed"); return;
+ this.forceState("initial",null);
+ return;
+ }
+ } else if ( parseFloat(p) >= parseFloat(this.getMaxValue())) {
+ if (!this.isAjaxMode()) {
+ this.forceState("complete",null);
+ return;
}
}
@@ -122,7 +159,7 @@
},
enable: function (ev) {
if (!this.isAjaxMode()) {
- this.forceProgressState();
+ this.forceState("progress",new Function ("new ProgressBar('"+this.id+"').setValue('0');"));
}else {
this.disable();
this.poll();
@@ -134,13 +171,15 @@
finish: function () {
//this.switchMode("completed");
},
- forceProgressState : function () {
+ forceState: function (state, oncomplete) {
var options = {};
options['parameters'] = {};
options['parameters'][this.id] = this.id;
- options['parameters']['forceState'] = "progress";
+ options['parameters']['forceState'] = state;
options['actionUrl'] = ProgressBar.Pollers[this.id]['options']['actionUrl'];
- options['oncomplete'] = function () { new ProgressBar(this.id).setValue("0") };
+ if (oncomplete) {
+ options['oncomplete'] = oncomplete;
+ }
A4J.AJAX.SubmitRequest(ProgressBar.Pollers[this.id]['containerId'],ProgressBar.Pollers[this.id]['formId'],null,options);
}
});
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-25 17:15:29 UTC (rev 5644)
+++ trunk/sandbox/ui/progressBAR/src/main/templates/org/richfaces/progressBar.jspx 2008-01-25 18:22:06 UTC (rev 5645)
@@ -38,7 +38,6 @@
<jsp:scriptlet>
<![CDATA[
-setProgressVar(context, component, value);
if (forcedState != null) {
renderForcedState(forcedState,context,component);
}else if (value.doubleValue() < minValue.doubleValue()) {
16 years, 11 months
JBoss Rich Faces SVN: r5644 - trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2008-01-25 12:15:29 -0500 (Fri, 25 Jan 2008)
New Revision: 5644
Modified:
trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js
Log:
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-25 16:24:45 UTC (rev 5643)
+++ trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js 2008-01-25 17:15:29 UTC (rev 5644)
@@ -19,12 +19,12 @@
this.button = $(buttonId);
this.buttonBG = $(buttonBGId);
- var fieldDem = Richfaces.ComboBoxList.getElemXY(this.field);
- fieldDem.height = this.field.offsetHeight;
+// var fieldDem = Richfaces.ComboBoxList.getElemXY(this.field);
+// fieldDem.height = this.field.offsetHeight;
listWidth = (!listWidth) ? this.getCurrentWidth() : listWidth;
this.comboList = new Richfaces.ComboBoxList(listId, parentListId, iframeId, selectFirstOnUpdate, classes.COMBO_LIST, listWidth,
- listHeight, itemsText, onlistcall, fieldDem, showDelay, hideDelay);
+ listHeight, itemsText, onlistcall, fieldId, showDelay, hideDelay);
this.defaultMessage = defaultMessage;
if (value) {
var item = this.comboList.findItemBySubstr(value);
@@ -344,13 +344,13 @@
Richfaces.ComboBoxList = Class.create();
Richfaces.ComboBoxList.prototype = {
- initialize: function(listId, parentListId, iframeId, selectFirstOnUpdate, classes, width, height, itemsText, onlistcall, fieldXY,
+ initialize: function(listId, parentListId, iframeId, selectFirstOnUpdate, classes, width, height, itemsText, onlistcall, fieldId,
showDelay, hideDelay) {
this.list = $(listId);
this.listParent = $(parentListId);
this.iframe = $(iframeId);
-
+ this.fieldElem = $(fieldId);
this.itemsText = itemsText;
this.onlistcall = onlistcall;
@@ -373,8 +373,8 @@
this.width = width;
this.height = height;
- this.fieldDimensions = fieldXY;
this.initDimensions();
+
},
initDimensions : function() {
@@ -385,7 +385,7 @@
Richfaces.ComboBoxList.LAYOUT_BORDER_H = Richfaces.getBorderWidth(this.listParent, "lr");
Richfaces.ComboBoxList.LAYOUT_PADDING_V = Richfaces.getPaddingWidth(this.listParent, "tb");
Richfaces.ComboBoxList.LAYOUT_PADDING_H = Richfaces.getPaddingWidth(this.listParent, "lr");
-
+
this.listParent.hide();
this.listParent.style.visibility = "visible";
},
@@ -410,7 +410,11 @@
},
show : function() {
+ this.fieldDimensions = Richfaces.ComboBoxList.getElemXY(this.fieldElem);
+ this.fieldDimensions.height = this.fieldElem.offsetHeight;
+
this.setSize();
+
this.setPosition(this.fieldDimensions.top, this.fieldDimensions.left, this.fieldDimensions.height);
if (this.selectedItem) {
@@ -655,14 +659,31 @@
}
Richfaces.ComboBoxList.getElemXY = function(elem) {
+
+ // for FF support
+ var originalVisibility = elem.style.visibility;
+ var originalPosition = elem.style.position;
+ var originalDisplay = elem.style.display;
+
+ elem.style.visibility = 'hidden';
+ elem.style.position = 'absolute';
+ elem.style.display = 'block';
+
var x = elem.offsetLeft;
var y = elem.offsetTop;
-
- for (var parent = elem.offsetParent; parent; parent = parent.offsetParent) {
- x += parent.offsetLeft;
- y += parent.offsetTop;
- }
- return {left: x, top: y};
+
+
+ for (var parent = Element.getOffsetParent(elem); parent != document.body; parent = Element.getOffsetParent(parent)) {
+ x += parent.offsetLeft;
+ y += parent.offsetTop;
+ }
+
+ elem.style.display = originalDisplay;
+ elem.style.visibility = originalVisibility;
+ elem.style.position = originalPosition;
+
+
+ return {left: x, top: y};
}
Richfaces.ComboBox.textboxSelect = function(oTextbox, iStart, iEnd) {
16 years, 11 months
JBoss Rich Faces SVN: r5643 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: cluts
Date: 2008-01-25 11:24:45 -0500 (Fri, 25 Jan 2008)
New Revision: 5643
Modified:
trunk/docs/userguide/en/src/main/docbook/included/inputNumberSpinner.xml
Log:
http://jira.jboss.com/jira/browse/RF-1052 - done for inputnumberspinner
Modified: trunk/docs/userguide/en/src/main/docbook/included/inputNumberSpinner.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/inputNumberSpinner.xml 2008-01-25 16:24:17 UTC (rev 5642)
+++ trunk/docs/userguide/en/src/main/docbook/included/inputNumberSpinner.xml 2008-01-25 16:24:45 UTC (rev 5643)
@@ -154,7 +154,7 @@
<section>
<title>Skin Parameters Redefinition</title>
- <table id="tab_cn1">
+ <table>
<title>Skin parameters redefinition for a container</title>
<tgroup cols="2">
<thead>
@@ -218,7 +218,7 @@
</mediaobject>
</figure>
- <table>
+ <table id="tab_cn1">
<title>Classes names that define a component appearance</title>
<tgroup cols="2">
16 years, 11 months
JBoss Rich Faces SVN: r5642 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: cluts
Date: 2008-01-25 11:24:17 -0500 (Fri, 25 Jan 2008)
New Revision: 5642
Modified:
trunk/docs/userguide/en/src/main/docbook/included/inputNumberSlider.xml
Log:
http://jira.jboss.com/jira/browse/RF-1052 - done for inputnumberslider
Modified: trunk/docs/userguide/en/src/main/docbook/included/inputNumberSlider.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/inputNumberSlider.xml 2008-01-25 16:23:56 UTC (rev 5641)
+++ trunk/docs/userguide/en/src/main/docbook/included/inputNumberSlider.xml 2008-01-25 16:24:17 UTC (rev 5642)
@@ -168,7 +168,7 @@
<section>
<title>Skin Parameters Redefinition</title>
- <table id="tab_cn">
+ <table>
<title>Skin parameters redefinition for a bar</title>
<tgroup cols="2">
<thead>
@@ -308,7 +308,7 @@
</mediaobject>
</figure>
- <table>
+ <table id="tab_cn">
<title>Classes names that define a component appearance</title>
<tgroup cols="2">
<thead>
@@ -391,6 +391,8 @@
<programlisting role="CSS"><![CDATA[...
.myClass{
font-style: italic;
+ font-weight:bold;
+ font-size:12px;
}
...]]></programlisting>
<para>The <emphasis><property>"inputClass"</property></emphasis> attribute for <emphasis role="bold"
16 years, 11 months
JBoss Rich Faces SVN: r5641 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: cluts
Date: 2008-01-25 11:23:56 -0500 (Fri, 25 Jan 2008)
New Revision: 5641
Modified:
trunk/docs/userguide/en/src/main/docbook/included/dropDownMenu.xml
Log:
http://jira.jboss.com/jira/browse/RF-1052 - done for dropdownmenu
Modified: trunk/docs/userguide/en/src/main/docbook/included/dropDownMenu.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/dropDownMenu.xml 2008-01-25 16:23:39 UTC (rev 5640)
+++ trunk/docs/userguide/en/src/main/docbook/included/dropDownMenu.xml 2008-01-25 16:23:56 UTC (rev 5641)
@@ -535,7 +535,7 @@
</mediaobject>
</figure>
- <table>
+ <table id="tab_cn4">
<title>Classes names that define a label</title>
<tgroup cols="2">
@@ -633,38 +633,33 @@
</table>
<para>In order to redefine styles for all <emphasis role="bold">
- <property><rich:dropDownMenu></property>
- </emphasis> components on a page using CSS, it's enough to create classes with the
- same names and define necessary properties in them.</para>
-
- <para>To change styles of particular <emphasis role="bold">
- <property><rich:dropDownMenu></property>
- </emphasis> components, define your own style classes in the corresponding <emphasis
- role="bold">
- <property><rich:dropDownMenu></property>
- </emphasis>attributes.</para>
+ <property><rich:dropDownMenu></property>
+ </emphasis> components on a page using CSS, it's enough to create classes with the
+ same names (possible classes could be found in the table <link linkend="tab_cn4">above</link>) and define necessary properties in them. An example is placed below:</para>
- <para>CSS code piece used on a page:</para>
-
<para>
<emphasis role="bold">Example:</emphasis>
</para>
<programlisting role="CSS"><![CDATA[...
.rich-ddmenu-label-select{
- font-size: 15px;
- color: #FFF0F5;
+ background-color: #fae6b0;
+ border-color: #e5973e;
}
-.myClass{
- background-color: #2F4F4F;
-}
-...]]></programlisting>
- <para>The component is defined in the following way:</para>
+...]]></programlisting>
- <para>
- <emphasis role="bold">Example:</emphasis>
- </para>
- <programlisting role="XML"><![CDATA[<rich:dropDownMenu ... inputClass="myClass" .../>]]></programlisting>
+ <para>This is a result:</para>
+ <figure>
+ <title>Redefinition styles with predefined classes</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/dropDownMenu_CS1.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>In the example a label select background color and border color were changed.</para>
+
</section>
<section>
16 years, 11 months
JBoss Rich Faces SVN: r5640 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: cluts
Date: 2008-01-25 11:23:39 -0500 (Fri, 25 Jan 2008)
New Revision: 5640
Modified:
trunk/docs/userguide/en/src/main/docbook/included/datascroller.xml
Log:
http://jira.jboss.com/jira/browse/RF-1052 - done for datascroller
Modified: trunk/docs/userguide/en/src/main/docbook/included/datascroller.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/datascroller.xml 2008-01-25 16:23:20 UTC (rev 5639)
+++ trunk/docs/userguide/en/src/main/docbook/included/datascroller.xml 2008-01-25 16:23:39 UTC (rev 5640)
@@ -356,7 +356,7 @@
</mediaobject>
</figure>
- <table>
+ <table id="tab_cn2">
<title>Classes names that define a component appearance</title>
<tgroup cols="2">
<thead>
@@ -412,38 +412,68 @@
</tbody>
</tgroup>
</table>
+
<para>In order to redefine styles for all <emphasis role="bold">
<property><rich:datascroller></property>
</emphasis> components on a page using CSS, it's enough to create classes with the
- same names and define necessary properties in them.</para>
+ same names (possible classes could be found in the table <link linkend="tab_cn2">above</link>) and define necessary properties in them. An example is placed below:</para>
- <para>To change styles of particular <emphasis role="bold">
- <property><rich:datascroller></property>
- </emphasis> components, define your own style classes in the corresponding <emphasis
- role="bold">
- <property><rich:datascroller></property>
- </emphasis>attributes.</para>
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
+ <programlisting role="CSS"><![CDATA[...
+.rich-datascr-button{
+ color: #CD6600;
+}
+...]]></programlisting>
- <para>CSS code piece used on a page:</para>
+ <para>This is a result:</para>
+ <figure>
+ <title>Redefinition styles with predefined classes</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/datascroller_CS1.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>In the example an input text font style was changed.</para>
+
+ <para>Also it’s possible to change styles of particular <emphasis role="bold"
+ ><property><rich:datascroller></property></emphasis> component. In this case you should create own style classes and use them in corresponding <emphasis role="bold"
+ ><property><rich:datascroller></property></emphasis> <emphasis><property>styleClass</property></emphasis> attributes. An example is placed below:</para>
+
<para>
<emphasis role="bold">Example:</emphasis>
</para>
<programlisting role="CSS"><![CDATA[...
-.rich-datascr-button{
- color: #A52A2A;
-}
.myClass{
- font-size: xx-large;
+ background-color: #C6E2FF;
}
-...]]></programlisting>
- <para>The component is defined in the following way:</para>
+...]]></programlisting>
+ <para>The <emphasis><property>"styleClass"</property></emphasis> attribute for <emphasis role="bold"
+ ><property><rich:datascroller> </property></emphasis> is defined as it’s shown in the example below:</para>
<para>
<emphasis role="bold">Example:</emphasis>
</para>
- <programlisting role="XML"><![CDATA[<rich:datascroller ... inputClass="myClass" .../>]]></programlisting>
+ <programlisting role="CSS"><![CDATA[<rich:datascroller ... selectedStyleClass="myClass"/>
+]]></programlisting>
+ <para>This is a result:</para>
+
+ <figure>
+ <title>Redefinition styles with own classes and styleClass attributes</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/datascroller_CS2.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>As it could be seen on the picture above, background color the selected cell on scroller was changed.</para>
+
</section>
<section>
<title>Relevant Resources Links</title>
16 years, 11 months
JBoss Rich Faces SVN: r5639 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: cluts
Date: 2008-01-25 11:23:20 -0500 (Fri, 25 Jan 2008)
New Revision: 5639
Modified:
trunk/docs/userguide/en/src/main/docbook/included/calendar.xml
Log:
http://jira.jboss.com/jira/browse/RF-1052 - correct for calendar
Modified: trunk/docs/userguide/en/src/main/docbook/included/calendar.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/calendar.xml 2008-01-25 16:22:59 UTC (rev 5638)
+++ trunk/docs/userguide/en/src/main/docbook/included/calendar.xml 2008-01-25 16:23:20 UTC (rev 5639)
@@ -1288,7 +1288,7 @@
</mediaobject>
</figure>
- <table>
+ <table id="tab_cn3">
<title>Classes names that define an input field and a button appearance</title>
<tgroup cols="2">
@@ -1584,35 +1584,65 @@
<para>In order to redefine styles for all <emphasis role="bold">
<property><rich:calendar></property>
</emphasis> components on a page using CSS, it's enough to create classes with the
- same names and define necessary properties in them.</para>
+ same names (possible classes could be found in the tables <link linkend="tab_cn3"> above</link>) and define necessary properties in them. </para>
- <para>To change styles of particular <emphasis role="bold">
- <property><rich:calendar></property>
- </emphasis> components, define your own style classes in the corresponding <emphasis
- role="bold">
- <property><rich:calendar></property>
- </emphasis>attributes.</para>
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
+ <programlisting role="CSS"><![CDATA[...
+.rich-calendar-today {
+ background-color: #FF0000;
+}
+...]]></programlisting>
- <para>CSS code piece used on a page:</para>
+ <para>This is a result:</para>
+ <figure>
+ <title>Redefinition styles with predefined classes</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/calendar_CS1.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>In the example an active cell background color was changed.</para>
+
+ <para>Also it’s possible to change styles of particular <emphasis role="bold"
+ ><property><rich:calendar></property></emphasis> component. In this case you should create own style classes and use them in corresponding <emphasis role="bold"
+ ><property><rich:calendar></property></emphasis> <emphasis><property>styleClass</property></emphasis> attributes. An example is placed below:</para>
+
<para>
<emphasis role="bold">Example:</emphasis>
</para>
<programlisting role="CSS"><![CDATA[...
-.rich-calendar-today {
- background-color: #00FA9A;
+.myFontClass{
+ font-style: italic;
}
- .myClass {
- font-size: xx-large;
-}
-...]]></programlisting>
- <para>The component is defined in the following way:</para>
+...]]></programlisting>
+ <para>The <emphasis><property>"inputClass"</property></emphasis> attribute for <emphasis role="bold"
+ ><property><rich:calendar> </property></emphasis> is defined as it’s shown in the example below:</para>
<para>
<emphasis role="bold">Example:</emphasis>
</para>
- <programlisting role="XML"><![CDATA[<rich:calendar ... inputClass="myClass" .../>]]></programlisting>
+ <programlisting role="CSS"><![CDATA[<rich:calendar ... inputClass="myFontClass"/>
+]]></programlisting>
+ <para>This is a result:</para>
+
+ <figure>
+ <title>Redefinition styles with own classes and styleClass attributes</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/calendar_CS2.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>As it could be seen on the picture above, the font style for output text was changed.</para>
+
+
</section>
<section>
16 years, 11 months
JBoss Rich Faces SVN: r5638 - trunk/docs/userguide/en/src/main/resources/images.
by richfaces-svn-commits@lists.jboss.org
Author: cluts
Date: 2008-01-25 11:22:59 -0500 (Fri, 25 Jan 2008)
New Revision: 5638
Added:
trunk/docs/userguide/en/src/main/resources/images/dropDownMenu_CS1.png
Log:
http://jira.jboss.com/jira/browse/RF-1052 - added screen for dropDownMenu
Added: trunk/docs/userguide/en/src/main/resources/images/dropDownMenu_CS1.png
===================================================================
(Binary files differ)
Property changes on: trunk/docs/userguide/en/src/main/resources/images/dropDownMenu_CS1.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
16 years, 11 months
JBoss Rich Faces SVN: r5637 - trunk/docs/userguide/en/src/main/resources/images.
by richfaces-svn-commits@lists.jboss.org
Author: cluts
Date: 2008-01-25 11:22:41 -0500 (Fri, 25 Jan 2008)
New Revision: 5637
Added:
trunk/docs/userguide/en/src/main/resources/images/datascroller_CS2.png
Log:
http://jira.jboss.com/jira/browse/RF-1052 - added screens for datascroller
Added: trunk/docs/userguide/en/src/main/resources/images/datascroller_CS2.png
===================================================================
(Binary files differ)
Property changes on: trunk/docs/userguide/en/src/main/resources/images/datascroller_CS2.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
16 years, 11 months
JBoss Rich Faces SVN: r5636 - trunk/docs/userguide/en/src/main/resources/images.
by richfaces-svn-commits@lists.jboss.org
Author: cluts
Date: 2008-01-25 11:22:32 -0500 (Fri, 25 Jan 2008)
New Revision: 5636
Added:
trunk/docs/userguide/en/src/main/resources/images/datascroller_CS1.png
Log:
http://jira.jboss.com/jira/browse/RF-1052 - added screens for datascroller
Added: trunk/docs/userguide/en/src/main/resources/images/datascroller_CS1.png
===================================================================
(Binary files differ)
Property changes on: trunk/docs/userguide/en/src/main/resources/images/datascroller_CS1.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
16 years, 11 months