JBoss Rich Faces SVN: r1947 - trunk/sandbox/ui/scrollable-grid/src/main/javascript/ClientUI/controls/grid.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2007-07-31 08:22:59 -0400 (Tue, 31 Jul 2007)
New Revision: 1947
Modified:
trunk/sandbox/ui/scrollable-grid/src/main/javascript/ClientUI/controls/grid/Selection.js
Log:
RF-514
Modified: trunk/sandbox/ui/scrollable-grid/src/main/javascript/ClientUI/controls/grid/Selection.js
===================================================================
--- trunk/sandbox/ui/scrollable-grid/src/main/javascript/ClientUI/controls/grid/Selection.js 2007-07-31 10:48:49 UTC (rev 1946)
+++ trunk/sandbox/ui/scrollable-grid/src/main/javascript/ClientUI/controls/grid/Selection.js 2007-07-31 12:22:59 UTC (rev 1947)
@@ -427,10 +427,12 @@
this.setSelection(range);
}
this.setActiveRow(rowIndex);
- if (window.getSelection) {
- window.getSelection().removeAllRanges();
- } else if (document.selection) {
- document.selection.empty();
+ if (event.shiftKey) {
+ if (window.getSelection) {
+ window.getSelection().removeAllRanges();
+ } else if (document.selection) {
+ document.selection.empty();
+ }
}
this.selectionChanged(event);
},
17 years, 2 months
JBoss Rich Faces SVN: r1946 - in trunk/samples/inputNumberSliderDemo/src/main: webapp/pages and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: A.Skokov
Date: 2007-07-31 06:48:49 -0400 (Tue, 31 Jul 2007)
New Revision: 1946
Modified:
trunk/samples/inputNumberSliderDemo/src/main/java/org/richfaces/Bean.java
trunk/samples/inputNumberSliderDemo/src/main/webapp/pages/index.jsp
Log:
http://jira.jboss.com/jira/browse/RF-490
Modified: trunk/samples/inputNumberSliderDemo/src/main/java/org/richfaces/Bean.java
===================================================================
--- trunk/samples/inputNumberSliderDemo/src/main/java/org/richfaces/Bean.java 2007-07-31 10:41:40 UTC (rev 1945)
+++ trunk/samples/inputNumberSliderDemo/src/main/java/org/richfaces/Bean.java 2007-07-31 10:48:49 UTC (rev 1946)
@@ -20,18 +20,44 @@
*/
package org.richfaces;
-/**
- * @author $Autor$
- *
- */
+
+/** @author $Autor$ */
public class Bean {
- private int value = 20;
-
- public int getValue() {
- return value;
- }
-
- public void setValue(int value) {
- this.value = value;
- }
+
+ private int value = 20;
+ private boolean showBoundaryValues = true;
+ private boolean showInput = true;
+ private boolean disabled = false;
+
+ public int getValue() {
+ return value;
+ }
+
+ public void setValue(int value) {
+ this.value = value;
+ }
+
+ public boolean isShowBoundaryValues() {
+ return showBoundaryValues;
+ }
+
+ public void setShowBoundaryValues(boolean showBoundaryValues) {
+ this.showBoundaryValues = showBoundaryValues;
+ }
+
+ public boolean isShowInput() {
+ return showInput;
+ }
+
+ public void setShowInput(boolean showInput) {
+ this.showInput = showInput;
+ }
+
+ public boolean isDisabled() {
+ return disabled;
+ }
+
+ public void setDisabled(boolean disabled) {
+ this.disabled = disabled;
+ }
}
\ No newline at end of file
Modified: trunk/samples/inputNumberSliderDemo/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/samples/inputNumberSliderDemo/src/main/webapp/pages/index.jsp 2007-07-31 10:41:40 UTC (rev 1945)
+++ trunk/samples/inputNumberSliderDemo/src/main/webapp/pages/index.jsp 2007-07-31 10:48:49 UTC (rev 1946)
@@ -1,87 +1,118 @@
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
-<%@ taglib uri="http://labs.jboss.com/jbossrichfaces/ui/inputnumber-slider" prefix="rich" %>
+<%@ taglib uri="http://labs.jboss.com/jbossrichfaces/ui/inputnumber-slider"
+ prefix="rich" %>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j" %>
<html>
- <head>
- <title></title>
- <script type="text/javascript">
- function doEvent() {
- alert("Event");
- }
- </script>
- </head>
- <body>
- <f:view>
- <h:form>
- <h:selectOneRadio binding="#{skinBean.component}" />
- <h:commandLink action="#{skinBean.change}" value="set skin" />
+<head>
+ <title></title>
+ <script type="text/javascript">
+ function doEvent() {
+ alert("Event");
+ }
+ </script>
+</head>
- <f:verbatim>
- <br />
- <br />
- </f:verbatim>
- <rich:inputNumberSlider value="#{bean.value}" onclick="doEvent()"/>
+<body>
+<f:view>
+ <h:form>
+ <h:selectOneRadio binding="#{skinBean.component}"/>
+ <h:commandLink action="#{skinBean.change}" value="set skin"/>
- <f:verbatim>
- <br />
- <br />
- </f:verbatim>
- <rich:inputNumberSlider value="20.1" minValue="19.1" maxValue="21.1" step="1.0"/>
+ <f:verbatim>
+ <br/>
+ <br/>
+ </f:verbatim>
+ <rich:inputNumberSlider value="#{bean.value}" onclick="doEvent()"/>
- <f:verbatim>
- <br />
- <br />
- Here is an example of default inputNumberSlider:
- </f:verbatim>
- <rich:inputNumberSlider value="50"/>
+ <f:verbatim>
+ <br/>
+ <br/>
+ </f:verbatim>
+ <rich:inputNumberSlider value="20.1" minValue="19.1" maxValue="21.1"
+ step="1.0"/>
- <f:verbatim>
- <br />
- <br />
- Here is "minimalistic" inputNumberSlider:
- </f:verbatim>
- <rich:inputNumberSlider value="50" showInput="false" enableManualInput="false" showBoundaryValues="false" showToolTip="false"/>
+ <f:verbatim>
+ <br/>
+ <br/>
+ Here is an example of default inputNumberSlider:
+ </f:verbatim>
+ <rich:inputNumberSlider value="50"/>
- <f:verbatim>
- <br />
- <br />
- Another variation of input:
- </f:verbatim>
- <rich:inputNumberSlider value="10" minValue="0" maxValue="100" step="5" showToolTip="true" />
+ <f:verbatim>
+ <br/>
+ <br/>
+ Here is "minimalistic" inputNumberSlider:
+ </f:verbatim>
+ <rich:inputNumberSlider value="50" showInput="false"
+ enableManualInput="false"
+ showBoundaryValues="false" showToolTip="false"/>
- <f:verbatim>
- <br />
- <br />
- </f:verbatim>
+ <f:verbatim>
+ <br/>
+ <br/>
+ Another variation of input:
+ </f:verbatim>
+ <rich:inputNumberSlider value="10" minValue="0" maxValue="100" step="5"
+ showToolTip="true"/>
- <rich:inputNumberSlider showInput="true" showBoundaryValues="true" showToolTip="true"
- value="2.5" step="0.5" minValue="0.0" maxValue="10.0" inputSize="30" />
+ <f:verbatim>
+ <br/>
+ <br/>
+ </f:verbatim>
- <f:verbatim>
- <br />
- <br />
- </f:verbatim>
+ <rich:inputNumberSlider showInput="true" showBoundaryValues="true"
+ showToolTip="true"
+ value="2.5" step="0.5" minValue="0.0"
+ maxValue="10.0" inputSize="30"/>
- <rich:inputNumberSlider showInput="true" showBoundaryValues="true" showToolTip="true"
- value="2.5" step="0.5" minValue="0" maxValue="10" />
+ <f:verbatim>
+ <br/>
+ <br/>
+ </f:verbatim>
- <f:verbatim>
- <br />
- <br />
- </f:verbatim>
+ <rich:inputNumberSlider showInput="true" showBoundaryValues="true"
+ showToolTip="true"
+ value="2.5" step="0.5" minValue="0"
+ maxValue="10"/>
- <rich:inputNumberSlider showInput="true" showBoundaryValues="true" showToolTip="true"
- value="1.4" step="0.1" minValue="1.2" maxValue="2.2" />
+ <f:verbatim>
+ <br/>
+ <br/>
+ </f:verbatim>
- <f:verbatim>
- <br />
- <br />
- </f:verbatim>
+ <rich:inputNumberSlider id="SliderId" showInput="#{bean.showInput}" showBoundaryValues="#{bean.showBoundaryValues}"
+ showToolTip="true" disabled="#{bean.disabled}"
+ value="1.4" step="0.1" minValue="1.2"
+ maxValue="2.2"/>
- <h:commandButton value="Value: #{bean.value}" />
- </h:form>
- </f:view>
- </body>
+ <f:verbatim>
+ <br/>
+ <br/>
+ </f:verbatim>
+
+ <h:panelGrid columns="2" cellspacing="10px" border="1">
+ <h:outputText value="Disabled:"></h:outputText>
+ <h:selectBooleanCheckbox value="#{bean.disabled}">
+ <a4j:support event="onchange" reRender="SliderId"></a4j:support>
+ </h:selectBooleanCheckbox>
+
+ <h:outputText value="Boundary Values:"></h:outputText>
+ <h:selectBooleanCheckbox
+ value="#{bean.showBoundaryValues}">
+ <a4j:support event="onchange" reRender="SliderId"></a4j:support>
+ </h:selectBooleanCheckbox>
+
+ <h:outputText value="Show Input:"></h:outputText>
+ <h:selectBooleanCheckbox value="#{bean.showInput}">
+ <a4j:support event="onchange" reRender="SliderId"></a4j:support>
+ </h:selectBooleanCheckbox>
+ </h:panelGrid>
+ <br/>
+
+ <h:commandButton value="Value: #{bean.value}"/>
+ </h:form>
+</f:view>
+</body>
</html>
17 years, 2 months
JBoss Rich Faces SVN: r1945 - in trunk/ui/inputnumber-slider/src/main: resources/org/richfaces/renderkit/html/script and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: A.Skokov
Date: 2007-07-31 06:41:40 -0400 (Tue, 31 Jul 2007)
New Revision: 1945
Modified:
trunk/ui/inputnumber-slider/src/main/java/org/richfaces/renderkit/InputNumberSliderRendererBase.java
trunk/ui/inputnumber-slider/src/main/resources/org/richfaces/renderkit/html/script/SliderScript.js
trunk/ui/inputnumber-slider/src/main/templates/inputNumberSlider.jspx
Log:
http://jira.jboss.com/jira/browse/RF-490
Modified: trunk/ui/inputnumber-slider/src/main/java/org/richfaces/renderkit/InputNumberSliderRendererBase.java
===================================================================
--- trunk/ui/inputnumber-slider/src/main/java/org/richfaces/renderkit/InputNumberSliderRendererBase.java 2007-07-31 09:50:46 UTC (rev 1944)
+++ trunk/ui/inputnumber-slider/src/main/java/org/richfaces/renderkit/InputNumberSliderRendererBase.java 2007-07-31 10:41:40 UTC (rev 1945)
@@ -29,7 +29,7 @@
/**
* @author Nick - mailto:nbelaevski@exadel.com
* created 19.01.2007
- *
+ *
*/
public class InputNumberSliderRendererBase extends InputRendererBase {
@@ -40,9 +40,4 @@
protected boolean attributeToBoolean(UIComponent component, String attributeName) {
return getUtils().isBooleanAttribute(component, attributeName);
}
-
- public String writeSpace() {
- return " ";
- }
-
}
Modified: trunk/ui/inputnumber-slider/src/main/resources/org/richfaces/renderkit/html/script/SliderScript.js
===================================================================
--- trunk/ui/inputnumber-slider/src/main/resources/org/richfaces/renderkit/html/script/SliderScript.js 2007-07-31 09:50:46 UTC (rev 1944)
+++ trunk/ui/inputnumber-slider/src/main/resources/org/richfaces/renderkit/html/script/SliderScript.js 2007-07-31 10:41:40 UTC (rev 1945)
@@ -86,12 +86,13 @@
Event.observe(this.input, "change", this.eventInputChange);
}
this.initialized = true;
- Event.observe(window, "load", this.setInitialValue.bindAsEventListener(this)); //FIX RFA-190
- //Event.observe($(input), "propertychange", this.setInitialValue.bindAsEventListener(this));
+ this.setInitialValue();
+ //Event.observe(window, "load", this.setInitialValue.bindAsEventListener(this)); //FIX RFA-190
+ //Event.observe($(input), "propertychange", this.setInitialValue.bindAsEventListener(this));
this.required = options.required;
},
-
+
setInitialValue: function(){
this.setValue(parseFloat(this.options.sliderValue || this.range.start));
this.handle.style.visibility="visible";
@@ -114,9 +115,9 @@
},
roundFloat: function(x){
- if (!this.digCount)
+ if (!this.digCount)
return Math.round(x);
-
+
return parseFloat(Number(x).toFixed(this.digCount));
},
@@ -163,7 +164,7 @@
if (t <= v[k]) j = k;
else i = k + 1;
}
-
+
return i;
},
@@ -215,10 +216,10 @@
if(Event.isLeftClick(event)) {
if(!this.disabled){
- this.handle.className = this.classes.arrowSelected + this.classes.base + this.classes.handleSelected;
+ this.handle.className = this.classes.arrowSelected + this.classes.base + this.classes.handleSelected;
if (this.options.currValue){
this.tip.style.display = "block";
- }
+ }
Richfaces.createEvent("mousedown", this.mainTable, null, null).fire();
this.active = true;
var handle = Event.element(event);
@@ -234,7 +235,7 @@
update: function(event) {
if(this.active) {
-
+
if(!this.dragging) this.dragging = true;
this.draw(event);
Event.stop(event);
@@ -247,7 +248,7 @@
pointer -= this.offsetX + offsets[0];
this.setValue(this.translateToValue( pointer ));
},
-
+
processMouseUp: function(event) {
this.endDrag(event);
this.fireClickIfNeeded(event);
@@ -262,27 +263,27 @@
if (this.eventChanged && this.isValueChanged()){
this.eventChanged(event);
}
- this.handle.className = this.classes.arrow + this.classes.base;
+ this.handle.className = this.classes.arrow + this.classes.base;
if(this.active && this.dragging) {
this.active = false;
- this.dragging = false;
+ this.dragging = false;
Richfaces.createEvent("mouseup", this.mainTable, null, null).fire();
Event.stop(event);
}
if (RichFaces.navigatorType() != "MSIE")
Richfaces.createEvent("change", this.input, null, null).fire();
},
-
- fireClickIfNeeded: function(event){
- if ((this.prevMouseDownEvent.target != event.target
+
+ fireClickIfNeeded: function(event){
+ if ((this.prevMouseDownEvent.target != event.target
&& RichFaces.navigatorType() == "FF")
- || (RichFaces.getOperaVersion()
- && RichFaces.getOperaVersion() < 9.0
- && event.target.tagName.toLowerCase() != "div")) {
+ || (RichFaces.getOperaVersion()
+ && RichFaces.getOperaVersion() < 9.0
+ && event.target.tagName.toLowerCase() != "div")) {
Richfaces.createEvent("click", this.mainTable, null, null).fire();
}
},
-
+
isValueChanged : function(){
var ret =this.prevValue != this.value
this.prevValue = this.value;
Modified: trunk/ui/inputnumber-slider/src/main/templates/inputNumberSlider.jspx
===================================================================
--- trunk/ui/inputnumber-slider/src/main/templates/inputNumberSlider.jspx 2007-07-31 09:50:46 UTC (rev 1944)
+++ trunk/ui/inputnumber-slider/src/main/templates/inputNumberSlider.jspx 2007-07-31 10:41:40 UTC (rev 1945)
@@ -1,18 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
-<f:root
- xmlns:f="http://ajax4jsf.org/cdk/template"
- xmlns:c=" http://java.sun.com/jsf/core"
+<f:root
+ xmlns:f="http://ajax4jsf.org/cdk/template"
+ xmlns:c=" http://java.sun.com/jsf/core"
xmlns:ui=" http://ajax4jsf.org/cdk/ui"
xmlns:u=" http://ajax4jsf.org/cdk/u"
xmlns:x=" http://ajax4jsf.org/cdk/x"
class="org.richfaces.renderkit.html.InputNumberSliderRenderer"
baseclass="org.richfaces.renderkit.InputNumberSliderRendererBase"
- component="org.richfaces.component.UIInputNumberSlider"
+ component="org.richfaces.component.UIInputNumberSlider"
>
<h:styles>css/slider.xcss</h:styles>
<h:scripts>new org.ajax4jsf.javascript.PrototypeScript(),script/SliderScript.js,/org/richfaces/renderkit/html/scripts/browser_info.js,/org/richfaces/renderkit/html/scripts/events.js</h:scripts>
<f:clientid var="clientId"/>
-
+
<f:resource name="/org/richfaces/renderkit/html/images/spacer.gif" var="spacer" />
<f:resource name="org.richfaces.renderkit.html.images.SliderArrowImage" var="arrow" />
<f:resource name="org.richfaces.renderkit.html.images.SliderArrowSelectedImage" var="arrowSelected" />
@@ -23,21 +23,21 @@
<tr>
<td class="dr-insldr-left-num rich-inslider-left-num #{component.attributes['boundClass']}">
<jsp:scriptlet><![CDATA[
- if (attributeToBoolean(component, "showBoundaryValues")){
- ]]></jsp:scriptlet>
+ if (attributeToBoolean(component, "showBoundaryValues")){
+ ]]></jsp:scriptlet>
#{component.attributes['minValue']}
<jsp:scriptlet><![CDATA[
- }
- ]]></jsp:scriptlet>
+ }
+ ]]></jsp:scriptlet>
</td>
<td class="dr-insldr-right-num rich-inslider-right-num #{component.attributes['boundClass']}">
<jsp:scriptlet><![CDATA[
- if (attributeToBoolean(component, "showBoundaryValues")){
- ]]></jsp:scriptlet>
+ if (attributeToBoolean(component, "showBoundaryValues")){
+ ]]></jsp:scriptlet>
#{component.attributes['maxValue']}
<jsp:scriptlet><![CDATA[
- }
- ]]></jsp:scriptlet>
+ }
+ ]]></jsp:scriptlet>
</td>
<td rowspan="2" style="vertical-align : bottom">
<jsp:scriptlet><![CDATA[
@@ -49,14 +49,14 @@
variables.setVariable("inputDisabled",new Boolean(disabled));
if (!manualInput || disabled){
- variables.setVariable("color", "color: gray;");
+ variables.setVariable("color", "color: gray;");
}
else{
- variables.setVariable("color", "");
+ variables.setVariable("color", "");
}
-
+
variables.setVariable("inputSize", component.getAttributes().get("inputSize"));
-
+
//if (showInput || manualInput) {
if (showInput) {
]]></jsp:scriptlet>
@@ -64,7 +64,7 @@
name="#{clientId}"
value="#{this:getInputValue(context,component)}"
type="text"
- class="dr-insldr-field rich-inslider-field #{component.attributes['inputClass']}"
+ class="dr-insldr-field rich-inslider-field #{component.attributes['inputClass']}"
style="#{component.attributes['inputStyle']}; #{color}"
readonly="#{inputReadOnly}"
disabled="#{disabled}"
@@ -74,7 +74,7 @@
accesskey="#{component.attributes['accesskey']}"
size="#{inputSize}"
maxlength="#{component.attributes['maxlength']}"
- />
+ />
<jsp:scriptlet><![CDATA[
} else {
]]></jsp:scriptlet>
@@ -82,7 +82,7 @@
name="#{clientId}"
value="#{this:getInputValue(context,component)}"
type="hidden"
- />
+ />
<jsp:scriptlet><![CDATA[
}
]]></jsp:scriptlet>
@@ -96,9 +96,15 @@
<td id="#{clientId}Track">
<div style="position : relative">
<div id="#{clientId}Tip" class="dr-insldr-tip rich-inslider-tip #{component.attributes['tipClass']}" style="display: none;#{component.attributes['tipStyle']}">
- #{this:writeSpace()}</div>
+ <jsp:scriptlet><![CDATA[
+ writer.write(" ");
+ ]]></jsp:scriptlet>
+ </div>
<div class="dr-insldr-handler rich-inslider-handler #{component.attributes['handleClass']}" id="#{clientId}Handle">
- #{this:writeSpace()}</div>
+ <jsp:scriptlet><![CDATA[
+ writer.write(" ");
+ ]]></jsp:scriptlet>
+ </div>
</div>
<div class="dr-insldr-track rich-inslider-track #{component.attributes['barClass']}" style="#{component.attributes['barStyle']}">
<table class="dr-insldr-track-decor-1" cellpadding="0" cellspacing="0">
@@ -111,13 +117,13 @@
</tbody>
</table>
</div>
- <script type="text/javascript">
+ <script type="text/javascript">
new Exadel.Slider(
- "#{clientId}Handle",
+ "#{clientId}Handle",
"#{clientId}Track",
"#{clientId}Tip",
"#{clientId}",
- "#{component.attributes['handleSelectedClass']}",
+ "#{component.attributes['handleSelectedClass']}",
{
range : $R(#{component.attributes['minValue']},#{component.attributes['maxValue']}),
step : "#{component.attributes['step']}",
@@ -127,7 +133,7 @@
inputId : "#{clientId}Input",
arrowSelected : "#{arrowSelected}",
onerr : "#{component.attributes['onerror']}",
- onchange : "#{component.attributes['onchange']}",
+ onchange : "#{component.attributes['onchange']}",
required : #{component.attributes['required']}
})
</script>
17 years, 2 months
JBoss Rich Faces SVN: r1944 - trunk/sandbox/ui/scrollable-grid/src/main/javascript/ClientUI/common/utils.
by richfaces-svn-commits@lists.jboss.org
Author: maksimkaszynski
Date: 2007-07-31 05:50:46 -0400 (Tue, 31 Jul 2007)
New Revision: 1944
Modified:
trunk/sandbox/ui/scrollable-grid/src/main/javascript/ClientUI/common/utils/Utils.js
Log:
fixed incompatibilities with IE7
Modified: trunk/sandbox/ui/scrollable-grid/src/main/javascript/ClientUI/common/utils/Utils.js
===================================================================
--- trunk/sandbox/ui/scrollable-grid/src/main/javascript/ClientUI/common/utils/Utils.js 2007-07-31 09:34:24 UTC (rev 1943)
+++ trunk/sandbox/ui/scrollable-grid/src/main/javascript/ClientUI/common/utils/Utils.js 2007-07-31 09:50:46 UTC (rev 1944)
@@ -50,51 +50,18 @@
if (ClientUILib.isIE) {
var s = String();
- var newOuterXml = "<table><tbody>" + src.xml.replace(Utils.xmlns, '') + "</tbody></table>";
+ var newOuterXml = "<table><tbody>" + src.xml + "</tbody></table>";
var newNode = document.createElement("DIV");
+
newNode.innerHTML = newOuterXml;
+
var imported = newNode.firstChild.firstChild.firstChild;
-
- //alert(imported);
-
target.parentNode.replaceChild(imported, target);;
return imported;
- } /*else if (ClientUILib.isIE) {
+ } else {
var theDoc = document;
- //var createEl = theDoc.createElement;
- row = theDoc.createElement( "TR" );
- Utils.DOM.copyAttributes(row, src);
-
- var tdSrc, tdNode, subNode;
- var childs = src.childNodes;
- var ccount = childs.length;
- var tcount = target.childNodes.length;
- for(var k=0; k<tcount; k++) {
- tdSrc = k<ccount ? childs[k] : null;
- tdNode = theDoc.createElement( "TD" );
- tdNode.className = target.childNodes[k].className;
-
- if(tdSrc) {
- innerHTML = [];
- innerCount = tdSrc.childNodes.length;
- for(j=0; j<innerCount; j++) {
- subNode = tdSrc.childNodes[j];
- innerHTML.push(subNode.xml);
- }
- tdNode.innerHTML = innerHTML.join("");
- }
- row.insertBefore(tdNode, null);
- }
-
- target.parentNode.replaceChild(row, target);
- return row;
-
- } */
- else {
- var theDoc = document;
-
Utils.DOM._clearAttributes(target);
Utils.DOM.copyAttributes(target, src);
17 years, 2 months
JBoss Rich Faces SVN: r1943 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: vkorluzhenko
Date: 2007-07-31 05:34:24 -0400 (Tue, 31 Jul 2007)
New Revision: 1943
Modified:
trunk/docs/userguide/en/src/main/docbook/included/modalPanel.xml
Log:
http://jira.jboss.com/jira/browse/RF-511
Modified: trunk/docs/userguide/en/src/main/docbook/included/modalPanel.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/modalPanel.xml 2007-07-31 01:59:25 UTC (rev 1942)
+++ trunk/docs/userguide/en/src/main/docbook/included/modalPanel.xml 2007-07-31 09:34:24 UTC (rev 1943)
@@ -263,7 +263,14 @@
]]></programlisting>
<para> Here, if user opens modal dialog window using current link and after submits data then
modalPanel destination and height on new loaded page will be restored. </para>
- <para>You can use input or/and command components inside modalPanel. Simple example of using
+ <para>if you need the content of the modalPanel to be submitted - you need to remember two important rules: </para>
+ <itemizedlist>
+ <listitem>modalPanel must have its own form if it has form elements (input or/and command
+ components) inside (as it was shown in the example above) </listitem>
+ <listitem>modalPanel must not be included into the form (on any level up) if it has the
+ form inside.</listitem>
+ </itemizedlist>
+ <para>Simple example of using
commandButton within modalPanel is placed below.</para>
<emphasis role="bold">Example:</emphasis>
<programlisting role="XML"><![CDATA[...
@@ -278,18 +285,13 @@
<t:commandButton value="Test" action="#{TESTCONTROLLER.test}" />
</h:form>
</rich:modalPanel>
-...
+ ...
+ <h:form>
+ <!--Some other Page content-->
+ </h:form>
+...
]]></programlisting>
- <para>
- <note>
- <title>Note:</title>Two rules are important for modalPanel: <itemizedlist>
- <listitem>modalPanel must have its own form if it has form elements (input or/and command
- components) inside (as it was shown in the example above) </listitem>
- <listitem>modalPanel must not be included into the form (on any level up) if it has the
- form inside.</listitem>
- </itemizedlist></note>
- </para>
- <para>See also <ulink
+ <para>See also discussion about this problem on the <ulink
url="http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4064191"
>RichFaces Users Forum</ulink>.</para>
</section>
17 years, 2 months
JBoss Rich Faces SVN: r1942 - in trunk/samples/richfaces-demo: src/main/resources/org/richfaces/demo/common and 9 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: SergeySmirnov
Date: 2007-07-30 21:59:25 -0400 (Mon, 30 Jul 2007)
New Revision: 1942
Added:
trunk/samples/richfaces-demo/src/main/webapp/images/ajax/
trunk/samples/richfaces-demo/src/main/webapp/images/ajax/ajax_process.gif
trunk/samples/richfaces-demo/src/main/webapp/richfaces/ajaxListener.xhtml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/ajaxListener/
trunk/samples/richfaces-demo/src/main/webapp/richfaces/ajaxListener/source/
trunk/samples/richfaces-demo/src/main/webapp/richfaces/ajaxListener/source/usage.html
trunk/samples/richfaces-demo/src/main/webapp/richfaces/ajaxListener/source/usage.xhtml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/ajaxListener/usage.xhtml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/status.xhtml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/status/
trunk/samples/richfaces-demo/src/main/webapp/richfaces/status/source/
trunk/samples/richfaces-demo/src/main/webapp/richfaces/status/source/usage.html
trunk/samples/richfaces-demo/src/main/webapp/richfaces/status/source/usage.xhtml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/status/usage.xhtml
Modified:
trunk/samples/richfaces-demo/
trunk/samples/richfaces-demo/src/main/resources/org/richfaces/demo/common/components.properties
trunk/samples/richfaces-demo/src/main/webapp/richfaces/jsFunction/usage.xhtml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/poll/usage.xhtml
Log:
Property changes on: trunk/samples/richfaces-demo
___________________________________________________________________
Name: svn:ignore
- target
.settings
.classpath
.exadelproject
.project
+ target
.settings
.classpath
.exadelproject
.project
richfaces-demo.iws
richfaces-demo.ipr
richfaces-demo.iml
Modified: trunk/samples/richfaces-demo/src/main/resources/org/richfaces/demo/common/components.properties
===================================================================
--- trunk/samples/richfaces-demo/src/main/resources/org/richfaces/demo/common/components.properties 2007-07-30 23:45:24 UTC (rev 1941)
+++ trunk/samples/richfaces-demo/src/main/resources/org/richfaces/demo/common/components.properties 2007-07-31 01:59:25 UTC (rev 1942)
@@ -42,8 +42,8 @@
jsFunction= ajaxSupport, JavaScript Function, /images/ico_common.gif, /images/cn_jsFunction.gif, http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., /richfaces/jsFunction.jsf
poll= ajaxSupport, Poll, /images/ico_common.gif, /images/cn_poll.gif, http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., /richfaces/poll.jsf
push= ajaxSupport, Push, /images/ico_common.gif, /images/cn_common.gif, http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., /richfaces/panel.jsf
-status= ajaxSupport, Status, /images/ico_common.gif, /images/cn_common.gif, http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., /richfaces/panel.jsf
-ajaxListener= ajaxSupport, Ajax Listener, /images/ico_common.gif, /images/cn_common.gif, http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., /richfaces/panel.jsf
+status= ajaxSupport, Status, /images/ico_common.gif, /images/cn_status.gif, http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., /richfaces/status.jsf
+ajaxListener= ajaxSupport, Ajax Listener, /images/ico_common.gif, /images/cn_ajaxListener.gif, http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., /richfaces/ajaxListener.jsf
region= ajaxSupport, Ajax Region, /images/ico_common.gif, /images/cn_ajaxRegion.gif, http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., /richfaces/region.jsf
loadBundle= ajaxResources, Bundle, /images/ico_common.gif, /images/cn_common.gif, http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., /richfaces/panel.jsf
loadScript= ajaxResources, Script, /images/ico_common.gif, /images/cn_common.gif, http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., /richfaces/panel.jsf
Added: trunk/samples/richfaces-demo/src/main/webapp/images/ajax/ajax_process.gif
===================================================================
(Binary files differ)
Property changes on: trunk/samples/richfaces-demo/src/main/webapp/images/ajax/ajax_process.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/samples/richfaces-demo/src/main/webapp/richfaces/ajaxListener/source/usage.html
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/ajaxListener/source/usage.html (rev 0)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/ajaxListener/source/usage.html 2007-07-31 01:59:25 UTC (rev 1942)
@@ -0,0 +1 @@
+TODO: source should be added
\ No newline at end of file
Added: trunk/samples/richfaces-demo/src/main/webapp/richfaces/ajaxListener/source/usage.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/ajaxListener/source/usage.xhtml (rev 0)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/ajaxListener/source/usage.xhtml 2007-07-31 01:59:25 UTC (rev 1942)
@@ -0,0 +1 @@
+x
\ No newline at end of file
Added: trunk/samples/richfaces-demo/src/main/webapp/richfaces/ajaxListener/usage.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/ajaxListener/usage.xhtml (rev 0)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/ajaxListener/usage.xhtml 2007-07-31 01:59:25 UTC (rev 1942)
@@ -0,0 +1,35 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich">
+ <ui:composition template="/templates/component-sample.xhtml">
+ <ui:define name="sample">
+ <p>
+ Additional to the listeners provided by JSF specification, RichFaces add one more:
+ Ajax Listener (a4j:ajaxListener). Ajax Listener in invoked before the Render Response
+ phase. Instead of Action Listener of Value Change Listener which are not invoked when
+ Validation of Update Model phases failed, Ajax Listener is guarantied to be invoked
+ for each Ajax response. So, it is a good place for update the list of re-rendered
+ components, for example.
+ </p>
+ <p>
+ Ajax Listener is not invoked for non-Ajax request and when RichFaces works in
+ "Ajax Request generates Non-Ajax Response" mode. Therefore, Ajax Listener invocation
+ is a good indicator that Ajax response is going to be processed.
+ </p>
+
+ <p>
+ <b>type</b> attribute defines the fully qualified Java class name for listener. This
+ class should implement org.ajax4jsf.events.AjaxListener interface. You can access to
+ the source of the event (Ajax component) using event.getSource() call.
+ </p>
+
+
+
+ </ui:define>
+
+ </ui:composition>
+</html>
Added: trunk/samples/richfaces-demo/src/main/webapp/richfaces/ajaxListener.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/ajaxListener.xhtml (rev 0)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/ajaxListener.xhtml 2007-07-31 01:59:25 UTC (rev 1942)
@@ -0,0 +1,17 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich">
+<ui:composition template="/templates/main.xhtml">
+ <ui:define name="title">RichFaces - Open Source Rich JSF Components - Ajax Listener</ui:define>
+ <ui:define name="body">
+ <rich:tabPanel switchType="server" styleClass="top_tab" contentClass="content_tab" inactiveTabClass="inactive_tab" activeTabClass="active_tab">
+ <rich:tab label="Usage">
+ <ui:include src="/richfaces/ajaxListener/usage.xhtml"/>
+ </rich:tab>
+ </rich:tabPanel>
+ </ui:define>
+</ui:composition>
+</html>
Modified: trunk/samples/richfaces-demo/src/main/webapp/richfaces/jsFunction/usage.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/jsFunction/usage.xhtml 2007-07-30 23:45:24 UTC (rev 1941)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/jsFunction/usage.xhtml 2007-07-31 01:59:25 UTC (rev 1942)
@@ -3,7 +3,7 @@
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
- xmlns:a4j="http://richfaces.org/ajax"
+ xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.ajax4jsf.org/rich">
<ui:composition template="/templates/component-sample.xhtml">
<ui:define name="sample">
@@ -14,8 +14,9 @@
shows how the part of the page is re-rendered when user hover over the names.
</p>
+
<div class="sample-container" >
- <rich:separator lineType="solid" height="1" />
+ <rich:separator lineType="solid" height="1" />
<table width="400">
<tbody>
<tr>
Modified: trunk/samples/richfaces-demo/src/main/webapp/richfaces/poll/usage.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/poll/usage.xhtml 2007-07-30 23:45:24 UTC (rev 1941)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/poll/usage.xhtml 2007-07-31 01:59:25 UTC (rev 1942)
@@ -1,92 +1,105 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
- xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:f="http://java.sun.com/jsf/core"
- xmlns:a4j="http://richfaces.org/ajax"
- xmlns:rich="http://richfaces.ajax4jsf.org/rich">
- <ui:composition template="/templates/component-sample.xhtml">
- <ui:define name="sample">
-
-
- <p>a4j:poll is one of the way how you can orginize the periodical polling of server data and
- updating the page. a4j:poll is a standard RichFaces Ajax component. So, you can use the same
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich">
+<ui:composition template="/templates/component-sample.xhtml">
+ <ui:define name="sample">
+
+
+ <p>a4j:poll is one of the way how you can orginize the periodical polling of server data and
+ updating the page. a4j:poll is a standard RichFaces Ajax component. So, you can use the same
approach as for a4j:commandButton for example. I.e. you can use action attribute to invoke the
actiom method and reRender attribute to update area(s) on the client when Ajax response returns
- back. RichFaces use the standard form based request, so having the form around the
+ back. RichFaces use the standard form based request, so having the form around the
a4j:poll component is required.
- </p>
- <p>The following example shown how the date and time is updated on the page based on the data
+ </p>
+
+ <p>The following example shown how the date and time is updated on the page based on the data
taken from the server.</p>
- <div class="sample-container" >
- <rich:separator height="1"/>
- <a4j:region>
- <h:form>
- <a4j:poll id="poll" interval="500" enabled="#{userBean.pollEnabled}" reRender="serverDate" />
- </h:form>
- </a4j:region>
+
+ <div class="sample-container">
+ <rich:separator height="1"/>
+ <a4j:region>
<h:form>
- <h:panelGrid columns="2" width="80%">
- <a4j:commandButton style="width:120px" id="control" value="#{userBean.pollEnabled?'Stop':'Start'} Polling"
- reRender="poll, control">
- <a4j:actionparam name="polling" value="#{!userBean.pollEnabled}"
- assignTo="#{userBean.pollEnabled}"/>
- </a4j:commandButton>
- <h:outputText id="serverDate" style="font-size:16px" value="Server Date: #{userBean.date}" />
- </h:panelGrid>
+ <a4j:poll id="poll" interval="500" enabled="#{userBean.pollEnabled}" reRender="serverDate"/>
</h:form>
- <rich:separator height="1" style="padding-top:10px"/>
- </div>
+ </a4j:region>
+ <h:form>
+ <h:panelGrid columns="2" width="80%">
+ <a4j:commandButton style="width:120px" id="control"
+ value="#{userBean.pollEnabled?'Stop':'Start'} Polling"
+ reRender="poll, control">
+ <a4j:actionparam name="polling" value="#{!userBean.pollEnabled}"
+ assignTo="#{userBean.pollEnabled}"/>
+ </a4j:commandButton>
+ <h:outputText id="serverDate" style="font-size:16px" value="Server Date: #{userBean.date}"/>
+ </h:panelGrid>
+ </h:form>
+ <rich:separator height="1" style="padding-top:10px"/>
+ </div>
- <p><b>interval</b> attribute defines the interval in ms between the previous response and the
+ <p><b>interval</b> attribute defines the interval in ms between the previous response and the
next request. So, the total period between two request generated by a4j:poll is a sum of interval
- and server response time.
- </p>
- <p>
- <b>timeout</b> attribute defines the time in ms how long the client will wait for server response.
- if Ajax response does not come during this period, the connection is aborted and the next
- request is sent. By default, the timeout is not set.
- </p>
- <p>
- <b>enabled</b> attribute defines should the a4j:poll send request or not. You can use EL
- to point to the bean property that will be the flag. Re-render the a4j:poll component itself
- to apply the current value. See the example how to accomplish this task.
- </p>
- <p>
- a4j:poll sends requests in parallel with user activities. The intersections
- between a4j:poll Ajax requests and other Ajax requests are possible. This might causes
- unpredictable glitches. Especially, it is true for the earlier version of JSF implementations
- when the parallel requests to the server was not expected. To avoid problem, try to follow
- very simple rules:
- <ul>
- <li>Have a separate form for a4j:poll. Note, that other fields will be included in
- request and processed on the server if the form contains not only a4j:poll;</li>
- <li>Surround a4j:poll with a4j:region. This allow to limit the part of the component
- tree that will be processed for each Ajax request;</li>
- <li>Try to avoid updating the same server data that might be updated by the Ajax requests
- produced by the user activities. If you need this, be sure your code allows to access
- the data from parallel thread without conflicts;</li>
- <li>Try to avoid re-rendering the area(s) with input field and other form controls.
- This causes the losing of input focus because the old elements are removed before
- the update with the upcomming ones</li>
- <li>Try to re-render as little area(s) on the client as possible. Try do not have
- intersections between the areas re-rendered by a4j:poll and areas re-rendered
- by other Ajax components;</li>
- <li>Use the eventsQueue with the same name as the name for other Ajax components.
- This allows to queue the Ajax request and avoid updating the server side data
- and re-rendering the page area(s) in parallet;</li>
- <li>Set the reasonable interval. Note that each Ajax request restores the session
- and component tree as well as processes the whole JSF lifecycle. Too often requests
- just degrade the overall performance of application</li>
- </ul>
-
- </p>
-
-
- </ui:define>
- <ui:define name="sources">
- Here is a fragment of page sources for the given example:
- <iframe src="${facesContext.externalContext.requestContextPath}/richfaces/poll/source/usage.html" class="source_frame"/>
- </ui:define>
- </ui:composition>
+ and server response time.
+ </p>
+
+ <p>
+ <b>timeout</b> attribute defines the time in ms how long the client will wait for server response.
+ if Ajax response does not come during this period, the connection is aborted and the next
+ request is sent. By default, the timeout is not set.
+ </p>
+
+ <p>
+ <b>enabled</b> attribute defines should the a4j:poll send request or not. You can use EL
+ to point to the bean property that will be the flag. Re-render the a4j:poll component itself
+ to apply the current value. See the example how to accomplish this task.
+ </p>
+
+ <p>
+ a4j:poll sends requests in parallel with user activities. The intersections
+ between a4j:poll Ajax requests and other Ajax requests are possible. This might causes
+ unpredictable glitches. Especially, it is true for the earlier version of JSF implementations
+ when the parallel requests to the server was not expected. To avoid problem, try to follow
+ very simple rules:
+ </p>
+ <ul>
+ <li>Have a separate form for a4j:poll. Note, that other fields will be included in
+ request and processed on the server if the form contains not only a4j:poll;
+ </li>
+ <li>Surround a4j:poll with a4j:region. This allow to limit the part of the component
+ tree that will be processed for each Ajax request;
+ </li>
+ <li>Try to avoid updating the same server data that might be updated by the Ajax requests
+ produced by the user activities. If you need this, be sure your code allows to access
+ the data from parallel thread without conflicts;
+ </li>
+ <li>Try to avoid re-rendering the area(s) with input field and other form controls.
+ This causes the losing of input focus because the old elements are removed before
+ the update with the upcomming ones
+ </li>
+ <li>Try to re-render as little area(s) on the client as possible. Try do not have
+ intersections between the areas re-rendered by a4j:poll and areas re-rendered
+ by other Ajax components;
+ </li>
+ <li>Use the eventsQueue with the same name as the name for other Ajax components.
+ This allows to queue the Ajax request and avoid updating the server side data
+ and re-rendering the page area(s) in parallet;
+ </li>
+ <li>Set the reasonable interval. Note that each Ajax request restores the session
+ and component tree as well as processes the whole JSF lifecycle. Too often requests
+ just degrade the overall performance of application
+ </li>
+ </ul>
+
+
+ </ui:define>
+ <ui:define name="sources">
+ Here is a fragment of page sources for the given example:
+ <iframe src="${facesContext.externalContext.requestContextPath}/richfaces/poll/source/usage.html"
+ class="source_frame"/>
+ </ui:define>
+</ui:composition>
</html>
Added: trunk/samples/richfaces-demo/src/main/webapp/richfaces/status/source/usage.html
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/status/source/usage.html (rev 0)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/status/source/usage.html 2007-07-31 01:59:25 UTC (rev 1942)
@@ -0,0 +1 @@
+TODO: source should be added
\ No newline at end of file
Added: trunk/samples/richfaces-demo/src/main/webapp/richfaces/status/source/usage.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/status/source/usage.xhtml (rev 0)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/status/source/usage.xhtml 2007-07-31 01:59:25 UTC (rev 1942)
@@ -0,0 +1 @@
+x
\ No newline at end of file
Added: trunk/samples/richfaces-demo/src/main/webapp/richfaces/status/usage.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/status/usage.xhtml (rev 0)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/status/usage.xhtml 2007-07-31 01:59:25 UTC (rev 1942)
@@ -0,0 +1,137 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich">
+ <ui:composition template="/templates/component-sample.xhtml">
+ <ui:define name="sample">
+
+
+
+ <p>a4j:status is an indicator of Ajax request. It has two states - start and stop. Start
+ state indicates that the Ajax request is in progress. When Ajax response comes back,
+ the component switches to the stop stage.
+ </p>
+ <div class="sample-container" >
+
+ <h:outputText value="Ajax Status:"/>
+ <a4j:status id="commonstatus" startText="In progress..." stopText="Complete"/>
+
+ <h:form>
+ <a4j:commandButton eventsQueue="foo" value="Ajax Request"/>
+ </h:form>
+ </div>
+ <p>
+ <b>startText</b> attribute defines the label that will be visible when the Ajax request
+ is in progress. You can use <b>startStyle</b> or <b>startStyleClass</b> attribuite to
+ customize style for start label. You can use <b>facet name="start"</b> to define more enhanced
+ content for indication the start state. If facet is defined, the value of startText
+ attribute becomes void.
+ </p>
+ <p>
+ <b>stopText</b> attribute defines the label that will be visible when the Ajax response
+ comes back. You can use <b>stopStyle</b> or <b>stopStyleClass</b> attribuite to
+ customize style for stop label. You can use <b>facet name="stop"</b> to define more enhanced
+ content for indication the stop state. If facet is defined, the value of stopText
+ attribute becomes void.
+ </p>
+ <p>
+ In case of not stopText nor facet name="stop" are not defined, the stop stage will
+ not have a visual representation. You can use this option if you want to show only
+ "in progress" indicatior. The following example show the graphic image at the top
+ right hand corner of this page during the Ajax request.
+ </p>
+
+ <div class="sample-container" >
+ <a4j:region id="rb">
+ <a4j:status>
+ <f:facet name="start">
+ <h:graphicImage style="position:absolute;top:120px;right:10px" value="/images/ajax/ajax_process.gif"/>
+ </f:facet>
+ </a4j:status>
+
+
+ <h:form>
+ <a4j:commandButton eventsQueue="foo2" value="Ajax Request 2"/>
+ </h:form>
+ </a4j:region>
+
+ </div>
+
+ <p>
+ By default, a4j:status works for each Ajax components inside the local region. This
+ means if you have not any region defined on the page (the whole view is a region) and
+ have only one a4j:status on the page, this a4j:status will be activated durng
+ Ajax request sent by any of the Ajax component located on the page.
+ </p>
+ <p>
+ This client id of the a4j:status component is assigned based on the following pattern:
+ <working region Id>:status . <b>for</b> attribute defines the id of the region the
+ a4j:status will work for. If 'for' attribute is not defined, the working region will be the
+ region, the a4j:status located into.
+ </p>
+ <p><b>forceId</b> attribute allows to replace the ":status" postfix of the client id with the
+ defined 'id' attribute. If 'forceId' attribute is not defined, the defined 'id' attribute
+ will be ignored.
+ </p>
+
+ <p>
+ It is possible to have more than one a4j:status on the same page. In this case, you need
+ to wire status components with the Ajax component used for Ajax requests producing.
+ </p>
+ <p>
+ You do not have any additional attribute defined if you have a4j:status inside each region
+ and working for this given region. You can locate the a4j:status outside of the region if this
+ required by page layout. In this case you have to define a 'for' attribute explicilty. The 'for'
+ attribute should point to the id of the region it should work for.
+ </p>
+ <p>
+ Use attrubute 'status' of the Ajax component (such as a4j:commandButton, a4j:poll etc) to point to
+ the id of the a4j:status if you want to share it between the different Ajax component located in
+ different regions. The following example shows how to share the same a4j:status from the Ajax
+ component located in the different region:
+ </p>
+
+
+ <div class="sample-container" >
+ <a4j:region id="extr">
+ <h:form>
+ <h:outputText value="Status:" />
+ <a4j:status id="commonstatus" startText="In Progress...." stopText=""/>
+
+ <h:panelGrid columns="2">
+ <h:outputText value="Name"/>
+ <h:inputText id="name" value="#{userBean.name}">
+ <a4j:support event="onkeyup" />
+ </h:inputText>
+
+ <h:outputText value="Job"/>
+ <a4j:region id="intr">
+ <h:inputText id="job" value="#{userBean.job}">
+ <a4j:support event="onkeyup" status="commonstatus"/>
+ </h:inputText>
+ </a4j:region>
+
+ <h:panelGroup />
+
+ <a4j:region>
+ <a4j:commandButton ajaxSingle="true" value="Clean Up Form" reRender="name, job">
+ <a4j:actionparam name="n" value="" assignTo="#{userBean.name}" />
+ <a4j:actionparam name="j" value="" assignTo="#{userBean.job}" />
+ </a4j:commandButton>
+ </a4j:region>
+
+ </h:panelGrid>
+ </h:form>
+ </a4j:region>
+ </div>
+
+ </ui:define>
+ <ui:define name="sources">
+ Here is a fragment of page sources for the given example:
+ <iframe src="${facesContext.externalContext.requestContextPath}/richfaces/status/source/usage.html" class="source_frame"/>
+ </ui:define>
+ </ui:composition>
+</html>
Added: trunk/samples/richfaces-demo/src/main/webapp/richfaces/status.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/status.xhtml (rev 0)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/status.xhtml 2007-07-31 01:59:25 UTC (rev 1942)
@@ -0,0 +1,17 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich">
+<ui:composition template="/templates/main.xhtml">
+ <ui:define name="title">RichFaces - Open Source Rich JSF Components - Ajax Status</ui:define>
+ <ui:define name="body">
+ <rich:tabPanel switchType="server" styleClass="top_tab" contentClass="content_tab" inactiveTabClass="inactive_tab" activeTabClass="active_tab">
+ <rich:tab label="Usage">
+ <ui:include src="/richfaces/status/usage.xhtml"/>
+ </rich:tab>
+ </rich:tabPanel>
+ </ui:define>
+</ui:composition>
+</html>
17 years, 2 months
JBoss Rich Faces SVN: r1941 - in trunk: ui/assembly and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2007-07-30 19:45:24 -0400 (Mon, 30 Jul 2007)
New Revision: 1941
Modified:
trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/AssemblyLibraryMojo.java
trunk/ui/assembly/pom.xml
trunk/ui/assembly/src/main/assembly/richfaces.xml
trunk/ui/assembly/src/main/assembly/src.xml
Log:
build distribution package with jar's , sources and docs
Modified: trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/AssemblyLibraryMojo.java
===================================================================
--- trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/AssemblyLibraryMojo.java 2007-07-30 23:34:52 UTC (rev 1940)
+++ trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/AssemblyLibraryMojo.java 2007-07-30 23:45:24 UTC (rev 1941)
@@ -422,7 +422,7 @@
.addAll(projectsDependencies.values());
writePom(generatedProject);
project.setDependencies(new ArrayList(projectsDependencies.values()));
- project.setFile(generatedPom);
+// project.setFile(generatedPom);
}
/**
Modified: trunk/ui/assembly/pom.xml
===================================================================
--- trunk/ui/assembly/pom.xml 2007-07-30 23:34:52 UTC (rev 1940)
+++ trunk/ui/assembly/pom.xml 2007-07-30 23:45:24 UTC (rev 1941)
@@ -121,7 +121,6 @@
</execution>
</executions>
</plugin>
-<!--
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
@@ -142,6 +141,8 @@
<version>
3.1.0-SNAPSHOT
</version>
+ <type>war</type>
+ <classifier>pdf</classifier>
<outputDirectory>
${project.build.directory}/docs/userguide/en
</outputDirectory>
@@ -179,7 +180,6 @@
</execution>
</executions>
</plugin>
--->
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
Modified: trunk/ui/assembly/src/main/assembly/richfaces.xml
===================================================================
--- trunk/ui/assembly/src/main/assembly/richfaces.xml 2007-07-30 23:34:52 UTC (rev 1940)
+++ trunk/ui/assembly/src/main/assembly/richfaces.xml 2007-07-30 23:45:24 UTC (rev 1941)
@@ -27,6 +27,9 @@
<fileSet>
<directory>target/apidocs</directory>
<outputDirectory>apidocs</outputDirectory>
+ <excludes>
+ <exclude>**/META-INF</exclude>
+ </excludes>
</fileSet>
<fileSet>
<directory>target/tlddoc</directory>
@@ -43,10 +46,9 @@
<unpack>false</unpack>
<scope>runtime</scope>
<includes>
- <include>org.ajax4jsf:ajax4jsf</include>
- <include>org.ajax4jsf:test</include>
- <include>org.richfaces:richfaces</include>
- <include></include>
+ <include>org.richfaces.framework:richfaces-api</include>
+ <include>org.richfaces.framework:richfaces-impl</include>
+ <include>org.richfaces.framework:richfaces-test</include>
</includes>
<excludes>
<exclude>junit:junit</exclude>
Modified: trunk/ui/assembly/src/main/assembly/src.xml
===================================================================
--- trunk/ui/assembly/src/main/assembly/src.xml 2007-07-30 23:34:52 UTC (rev 1940)
+++ trunk/ui/assembly/src/main/assembly/src.xml 2007-07-30 23:45:24 UTC (rev 1941)
@@ -6,7 +6,7 @@
</formats>
<fileSets>
<fileSet>
- <directory>../..</directory>
+ <directory>${basedir}/../..</directory>
<outputDirectory>/</outputDirectory>
<excludes>
<exclude>**/target/**</exclude>
17 years, 2 months
JBoss Rich Faces SVN: r1940 - trunk/framework/api/src/main/java/org/richfaces/model.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-07-30 19:34:52 -0400 (Mon, 30 Jul 2007)
New Revision: 1940
Modified:
trunk/framework/api/src/main/java/org/richfaces/model/StackingTreeModel.java
Log:
Recursive model hasn't been processed correctly for recursion levels > 2 - fixed
Modified: trunk/framework/api/src/main/java/org/richfaces/model/StackingTreeModel.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/model/StackingTreeModel.java 2007-07-30 23:08:02 UTC (rev 1939)
+++ trunk/framework/api/src/main/java/org/richfaces/model/StackingTreeModel.java 2007-07-30 23:34:52 UTC (rev 1940)
@@ -129,7 +129,7 @@
return stackingTreeModel.isLeaf();
}
- Collection values = this.models.values();
+ Collection values = this.getModels().values();
for (Iterator iterator = values.iterator(); iterator.hasNext();) {
StackingTreeModel stackingTreeModel = (StackingTreeModel) iterator.next();
17 years, 2 months
JBoss Rich Faces SVN: r1939 - in trunk/framework: test/src/test/java/org/richfaces and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-07-30 19:08:02 -0400 (Mon, 30 Jul 2007)
New Revision: 1939
Added:
trunk/framework/test/src/test/java/org/richfaces/model/
trunk/framework/test/src/test/java/org/richfaces/model/StackingTreeDataModelTest.java
trunk/framework/test/src/test/java/org/richfaces/model/entity/
trunk/framework/test/src/test/java/org/richfaces/model/entity/Directory.java
trunk/framework/test/src/test/java/org/richfaces/model/entity/File.java
trunk/framework/test/src/test/java/org/richfaces/model/entity/Named.java
trunk/framework/test/src/test/java/org/richfaces/model/entity/Project.java
Modified:
trunk/framework/api/src/main/java/org/richfaces/model/StackingTreeModel.java
Log:
- StackingTreeDataModelTest.java extended & model entity classes added
- StackingTreeModel few bugs fixed
Modified: trunk/framework/api/src/main/java/org/richfaces/model/StackingTreeModel.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/model/StackingTreeModel.java 2007-07-30 23:06:53 UTC (rev 1938)
+++ trunk/framework/api/src/main/java/org/richfaces/model/StackingTreeModel.java 2007-07-30 23:08:02 UTC (rev 1939)
@@ -5,6 +5,7 @@
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
@@ -29,6 +30,8 @@
private String modelId;
private Object modelKey;
+ private Object rowData;
+
private StackingTreeModelDataProvider dataProvider;
protected StackingTreeModel stackingTreeModel;
@@ -52,6 +55,12 @@
return dataModel;
}
+ public boolean isEmpty() {
+ //TODO optimize that
+ return getDataModel().getRowCount() == 0;
+ }
+
+
public StackingTreeModel(String id, String var, StackingTreeModelDataProvider dataProvider) {
super();
this.id = id;
@@ -75,6 +84,8 @@
Map map = facesContext.getExternalContext().getRequestMap();
map.put(var, varObject);
}
+
+ rowData = null;
}
public void leaveModel() {
@@ -87,6 +98,8 @@
varObject = map.get(var);
map.put(var, object);
}
+
+ rowData = object;
}
public void setupModel(Object object) {
@@ -112,8 +125,20 @@
* @see org.richfaces.model.AbstractTreeDataModel#isLeaf()
*/
public boolean isLeaf() {
- // TODO Auto-generated method stub
- return false;
+ if (stackingTreeModel != null && stackingTreeModel != this) {
+ return stackingTreeModel.isLeaf();
+ }
+
+ Collection values = this.models.values();
+ for (Iterator iterator = values.iterator(); iterator.hasNext();) {
+ StackingTreeModel stackingTreeModel = (StackingTreeModel) iterator.next();
+
+ if (!stackingTreeModel.isEmpty()) {
+ return false;
+ }
+ }
+
+ return true;
}
protected void doWalk(FacesContext context, DataVisitor dataVisitor,
@@ -131,7 +156,7 @@
}
dataModel.setRowKey(localRowKey);
setupModel(dataModel.getRowData(), context);
- System.out.println(dataModel.getRowData() + (last ? " * " : "") + " - " + argumentKey);
+ //System.out.println(dataModel.getRowData() + (last ? " * " : "") + " - " + argumentKey);
processElement(context, dataVisitor, argument, argumentKey, last);
}
@@ -249,10 +274,6 @@
private DataVisitor dataVisitor;
- public DataVisitor getDataVisitor() {
- return dataVisitor;
- }
-
public ShiftingDataVisitor(DataVisitor dataVisitor) {
super();
this.dataVisitor = dataVisitor;
@@ -369,8 +390,11 @@
* @see javax.faces.model.DataModel#getRowData()
*/
public Object getRowData() {
- // TODO Auto-generated method stub
- return null;
+ if (stackingTreeModel != null && stackingTreeModel != this) {
+ return stackingTreeModel.getRowData();
+ }
+
+ return rowData;
}
/*
Added: trunk/framework/test/src/test/java/org/richfaces/model/StackingTreeDataModelTest.java
===================================================================
--- trunk/framework/test/src/test/java/org/richfaces/model/StackingTreeDataModelTest.java (rev 0)
+++ trunk/framework/test/src/test/java/org/richfaces/model/StackingTreeDataModelTest.java 2007-07-30 23:08:02 UTC (rev 1939)
@@ -0,0 +1,167 @@
+/**
+ *
+ */
+package org.richfaces.model;
+
+import java.io.IOException;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+import javax.faces.el.ValueBinding;
+
+import org.ajax4jsf.model.DataVisitor;
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+import org.richfaces.model.entity.Directory;
+import org.richfaces.model.entity.File;
+import org.richfaces.model.entity.Named;
+import org.richfaces.model.entity.Project;
+
+
+/**
+ * @author Nick Belaevski
+ * mailto:nbelaevski@exadel.com
+ * created 30.07.2007
+ *
+ */
+public class StackingTreeDataModelTest extends AbstractAjax4JsfTestCase {
+
+ public StackingTreeDataModelTest(String name) {
+ super(name);
+ }
+
+ private StackingTreeModel stackingTreeModel;
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#setUp()
+ */
+ public void setUp() throws Exception {
+ super.setUp();
+ this.stackingTreeModel = new StackingTreeModel();
+ StackingTreeModel projectsModel = new StackingTreeModel("project", "project", new StackingTreeModelDataProvider() {
+
+ private Map data = null;
+
+ public Object getData() {
+ if (data == null) {
+ data = new LinkedHashMap();
+ Project projectA = new Project("projectA", 10);
+
+ Directory adir1 = new Directory("ADir1", 50);
+
+ adir1.addFile(new File("AFile1", 60));
+ adir1.addFile(new File("AFile2", 61));
+
+ Directory adir2 = new Directory("ADir2", 101);
+
+ projectA.addDirectory(adir1);
+ projectA.addDirectory(adir2);
+
+ data.put(projectA.getName(), projectA);
+
+ Project projectB = new Project("projectB", 501);
+
+ Directory bdir1 = new Directory("BDir1", 600);
+ Directory bdir2 = new Directory("BDir2", 700);
+ Directory bdir3 = new Directory("BDir3", 801);
+
+ projectB.addDirectory(bdir1);
+ projectB.addDirectory(bdir2);
+ projectB.addDirectory(bdir3);
+
+ data.put(projectB.getName(), projectB);
+ }
+ return data;
+ }
+
+ });
+
+ final ValueBinding dirVB = application.createValueBinding("#{project.directories}");
+ StackingTreeModel directoriesModel = new StackingTreeModel("directory", "directory", new StackingTreeModelDataProvider() {
+ public Object getData() {
+ return dirVB.getValue(facesContext);
+ }
+ });
+
+ final ValueBinding fileVB = application.createValueBinding("#{directory.files}");
+ StackingTreeModel filesModel = new StackingTreeModel("file", "file", new StackingTreeModelDataProvider() {
+ public Object getData() {
+ return fileVB.getValue(facesContext);
+ }
+ });
+
+ directoriesModel.addStackingModel(filesModel);
+ projectsModel.addStackingModel(directoriesModel);
+ this.stackingTreeModel.addStackingModel(projectsModel);
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#tearDown()
+ */
+ public void tearDown() throws Exception {
+ super.tearDown();
+ this.stackingTreeModel = null;
+ }
+
+ public void testWalk() throws Exception {
+ StackingTreeDataModelTestVisitor1 visitor1 = new StackingTreeDataModelTestVisitor1();
+ this.stackingTreeModel.walk(facesContext, visitor1, null, null);
+ assertEquals(9, visitor1.getCounter());
+ }
+
+ class StackingTreeDataModelTestVisitor1 implements DataVisitor, LastElementAware {
+
+ private boolean last;
+ private int tag = 0;
+ private int counter = 0;
+
+ public void process(FacesContext context, Object rowKey, Object argument)
+ throws IOException {
+
+ stackingTreeModel.setRowKey(rowKey);
+ assertNull(stackingTreeModel.getTreeNode());
+ Object rowData = stackingTreeModel.getRowData();
+ assertNotNull(rowData);
+ assertTrue(rowData instanceof Named);
+
+ Named named = (Named) rowData;
+
+ if (tag == 0) {
+ tag = named.getTag();
+ } else {
+ int currentTag = named.getTag();
+ assertTrue(currentTag > tag);
+ this.tag = currentTag;
+ }
+
+ assertFalse(this.tag % 10 == 1 ^ last);
+
+ if (named instanceof Directory) {
+ if ("ADir1".equals(named.getName())) {
+ assertFalse(stackingTreeModel.isLeaf());
+ } else {
+ assertTrue(stackingTreeModel.isLeaf());
+ }
+ } else if (named instanceof Project) {
+ assertFalse(stackingTreeModel.isLeaf());
+ } else if (named instanceof File) {
+ assertTrue(stackingTreeModel.isLeaf());
+ }
+
+ counter++;
+ }
+
+ public void resetLastElement() {
+ this.last = false;
+ }
+
+ public void setLastElement() {
+ this.last = true;
+ }
+
+ public int getCounter() {
+ return counter;
+ }
+ }
+}
+
Added: trunk/framework/test/src/test/java/org/richfaces/model/entity/Directory.java
===================================================================
--- trunk/framework/test/src/test/java/org/richfaces/model/entity/Directory.java (rev 0)
+++ trunk/framework/test/src/test/java/org/richfaces/model/entity/Directory.java 2007-07-30 23:08:02 UTC (rev 1939)
@@ -0,0 +1,30 @@
+/**
+ *
+ */
+package org.richfaces.model.entity;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Nick Belaevski
+ * mailto:nbelaevski@exadel.com
+ * created 30.07.2007
+ *
+ */
+public class Directory extends Named {
+
+ public Directory(String name, int tag) {
+ super(name, tag);
+ }
+
+ private List files = new ArrayList();
+
+ public List getFiles() {
+ return files;
+ }
+
+ public void addFile(File file) {
+ this.files.add(file);
+ }
+}
Added: trunk/framework/test/src/test/java/org/richfaces/model/entity/File.java
===================================================================
--- trunk/framework/test/src/test/java/org/richfaces/model/entity/File.java (rev 0)
+++ trunk/framework/test/src/test/java/org/richfaces/model/entity/File.java 2007-07-30 23:08:02 UTC (rev 1939)
@@ -0,0 +1,18 @@
+/**
+ *
+ */
+package org.richfaces.model.entity;
+
+/**
+ * @author Nick Belaevski
+ * mailto:nbelaevski@exadel.com
+ * created 30.07.2007
+ *
+ */
+public class File extends Named {
+
+ public File(String name, int tag) {
+ super(name, tag);
+ }
+
+}
Added: trunk/framework/test/src/test/java/org/richfaces/model/entity/Named.java
===================================================================
--- trunk/framework/test/src/test/java/org/richfaces/model/entity/Named.java (rev 0)
+++ trunk/framework/test/src/test/java/org/richfaces/model/entity/Named.java 2007-07-30 23:08:02 UTC (rev 1939)
@@ -0,0 +1,27 @@
+/**
+ *
+ */
+package org.richfaces.model.entity;
+
+/**
+ * @author Nick Belaevski
+ * mailto:nbelaevski@exadel.com
+ * created 30.07.2007
+ *
+ */
+public class Named {
+ private String name;
+ private int tag;
+ public String getName() {
+ return name;
+ }
+ public int getTag() {
+ return tag;
+ }
+ public Named(String name, int tag) {
+ super();
+ this.name = name;
+ this.tag = tag;
+ }
+
+}
Added: trunk/framework/test/src/test/java/org/richfaces/model/entity/Project.java
===================================================================
--- trunk/framework/test/src/test/java/org/richfaces/model/entity/Project.java (rev 0)
+++ trunk/framework/test/src/test/java/org/richfaces/model/entity/Project.java 2007-07-30 23:08:02 UTC (rev 1939)
@@ -0,0 +1,29 @@
+/**
+ *
+ */
+package org.richfaces.model.entity;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Nick Belaevski
+ * mailto:nbelaevski@exadel.com
+ * created 30.07.2007
+ *
+ */
+public class Project extends Named {
+ public Project(String name, int tag) {
+ super(name, tag);
+ }
+
+ private List directories = new ArrayList();
+
+ public List getDirectories() {
+ return directories;
+ }
+
+ public void addDirectory(Directory directory) {
+ directories.add(directory);
+ }
+}
17 years, 2 months
JBoss Rich Faces SVN: r1938 - in trunk/sandbox/ui/calendar/src/main/java/org/richfaces: renderkit and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-07-30 19:06:53 -0400 (Mon, 30 Jul 2007)
New Revision: 1938
Modified:
trunk/sandbox/ui/calendar/src/main/java/org/richfaces/component/CurrentDateChangeEvent.java
trunk/sandbox/ui/calendar/src/main/java/org/richfaces/component/UICalendar.java
trunk/sandbox/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
Log:
Calendar code review results commited
Modified: trunk/sandbox/ui/calendar/src/main/java/org/richfaces/component/CurrentDateChangeEvent.java
===================================================================
--- trunk/sandbox/ui/calendar/src/main/java/org/richfaces/component/CurrentDateChangeEvent.java 2007-07-30 23:06:05 UTC (rev 1937)
+++ trunk/sandbox/ui/calendar/src/main/java/org/richfaces/component/CurrentDateChangeEvent.java 2007-07-30 23:06:53 UTC (rev 1938)
@@ -8,19 +8,23 @@
public class CurrentDateChangeEvent extends FacesEvent {
- private Date currentDate = null;
- private String currentDateString = null;
-
+ /**
+ *
+ */
+ private static final long serialVersionUID = -8169207286087810907L;
+ private Date currentDate = null;
+ private String currentDateString = null;
+
public CurrentDateChangeEvent(UIComponent component, Date curentDate) {
- super(component);
- this.currentDate = curentDate;
-
+ super(component);
+ this.currentDate = curentDate;
+
}
public CurrentDateChangeEvent(UIComponent component, String curentDateString) {
- super(component);
- this.currentDateString = curentDateString;
+ super(component);
+ this.currentDateString = curentDateString;
}
-
+
public boolean isAppropriateListener(FacesListener listener) {
return false;
}
@@ -33,9 +37,9 @@
public Date getCurrentDate() {
return currentDate;
}
-
+
public String getCurrentDateString() {
return currentDateString;
}
-
+
}
Modified: trunk/sandbox/ui/calendar/src/main/java/org/richfaces/component/UICalendar.java
===================================================================
--- trunk/sandbox/ui/calendar/src/main/java/org/richfaces/component/UICalendar.java 2007-07-30 23:06:05 UTC (rev 1937)
+++ trunk/sandbox/ui/calendar/src/main/java/org/richfaces/component/UICalendar.java 2007-07-30 23:06:53 UTC (rev 1938)
@@ -21,7 +21,6 @@
package org.richfaces.component;
-import java.io.IOException;
import java.util.AbstractCollection;
import java.util.ArrayList;
import java.util.Calendar;
@@ -30,24 +29,19 @@
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
-import java.util.Set;
import java.util.TimeZone;
import javax.faces.application.FacesMessage;
-import javax.faces.component.UIComponent;
import javax.faces.component.UIInput;
import javax.faces.component.UIViewRoot;
import javax.faces.context.FacesContext;
-import javax.faces.convert.Converter;
import javax.faces.convert.ConverterException;
import javax.faces.convert.DateTimeConverter;
import javax.faces.el.ValueBinding;
import javax.faces.event.AbortProcessingException;
import javax.faces.event.FacesEvent;
import javax.faces.event.ValueChangeEvent;
-import javax.faces.render.Renderer;
-import org.ajax4jsf.component.AjaxChildrenEncoder;
import org.ajax4jsf.context.AjaxContext;
import org.ajax4jsf.event.AjaxEvent;
import org.richfaces.model.CalendarDataModel;
@@ -133,21 +127,21 @@
// currentDate processing -------------------------------------------------
- public String getValueAsString(FacesContext context, UIComponent component)
- throws IOException {
- UICalendar calendar = (UICalendar) component;
- Date valueString = calendar.getCurrentDate();
- return valueString.toString();
- }
+// public String getValueAsString(FacesContext context, UIComponent component)
+// throws IOException {
+// UICalendar calendar = (UICalendar) component;
+// Date valueString = calendar.getCurrentDate();
+// return valueString.toString();
+// }
public Calendar getCalendar() {
return Calendar.getInstance(getTimeZone(), getLocale());
}
- public Converter getDateConverter() {
- DateTimeConverter datetime = new DateTimeConverter();
- return datetime;
- }
+// public Converter getDateConverter() {
+// DateTimeConverter datetime = new DateTimeConverter();
+// return datetime;
+// }
public Date getConvertedValue(FacesContext context, String currentDateString)
throws ConverterException {
@@ -160,7 +154,11 @@
}
protected void validateValue(FacesContext context, Object newValue) {
+ //TODO nick - nick - do we need this?
+ //store converted value in submitted value to ease client-side code's life
+ //see org.richfaces.renderkit.CalendarRendererBase.getSelectedDate(FacesContext, UICalendar) for more
setSubmittedValue(newValue);
+
super.validateValue(context, newValue);
}
@@ -178,7 +176,8 @@
setCurrentDate(currentDate);
}
} catch (Exception e) {
-
+ //TODO nick - kaa - missed setValid(false) !
+ //TODO nick - kaa - add log.debug(...)
String messageString = e.getMessage();
FacesMessage message = new FacesMessage(messageString);
message.setSeverity(FacesMessage.SEVERITY_ERROR);
@@ -267,12 +266,19 @@
// if currentDateString is not null then event cames from
// apply request phase
try {
+ //TODO nick - kaa - we should use datePattern attribute-based converter only for selectedDate
+ // current date string always has predefined format: m/y
+ // review org.richfaces.renderkit.CalendarRendererBase.convertCurrentDate(String) method
+ // for more
Date currentDate = getConvertedValue(facesContext,
currentDateString);
CurrentDateChangeEvent newDateChangeEvent = new CurrentDateChangeEvent(
this, currentDate);
newDateChangeEvent.queue();
} catch (Exception e) {
+ //TODO nick - kaa - add log.debug(...)
+ //TODO nick - kaa - we should stop processing on exc. setValid(false) and then call FacesContext.renderResponse(...)
+ // update model phase shouldn't start
String messageString = e.getMessage();
FacesMessage message = new FacesMessage(messageString);
message.setSeverity(FacesMessage.SEVERITY_ERROR);
@@ -346,15 +352,15 @@
return (Date[]) dates.toArray(new Date[dates.size()]);
}
- public void encodeAjaxChild(FacesContext context, String path, Set ids,
- Set renderedAreas) throws IOException {
-
- Renderer renderer = this.getRenderer(context);
- if (renderer instanceof AjaxChildrenEncoder) {
- ((AjaxChildrenEncoder) renderer).encodeAjaxChild(context, path,
- ids, renderedAreas);
- }
- }
+// public void encodeAjaxChild(FacesContext context, String path, Set ids,
+// Set renderedAreas) throws IOException {
+//
+// Renderer renderer = this.getRenderer(context);
+// if (renderer instanceof AjaxChildrenEncoder) {
+// ((AjaxChildrenEncoder) renderer).encodeAjaxChild(context, path,
+// ids, renderedAreas);
+// }
+// }
}
class AdaptingCollection extends AbstractCollection {
Modified: trunk/sandbox/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
===================================================================
--- trunk/sandbox/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2007-07-30 23:06:05 UTC (rev 1937)
+++ trunk/sandbox/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2007-07-30 23:06:53 UTC (rev 1938)
@@ -31,7 +31,6 @@
import java.util.Map;
import javax.faces.component.UIComponent;
-import javax.faces.component.UIInput;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import javax.faces.convert.Converter;
@@ -50,7 +49,6 @@
import org.richfaces.component.CurrentDateChangeEvent;
import org.richfaces.component.UICalendar;
import org.richfaces.component.util.ComponentUtil;
-import org.richfaces.component.util.HtmlUtil;
/**
* @author Nick Belaevski - mailto:nbelaevski@exadel.com created 08.06.2007
@@ -79,13 +77,6 @@
return UICalendar.class;
}
- public String qualifySize(Object size) {
- if (size == null) {
- return "";
- }
- return HtmlUtil.qualifySize(size.toString());
- }
-
public void addPopupToAjaxRendered(FacesContext context,
UICalendar component) {
@@ -148,6 +139,7 @@
ev.setPhaseId(PhaseId.PROCESS_VALIDATIONS);
ev.queue();
+ //TODO nick - nick - queue this event when ValueChangeEvent is queued?
new AjaxEvent(component).queue();
}
@@ -228,6 +220,7 @@
public String getInputValue(FacesContext context, UIComponent component) {
UICalendar input = (UICalendar) component;
+ //TODO nick - nick - can contain either Date or String instance
String value = (String) input.getSubmittedValue();
if (value == null) {
Object curVal = input.getValue();
@@ -238,6 +231,7 @@
// Converter converter =
// SelectUtils.getConverterForProperty(context, input, "value");
+ //TODO nick - kaa - how could converter be null here?
if (converter != null) {
value = converter.getAsString(context, input, curVal);
} else {
@@ -262,7 +256,7 @@
while (entryIterator.hasNext()) {
Map.Entry entry = (Map.Entry) entryIterator.next();
- writer.writeText(entry.getKey(), null);
+ writer.writeText(ScriptUtils.toScript(entry.getKey()), null);
writer.writeText(": ", null);
writer.writeText(ScriptUtils.toScript(entry.getValue()), null);
@@ -294,7 +288,7 @@
int minimum = cal.getActualMinimum(Calendar.DAY_OF_WEEK);
int firstDayOfWeek = cal.getFirstDayOfWeek();
- // .getInstance(locale) changet to new DateFormatSymbols(locale) by
+ // .getInstance(locale) changed to new DateFormatSymbols(locale) by
// Alexej Kushunin ;
DateFormatSymbols symbols = new DateFormatSymbols(locale);
String[] weekDayLabels = ComponentUtil.asArray(calendar
17 years, 2 months