JBoss Rich Faces SVN: r5595 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2008-01-24 11:08:58 -0500 (Thu, 24 Jan 2008)
New Revision: 5595
Modified:
trunk/docs/userguide/en/src/main/docbook/included/columns.desc.xml
Log:
http://jira.jboss.com/jira/browse/RF-1199 - add initial screenshot
Modified: trunk/docs/userguide/en/src/main/docbook/included/columns.desc.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/columns.desc.xml 2008-01-24 16:08:35 UTC (rev 5594)
+++ trunk/docs/userguide/en/src/main/docbook/included/columns.desc.xml 2008-01-24 16:08:58 UTC (rev 5595)
@@ -11,14 +11,14 @@
<property><rich:columns></property>
</emphasis> is a component, that allows you to create a <property>dynamic</property> set of columns from your model.</para>
- <!--figure>
- <title><rich:columns> component</title>
- <mediaobject>
+ <figure>
+ <title><rich:dataTable> component</title>
+ <mediaobject>
<imageobject>
- <imagedata fileref="/images/columns1.png"/>
+ <imagedata fileref="images/columns1.png"/>
</imageobject>
</mediaobject>
- </figure-->
+ </figure>
</section>
<section>
16 years, 11 months
JBoss Rich Faces SVN: r5594 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2008-01-24 11:08:35 -0500 (Thu, 24 Jan 2008)
New Revision: 5594
Modified:
trunk/docs/userguide/en/src/main/docbook/included/calendar.xml
Log:
http://jira.jboss.com/jira/browse/RF-920 - add Classes names, Skin Parameters Redefinition for Time selction feature.
Modified: trunk/docs/userguide/en/src/main/docbook/included/calendar.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/calendar.xml 2008-01-24 15:58:44 UTC (rev 5593)
+++ trunk/docs/userguide/en/src/main/docbook/included/calendar.xml 2008-01-24 16:08:35 UTC (rev 5594)
@@ -1132,6 +1132,121 @@
</tgroup>
</table>
+ <!-- Time selection-->
+
+ <table>
+ <title>Skin parameters redefinition for a popup element during time selection</title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Skin parameters</entry>
+ <entry>CSS properties</entry>
+ </row>
+ </thead>
+
+ <tbody>
+
+ <row>
+ <entry>additionalBackgroundColor</entry>
+ <entry>background</entry>
+ </row>
+
+ <row>
+ <entry>panelBorderColor</entry>
+ <entry>border-color</entry>
+ </row>
+
+ </tbody>
+ </tgroup>
+ </table>
+
+ <table>
+ <title>Skin parameters redefinition for a wrapper <td> element for an input field</title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Skin parameters</entry>
+ <entry>CSS properties</entry>
+ </row>
+ </thead>
+
+ <tbody>
+
+ <row>
+ <entry>controlBackgroundColor</entry>
+ <entry>background-color</entry>
+ </row>
+
+ <row>
+ <entry>panelBorderColor</entry>
+ <entry>border-color</entry>
+ </row>
+
+ <row>
+ <entry>subBorderColor</entry>
+ <entry>border-bottom-color</entry>
+ </row>
+
+ <row>
+ <entry>subBorderColor</entry>
+ <entry>border-right-color</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
+ <table>
+ <title>Skin parameters redefinition for an input field</title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Skin parameters</entry>
+ <entry>CSS properties</entry>
+ </row>
+ </thead>
+
+ <tbody>
+
+ <row>
+ <entry>buttonSizeFont</entry>
+ <entry>font-size</entry>
+ </row>
+
+ <row>
+ <entry>buttonFamilyFont</entry>
+ <entry>font-family</entry>
+ </row>
+
+ </tbody>
+ </tgroup>
+ </table>
+
+ <table>
+ <title>Skin parameters redefinition for a wrapper <td> element for spinner buttons</title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Skin parameters</entry>
+ <entry>CSS properties</entry>
+ </row>
+ </thead>
+
+ <tbody>
+
+ <row>
+ <entry>headerBackgroundColor</entry>
+ <entry>background-color</entry>
+ </row>
+
+ <row>
+ <entry>headerBackgroundColor</entry>
+ <entry>border-color</entry>
+ </row>
+
+ </tbody>
+ </tgroup>
+ </table>
+
</section>
<section>
@@ -1141,20 +1256,38 @@
<figure>
<title>Style classes</title>
-
<mediaobject>
<imageobject>
- <imagedata fileref="images/calendar1a.png" scalefit="1"/>
+ <imagedata fileref="images/calendar_cn1.png" scalefit="1"/>
</imageobject>
</mediaobject>
+ </figure>
+ <figure>
+ <title>Style classes</title>
<mediaobject>
<imageobject>
- <imagedata fileref="images/calendar6.png" scalefit="1"/>
+ <imagedata fileref="images/calendar_cn2.png" scalefit="1"/>
</imageobject>
</mediaobject>
+ </figure>
+ <figure>
+ <title>Style classes</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/calendar_cn3.png" scalefit="1"/>
+ </imageobject>
+ </mediaobject>
</figure>
-
+ <figure>
+ <title>Style classes</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/calendar_cn4.png" scalefit="1"/>
+ </imageobject>
+ </mediaobject>
+
+ </figure>
<table>
<title>Classes names that define an input field and a button appearance</title>
16 years, 11 months
JBoss Rich Faces SVN: r5593 - trunk/docs/userguide/en/src/main/resources/images.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2008-01-24 10:58:44 -0500 (Thu, 24 Jan 2008)
New Revision: 5593
Added:
trunk/docs/userguide/en/src/main/resources/images/calendar_cn1.png
trunk/docs/userguide/en/src/main/resources/images/calendar_cn2.png
trunk/docs/userguide/en/src/main/resources/images/calendar_cn3.png
trunk/docs/userguide/en/src/main/resources/images/calendar_cn4.png
Removed:
trunk/docs/userguide/en/src/main/resources/images/calendar6.png
Log:
http://jira.jboss.com/jira/browse/RF-920 - add screenshots for Definition of Custom Style Classes
Deleted: trunk/docs/userguide/en/src/main/resources/images/calendar6.png
===================================================================
(Binary files differ)
Added: trunk/docs/userguide/en/src/main/resources/images/calendar_cn1.png
===================================================================
(Binary files differ)
Property changes on: trunk/docs/userguide/en/src/main/resources/images/calendar_cn1.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/docs/userguide/en/src/main/resources/images/calendar_cn2.png
===================================================================
(Binary files differ)
Property changes on: trunk/docs/userguide/en/src/main/resources/images/calendar_cn2.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/docs/userguide/en/src/main/resources/images/calendar_cn3.png
===================================================================
(Binary files differ)
Property changes on: trunk/docs/userguide/en/src/main/resources/images/calendar_cn3.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/docs/userguide/en/src/main/resources/images/calendar_cn4.png
===================================================================
(Binary files differ)
Property changes on: trunk/docs/userguide/en/src/main/resources/images/calendar_cn4.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
16 years, 11 months
JBoss Rich Faces SVN: r5592 - 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: akushunin
Date: 2008-01-24 10:41:45 -0500 (Thu, 24 Jan 2008)
New Revision: 5592
Modified:
branches/3.1.x/ui/menu-components/src/main/java/org/richfaces/renderkit/html/AbstractMenuRenderer.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-1993
Modified: branches/3.1.x/ui/menu-components/src/main/java/org/richfaces/renderkit/html/AbstractMenuRenderer.java
===================================================================
--- branches/3.1.x/ui/menu-components/src/main/java/org/richfaces/renderkit/html/AbstractMenuRenderer.java 2008-01-24 15:08:33 UTC (rev 5591)
+++ branches/3.1.x/ui/menu-components/src/main/java/org/richfaces/renderkit/html/AbstractMenuRenderer.java 2008-01-24 15:41:45 UTC (rev 5592)
@@ -164,14 +164,6 @@
writer.endElement("div");
writer.endElement("div");
- writer.startElement("iframe", layer);
- writer.writeAttribute("src","javascript:''", null);
- writer.writeAttribute("id", clientId+"_menu_iframe", null);
- writer.writeAttribute("class", "underneath_iframe", null);
- writer.writeAttribute("style", "position:absolute; z-index: 1;", null);
- writer.writeText("aaa", null);
- writer.endElement("iframe");
-
writer.startElement("script", layer);
writer.writeAttribute("id", clientId+"_menu_script", null);
writer.writeAttribute("type", "text/javascript", null);
@@ -180,7 +172,6 @@
AjaxContext ajaxContext = AjaxContext.getCurrentInstance();
Set renderedAreas = ajaxContext.getAjaxRenderedAreas();
- renderedAreas.add(clientId + "_menu_iframe");
renderedAreas.add(clientId + "_menu_script");
}
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-24 15:08:33 UTC (rev 5591)
+++ branches/3.1.x/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js 2008-01-24 15:41:45 UTC (rev 5592)
@@ -140,12 +140,22 @@
}
},
+ initIFrame: function(layer) {
+ var menu = $(layer);
+ var iframe = new Insertion.Before(menu,
+ "<iframe src=\"javascript:''\" id=\"" + menu.id + "_iframe\" style=\" position: absolute; z-index: 1;\" class=\"underneath_iframe\">" + "</iframe>");
+ return iframe;
+ },
+
ieSelectWorkAround: function(menuName, on){
//alert(navigator.userAgent);
if(this.IE || this.NS) {
menuName = $(menuName).id;
var menu = $(menuName);
var iframe = $(menuName + "_iframe");
+ if(!iframe&&on){
+ iframe = this.initIFrame(menu);
+ }
var nsfix = (this.NS ? 7 : 0);
if(on){
var dim = Element.getDimensions(menu);
@@ -154,7 +164,7 @@
iframe.style.width = menu.offsetWidth + "px"
iframe.style.height = menu.offsetHeight + "px"
iframe.style.visibility = "visible";
- } else {
+ } else if(iframe) {
iframe.style.visibility = "hidden";
}
}
16 years, 11 months
JBoss Rich Faces SVN: r5591 - trunk/sandbox/samples/progressBarDemo/src/main/webapp/pages.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-01-24 10:08:33 -0500 (Thu, 24 Jan 2008)
New Revision: 5591
Modified:
trunk/sandbox/samples/progressBarDemo/src/main/webapp/pages/index.jsp
Log:
Modified: trunk/sandbox/samples/progressBarDemo/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/sandbox/samples/progressBarDemo/src/main/webapp/pages/index.jsp 2008-01-24 15:04:27 UTC (rev 5590)
+++ trunk/sandbox/samples/progressBarDemo/src/main/webapp/pages/index.jsp 2008-01-24 15:08:33 UTC (rev 5591)
@@ -30,21 +30,23 @@
<h:form>
<progressBar:progressBar value="#{bean.value}" enabled="#{bean.enabled}" id="progrs"
- interval="500"
+ interval="700"
reRender="per1"
styleClass="main"
permanent="#{bean.permanent}"
determined="#{bean.determined}"
reRenderAfterComplete="per2"
mode="#{bean.modeString}"
- progressVar="percent">
+ progressVar="percent"
+ parameters="p1:crack, p2: Process"
+ >
<f:facet name="initial">
<h:outputText value="Process not started"></h:outputText>
</f:facet>
<f:facet name="complete">
<h:outputText value="Process completed"></h:outputText>
</f:facet>
- <h:outputText value="#{percent}%"></h:outputText>
+ <h:outputText value="{value}%"></h:outputText>
</progressBar:progressBar>
<br clear="all"/>
<table><tr>
@@ -77,9 +79,17 @@
<script>
var pr = new ProgressBar('j_id_jsp_2009877409_4:progrs');
</script>
- <input type="button" value="Get Progress" onclick="alert(pr.getProgress());" /><br/><br/>
+ <input type="button" value="Get value" onclick="alert(pr.getValue());" /><br/>
<input type="text" value="" id="percent"/>
- <input type="button" value="Set Progress" onclick="pr.enable(); pr.setProgress(document.getElementById('percent').value);" />
+ <input type="button" value="Set value" onclick="pr.setValue(document.getElementById('percent').value);" />
+ <br/>
+ <input type="text" value="" id="label"/>
+ <input type="button" value="Set label" onclick="pr.setLabel(document.getElementById('label').value);" />
+ <br/>
+ <input type="button" value="Disable" onclick="pr.disable();" />
+ <br/>
+ <input type="button" value="Enable" onclick="pr.enable(event);" />
+
</f:view>
</body>
</html>
16 years, 11 months
JBoss Rich Faces SVN: r5590 - in trunk/sandbox/ui/progressBAR/src/main: resources/org/richfaces/renderkit/html/js and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-01-24 10:04:27 -0500 (Thu, 24 Jan 2008)
New Revision: 5590
Modified:
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
Log:
Component refactoring
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-24 14:57:55 UTC (rev 5589)
+++ trunk/sandbox/ui/progressBAR/src/main/java/org/richfaces/renderkit/AbstractProgressBarRenderer.java 2008-01-24 15:04:27 UTC (rev 5590)
@@ -15,26 +15,20 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import javax.faces.FactoryFinder;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
-import javax.faces.render.RenderKit;
-import javax.faces.render.RenderKitFactory;
import javax.servlet.http.HttpServletRequest;
import org.ajax4jsf.context.AjaxContext;
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.AjaxCommandRendererBase;
import org.ajax4jsf.renderkit.AjaxRendererUtils;
import org.ajax4jsf.renderkit.ComponentVariables;
import org.ajax4jsf.renderkit.ComponentsVariableResolver;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
-import org.ajax4jsf.resource.CountingOutputWriter;
import org.richfaces.component.UIProgressBar;
/**
@@ -52,7 +46,10 @@
/** Expression for params string split */
private static final String SPLIT_EXPRS = "[;,]";
+ private static final String FORCE_STATE_PARAM = "forceState";
+ private static final String AJAX_POLL_FUNCTION = "A4J.AJAX.Poll";
+
/*
* (non-Javadoc)
*
@@ -71,12 +68,17 @@
HttpServletRequest request = (HttpServletRequest) facesContext
.getExternalContext().getRequest();
- ComponentVariables variables = ComponentsVariableResolver.getVariables(
- this, uiComponent);
Number percent = getNumber(uiComponent.getAttributes().get("value"));
Number maxValue = getNumber(uiComponent.getAttributes().get("maxValue"));
Map params = request.getParameterMap();
- if (percent.doubleValue() < maxValue.doubleValue()
+ if (params.containsKey(FORCE_STATE_PARAM)) {
+ ajaxContext.addComponentToAjaxRender(uiComponent);
+ String [] str = (String [])params.get(FORCE_STATE_PARAM);
+ for (String s : str) {
+ uiComponent.getAttributes().put(FORCE_STATE_PARAM,s);
+ }
+
+ } else if (percent.doubleValue() < maxValue.doubleValue()
&& params.containsKey("percent")) {
ajaxContext.removeRenderedArea(uiComponent
.getClientId(facesContext));
@@ -97,7 +99,39 @@
}
/**
+ * TODO Description goes here.
+ * @param state
+ * @param context
+ * @param component
+ * @throws IOException
+ */
+ public void renderForcedState(String state, FacesContext context,
+ UIComponent component) throws IOException {
+ if ("initial".equals(state)) {
+ encodeInitialState(context, component);
+ } else if ("progress".equals(state)) {
+ encodeProgressState(context, component);
+ } else if ("complete".equals(state)) {
+ encodeCompletedState(context, component);
+ }
+ component.getAttributes().remove(FORCE_STATE_PARAM);
+ }
+
+ /**
+ * TODO Description goes here.
+ * @param component
+ * @return
+ */
+ public String getForcedState(UIComponent component) {
+ if (component.getAttributes().containsKey(FORCE_STATE_PARAM)) {
+ return (String) component.getAttributes().get(FORCE_STATE_PARAM);
+ }
+ return null;
+ }
+
+ /**
* Returns ajax response data
+ *
* @param uiComponent
* @param percent
* @return
@@ -108,7 +142,7 @@
buffer.append("percent:");
buffer.append(percent);
buffer.append(",");
-
+
buffer.append("data:");
buffer.append(percent);
buffer.append(",");
@@ -135,6 +169,7 @@
/**
* Add component classes to ajax response
+ *
* @param buffer
* @param attr
* @param newValue
@@ -148,14 +183,15 @@
buffer.append(",");
}
}
-
+
/**
- * Return poll function name
+ * Return poll function name
+ *
* @param component
* @return
*/
public String getVarName(UIComponent component) {
- return "p" + Math.abs(component.hashCode());
+ return String.valueOf(Math.abs(component.hashCode()));
}
/**
@@ -178,27 +214,24 @@
writer.writeAttribute(HTML.style_ATTRIBUTE, "display:none;", null);
writer.startElement(HTML.SCRIPT_ELEM, component);
writer.writeAttribute(HTML.TYPE_ATTR, "text/javascript", null);
- String varName = getVarName(component);
StringBuffer pollScript = new StringBuffer("\n");
StringBuffer script = new StringBuffer("\n");
- if (isAjaxMode(component)) {
+ if (isAjaxMode(component) && progressBar.isEnabled()) {
+ JSFunction function = AjaxRendererUtils.buildAjaxFunction(
+ component, context, AJAX_POLL_FUNCTION);
- pollScript.append(getStopPollScript(clientId));
-
- pollScript.append("var ");
- pollScript.append(varName);
- pollScript.append("= function () { \n");
-
- JSFunction function = AjaxRendererUtils.buildAjaxFunction(
- component, context, AjaxRendererUtils.AJAX_FUNCTION_NAME);
- function.addParameter(new JSReference("null"));
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();
@@ -210,19 +243,6 @@
function.appendScript(script);
pollScript.append(script);
- pollScript.append("\n A4J.AJAX._pollers['");
- pollScript.append(clientId);
- pollScript.append("'] = window.setTimeout(");
- pollScript.append(varName);
- pollScript.append(",");
- pollScript.append(progressBar.getInterval());
- pollScript.append(");\n");
- pollScript.append("}\n");
- if (progressBar.isEnabled()) {
- pollScript.append(varName);
- pollScript.append("();");
- }
-
} else {
pollScript.append(getStopPollScript(clientId));
}
@@ -231,18 +251,87 @@
writer.endElement(HTML.SCRIPT_ELEM);
writer.endElement(HTML.SPAN_ELEM);
}
-
+
/**
+ * TODO Description goes here.
+ * @param context
+ * @param component
+ * @throws IOException
+ */
+ public void encodeLabelScript(FacesContext context, UIComponent component)
+ throws IOException {
+ ResponseWriter writer = context.getResponseWriter();
+ StringBuffer script = new StringBuffer();
+ writer.startElement(HTML.SPAN_ELEM, component);
+ writer.startElement(HTML.SCRIPT_ELEM, component);
+ script.append("new ProgressBar('" + component.getClientId(context)
+ + "').renderLabel();\n");
+ writer.append(script.toString());
+ writer.endElement(HTML.SCRIPT_ELEM);
+ writer.endElement(HTML.SPAN_ELEM);
+
+ }
+
+ /**
+ * TODO Description goes here.
+ * @param context
+ * @param component
+ * @throws IOException
+ */
+ public void encodeInitialScript(FacesContext context, UIComponent component)
+ throws IOException {
+ ResponseWriter writer = context.getResponseWriter();
+
+ 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(",");
+ writer.write(script.toString());
+ writeScriptBody(context, component, true);
+ script = new StringBuffer();
+ script.append(",");
+ script.append(ScriptUtils.toScript(getParametersMap(component)));
+ script.append(");\n");
+ writer.write(script.toString());
+
+ writer.endElement(HTML.SCRIPT_ELEM);
+ writer.endElement(HTML.SPAN_ELEM);
+ }
+
+ /**
* Check if component mode is AJAX
+ *
* @param component
* @return
*/
- private boolean isAjaxMode (UIComponent component) {
- String mode = (String)component.getAttributes().get("mode");
+ private boolean isAjaxMode(UIComponent component) {
+ String mode = (String) component.getAttributes().get("mode");
return "ajax".equalsIgnoreCase(mode);
}
+
/**
* Creates oncomplete function
+ *
* @param clientId
* @param component
* @param context
@@ -265,10 +354,7 @@
UIComponent form = (UIComponent) AjaxRendererUtils
.getNestingForm(component);
String content = (String) variables.getVariable("content");
- body.append("new ProgressBar('" + clientId + "').onComplete(data,'")
- .append(content).append("',").append(
- ScriptUtils.toScript(getParametersMap(component)))
- .append(")");
+ body.append("new ProgressBar('" + clientId + "').onComplete(data);");
functionDefinition.addToBody(body.toString());
return functionDefinition;
@@ -284,9 +370,8 @@
* @throws IOException -
* IOException
*/
- public void encodeInitialState(FacesContext context, UIComponent component,
- Object data) throws IOException {
- Boolean isAjax = Boolean.parseBoolean((String) data);
+ public void encodeInitialState(FacesContext context, UIComponent component)
+ throws IOException {
String clientId = component.getClientId(context);
String initialClass = (String) component.getAttributes().get(
"initialClass");
@@ -295,14 +380,12 @@
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);
-
+ writer.writeAttribute(HTML.id_ATTRIBUTE, clientId, null);
UIComponent initial = component.getFacet("initial");
if (initial != null) {
renderChild(context, initial);
}
- if (isAjax) {
+ if (isAjaxMode(component)) {
encodePollScript(context, component);
}
writer.endElement(HTML.DIV_ELEM);
@@ -330,6 +413,33 @@
}
/**
+ * TODO Description goes here.
+ * @param context
+ * @param component
+ * @throws IOException
+ */
+ public void encodeProgressState(FacesContext context, UIComponent component)
+ throws IOException {
+ ResponseWriter writer = context.getResponseWriter();
+ ComponentVariables variables = ComponentsVariableResolver.getVariables(
+ this, component);
+ String clientId = component.getClientId(context);
+ writer.startElement("div", component);
+ getUtils().writeAttribute(
+ writer,
+ "class",
+ "rich-progress-bar "
+ + (String) variables.getVariable("styleClass"));
+ getUtils().writeAttribute(writer, "id", clientId);
+ getUtils().writeAttribute(writer, "style",
+ variables.getVariable("style"));
+ encodeInitialScript(context, component);
+ encodeProgressBar(context, component);
+ encodeLabelScript(context, component);
+ writer.endElement("div");
+ }
+
+ /**
* Encodes progress state of component
*
* @param context -
@@ -338,7 +448,7 @@
* component instance
* @throws IOException
*/
- public void encodeProgressState(FacesContext context, UIComponent component)
+ public void encodeProgressBar(FacesContext context, UIComponent component)
throws IOException {
ResponseWriter writer = context.getResponseWriter();
String clientId = component.getClientId(context);
@@ -350,9 +460,6 @@
String style = (String) component.getAttributes().get("style");
Boolean permanent = (Boolean) component.getAttributes()
.get("permanent");
- Boolean determined = (Boolean) component.getAttributes().get(
- "determined");
- String content = getLabel(context, component, writer);
if (!(permanent != null && permanent.booleanValue())) {
String completeClass = (String) component.getAttributes().get(
@@ -366,11 +473,7 @@
remainClass + " rich-progress-bar-base");
getUtils().writeAttribute(writer, "id", clientId + ":remain");
getUtils().writeAttribute(writer, "style", style);
-
- encodeChildren(context, component, clientId + ":remain");
-
-
writer.endElement("div");
writer.startElement("div", component);
getUtils().writeAttribute(writer, "class",
@@ -387,59 +490,29 @@
completeClass + " rich-progress-bar-base");
getUtils().writeAttribute(writer, "id", clientId + ":complete");
getUtils().writeAttribute(writer, "style", style);
-
- encodeChildren(context, component, clientId + ":complete");
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);
+ }
}
}
/**
- * Renderers children label components
- * @param context
- * @param component
- * @param writer
- * @return
- */
- public String getLabel(FacesContext context, UIComponent component,
- ResponseWriter writer) {
- String childrenContent = null;
- CountingOutputWriter customWriter = new CountingOutputWriter();
- String defaultRenderKitId = context.getApplication()
- .getDefaultRenderKitId();
- if (null == defaultRenderKitId) {
- defaultRenderKitId = RenderKitFactory.HTML_BASIC_RENDER_KIT;
- }
- RenderKitFactory renderKitFactory = (RenderKitFactory) FactoryFinder
- .getFactory(FactoryFinder.RENDER_KIT_FACTORY);
- RenderKit renderKit = renderKitFactory.getRenderKit(context,
- defaultRenderKitId);
- try {
-
- ResponseWriter responseWriter = renderKit.createResponseWriter(
- customWriter, null, "UTF-8");
- context.setResponseWriter(responseWriter);
- renderChildrenComponents(context, component);
- childrenContent = customWriter.getContent().toString();
- context.setResponseWriter(writer);
- } catch (Exception e) {
- // TODO: do nothing
- } finally {
- context.setResponseWriter(writer);
- }
- return childrenContent;
- }
-
- /**
* Gets map with parameters defined in 'parameters' attr
+ *
* @param component
* @return
*/
@@ -464,30 +537,6 @@
}
/**
- * Return parameters splitted by ',' to be correctly parsed in JS
- * @param context
- * @param component
- * @return
- */
- public String getParametersString(FacesContext context,
- UIComponent component) {
- String parameters = (String) component.getAttributes()
- .get("parameters");
- StringBuffer buffer = new StringBuffer();
- if (parameters != null) {
- String[] r = parameters.split(SPLIT_EXPRS);
-
- for (String s : r) {
- buffer.append(s);
- buffer.append(",");
- }
- buffer.deleteCharAt(buffer.length() - 1);
- return buffer.toString();
- }
- return "";
- }
-
- /**
* Methods encodes finish facet of progress bar component
*
* @param context -
@@ -497,9 +546,9 @@
* @throws IOException -
* IOException
*/
- public void encodeCompletedState(FacesContext context,
- UIComponent component, Object data) throws IOException {
- Boolean isAjax = Boolean.parseBoolean((String) data);
+ public void encodeCompletedState(FacesContext context, UIComponent component)
+ throws IOException {
+ boolean isAjax = isAjaxMode(component);
if (isAjax) {
Object rerenderAfterComplete = component.getAttributes().get(
"reRenderAfterComplete");
@@ -514,9 +563,7 @@
}
}
}
- String clientId = (isAjax) ? component.getClientId(context) : component
- .getClientId(context)
- + ":completedState";
+ String clientId = component.getClientId(context);
String finishClass = (String) component.getAttributes().get(
"finishClass");
String style = (String) component.getAttributes().get("style");
@@ -540,19 +587,6 @@
writer.endElement(HTML.DIV_ELEM);
}
-
-
- public void encodeChildren(FacesContext context, UIComponent component, String id)
- throws IOException {
- ResponseWriter writer = context.getResponseWriter();
- writer.startElement("script", component);
- writer.write("var evaluator = ");
- writeScriptBody(context, component, true);
- //markup.invoke('getContent', context).join('');
- writer.write(";\n $('"+id+"').innerHTML = evaluator.invoke('getContent', {'minValue': '0'}).join('');");
- writer.endElement("script");
- }
-
/**
* Converts value attr to number value
@@ -585,6 +619,7 @@
/**
* Returns JS script to stop polling
+ *
* @param clientId
* @return
*/
@@ -604,17 +639,28 @@
return UIProgressBar.class;
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.richfaces.renderkit.TemplateEncoderRendererBase#encodeChildren(javax.faces.context.FacesContext,
+ * javax.faces.component.UIComponent)
+ */
+ @Override
+ public void encodeChildren(FacesContext context, UIComponent component)
+ throws IOException {
+ ;
+ }
- /**
- * Renders children components
+ /*
+ * (non-Javadoc)
*
- * @param facesContext
- * @param component
- * @throws IOException
+ * @see org.ajax4jsf.renderkit.RendererBase#doEncodeChildren(javax.faces.context.ResponseWriter,
+ * javax.faces.context.FacesContext, javax.faces.component.UIComponent)
*/
- private void renderChildrenComponents(FacesContext facesContext,
+ @Override
+ public void doEncodeChildren(ResponseWriter writer, FacesContext context,
UIComponent component) throws IOException {
- super.renderChildren(facesContext, component);
+ ;
}
}
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-24 14:57:55 UTC (rev 5589)
+++ trunk/sandbox/ui/progressBAR/src/main/resources/org/richfaces/renderkit/html/js/progressBar.js 2008-01-24 15:04:27 UTC (rev 5590)
@@ -1,13 +1,25 @@
ProgressBar = {};
ProgressBar = Class.create();
-
+ProgressBar.Pollers = {}
Object.extend(ProgressBar.prototype, {
- initialize: function(id) {
- this.id = id;
- this.maxValue = $(id + ":max").value;
- this.minValue = $(id + ":min").value;
- this.mode = "initial";
+ initialize: function() {
+ 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) {
+ ProgressBar.Pollers[id] = {};
+ ProgressBar.Pollers[id]['containerId'] = containerId;
+ ProgressBar.Pollers[id]['formId'] = formId;
+ ProgressBar.Pollers[id]['mode'] = mode;
+ ProgressBar.Pollers[id]['minValue'] = minValue;
+ ProgressBar.Pollers[id]['maxValue'] = maxValue;
+ ProgressBar.Pollers[id]['label'] = label;
+ ProgressBar.Pollers[id]['context'] = context;
+ },
getValue: function () {
var d = $(this.id + ":upload");
if (d != null) {
@@ -18,26 +30,18 @@
}
return null;
},
- onComplete: function (data, str, context) {
+ onComplete: function (data) {
if (data) {
this.parseResponse(data);
- context['value'] = this.value;
- context['minValue'] = this.minValue;
- context['maxValue'] = this.maxValue;
-
- this.mode = "progress";
this.setValue(this.value);
-
- this.context = context;
- //this.setLabel(str);
-
- //A4J.AJAX.Poll(containerId, formId, options);
- /*if (this.value >= this.maxValue) {
- this.disable();
- }*/
+ this.renderLabel();
+ this.poll();
}
},
+ poll: function () {
+ A4J.AJAX.Poll(ProgressBar.Pollers[this.id]['containerId'], ProgressBar.Pollers[this.id]['formId'], ProgressBar.Pollers[this.id]['options']);
+ },
interpolate: function (placeholders) {
for(var k in this.context) {
var v = this.context[k];
@@ -79,41 +83,25 @@
}
}
},
+ renderLabel: 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());
+ var markup = ProgressBar.Pollers[this.id]['label'];
+ var html = markup.invoke('getContent', context).join('');
+ $(this.id + ":remain").innerHTML = $(this.id + ":complete").innerHTML = html;
+ },
setLabel: function (str) {
- if (!this.context) { this.context = this.parseParams();}
- str = this.interpolate(str);
- var d = $(this.id + ":remain");
- if (d != null) d.innerHTML = str;
- d = $(this.id + ":complete");
- if (d != null) d.innerHTML = str;
},
- parseParams: function () {
- var params = $(this.id + ":parameters").value;
- if (params != "") {
- var map = new Array();
- var p = params.split(",");
- for (var i = 0; i < p.length; i++) {
- var k = p[i].match("\\s*([\\w\\d]+)\\s*[:=]+");
- if (k) {
- k = k[1];
- }
- var v = p[i].match(".*[:=]+\\s*['\"]*([\\w\\d]+)['\"]*\\s*");
- if (v) {
- v = v[1];
- }
- if (k && v) {
- map[k] = v;
- }
- }
- map['value'] = this.getValue();
- map['minValue'] = this.minValue;
- map['maxValue'] = this.maxValue;
- return map;
- }
- return null;
+ getMode: function () {
+ return ProgressBar.Pollers[this.id]['mode'];
},
+ getMaxValue: function () {
+ return ProgressBar.Pollers[this.id]['maxValue'];
+ },
isAjaxMode: function () {
- return ($(this.id + ":progressState") == null);
+ return (this.getMode() == "ajax");
},
setValue: function (val) {
var p = val;
@@ -121,79 +109,38 @@
if (val.indexOf("%") < 0)
val = val + "%";
}
-
- if ( parseFloat(p) >= parseFloat(this.maxValue)) {
+
+ if ( parseFloat(p) >= parseFloat(this.getMaxValue())) {
if (!this.isAjaxMode()) {
- this.switchMode("completed"); return;
+ //this.switchMode("completed"); return;
}
}
- if (this.mode == "progress" || this.isAjaxMode()) {
- d = $(this.id + ":upload");
- if (d != null) d.style.width = val;
- }
+ d = $(this.id + ":upload");
+ if (d != null) d.style.width = val;
},
enable: function (ev) {
if (!this.isAjaxMode()) {
- this.switchMode("progress");
- this.setValue("0");
- }else if (!A4J.AJAX._pollers[this.id]) {
- var funcName = $(this.id + ":func").value;
- var f = new Function(funcName + "();");
- f();
+ this.forceProgressState();
+ }else {
+ this.disable();
+ this.poll();
}
},
disable: function () {
A4J.AJAX.StopPoll(this.id);
},
finish: function () {
- this.switchMode("completed");
+ //this.switchMode("completed");
},
- getForm: function () {
- var p = $(this.id).parentNode;
- while (p) {
- if (p) {
- if (p.tagName.toUpperCase() == "FORM") {
- return p;
- }
- }
- p = p.parentNode;
- }
- return null;
- },
- switchMode : function (mode) {
- switch (mode) {
- case "initial" :
- this.hideStates(this.id + ":progressState",this.id + ":completedState");
- this.show($(this.id + ":initialState"));
- break;
- case "progress" :
- this.hideStates(this.id + ":initialState",this.id + ":completedState");
- this.show($(this.id + ":progressState"));
- break;
- case "completed" :
- this.hideStates(this.id + ":progressState",this.id + ":initialState");
- this.show($(this.id + ":completedState"));
- break;
- }
- this.mode = mode;
- },
- hideStates : function () {
- for (i = 0 ; i < arguments.length; i++) {
- d = $(arguments[i]);
- if (d != null) this.hide(d);
- }
- },
- init : function () {
- this.switchMode("initial");
- },
- hide : function (o) {
- if (o != null)
- o.style.display = 'none';
- },
- show : function (o) {
- if (o != null)
- o.style.display = '';
+ forceProgressState : function () {
+ var options = {};
+ options['parameters'] = {};
+ options['parameters'][this.id] = this.id;
+ options['parameters']['forceState'] = "progress";
+ options['actionUrl'] = ProgressBar.Pollers[this.id]['options']['actionUrl'];
+ options['oncomplete'] = function () { new ProgressBar(this.id).setValue("0") };
+ 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-24 14:57:55 UTC (rev 5589)
+++ trunk/sandbox/ui/progressBAR/src/main/templates/org/richfaces/progressBar.jspx 2008-01-24 15:04:27 UTC (rev 5590)
@@ -11,6 +11,7 @@
new org.ajax4jsf.javascript.PrototypeScript(),
new org.ajax4jsf.javascript.AjaxScript(),
/org/richfaces/renderkit/html/scripts/utils.js,
+ /org/richfaces/renderkit/html/scripts/json/json-dom.js,
/org/richfaces/renderkit/html/js/progressBar.js,
</h:scripts>
@@ -27,62 +28,26 @@
Number maxValue = getNumber(component.getAttributes().get("maxValue"));
boolean isAjax = ("ajax".equalsIgnoreCase(mode));
Number value = getNumber(component.getAttributes().get("value"));
- String content = getLabel(context, component, writer);
variables.setVariable("percent",value);
- variables.setVariable("content",content);
variables.setVariable("style",(String)component.getAttributes().get("style"));
variables.setVariable("styleClass",(String)component.getAttributes().get("styleClass"));
-
+ String forcedState = getForcedState(component);
]]>
</jsp:scriptlet>
<jsp:scriptlet>
<![CDATA[
-if (isAjax) {
setProgressVar(context, component, value);
-if (value.doubleValue() < minValue.doubleValue()) {
- encodeInitialState(context, component, "true");
-} else if (value.doubleValue() >= maxValue.doubleValue() ) {
- encodeCompletedState(context, component, "true");
-} else {
+if (forcedState != null) {
+ renderForcedState(forcedState,context,component);
+}else if (value.doubleValue() < minValue.doubleValue()) {
+ encodeInitialState(context, component);
+} else if (value.doubleValue() >= maxValue.doubleValue()) {
+ encodeCompletedState(context, component);
+} else {
+ encodeProgressState(context, component);
+}
]]>
</jsp:scriptlet>
- <div class="rich-progress-bar #{styleClass}" style="#{style}" id="#{clientId}">
- <f:call name="encodeProgressState"/>
- <input type="hidden" id="#{clientId}:min" disabled="true" value="#{component.attributes['minValue']}" />
- <input type="hidden" id="#{clientId}:max" disabled="true" value="#{component.attributes['maxValue']}" />
- <input type="hidden" id="#{clientId}:parameters" disabled="true" value="#{this:getParametersString(context, component)}" />
- <input type="hidden" id="#{clientId}:func" disabled="true" value="#{this:getVarName(component)}" />
- <f:call name="encodePollScript" />
- </div>
-<jsp:scriptlet>
-<![CDATA[
-}
-}else {
-]]>
-</jsp:scriptlet>
-<div id="#{clientId}" style="#{style}">
- <div id="#{clientId}:progressState" class="rich-progress-bar #{styleClass}" style="#{style}">
- <f:call name="encodeProgressState" />
- </div>
- <f:call name="encodeInitialState">
- <f:parameter value="false"/>
- </f:call>
- <f:call name="encodeCompletedState">
- <f:parameter value="false"/>
- </f:call>
- <input type="hidden" id="#{clientId}:min" disabled="true" value="#{component.attributes['minValue']}" />
- <input type="hidden" id="#{clientId}:max" disabled="true" value="#{component.attributes['maxValue']}" />
- <input type="hidden" id="#{clientId}:parameters" disabled="true" value="#{this:getParametersString(context, component)}" />
- <script>
- new ProgressBar('#{clientId}').init();
- </script>
-</div>
-<jsp:scriptlet>
-<![CDATA[
-}
-]]>
-</jsp:scriptlet>
-
</f:root>
\ No newline at end of file
16 years, 11 months
JBoss Rich Faces SVN: r5589 - in management/design: orderingList and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: smukhina
Date: 2008-01-24 09:57:55 -0500 (Thu, 24 Jan 2008)
New Revision: 5589
Modified:
management/design/listShuttle/FuncSpec - ListShuttle.doc
management/design/orderingList/FuncSpec - orderingList.doc
Log:
http://jira.jboss.com/jira/browse/RF-1998
Modified: management/design/listShuttle/FuncSpec - ListShuttle.doc
===================================================================
(Binary files differ)
Modified: management/design/orderingList/FuncSpec - orderingList.doc
===================================================================
(Binary files differ)
16 years, 11 months
JBoss Rich Faces SVN: r5588 - trunk/docs/userguide/en/src/main/resources/images.
by richfaces-svn-commits@lists.jboss.org
Author: cluts
Date: 2008-01-24 08:54:50 -0500 (Thu, 24 Jan 2008)
New Revision: 5588
Added:
trunk/docs/userguide/en/src/main/resources/images/inputNumberSpinner_CS2.png
Log:
http://jira.jboss.com/jira/browse/RF-1052 - added screens for inputNumberSpinner
Added: trunk/docs/userguide/en/src/main/resources/images/inputNumberSpinner_CS2.png
===================================================================
(Binary files differ)
Property changes on: trunk/docs/userguide/en/src/main/resources/images/inputNumberSpinner_CS2.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
16 years, 11 months
JBoss Rich Faces SVN: r5587 - trunk/docs/userguide/en/src/main/resources/images.
by richfaces-svn-commits@lists.jboss.org
Author: cluts
Date: 2008-01-24 08:54:37 -0500 (Thu, 24 Jan 2008)
New Revision: 5587
Added:
trunk/docs/userguide/en/src/main/resources/images/inputNumberSpinner_CS1.png
Log:
http://jira.jboss.com/jira/browse/RF-1052 - added screens for inputNumberSpinner
Added: trunk/docs/userguide/en/src/main/resources/images/inputNumberSpinner_CS1.png
===================================================================
(Binary files differ)
Property changes on: trunk/docs/userguide/en/src/main/resources/images/inputNumberSpinner_CS1.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
16 years, 11 months