JBoss Rich Faces SVN: r1545 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: smukhina
Date: 2007-07-09 09:22:27 -0400 (Mon, 09 Jul 2007)
New Revision: 1545
Modified:
trunk/docs/userguide/en/src/main/docbook/included/datascroller.xml
Log:
http://jira.jboss.com/jira/browse/RF-430
Modified: trunk/docs/userguide/en/src/main/docbook/included/datascroller.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/datascroller.xml 2007-07-09 13:12:04 UTC (rev 1544)
+++ trunk/docs/userguide/en/src/main/docbook/included/datascroller.xml 2007-07-09 13:22:27 UTC (rev 1545)
@@ -46,6 +46,10 @@
<section>
<title>Creating the Component with a Page Tag</title>
<para>Here is a simple example as it might be used in a page:</para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
<programlisting role="XML"><![CDATA[...
<h:dataTable id="table">
...
@@ -88,6 +92,10 @@
</itemizedlist>
<para>The controls of fast switching are created adding the facets component with the
corresponding name:</para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
<programlisting role="XML"><![CDATA[ ...
<rich:datascroller for="table" maxPages="10">
<f:facet name="first">
17 years, 6 months
JBoss Rich Faces SVN: r1544 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: smukhina
Date: 2007-07-09 09:12:04 -0400 (Mon, 09 Jul 2007)
New Revision: 1544
Modified:
trunk/docs/userguide/en/src/main/docbook/included/column.xml
trunk/docs/userguide/en/src/main/docbook/included/columnGroup.xml
trunk/docs/userguide/en/src/main/docbook/included/dataDefinitionList.xml
trunk/docs/userguide/en/src/main/docbook/included/dataFilterSlider.xml
trunk/docs/userguide/en/src/main/docbook/included/dataGrid.xml
trunk/docs/userguide/en/src/main/docbook/included/dataList.xml
trunk/docs/userguide/en/src/main/docbook/included/dataOrderedList.xml
trunk/docs/userguide/en/src/main/docbook/included/dataTable.xml
trunk/docs/userguide/en/src/main/docbook/included/dragIndicator.xml
trunk/docs/userguide/en/src/main/docbook/included/dragIndicator1.xml
trunk/docs/userguide/en/src/main/docbook/included/inputNumberSlider.xml
trunk/docs/userguide/en/src/main/docbook/included/inputNumberSpinner.xml
trunk/docs/userguide/en/src/main/docbook/included/menuGroup.xml
trunk/docs/userguide/en/src/main/docbook/included/menuItem.xml
trunk/docs/userguide/en/src/main/docbook/included/menuSeparator.xml
trunk/docs/userguide/en/src/main/docbook/included/paint2D.xml
trunk/docs/userguide/en/src/main/docbook/included/panel.xml
trunk/docs/userguide/en/src/main/docbook/included/panelBar.xml
trunk/docs/userguide/en/src/main/docbook/included/panelBarItem.xml
trunk/docs/userguide/en/src/main/docbook/included/separator.xml
trunk/docs/userguide/en/src/main/docbook/included/spacer.xml
trunk/docs/userguide/en/src/main/docbook/included/subTable.xml
trunk/docs/userguide/en/src/main/docbook/included/suggestionBox.xml
trunk/docs/userguide/en/src/main/docbook/included/tab.xml
trunk/docs/userguide/en/src/main/docbook/included/togglePanel.xml
trunk/docs/userguide/en/src/main/docbook/included/tree.xml
trunk/docs/userguide/en/src/main/docbook/included/treeNode.xml
Log:
http://jira.jboss.com/jira/browse/RF-430
some code samples were framed properly
Modified: trunk/docs/userguide/en/src/main/docbook/included/column.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/column.xml 2007-07-09 12:32:01 UTC (rev 1543)
+++ trunk/docs/userguide/en/src/main/docbook/included/column.xml 2007-07-09 13:12:04 UTC (rev 1544)
@@ -44,6 +44,10 @@
<section>
<title>Creating the Component with a Page Tag</title>
<para>To create the simplest variant of <property>column</property> on a page, use the following syntax:</para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
<programlisting role="XML"><![CDATA[...
<rich:dataTable var="set">
<rich:column>
@@ -66,6 +70,10 @@
<title>Details of Usage</title>
<para>To output a simple table, the <emphasis role="bold"><property><rich:column></property></emphasis> component is used the same way as the standard
<emphasis role="bold"><property><h:column></property></emphasis>, i.e. the following code on a page is used:</para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
<programlisting role="XML"><![CDATA[...
<rich:dataTable value="#{capitalsBean.capitals}" var="cap" rows="5">
<rich:column>
@@ -100,6 +108,10 @@
the <emphasis ><property>"colspan"</property></emphasis> attribute, which is similar to an HTML one, specifying that the first column contains 3 columns.
In addition, it's necessary to specify that the next column begins from the first row with the help of the
<emphasis ><property>"breakBefore"</property></emphasis> attribute = true.</para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
<programlisting role="XML"><![CDATA[...
<rich:dataTable value="#{capitalsBean.capitals}" var="cap" rows="5">
<rich:column colspan="3">
@@ -129,6 +141,10 @@
<para>The same way is used for <property>columns</property> grouping with the <emphasis ><property>"rowspan"</property></emphasis>
attribute that is similar to an HTML one responsible for rows quantity definition occupied with the
current one. The only thing to add in the example is an instruction to move onto the next row for each next after the second column.</para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
<programlisting role="XML"><![CDATA[...
<rich:dataTable value="#{capitalsBean.capitals}" var="cap" rows="5">
<rich:column rowspan="3">
Modified: trunk/docs/userguide/en/src/main/docbook/included/columnGroup.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/columnGroup.xml 2007-07-09 12:32:01 UTC (rev 1543)
+++ trunk/docs/userguide/en/src/main/docbook/included/columnGroup.xml 2007-07-09 13:12:04 UTC (rev 1544)
@@ -42,6 +42,10 @@
<section>
<title>Creating the Component with a Page Tag</title>
<para>To create the simplest variant of <property>columnGroup</property> on a page which you can see at the screenshot, use the following syntax:</para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
<programlisting role="XML"><![CDATA[...
<rich:dataTable value="#{capitalsBean.capitals}" var="capitals"
ajaxKeys="#{bean.ajaxSet}" binding="#{bean.tabe}" id="table">
@@ -71,6 +75,10 @@
into one row. Columns are combined in a group the same way as when the <emphasis ><property>"breakBefore"</property></emphasis> attribute is used for
columns to add a moving to the next rows, but the first variant is clearer from a source code. Hence, the
following simple examples are very same.</para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
<programlisting role="XML"><![CDATA[...
<rich:dataTable value="#{capitalsBean.capitals}" var="cap" rows="5" id="sublist">
<rich:column colspan="3">
@@ -92,6 +100,10 @@
...
]]></programlisting>
<para>And representation without a grouping:</para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
<programlisting role="XML"><![CDATA[...
<rich:dataTable value="#{capitalsBean.capitals}" var="cap" rows="5" id="sublist">
<rich:column colspan="3">
@@ -115,6 +127,10 @@
</figure>
<para>It's also possible to use the component for output of complex headers in a table. For example adding
of a complex header to a facet for the whole table looks the following way:</para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
<programlisting role="XML"><![CDATA[...
<f:facet name="header">
<rich:columnGroup>
Modified: trunk/docs/userguide/en/src/main/docbook/included/dataDefinitionList.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/dataDefinitionList.xml 2007-07-09 12:32:01 UTC (rev 1543)
+++ trunk/docs/userguide/en/src/main/docbook/included/dataDefinitionList.xml 2007-07-09 13:12:04 UTC (rev 1544)
@@ -44,6 +44,10 @@
<section>
<title>Creating the Component with a Page Tag</title>
<para>To create the simplest variant of <property>dataDefinitionList</property> on a page, use the following syntax:</para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
<programlisting role="XML"><![CDATA[...
<rich:dataDefinitionList value="#{bean.capitals}" var="caps">
<f:facet name="term">United States Capitals</f:facet>
@@ -74,6 +78,10 @@
<para>It allows definition inside a facet with the "term" name to add HTML DT elements into a list.</para>
<para>The component is created basing on the <emphasis role="bold"><property><a4j:repeat></property></emphasis> component and as a result the component could
be partially updated with AJAX.</para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
<programlisting role="XML"><![CDATA[...
<rich:dataDefinitionList value="#{bean.capitals}" var="caps" ajaxKeys="#{listBean.list}"
binding="#{listBean.dataList}" id="list">
Modified: trunk/docs/userguide/en/src/main/docbook/included/dataFilterSlider.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/dataFilterSlider.xml 2007-07-09 12:32:01 UTC (rev 1543)
+++ trunk/docs/userguide/en/src/main/docbook/included/dataFilterSlider.xml 2007-07-09 13:12:04 UTC (rev 1544)
@@ -38,6 +38,10 @@
<section>
<title>Creating the Component with a Page Tag</title>
<para>Here is a simple example as it might be used in a page:</para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
<programlisting role="XML"><![CDATA[...
<rich:dataFilterSlider sliderListener="#{mybean.doSlide}"
startRange="0"
Modified: trunk/docs/userguide/en/src/main/docbook/included/dataGrid.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/dataGrid.xml 2007-07-09 12:32:01 UTC (rev 1543)
+++ trunk/docs/userguide/en/src/main/docbook/included/dataGrid.xml 2007-07-09 13:12:04 UTC (rev 1544)
@@ -45,6 +45,10 @@
<section>
<title>Creating the Component with a Page Tag</title>
<para>To create the simplest variant of <property>dataGrid</property> on a page, use the following syntax:</para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
<programlisting role="XML"><![CDATA[...
<rich:dataGrid value="#{bean.capitals}" var="caps" columns="4">
<h:outputText value="#{caps.name}"/>
@@ -74,6 +78,10 @@
<para>The component is created basing on the <emphasis role="bold"><property><a4j:repeat></property></emphasis> component and as a result the component could
be partially updated with AJAX.</para>
<para>Here is an example for the first screenshot:</para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
<programlisting role="XML"><![CDATA[...
<rich:dataGrid value="#{bean.capitals}" var="caps" ajaxKeys="#{listBean.list}"
binding="#{listBean.dataList}" id="grid" elements="20" columns="4">
Modified: trunk/docs/userguide/en/src/main/docbook/included/dataList.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/dataList.xml 2007-07-09 12:32:01 UTC (rev 1543)
+++ trunk/docs/userguide/en/src/main/docbook/included/dataList.xml 2007-07-09 13:12:04 UTC (rev 1544)
@@ -46,6 +46,10 @@
<section>
<title>Creating the Component with a Page Tag</title>
<para>To create the simplest variant of <property>dataList</property> on a page, use the following syntax:</para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
<programlisting role="XML"><![CDATA[...
<rich:dataList value="#{bean.capitals}" var="caps">
<h:outputText value="#{caps.name}"/>
@@ -74,6 +78,10 @@
<para>The component has the <emphasis ><property>"type"</property></emphasis> attribute corresponding to the "ul" HTML element.</para>
<para>The component is created basing on the <emphasis role="bold"><property><a4j:repeat></property></emphasis> component and as a result the component could
be partially updated with AJAX.</para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
<programlisting role="XML"><![CDATA[...
<rich:dataList value="#{bean.capitals}" var="caps" ajaxKeys="#{listBean.list}"
binding="#{listBean.dataList}" id="list">
Modified: trunk/docs/userguide/en/src/main/docbook/included/dataOrderedList.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/dataOrderedList.xml 2007-07-09 12:32:01 UTC (rev 1543)
+++ trunk/docs/userguide/en/src/main/docbook/included/dataOrderedList.xml 2007-07-09 13:12:04 UTC (rev 1544)
@@ -45,6 +45,10 @@
<section>
<title>Creating the Component with a Page Tag</title>
<para>To create the simplest variant of <property>dataOrderedList</property> on a page, use the following syntax:</para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
<programlisting role="XML"><![CDATA[...
<rich:dataOrderedList value="#{bean.capitals}" var="caps">
<h:outputText value="#{caps.name}"/>
@@ -73,6 +77,10 @@
<para>The component has the <emphasis ><property>"type"</property></emphasis> attribute corresponding to the "ul" HTML element.</para>
<para>The component is created basing on the <emphasis role="bold"><property><a4j:repeat></property></emphasis> component and as a result the component could
be partially updated with AJAX.</para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
<programlisting role="XML"><![CDATA[...
<rich:dataOrderedList value="#{bean.capitals}" var="caps" ajaxKeys="#{listBean.list}"
binding="#{listBean.dataList}" id="list">
Modified: trunk/docs/userguide/en/src/main/docbook/included/dataTable.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/dataTable.xml 2007-07-09 12:32:01 UTC (rev 1543)
+++ trunk/docs/userguide/en/src/main/docbook/included/dataTable.xml 2007-07-09 13:12:04 UTC (rev 1544)
@@ -46,6 +46,10 @@
<section>
<title>Creating the Component with a Page Tag</title>
<para>Here is a simple example as it might be used in a page:</para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
<programlisting role="XML"><![CDATA[...
<rich:dataTable value="#{capitalsBean.capitals}" var="capitals">
<!--...//Set of columns and header/footer facets-->
@@ -81,6 +85,10 @@
role="bold">
<property><a4j:repeat></property>
</emphasis> outputs the standard HTML structure for table rendering.</para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
<programlisting role="XML"><![CDATA[...
<rich:dataTable value="#{capitalsBean.capitals}" var="capitals"
ajaxKeys="#{bean.ajaxSet}" binding="#{bean.table}" id="table">
Modified: trunk/docs/userguide/en/src/main/docbook/included/dragIndicator.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/dragIndicator.xml 2007-07-09 12:32:01 UTC (rev 1543)
+++ trunk/docs/userguide/en/src/main/docbook/included/dragIndicator.xml 2007-07-09 13:12:04 UTC (rev 1544)
@@ -46,6 +46,10 @@
<section>
<title>Creating the Component with a Page Tag</title>
<para>Here is a simple example as it might be used in a page:</para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
<programlisting role="XML"><![CDATA[...
<dnd:dragIndicator id="indicator">
<f:facet name="single">
@@ -106,6 +110,10 @@
<listitem> not above any drop zone </listitem>
</itemizedlist>
<para>Here is an example for an accept facet:</para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
<programlisting role="XML"><![CDATA[...
<f:dndParam name="accept">
<h:graphicImage value="./images/1.gif"/>
@@ -119,6 +127,10 @@
<emphasis>
<property>"typeMapping"</property>
</emphasis> attribute for the corresponding icons.</para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
<programlisting role="XML"><![CDATA[...
<rich:dropSupport acceptedTypes="[iconsDragged, textDragged]" typeMapping="{iconsDragged: DropIcon}">
<dnd:dndParam name="DropIcon">
Modified: trunk/docs/userguide/en/src/main/docbook/included/dragIndicator1.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/dragIndicator1.xml 2007-07-09 12:32:01 UTC (rev 1543)
+++ trunk/docs/userguide/en/src/main/docbook/included/dragIndicator1.xml 2007-07-09 13:12:04 UTC (rev 1544)
@@ -46,6 +46,10 @@
<section>
<title>Creating the Component with a Page Tag</title>
<para>Here is a simple example as it might be used in a page:</para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
<programlisting role="XML"><![CDATA[...
<dnd:dragIndicator id="indicator">
<f:facet name="single">
@@ -118,6 +122,10 @@
particular drag area, use the <property>drop zone</property>
<emphasis ><property>"typeMapping"</property></emphasis> attribute for the
corresponding icons.</para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
<programlisting role="XML"><![CDATA[<rich:dropSupport acceptedTypes="[iconsDragged, textDragged]"
typeMapping="{iconsDragged: DropIcon}">
Modified: trunk/docs/userguide/en/src/main/docbook/included/inputNumberSlider.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/inputNumberSlider.xml 2007-07-09 12:32:01 UTC (rev 1543)
+++ trunk/docs/userguide/en/src/main/docbook/included/inputNumberSlider.xml 2007-07-09 13:12:04 UTC (rev 1544)
@@ -91,6 +91,10 @@
<para>To remove input area use <emphasis>
<property>"showInput="false"</property>
</emphasis>:</para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
<programlisting role="XML"><![CDATA[<rich:inputNumberSlider minValue="1" maxValue="100" showInput="false"/>]]></programlisting>
<para>It looks at page like:</para>
<figure>
@@ -230,6 +234,10 @@
<emphasis role="bold">Example:</emphasis>
</para>
<para>CSS code piece used on the page:</para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
<programlisting role="HTML"><![CDATA[...
.rich-slider-handle{
border:2px solid;
@@ -240,6 +248,10 @@
...
]]></programlisting>
<para>The component is defined in the following way:</para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
<programlisting role="XML"><![CDATA[<rich:inputNumberSlider ... inputClass="myClass" .../>
]]></programlisting>
<para>Hence, header border width of all <property>sliders</property> is redefined on a page as
Modified: trunk/docs/userguide/en/src/main/docbook/included/inputNumberSpinner.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/inputNumberSpinner.xml 2007-07-09 12:32:01 UTC (rev 1543)
+++ trunk/docs/userguide/en/src/main/docbook/included/inputNumberSpinner.xml 2007-07-09 13:12:04 UTC (rev 1544)
@@ -237,6 +237,10 @@
<emphasis role="bold">Example:</emphasis>
</para>
<para>CSS code piece used on the page:</para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
<programlisting role="XML"><![CDATA[...
. rich-spinner-input {
font-style:italic;
@@ -247,6 +251,10 @@
...
]]></programlisting>
<para>The component is defined in the following way:</para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
<programlisting role="XML"><![CDATA[<rich:inputNumberSpinner inputClass="myClass" .../>
]]></programlisting>
<para>Hence, a font-style of all <property>spinners</property> is redefined on a page as well as
Modified: trunk/docs/userguide/en/src/main/docbook/included/menuGroup.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/menuGroup.xml 2007-07-09 12:32:01 UTC (rev 1543)
+++ trunk/docs/userguide/en/src/main/docbook/included/menuGroup.xml 2007-07-09 13:12:04 UTC (rev 1544)
@@ -43,6 +43,10 @@
<section>
<title>Creating the Component with a Page Tag</title>
<para>Here is a simple example as it might be used in a page:</para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
<programlisting role="xml"><![CDATA[...
<rich:dropDownMenu value="Active">
...
Modified: trunk/docs/userguide/en/src/main/docbook/included/menuItem.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/menuItem.xml 2007-07-09 12:32:01 UTC (rev 1543)
+++ trunk/docs/userguide/en/src/main/docbook/included/menuItem.xml 2007-07-09 13:12:04 UTC (rev 1544)
@@ -43,6 +43,10 @@
<section>
<title>Creating the Component with a Page Tag</title>
<para>Here is a simple example as it might be used in a page:</para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
<programlisting role="xml"><![CDATA[...
<rich:dropDownMenu>
...
Modified: trunk/docs/userguide/en/src/main/docbook/included/menuSeparator.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/menuSeparator.xml 2007-07-09 12:32:01 UTC (rev 1543)
+++ trunk/docs/userguide/en/src/main/docbook/included/menuSeparator.xml 2007-07-09 13:12:04 UTC (rev 1544)
@@ -43,6 +43,10 @@
<section>
<title>Creating the Component with a Page Tag</title>
<para>Here is a simple example as it might be used in a page:</para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
<programlisting role="xml"><![CDATA[...
<rich:dropDownMenu/>
...
Modified: trunk/docs/userguide/en/src/main/docbook/included/paint2D.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/paint2D.xml 2007-07-09 12:32:01 UTC (rev 1543)
+++ trunk/docs/userguide/en/src/main/docbook/included/paint2D.xml 2007-07-09 13:12:04 UTC (rev 1544)
@@ -104,6 +104,10 @@
<property>"data"</property>
</emphasis> attributes.</para>
<para>Example:</para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
<programlisting role="JAVA"><![CDATA[paintBean.java:
public void paint(Graphics2D g2, Object obj) {
Modified: trunk/docs/userguide/en/src/main/docbook/included/panel.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/panel.xml 2007-07-09 12:32:01 UTC (rev 1543)
+++ trunk/docs/userguide/en/src/main/docbook/included/panel.xml 2007-07-09 13:12:04 UTC (rev 1544)
@@ -284,6 +284,10 @@
<emphasis role="bold">Example:</emphasis>
</para>
<para>CSS code piece used on the page:</para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
<programlisting role="XML"><![CDATA[...
.rich-panel-header{
background-color:#F99;
Modified: trunk/docs/userguide/en/src/main/docbook/included/panelBar.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/panelBar.xml 2007-07-09 12:32:01 UTC (rev 1543)
+++ trunk/docs/userguide/en/src/main/docbook/included/panelBar.xml 2007-07-09 13:12:04 UTC (rev 1544)
@@ -162,6 +162,10 @@
<emphasis role="bold">Example:</emphasis>
</para>
<para>CSS code piece used on the page:</para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
<programlisting role="HTML"><![CDATA[...
. rich-panelbar{
padding:10px;
@@ -173,6 +177,10 @@
]]></programlisting>
<para>When using headerClass and headerClassActive attributes the declaration of headerClass
should precede the one of headerClassActive:</para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
<programlisting role="HTML"><![CDATA[...
.headerClass{
...
Modified: trunk/docs/userguide/en/src/main/docbook/included/panelBarItem.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/panelBarItem.xml 2007-07-09 12:32:01 UTC (rev 1543)
+++ trunk/docs/userguide/en/src/main/docbook/included/panelBarItem.xml 2007-07-09 13:12:04 UTC (rev 1544)
@@ -194,6 +194,10 @@
</table>
<para><emphasis role="bold">Example:</emphasis></para>
<para>CSS code piece used on the page:</para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
<programlisting role="XML"><![CDATA[...
.rich-panelbar-header{
font-size:14px;
@@ -204,6 +208,10 @@
...
]]></programlisting>
<para>The component is defined in the following way:</para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
<programlisting role="XML"><![CDATA[...
<rich:panelBar>
<rich:panelBarItem contentClass="myClass">
Modified: trunk/docs/userguide/en/src/main/docbook/included/separator.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/separator.xml 2007-07-09 12:32:01 UTC (rev 1543)
+++ trunk/docs/userguide/en/src/main/docbook/included/separator.xml 2007-07-09 13:12:04 UTC (rev 1544)
@@ -45,6 +45,10 @@
<section>
<title>Creating the Component with a Page Tag</title>
<para>Here is a simple example as it might be used in a page:</para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
<programlisting role="XML"><![CDATA[...
<rich:separator/>
...
Modified: trunk/docs/userguide/en/src/main/docbook/included/spacer.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/spacer.xml 2007-07-09 12:32:01 UTC (rev 1543)
+++ trunk/docs/userguide/en/src/main/docbook/included/spacer.xml 2007-07-09 13:12:04 UTC (rev 1544)
@@ -45,6 +45,10 @@
<section>
<title>Creating the Component with a Page Tag</title>
<para>Here is a simple example as it might be used in a page:</para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
<programlisting role="XML"><![CDATA[...
<rich:spacer/>
...]]></programlisting>
Modified: trunk/docs/userguide/en/src/main/docbook/included/subTable.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/subTable.xml 2007-07-09 12:32:01 UTC (rev 1543)
+++ trunk/docs/userguide/en/src/main/docbook/included/subTable.xml 2007-07-09 13:12:04 UTC (rev 1544)
@@ -44,6 +44,10 @@
<section>
<title>Creating the Component with a Page Tag</title>
<para>Here is a simple example as it might be used in a page:</para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
<programlisting role="XML"><![CDATA[...
<rich:dataTable value="#{capitalsBean.capitals}" var="capitals">
<!--...//Set of columns and header/footer facets-->
Modified: trunk/docs/userguide/en/src/main/docbook/included/suggestionBox.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/suggestionBox.xml 2007-07-09 12:32:01 UTC (rev 1543)
+++ trunk/docs/userguide/en/src/main/docbook/included/suggestionBox.xml 2007-07-09 13:12:04 UTC (rev 1544)
@@ -58,6 +58,10 @@
<para>Here is the <emphasis>
<property>bean.autocomplete</property>
</emphasis> method that returns the collection to pop up:</para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
<programlisting role="JAVA"><![CDATA[public List autocomplete(Object event) {
String pref = event.toString();
//collecting some data that begins with "pref" letters.
Modified: trunk/docs/userguide/en/src/main/docbook/included/tab.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/tab.xml 2007-07-09 12:32:01 UTC (rev 1543)
+++ trunk/docs/userguide/en/src/main/docbook/included/tab.xml 2007-07-09 13:12:04 UTC (rev 1544)
@@ -66,6 +66,10 @@
<title>Details of Usage</title>
<para>The main component function is to define a content group that is rendered and processed when the <property>tab</property> is active, i.e. click on a <property>tab</property> causes switching onto a <property>tab</property> containing content corresponded to this <property>tab</property>.</para>
<para>A marker on a <property>tab</property> header defined with the <emphasis ><property>"label"</property></emphasis> attribute. Moreover, each <property>tab</property> could be disabled (switching on this <property>tab</property> is impossible) with the <emphasis ><property>"disable"</property></emphasis> attribute.</para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
<programlisting role="XML"><![CDATA[...
<rich:tabPanel width="20%">
<rich:tab label="Tab">
Modified: trunk/docs/userguide/en/src/main/docbook/included/togglePanel.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/togglePanel.xml 2007-07-09 12:32:01 UTC (rev 1543)
+++ trunk/docs/userguide/en/src/main/docbook/included/togglePanel.xml 2007-07-09 13:12:04 UTC (rev 1544)
@@ -106,6 +106,10 @@
<property>"stateOrder"</property>
</emphasis> attribute. The facets names are enumerated in such an order that they are rendered
when a control is clicked, as it's not defined where to switch beforehand.</para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
<programlisting role="XML"><![CDATA[...
<rich:togglePanel id="panel" initialState="panelB" switchType="client"
stateOrder="panelA,panelB,panelC">
Modified: trunk/docs/userguide/en/src/main/docbook/included/tree.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/tree.xml 2007-07-09 12:32:01 UTC (rev 1543)
+++ trunk/docs/userguide/en/src/main/docbook/included/tree.xml 2007-07-09 13:12:04 UTC (rev 1544)
@@ -79,6 +79,10 @@
</emphasis> attribute that contains treeNode name for elements rendering. </para>
<para>On the screenshot there are examples of nodes defined with different templates on the
following conditions</para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
<programlisting role="JAVA"><![CDATA[nodeFace="#{data.name != 'param-value' ? 'input' : 'text'}"
]]></programlisting>
<figure>
Modified: trunk/docs/userguide/en/src/main/docbook/included/treeNode.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/treeNode.xml 2007-07-09 12:32:01 UTC (rev 1543)
+++ trunk/docs/userguide/en/src/main/docbook/included/treeNode.xml 2007-07-09 13:12:04 UTC (rev 1544)
@@ -99,6 +99,10 @@
<para>As it has been mentioned above, <property>treeNode</property> defines a template for nodes
rendering in a tree. Thus, during XML document rendering (a web.xml application) as a tree, the
following nodes output (passed via var="data" on a tree) happens:</para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
<programlisting role="XML"><![CDATA[...
<rich:tree ... faceNode="simpleNode" ... value="#{bean.data}" var="data">
<rich:treeNode type="simpleNode">
17 years, 6 months
JBoss Rich Faces SVN: r1543 - in branches/3.0.2/sandbox-samples/scrollable-grid-demo/src/main/resources: org and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: maksimkaszynski
Date: 2007-07-09 08:32:01 -0400 (Mon, 09 Jul 2007)
New Revision: 1543
Added:
branches/3.0.2/sandbox-samples/scrollable-grid-demo/src/main/resources/org/
branches/3.0.2/sandbox-samples/scrollable-grid-demo/src/main/resources/org/ajax4jsf/
branches/3.0.2/sandbox-samples/scrollable-grid-demo/src/main/resources/org/ajax4jsf/xml/
branches/3.0.2/sandbox-samples/scrollable-grid-demo/src/main/resources/org/ajax4jsf/xml/serializer/
branches/3.0.2/sandbox-samples/scrollable-grid-demo/src/main/resources/org/ajax4jsf/xml/serializer/output_xhtml.properties
Log:
disabled indents in a4j fast filter
Added: branches/3.0.2/sandbox-samples/scrollable-grid-demo/src/main/resources/org/ajax4jsf/xml/serializer/output_xhtml.properties
===================================================================
--- branches/3.0.2/sandbox-samples/scrollable-grid-demo/src/main/resources/org/ajax4jsf/xml/serializer/output_xhtml.properties (rev 0)
+++ branches/3.0.2/sandbox-samples/scrollable-grid-demo/src/main/resources/org/ajax4jsf/xml/serializer/output_xhtml.properties 2007-07-09 12:32:01 UTC (rev 1543)
@@ -0,0 +1,42 @@
+###########################################################################
+# Copyright 2003-2004 The Apache Software Foundation.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+##########################################################################
+#
+# $Id: output_xhtml.properties,v 1.1.2.1 2007/01/10 19:33:38 alexsmirnov Exp $
+#
+# Specify defaults when method="html". These defaults use output_xml.properties
+# as a base.
+#
+
+# XSLT properties do not need namespace qualification.
+method=xhtml
+indent=no
+media-type=application/xml+xhtml
+version=1.0
+
+# Xalan-specific output properties. These can be overridden in the stylesheet
+# assigning a xalan namespace. For example:
+# <xsl:stylesheet version="1.0"
+# xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+# xmlns:xalan="http://xml.apache.org/xalan">
+# <xsl:output method="html" encoding="UTF-8"
+# xalan:content-handler="MyContentHandler"/>
+# ...
+# Note that the colon after the protocol needs to be escaped.
+{http\u003a//xml.apache.org/xalan}indent-amount=0
+{http\u003a//xml.apache.org/xalan}content-handler=org.ajax4jsf.xml.serializer.ToXHTMLStream
+{http\u003a//xml.apache.org/xalan}entities=org/ajax4jsf/xml/serializer/HTMLEntities
+{http\u003a//xml.apache.org/xalan}use-url-escaping=yes
+{http\u003a//xml.apache.org/xalan}omit-meta-tag=yes
17 years, 6 months
JBoss Rich Faces SVN: r1542 - in trunk/docs/userguide/en/src/main/docbook: modules and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: vkorluzhenko
Date: 2007-07-09 05:54:23 -0400 (Mon, 09 Jul 2007)
New Revision: 1542
Modified:
trunk/docs/userguide/en/src/main/docbook/included/datascroller.xml
trunk/docs/userguide/en/src/main/docbook/modules/RFCfaq.xml
Log:
http://jira.jboss.com/jira/browse/RF-419
Modified: trunk/docs/userguide/en/src/main/docbook/included/datascroller.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/datascroller.xml 2007-07-09 08:52:00 UTC (rev 1541)
+++ trunk/docs/userguide/en/src/main/docbook/included/datascroller.xml 2007-07-09 09:54:23 UTC (rev 1542)
@@ -311,7 +311,10 @@
<ulink
url="http://livedemo.exadel.com/richfaces-demo/richfaces/dataTableScroller.jsf..."
>Here</ulink> you can see the example of <emphasis role="bold"
- ><rich:dataScroller></emphasis> usage and sources for the given example.
- </para>
+ ><rich:dataScroller></emphasis> usage and sources for the given example. </para>
+ <para> The solution about how to do true pagination using datascroller (load a part of data from
+ database) can be found on the <ulink
+ url="http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4060199#..."
+ >RichFaces Users Forum</ulink>. </para>
</section>
</section>
Modified: trunk/docs/userguide/en/src/main/docbook/modules/RFCfaq.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/modules/RFCfaq.xml 2007-07-09 08:52:00 UTC (rev 1541)
+++ trunk/docs/userguide/en/src/main/docbook/modules/RFCfaq.xml 2007-07-09 09:54:23 UTC (rev 1542)
@@ -100,7 +100,8 @@
<?dbhtml filename="WhyRichFaceslibrarycondataTablecomp"?>
<title>Why RichFaces library contains <rich:dataTable> component,
though there is the standard <h:dataTable>?</title>
- <para>The answer could be found <ulink
+ <para>The article about <emphasis role="bold"
+ ><rich:dataTable></emphasis> flexibility can be found <ulink
url="http://labs.jboss.com/wiki/RichFacesArticleDataTable"
>here</ulink>.</para>
<para>Source code (SVN) could be found <ulink
@@ -415,6 +416,7 @@
background-color: transparent;
}]]></programlisting>
</section>
+
<section>
<?dbhtml filename="subTableincombinationwithdataTable"?>
<title>How to use subTable in combination with dataTable?</title>
@@ -422,4 +424,13 @@
url="http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4059044#..."
>here</ulink>.</para>
</section>
+
+ <section id="Truepagination">
+ <?dbhtml filename="Howtodotruepagination"?>
+ <title>How to do true pagination using datascroller (load a part of data from database)?</title>
+ <para>The answer could be found on the <ulink
+ url="http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4060199#..."
+ >RichFaces Users Forum</ulink>.</para>
+ </section>
+
</chapter>
17 years, 6 months
JBoss Rich Faces SVN: r1541 - branches/3.0.2/sandbox-samples/scrollable-grid-demo/src/main/webapp/pages.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2007-07-09 04:52:00 -0400 (Mon, 09 Jul 2007)
New Revision: 1541
Modified:
branches/3.0.2/sandbox-samples/scrollable-grid-demo/src/main/webapp/pages/test.xhtml
Log:
change demo
Modified: branches/3.0.2/sandbox-samples/scrollable-grid-demo/src/main/webapp/pages/test.xhtml
===================================================================
--- branches/3.0.2/sandbox-samples/scrollable-grid-demo/src/main/webapp/pages/test.xhtml 2007-07-09 08:26:33 UTC (rev 1540)
+++ branches/3.0.2/sandbox-samples/scrollable-grid-demo/src/main/webapp/pages/test.xhtml 2007-07-09 08:52:00 UTC (rev 1541)
@@ -11,7 +11,7 @@
<h:selectOneMenu value="#{modelBuilder.grid}">
<f:selectItems value="#{modelBuilder.grids}" />
</h:selectOneMenu>
- <a4j:support event="onchange" reRender="panelGroup" />
+ <a4j:commandButton value="update" reRender="panelGroup" />
<h:panelGroup id="panelGroup">
<ui:include src="#{modelBuilder.grid}" />
</h:panelGroup>
17 years, 6 months
JBoss Rich Faces SVN: r1540 - branches/3.0.2/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2007-07-09 04:26:33 -0400 (Mon, 09 Jul 2007)
New Revision: 1540
Modified:
branches/3.0.2/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/GridRendererState.java
Log:
small fix
Modified: branches/3.0.2/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/GridRendererState.java
===================================================================
--- branches/3.0.2/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/GridRendererState.java 2007-07-09 08:16:34 UTC (rev 1539)
+++ branches/3.0.2/sandbox/scrollable-grid/src/main/java/org/richfaces/renderkit/html/GridRendererState.java 2007-07-09 08:26:33 UTC (rev 1540)
@@ -112,14 +112,8 @@
}
GridRendererState oldState = getRendererState(context);
GridRendererState state = new GridRendererState(context,oldState,grid);
- if(grid.getAttributes().get("columnClasses") != null){
- String columnClasses = (String)grid.getAttributes().get("columnClasses");
- state.setColumnClasses(columnClasses.split(","));
- }
- if(grid.getAttributes().get("rowClasses") != null){
- String rowClasses = (String)grid.getAttributes().get("rowClasses");
- state.setRowClasses(rowClasses.split(","));
- }
+ state.setColumnClasses(grid.getAttributes().get("columnClasses"));
+ state.setRowClasses(grid.getAttributes().get("rowClasses"));
context.getExternalContext().getRequestMap().put(DATA_GRID_RENDERER_STATE,state);
return state;
}
@@ -406,9 +400,9 @@
}
}
- public void setColumnClasses(String columnClasses[]) {
+ public void setColumnClasses(Object columnClasses) {
if(columnClasses != null) {
- this.columnClasses = columnClasses;
+ this.columnClasses = ((String)columnClasses).split(",");
columnClassesSize = this.columnClasses.length;
}
}
@@ -421,9 +415,9 @@
}
}
- public void setRowClasses(String rowClasses[]) {
+ public void setRowClasses(Object rowClasses) {
if(rowClasses != null) {
- this.rowClasses = rowClasses;
+ this.rowClasses = ((String)rowClasses).split(",");
rowClassesSize = this.rowClasses.length;
}
}
17 years, 6 months
JBoss Rich Faces SVN: r1539 - branches/3.0.2/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid.
by richfaces-svn-commits@lists.jboss.org
Author: dmorozov
Date: 2007-07-09 04:16:34 -0400 (Mon, 09 Jul 2007)
New Revision: 1539
Modified:
branches/3.0.2/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/ScrollableGrid.js
Log:
Fix typo in doCollapse
Modified: branches/3.0.2/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/ScrollableGrid.js
===================================================================
--- branches/3.0.2/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/ScrollableGrid.js 2007-07-09 07:55:36 UTC (rev 1538)
+++ branches/3.0.2/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/ScrollableGrid.js 2007-07-09 08:16:34 UTC (rev 1539)
@@ -154,7 +154,7 @@
if(index < flength + nlength - 1) {
var frozen = true;
if(index >= flength) {
- index -= fcount;
+ index -= flength;
frozen = false;
}
this.hideColumn(index, frozen);
17 years, 6 months
JBoss Rich Faces SVN: r1538 - in branches/3.0.2/sandbox/scrollable-grid/src/main: resources/org/richfaces/renderkit/html/css and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: dmorozov
Date: 2007-07-09 03:55:36 -0400 (Mon, 09 Jul 2007)
New Revision: 1538
Modified:
branches/3.0.2/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridHeader.js
branches/3.0.2/sandbox/scrollable-grid/src/main/resources/org/richfaces/renderkit/html/css/grid.xcss
branches/3.0.2/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid-header-cell.jspx
Log:
Simplify header sort icons
Modified: branches/3.0.2/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridHeader.js
===================================================================
--- branches/3.0.2/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridHeader.js 2007-07-08 13:49:02 UTC (rev 1537)
+++ branches/3.0.2/sandbox/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridHeader.js 2007-07-09 07:55:36 UTC (rev 1538)
@@ -169,14 +169,8 @@
sep.setStyle({cursor: 'auto'});
}
// sort icons
- columns[j].sortDesc = details[1];
- columns[j].sortAsc = details[2];
- columns[j].sortSpace = details[3];
- if(ClientUILib.isIE && columns[j].sortDesc) {
- Element.setStyle(columns[j].sortDesc, {left: "-10px"});
- Element.setStyle(columns[j].sortAsc, {left: "-10px"});
- Element.setStyle(columns[j].sortSpace, {left: "-10px"});
- }
+ columns[j].sortDesc = new ClientUI.common.box.Box(details[1], null, true);
+ columns[j].sortAsc = new ClientUI.common.box.Box(details[2], null, true);
j++;
}
@@ -222,14 +216,8 @@
sep.setStyle({cursor: 'auto'});
}
// sort icons
- columns[j].sortDesc = details[1];
- columns[j].sortAsc = details[2];
- columns[j].sortSpace = details[3];
- if(ClientUILib.isIE && columns[j].sortDesc) {
- Element.setStyle(columns[j].sortDesc, {left: "-10px"});
- Element.setStyle(columns[j].sortAsc, {left: "-10px"});
- Element.setStyle(columns[j].sortSpace, {left: "-10px"});
- }
+ columns[j].sortDesc = new ClientUI.common.box.Box(details[1], null, true);
+ columns[j].sortAsc = new ClientUI.common.box.Box(details[2], null, true);
}
j++;
}
@@ -256,7 +244,6 @@
details[0] = document.getElementById(clientId + ":hsep_" + column);
details[1] = document.getElementById(clientId + ":hsortd_" + column);
details[2] = document.getElementById(clientId + ":hsorta_" + column);
- details[3] = document.getElementById(clientId + ":hsort_" + column);
return details;
},
agjustSeparators: function() {
@@ -420,13 +407,13 @@
var h = this.getColumns()[i];
if(h.sortDesc && h.sortAsc) {
if(i != index) {
- Element.setStyle(h.sortDesc, {display: 'none'});
- Element.setStyle(h.sortAsc, {display: 'none'});
- Element.setStyle(h.sortSpace, {display: 'block'});
+ Element.setStyle(h.sortDesc.getElement(), {display: 'none'});
+ Element.setStyle(h.sortAsc.getElement(), {display: 'none'});
} else{
- Element.setStyle(h.sortDesc, {display: (dir == 'desc' ? 'block' : 'none')});
- Element.setStyle(h.sortAsc, {display: (dir == 'asc' ? 'block' : 'none')});
- Element.setStyle(h.sortSpace, {display: 'none'});
+ h.sortDesc.moveTo(h.object.getWidth() - 16, 4);
+ h.sortAsc.moveTo(h.object.getWidth() - 16, 4);
+ Element.setStyle(h.sortDesc.getElement(), {display: (dir == 'desc' ? 'block' : 'none')});
+ Element.setStyle(h.sortAsc.getElement(), {display: (dir == 'asc' ? 'block' : 'none')});
}
}
}
Modified: branches/3.0.2/sandbox/scrollable-grid/src/main/resources/org/richfaces/renderkit/html/css/grid.xcss
===================================================================
--- branches/3.0.2/sandbox/scrollable-grid/src/main/resources/org/richfaces/renderkit/html/css/grid.xcss 2007-07-08 13:49:02 UTC (rev 1537)
+++ branches/3.0.2/sandbox/scrollable-grid/src/main/resources/org/richfaces/renderkit/html/css/grid.xcss 2007-07-09 07:55:36 UTC (rev 1538)
@@ -86,28 +86,22 @@
border-right: 1px solid #ebeadb;
}
-.ClientUI_Grid_HC sort-cell {
- background-position: right;
- background-repeat: no-repeat;
- display: block;
- width: 16px !important;;
- position: relative;
-}
-
.ClientUI_Grid_HC .sort-asc {
+/* background-image: url(sort_asc.gif);*/
background-position: right;
background-repeat: no-repeat;
display: none;
width: 16px !important;;
- position: relative;
+ position: absolute;
}
.ClientUI_Grid_HC .sort-desc {
+/* background-image: url(sort_desc.gif);*/
background-position: right;
background-repeat: no-repeat;
display: none;
width: 16px !important;;
- position: relative;
+ position: absolute;
}
/**
@@ -148,14 +142,6 @@
width: 100%;
font: normal 8pt arial;
}
-.ClientUI_Grid_HCBody span {
- font: normal 8pt arial;
- white-space: nowrap;
-}
-.ClientUI_Grid_HCBodyContent {
- font: normal 8pt arial;
- white-space: nowrap;
-}
.ClientUI_Grid_HC_Over{
border-bottom: 1px solid #fcc247;
Modified: branches/3.0.2/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid-header-cell.jspx
===================================================================
--- branches/3.0.2/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid-header-cell.jspx 2007-07-08 13:49:02 UTC (rev 1537)
+++ branches/3.0.2/sandbox/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid-header-cell.jspx 2007-07-09 07:55:36 UTC (rev 1538)
@@ -13,25 +13,12 @@
>
<td class="ClientUI_Grid_HC Idg-header-cell #{component.attributes['headerClass']}" id="#{client_id}:hc_#{cell_index}" columnIndex="#{cell_index}" sortable="#{component.attributes['sortable']}">
- <span id="#{clientId}:hcb_#{cell_index}"
+ <div id="#{clientId}:hcb_#{cell_index}"
class="ClientUI_Grid_HCBody">
- <table width="100%" cellspacing="0" cellpadding="0" border="0" align="center">
- <tbody>
- <tr>
- <td width="100%">
- <span style="width: 100%;">
- <vcp:body/>
- </span>
- </td>
- <td>
- <div id="#{client_id}:hsort_#{cell_index}" class="sort-cell"> </div>
- <span id="#{client_id}:hsortd_#{cell_index}" class="sort-desc" />
- <span id="#{client_id}:hsorta_#{cell_index}" class="sort-asc" />
- </td>
- </tr>
- </tbody>
- </table>
- </span>
+ <vcp:body/>
+ <div align="right" id="#{client_id}:hsortd_#{cell_index}" class="sort-desc" />
+ <div align="right" id="#{client_id}:hsorta_#{cell_index}" class="sort-asc" />
+ </div>
<jsp:scriptlet>
int offset = ((Integer)variables.getVariable("sepOffset")).intValue() - 3;
17 years, 6 months
JBoss Rich Faces SVN: r1537 - in trunk: framework/impl/src/main/java/org/ajax4jsf/ajax/repeat and 20 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-07-08 09:49:02 -0400 (Sun, 08 Jul 2007)
New Revision: 1537
Added:
trunk/framework/impl/src/main/java/org/ajax4jsf/component/AjaxLoadBundleComponent.java
trunk/ui/core/src/main/java/org/ajax4jsf/component/
trunk/ui/core/src/main/java/org/ajax4jsf/component/UIActionParameter.java
trunk/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxCommandButton.java
trunk/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxCommandLink.java
trunk/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxForm.java
trunk/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxFunction.java
trunk/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxLog.java
trunk/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxOutputPanel.java
trunk/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxRegion.java
trunk/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxStatus.java
trunk/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxSupport.java
trunk/ui/core/src/main/java/org/ajax4jsf/component/UIDataAdaptor.java
trunk/ui/core/src/main/java/org/ajax4jsf/component/UIInclude.java
trunk/ui/core/src/main/java/org/ajax4jsf/component/UILoadBundle.java
trunk/ui/core/src/main/java/org/ajax4jsf/component/UIMediaOutput.java
trunk/ui/core/src/main/java/org/ajax4jsf/component/UIPoll.java
trunk/ui/core/src/main/java/org/ajax4jsf/component/UIPortlet.java
trunk/ui/core/src/main/java/org/ajax4jsf/component/UIPush.java
trunk/ui/core/src/main/java/org/ajax4jsf/component/UIRepeat.java
trunk/ui/core/src/main/java/org/ajax4jsf/component/UIResource.java
trunk/ui/core/src/main/java/org/ajax4jsf/component/UISelector.java
trunk/ui/core/src/test/java/org/ajax4jsf/component/
trunk/ui/core/src/test/java/org/ajax4jsf/component/ActionListenerTest.java
trunk/ui/core/src/test/java/org/ajax4jsf/component/DataAdaptorTestCase.java
trunk/ui/core/src/test/java/org/ajax4jsf/component/MockDataAdaptor.java
trunk/ui/core/src/test/java/org/ajax4jsf/component/RepeatTestCase.java
Removed:
trunk/framework/impl/src/main/java/org/ajax4jsf/ajax/UILoadBundle.java
trunk/framework/impl/src/main/java/org/ajax4jsf/ajax/repeat/UIDataAdaptor.java
trunk/framework/test/src/main/java/org/ajax4jsf/tests/MockDataAdaptor.java
trunk/framework/test/src/test/java/org/ajax4jsf/ajax/repeat/DataAdaptorTestCase.java
trunk/ui/core/src/main/java/META-INF/
trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIActionParameter.java
trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIAjaxCommandButton.java
trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIAjaxCommandLink.java
trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIAjaxForm.java
trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIAjaxFunction.java
trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIAjaxLog.java
trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIAjaxOutputPanel.java
trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIAjaxRegion.java
trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIAjaxStatus.java
trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIAjaxSupport.java
trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIInclude.java
trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIPoll.java
trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIPortlet.java
trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIPush.java
trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIResource.java
trunk/ui/core/src/main/java/org/ajax4jsf/ajax/repeat/
trunk/ui/core/src/main/java/org/ajax4jsf/ajax/resource/
trunk/ui/core/src/test/java/org/ajax4jsf/ajax/
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/framework/renderer/AjaxChildrenRenderer.java
trunk/framework/impl/src/main/java/org/ajax4jsf/framework/renderer/AjaxRendererUtils.java
trunk/ui/core/src/main/config/component/actionParameter.xml
trunk/ui/core/src/main/config/component/commandButton.xml
trunk/ui/core/src/main/config/component/commandLink.xml
trunk/ui/core/src/main/config/component/form.xml
trunk/ui/core/src/main/config/component/function.xml
trunk/ui/core/src/main/config/component/include.xml
trunk/ui/core/src/main/config/component/loadBundle.xml
trunk/ui/core/src/main/config/component/loadScript.xml
trunk/ui/core/src/main/config/component/loadStyle.xml
trunk/ui/core/src/main/config/component/log.xml
trunk/ui/core/src/main/config/component/mediaOutput.xml
trunk/ui/core/src/main/config/component/outputPanel.xml
trunk/ui/core/src/main/config/component/page.xml
trunk/ui/core/src/main/config/component/poll.xml
trunk/ui/core/src/main/config/component/portlet.xml
trunk/ui/core/src/main/config/component/push.xml
trunk/ui/core/src/main/config/component/region.xml
trunk/ui/core/src/main/config/component/repeat.xml
trunk/ui/core/src/main/config/component/status.xml
trunk/ui/core/src/main/config/component/support.xml
trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/AjaxFunctionRendererBase.java
trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/LoadResourceRendererBase.java
trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxFormRenderer.java
trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxIncludeRenderer.java
trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxOutputPanelRenderer.java
trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPageRenderer.java
trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPollRenderer.java
trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPushRenderer.java
trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxStatusRenderer.java
trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxSupportRenderer.java
trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/MediaOutputRenderer.java
trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/RepeatRenderer.java
trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/ActionParamHandler.java
trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/IncludeHandler.java
trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/MediaOutputHandler.java
trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/ActionParamTag.java
trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxFormTag.java
trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxRegionTag.java
trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxStatusTag.java
trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxSupportTag.java
trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/IncludeTag.java
trunk/ui/core/src/main/templates/org/ajax4jsf/renderkit/html/button.jspx
trunk/ui/core/src/main/templates/org/ajax4jsf/renderkit/html/function.jspx
trunk/ui/core/src/main/templates/org/ajax4jsf/renderkit/html/link.jspx
trunk/ui/core/src/main/templates/org/ajax4jsf/renderkit/html/log.jspx
trunk/ui/dataTable/src/main/java/org/richfaces/component/UIDataGrid.java
trunk/ui/dataTable/src/main/java/org/richfaces/component/UIDataList.java
trunk/ui/dataTable/src/main/java/org/richfaces/component/UIDataTable.java
trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractDefinitionListRenderer.java
trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractGridRenderer.java
trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractListRenderer.java
trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractRowsRenderer.java
trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/TableHolder.java
trunk/ui/dataTable/src/test/java/org/richfaces/component/DataTableComponentTest.java
trunk/ui/tree/src/main/java/org/richfaces/component/UITree.java
Log:
ui.core refactored
Deleted: trunk/framework/impl/src/main/java/org/ajax4jsf/ajax/UILoadBundle.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/ajax/UILoadBundle.java 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/ajax/UILoadBundle.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -1,127 +0,0 @@
-/**
- * License Agreement.
- *
- * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.ajax4jsf.ajax;
-
-import java.io.IOException;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-import javax.faces.component.UIComponentBase;
-import javax.faces.component.UIViewRoot;
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.Messages;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * @author shura
- *
- */
-public abstract class UILoadBundle extends UIComponentBase {
-
- public static final String COMPONENT_FAMILY = "org.ajax4jsf.Bundle";
-
- public static final String COMPONENT_TYPE = "org.ajax4jsf.ajax.Bundle";
-
- private static final Log _log = LogFactory.getLog(UILoadBundle.class);
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.component.UIComponent#getFamily()
- */
- public String getFamily() {
- // TODO Auto-generated method stub
- return COMPONENT_FAMILY;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.component.UIComponentBase#encodeBegin(javax.faces.context.FacesContext)
- */
- public void encodeBegin(FacesContext context) throws IOException {
- loadBundle(context);
-
- }
-
- public void decode(FacesContext context) {
- loadBundle(context);
- }
- /**
- * @param context
- */
- public void loadBundle(FacesContext context) {
- UIViewRoot viewRoot = context.getViewRoot();
- Locale locale = viewRoot.getLocale();
- if (locale == null) {
- locale = context.getApplication().getDefaultLocale();
- }
-
- ResourceBundle bundle;
- try {
- bundle = ResourceBundle.getBundle(getBasename(), locale, Thread
- .currentThread().getContextClassLoader());
- } catch (MissingResourceException e) {
- _log.error(Messages.getMessage(Messages.COULD_NOT_LOAD_RESOURCE_BUNDLE, getBasename()));
- return;
- }
-
- context.getExternalContext().getRequestMap().put(getVar(),
- new ResourceBundleMap(bundle));
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.component.UIComponentBase#getRendererType()
- */
- public String getRendererType() {
- // TODO Auto-generated method stub
- return null;
- }
-
- /**
- * @return Returns the basename.
- */
- public abstract String getBasename();
-
- /**
- * @param basename
- * The basename to set.
- */
- public abstract void setBasename(String basename);
-
- /**
- * @return Returns the var.
- */
- public abstract String getVar();
-
- /**
- * @param var
- * The var to set.
- */
- public abstract void setVar(String var);
-
-}
Deleted: trunk/framework/impl/src/main/java/org/ajax4jsf/ajax/repeat/UIDataAdaptor.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/ajax/repeat/UIDataAdaptor.java 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/ajax/repeat/UIDataAdaptor.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -1,1333 +0,0 @@
-/**
- * License Agreement.
- *
- * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.ajax4jsf.ajax.repeat;
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-import javax.faces.FacesException;
-import javax.faces.application.FacesMessage;
-import javax.faces.component.EditableValueHolder;
-import javax.faces.component.NamingContainer;
-import javax.faces.component.StateHolder;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIData;
-import javax.faces.context.FacesContext;
-import javax.faces.el.ValueBinding;
-import javax.faces.event.AbortProcessingException;
-import javax.faces.event.FacesEvent;
-import javax.faces.event.FacesListener;
-import javax.faces.event.PhaseId;
-import javax.faces.model.DataModel;
-import javax.faces.model.ListDataModel;
-import javax.faces.render.Renderer;
-
-import org.ajax4jsf.component.AjaxDataEncoder;
-import org.ajax4jsf.framework.renderer.AjaxChildrenRenderer;
-import org.ajax4jsf.model.DataComponentState;
-import org.ajax4jsf.model.DataVisitor;
-import org.ajax4jsf.model.ExtendedDataModel;
-import org.ajax4jsf.model.SerializableDataModel;
-
-/**
- * Base class for iterable components, like dataTable, Tomahawk dataList,
- * Facelets repeat, tree etc., with support for partial rendering on AJAX
- * responces for one or more selected iterations.
- *
- * @author shura
- *
- */
-public abstract class UIDataAdaptor extends UIData implements AjaxDataEncoder {
-
- /**
- *
- */
- public static final String COMPONENT_STATE_ATTRIBUTE = "componentState";
-
- public final static DataModel EMPTY_MODEL = new ListDataModel(
- Collections.EMPTY_LIST);
-
- /**
- * Base class for visit data model at phases decode, validation and
- * update model
- *
- * @author shura
- *
- */
- protected abstract class ComponentVisitor implements DataVisitor {
-
- public void process(FacesContext context, Object rowKey, Object argument)
- throws IOException {
- setRowKey(context, rowKey);
- if (isRowAvailable()) {
- Iterator childIterator = dataChildren();
- while (childIterator.hasNext()) {
- UIComponent component = (UIComponent) childIterator.next();
- processComponent(context, component, argument);
- }
-
- }
- }
-
- public abstract void processComponent(FacesContext context,
- UIComponent c, Object argument) throws IOException;
-
- }
-
- /**
- * Visitor for process decode on children components.
- */
- protected ComponentVisitor decodeVisitor = new ComponentVisitor() {
-
- public void processComponent(FacesContext context, UIComponent c,
- Object argument) {
- c.processDecodes(context);
- }
-
- };
-
- /**
- * Visitor for process validation phase
- */
- protected ComponentVisitor validateVisitor = new ComponentVisitor() {
-
- public void processComponent(FacesContext context, UIComponent c,
- Object argument) {
- c.processValidators(context);
- }
-
- };
-
- /**
- * Visitor for process update model phase.
- */
- protected ComponentVisitor updateVisitor = new ComponentVisitor() {
-
- public void processComponent(FacesContext context, UIComponent c,
- Object argument) {
- c.processUpdates(context);
- }
-
- };
-
- /**
- * Base client id's of this component, for wich invoked encode...
- * methods. Component will save state and serialisable models for this
- * keys only.
- */
- private Set _encoded;
-
- /**
- * Storage for data model instances with different client id's of this
- * component. In case of child for UIData component, this map will keep
- * data models for different iterations between phases.
- */
- private Map _modelsMap = new HashMap();
-
- /**
- * Reference for curent data model
- */
- private ExtendedDataModel _currentModel = null;
-
- /**
- * States of this component for diferent iterations, same as for models.
- */
- private Map _statesMap = new HashMap();
-
- /**
- * Reference for current component state.
- */
- private DataComponentState _currentState = null;
-
- /**
- * Name of EL variable for current component state.
- */
- private String _stateVar;
-
- private String _rowKeyVar;
-
- /**
- * Key for current value in model.
- */
- private Object _rowKey = null;
-
- /**
- * Values of row keys, encoded on ajax response rendering.
- */
- private Set _ajaxKeys = null;
-
- private Object _ajaxRowKey = null;
-
- private Map _ajaxRowKeysMap = new HashMap();
-
- /**
- * Get name of EL variable for component state.
- *
- * @return the varState
- */
- public String getStateVar() {
- return _stateVar;
- }
-
- /**
- * @param varStatus
- * the varStatus to set
- */
- public void setStateVar(String varStatus) {
- this._stateVar = varStatus;
- }
-
- /**
- * @return the rowKeyVar
- */
- public String getRowKeyVar() {
- return this._rowKeyVar;
- }
-
- /**
- * @param rowKeyVar
- * the rowKeyVar to set
- */
- public void setRowKeyVar(String rowKeyVar) {
- this._rowKeyVar = rowKeyVar;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.component.UIData#getRowCount()
- */
- public int getRowCount() {
- return getExtendedDataModel().getRowCount();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.component.UIData#getRowData()
- */
- public Object getRowData() {
- return getExtendedDataModel().getRowData();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.component.UIData#isRowAvailable()
- */
- public boolean isRowAvailable() {
- return this.getExtendedDataModel().isRowAvailable();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.component.UIData#setRowIndex(int)
- */
- public void setRowIndex(int index) {
- FacesContext faces = FacesContext.getCurrentInstance();
- ExtendedDataModel localModel = getExtendedDataModel();
- // if(key == localModel.getRowIndex()){
- // return;
- // }
- // save child state
- this.saveChildState(faces);
- // Set current model row by int, but immediately get value from model.
- // for compability, complex models must provide values map between
- // integer and key value.
- localModel.setRowIndex(index);
- this._rowKey = localModel.getRowKey();
- this._clientId = null;
- boolean rowSelected = this._rowKey != null;
-
- setupVariable(faces, localModel, rowSelected);
- // restore child state
- this.restoreChildState(faces);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.component.UIData#getRowIndex()
- */
- public int getRowIndex() {
- return getExtendedDataModel().getRowIndex();
- }
-
- /**
- * Same as for int index, but for complex model key.
- *
- * @return
- */
- public Object getRowKey() {
- return this._rowKey;
- }
-
- public void setRowKey(Object key) {
- setRowKey(FacesContext.getCurrentInstance(), key);
- }
-
- /**
- * Setup current roy by key. Perform same functionality as
- * {@link UIData#setRowIndex(int)}, but for key object - it may be not
- * only row number in sequence data, but, for example - path to current
- * node in tree.
- *
- * @param faces -
- * current FacesContext
- * @param key
- * new key value.
- */
- public void setRowKey(FacesContext faces, Object key) {
- ExtendedDataModel localModel = getExtendedDataModel();
- // save child state
- this.saveChildState(faces);
- this._rowKey = key;
- this._clientId = null;
- localModel.setRowKey(key);
-
- boolean rowSelected = key != null;
-
- setupVariable(faces, localModel, rowSelected);
- // restore child state
- this.restoreChildState(faces);
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.ajax.repeat.AjaxDataEncoder#getAjaxKeys()
- */
- public Set getAjaxKeys() {
- Set keys = null;
- if (this._ajaxKeys != null) {
- keys = (this._ajaxKeys);
- } else {
- ValueBinding vb = getValueBinding("ajaxKeys");
- if (vb != null) {
- keys = (Set) (vb.getValue(getFacesContext()));
- } else if(null != _ajaxRowKey){
- // If none of above exist , use row with submitted AjaxComponent
- keys = new HashSet(1);
- keys.add(_ajaxRowKey);
- }
- }
- return keys;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.ajax.repeat.AjaxDataEncoder#setAjaxKeys(java.util.Set)
- */
- public void setAjaxKeys(Set ajaxKeys) {
- this._ajaxKeys = ajaxKeys;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.framework.ajax.AjaxChildrenEncoder#encodeAjaxChild(javax.faces.context.FacesContext,
- * java.lang.String, java.util.Set, java.util.Set)
- */
- public void encodeAjaxChild(FacesContext context, String path,
- final Set ids, final Set renderedAreas) throws IOException {
- resetDataModel();
-
- Renderer renderer = getRenderer(context);
- if (null != renderer && renderer instanceof AjaxChildrenRenderer) {
- // If renderer support partial encoding - call them.
- AjaxChildrenRenderer childrenRenderer = (AjaxChildrenRenderer) renderer;
- childrenRenderer.encodeAjaxChildren(context, this, path, ids,
- renderedAreas);
- } else {
- // Use simple ajax children encoding for iterate other keys.
- final AjaxChildrenRenderer childrenRenderer = getChildrenRenderer();
- final String childrenPath = path + getId() + NamingContainer.SEPARATOR_CHAR;
- ComponentVisitor ajaxVisitor = new ComponentVisitor() {
-
- public void processComponent(FacesContext context,
- UIComponent c, Object argument) throws IOException {
- childrenRenderer.encodeAjaxComponent(context, c, childrenPath,
- ids, renderedAreas);
- }
-
- };
- Set ajaxKeys = getAjaxKeys();
- if (null != ajaxKeys) {
- captureOrigValue();
- Object savedKey = getRowKey();
- setRowKey(context, null);
- Iterator fixedChildren = fixedChildren();
- while (fixedChildren.hasNext()) {
- UIComponent component = (UIComponent) fixedChildren.next();
- ajaxVisitor.processComponent(context, component, null);
- }
- for (Iterator iter = ajaxKeys.iterator(); iter.hasNext();) {
- Object key = (Object) iter.next();
- ajaxVisitor.process(context, key, null);
- }
- setRowKey(savedKey);
- restoreOrigValue();
- } else {
- iterate(context, ajaxVisitor, null);
- }
- }
- }
-
- /**
- * Instance of default renderer in ajax responses.
- */
- private AjaxChildrenRenderer _childrenRenderer = null;
-
- /**
- * getter for simple {@link AjaxChildrenRenderer} instance in case of
- * ajax responses. If default renderer not support search of children
- * for encode in ajax response, component will use this instance by
- * default.
- *
- * @return
- */
- protected AjaxChildrenRenderer getChildrenRenderer() {
- if (_childrenRenderer == null) {
- _childrenRenderer = new AjaxChildrenRenderer() {
-
- protected Class getComponentClass() {
- return UIDataAdaptor.class;
- }
-
- };
-
- }
-
- return _childrenRenderer;
- }
-
- /**
- * @return Set of values for clientId's of this component, for wich was
- * invoked "encode" methods.
- */
- protected Set getEncodedIds() {
- if (_encoded == null) {
- _encoded = new HashSet();
- }
-
- return _encoded;
- }
-
- /**
- * Setup EL variable for different iteration. Value of row data and
- * component state will be put into request scope attributes with names
- * given by "var" and "varState" bean properties.
- *
- * @param faces
- * current faces context
- * @param localModel
- * @param rowSelected
- */
- protected void setupVariable(FacesContext faces, DataModel localModel,
- boolean rowSelected) {
- Map attrs = faces.getExternalContext().getRequestMap();
- if (rowSelected && isRowAvailable()) {
- // Current row data.
- setupVariable(getVar(), attrs, localModel.getRowData());
- // Component state variable.
- setupVariable(getStateVar(), attrs, getComponentState());
- // Row key Data variable.
- setupVariable(getRowKeyVar(), attrs, getRowKey());
-
- } else {
- removeVariable(getVar(), attrs);
- removeVariable(getStateVar(), attrs);
- removeVariable(getRowKeyVar(), attrs);
- }
- }
-
- /**
- * @param var
- * @param attrs
- * @param rowData
- */
- private void setupVariable(String var, Map attrs, Object rowData) {
- if (var != null) {
- attrs.put(var, rowData);
- }
- }
-
- /**
- * @param var
- * @param attrs
- * @param rowData
- */
- private void removeVariable(String var, Map attrs) {
- if (var != null) {
- attrs.remove(var);
- }
- }
-
- /**
- * Reset data model. this method must be called twice per request -
- * before decode phase and before component encoding.
- */
- protected void resetDataModel() {
- this.setExtendedDataModel(null);
- }
-
- /**
- * Set data model. Model value will be stored in Map with key as current
- * clientId for this component, to keep models between phases for same
- * iteration in case if this component child for other UIData
- *
- * @param model
- */
- protected void setExtendedDataModel(ExtendedDataModel model) {
- this._currentModel = model;
- this._modelsMap.put(getBaseClientId(getFacesContext()), model);
- }
-
- /**
- * Get current data model, or create it by {@link #createDataModel()}
- * method. For different iterations in ancestor UIData ( if present )
- * will be returned different models.
- *
- * @return current data model.
- */
- protected ExtendedDataModel getExtendedDataModel() {
- if (this._currentModel == null) {
- String baseClientId = getBaseClientId(getFacesContext());
- ExtendedDataModel model = (ExtendedDataModel) this._modelsMap
- .get(baseClientId);
- if (null == model) {
- model = createDataModel();
- this._modelsMap.put(baseClientId, model);
- }
- this._currentModel = model;
- }
- return this._currentModel;
- }
-
- /**
- * Hook mathod for create data model in concrete implementations.
- *
- * @return
- */
- protected abstract ExtendedDataModel createDataModel();
-
- /**
- * Set current state ( at most cases, visual representation ) of this
- * component. Same as for DataModel, component will keep states for
- * different iterations.
- *
- * @param state
- */
- public void setComponentState(DataComponentState state) {
- this._currentState = state;
- this._statesMap.put(getBaseClientId(getFacesContext()),
- this._currentState);
- }
-
- /**
- * @return current state of this component.
- */
- public DataComponentState getComponentState() {
- DataComponentState state = null;
- if (this._currentState == null) {
- // Check for binding state to user bean.
- ValueBinding valueBinding = getValueBinding(UIDataAdaptor.COMPONENT_STATE_ATTRIBUTE);
- FacesContext facesContext = getFacesContext();
- if (null != valueBinding) {
- state = (DataComponentState) valueBinding
- .getValue(facesContext);
- if (null == state) {
- // Create default state
- state = createComponentState();
- if (!valueBinding.isReadOnly(facesContext)) {
- // Store created state in user bean.
- valueBinding.setValue(facesContext, state);
- }
- }
- } else {
- // Check for stored state in map for parent iterations
- String baseClientId = getBaseClientId(facesContext);
- state = (DataComponentState) this._statesMap.get(baseClientId);
- if (null == state) {
- // Create default component state
- state = createComponentState();
- this._statesMap.put(baseClientId, state);
- }
- this._currentState = state;
- }
- } else {
- state = this._currentState;
- }
- return state;
- }
-
- /**
- * Hook method for create default state in concrete implementations.
- *
- * @return
- */
- protected abstract DataComponentState createComponentState();
-
- private String _clientId = null;
-
- public String getClientId(FacesContext faces) {
- if (null == _clientId) {
- StringBuffer id = new StringBuffer(getBaseClientId(faces));
- Object rowKey = getRowKey();
- if (rowKey != null) {
- id.append(NamingContainer.SEPARATOR_CHAR).append(
- rowKey.toString());
- }
- Renderer renderer;
- if (null != (renderer = getRenderer(faces))) {
- _clientId = renderer.convertClientId(faces, id.toString());
- } else {
- _clientId = id.toString();
- }
-
- }
- return _clientId;
- }
-
- private String _baseClientId = null;
-
- /**
- * Get base clietntId of this component ( withowt iteration part )
- *
- * @param faces
- * @return
- */
- public String getBaseClientId(FacesContext faces) {
- // Return any previously cached client identifier
- if (_baseClientId == null) {
-
- // Search for an ancestor that is a naming container
- UIComponent ancestorContainer = this;
- StringBuffer parentIds = new StringBuffer();
- while (null != (ancestorContainer = ancestorContainer.getParent())) {
- if (ancestorContainer instanceof NamingContainer) {
- parentIds.append(ancestorContainer.getClientId(faces))
- .append(NamingContainer.SEPARATOR_CHAR);
- break;
- }
- }
- String id = getId();
- if (null != id) {
- _baseClientId = parentIds.append(id).toString();
- } else {
- _baseClientId = parentIds.append(
- faces.getViewRoot().createUniqueId()).toString();
- }
- }
- return (_baseClientId);
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.component.UIComponentBase#setId(java.lang.String)
- */
- public void setId(String id) {
- // If component created by restoring tree or JSP, initial Id is null.
- boolean haveId = null != super.getId();
- super.setId(id);
- _baseClientId = null;
- _clientId = null;
- if (haveId) {
- // parent UIData ( if present ) will be set same Id at iteration
- // -
- // we use it for
- // switch to different model and state.
- String baseClientId = getBaseClientId(getFacesContext());
- this._currentState = (DataComponentState) this._statesMap
- .get(baseClientId);
- this._currentModel = (ExtendedDataModel) this._modelsMap
- .get(baseClientId);
- if (null != this._currentModel) {
- this._rowKey = this._currentModel.getRowKey();
- // restoreChildState();
- }
- // Restore value for row with submitted AjaxComponent.
- this._ajaxRowKey = _ajaxRowKeysMap.get(baseClientId);
- }
- }
-
- private Object origValue;
-
- /**
- * Save current state of data variable.
- */
- public void captureOrigValue() {
- captureOrigValue(FacesContext.getCurrentInstance());
- }
-
- /**
- * Save current state of data variable.
- *
- * @param faces
- * current faces context
- */
- public void captureOrigValue(FacesContext faces) {
- String var = getVar();
- if (var != null) {
- Map attrs = faces.getExternalContext().getRequestMap();
- this.origValue = attrs.get(var);
- }
- }
-
- /**
- * Restore value of data variable after processing phase.
- */
- public void restoreOrigValue() {
- restoreOrigValue(FacesContext.getCurrentInstance());
- }
-
- /**
- * Restore value of data variable after processing phase.
- *
- * @param faces
- * current faces context
- */
- public void restoreOrigValue(FacesContext faces) {
- String var = getVar();
- if (var != null) {
- Map attrs = faces.getExternalContext().getRequestMap();
- if (this.origValue != null) {
- attrs.put(var, this.origValue);
- } else {
- attrs.remove(var);
- }
- }
- }
-
- /**
- * Saved values of {@link EditableValueHolder} fields per iterations.
- */
- private Map childState;
-
- /**
- * @param faces
- * @return Saved values of {@link EditableValueHolder} fields per
- * iterations.
- */
- protected Map getChildState(FacesContext faces) {
- if (this.childState == null) {
- this.childState = new HashMap();
- }
- String baseClientId = getBaseClientId(faces);
- Map currentChildState = (Map) childState.get(baseClientId);
- if (null == currentChildState) {
- currentChildState = new HashMap();
- childState.put(baseClientId, currentChildState);
- }
- return currentChildState;
- }
-
- /**
- * Save values of {@link EditableValueHolder} fields before change
- * current row.
- *
- * @param faces
- */
- protected void saveChildState(FacesContext faces) {
-
- Iterator itr = dataChildren();
- while (itr.hasNext()) {
- Map childState = this.getChildState(faces);
- this.saveChildState(faces, (UIComponent) itr.next(), childState);
- }
- }
-
- /**
- * Recursive method for Iterate on children for save
- * {@link EditableValueHolder} fields states.
- *
- * @param faces
- * @param c
- * @param childState
- */
- private void saveChildState(FacesContext faces, UIComponent c,
- Map childState) {
-
- if (c instanceof EditableValueHolder && !c.isTransient()) {
- String clientId = c.getClientId(faces);
- SavedState ss = (SavedState) childState.get(clientId);
- if (ss == null) {
- ss = new SavedState();
- childState.put(clientId, ss);
- }
- ss.populate((EditableValueHolder) c);
- }
-
- // continue hack
- Iterator itr = c.getChildren().iterator();
- while (itr.hasNext()) {
- saveChildState(faces, (UIComponent) itr.next(), childState);
- }
- itr = c.getFacets().values().iterator();
- while (itr.hasNext()) {
- saveChildState(faces, (UIComponent) itr.next(), childState);
- }
- }
-
- /**
- * Restore values of {@link EditableValueHolder} fields after change
- * current row.
- *
- * @param faces
- */
- protected void restoreChildState(FacesContext faces) {
-
- Iterator itr = dataChildren();
- while (itr.hasNext()) {
- Map childState = this.getChildState(faces);
- this.restoreChildState(faces, (UIComponent) itr.next(), childState);
- }
- }
-
- /**
- * Recursive part of
- * {@link #restoreChildState(FacesContext, UIComponent, Map)}
- *
- * @param faces
- * @param c
- * @param childState
- *
- */
- private void restoreChildState(FacesContext faces, UIComponent c,
- Map childState) {
- // reset id
- String id = c.getId();
- c.setId(id);
-
- // hack
- if (c instanceof EditableValueHolder) {
- EditableValueHolder evh = (EditableValueHolder) c;
- String clientId = c.getClientId(faces);
- SavedState ss = (SavedState) childState.get(clientId);
- if (ss != null) {
- ss.apply(evh);
- } else {
- NullState.apply(evh);
- }
- }
-
- // continue hack
- Iterator itr = c.getChildren().iterator();
- while (itr.hasNext()) {
- restoreChildState(faces, (UIComponent) itr.next(), childState);
- }
- itr = c.getFacets().values().iterator();
- while (itr.hasNext()) {
- restoreChildState(faces, (UIComponent) itr.next(), childState);
- }
- }
-
- /**
- * Check for validation errors on children components. If true, saved
- * values must be keep on render phase
- *
- * @param context
- * @return
- */
- private boolean keepSaved(FacesContext context) {
-
- Iterator clientIds = this.getChildState(context).keySet().iterator();
- while (clientIds.hasNext()) {
- String clientId = (String) clientIds.next();
- Iterator messages = context.getMessages(clientId);
- while (messages.hasNext()) {
- FacesMessage message = (FacesMessage) messages.next();
- if (message.getSeverity()
- .compareTo(FacesMessage.SEVERITY_ERROR) >= 0) {
- return (true);
- }
- }
- }
- return false;
- }
-
- /**
- * Perform iteration on all children components and all data rows with
- * given visitor.
- *
- * @param faces
- * @param visitor
- */
- protected void iterate(FacesContext faces, ComponentVisitor visitor,
- Object argument) {
-
- // stop if not rendered
- if (!this.isRendered()) {
- return;
- }
- // reset rowIndex
- this.captureOrigValue(faces);
- this.setRowKey(faces, null);
- try {
- Iterator fixedChildren = fixedChildren();
- while (fixedChildren.hasNext()) {
- UIComponent component = (UIComponent) fixedChildren.next();
- visitor.processComponent(faces, component, argument);
- }
-
- walk(faces, visitor, argument);
- } catch (Exception e) {
- throw new FacesException(e);
- } finally {
- this.setRowKey(faces, null);
- this.restoreOrigValue(faces);
- }
- }
-
- /**
- * Walk ( visit ) this component on all data-avare children for each
- * row.
- *
- * @param faces
- * @param visitor
- * @throws IOException
- */
- public void walk(FacesContext faces, DataVisitor visitor, Object argument)
- throws IOException {
- getExtendedDataModel().walk(faces, visitor,
- getComponentState().getRange(), argument);
- }
-
- protected void processDecodes(FacesContext faces, Object argument) {
- if (!this.isRendered())
- return;
- this.resetComponent(faces);
- this.iterate(faces, decodeVisitor, argument);
- this.decode(faces);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.component.UIData#processDecodes(javax.faces.context.FacesContext)
- */
- public void processDecodes(FacesContext faces) {
- processDecodes(faces, null);
- }
-
- /**
- * Reset per-request fields in component.
- *
- * @param faces
- *
- */
- protected void resetComponent(FacesContext faces) {
- // resetDataModel();
- if (null != this.childState) {
- childState.remove(getBaseClientId(faces));
- }
- this._encoded = null;
- }
-
- protected void processUpdates(FacesContext faces, Object argument) {
- if (!this.isRendered())
- return;
- this.iterate(faces, updateVisitor, argument);
- ExtendedDataModel dataModel = getExtendedDataModel();
- // If no validation errors, update values for serializable model,
- // restored from view.
- if (dataModel instanceof SerializableDataModel && (!keepSaved(faces))) {
- SerializableDataModel serializableModel = (SerializableDataModel) dataModel;
- serializableModel.update();
- }
- }
-
- public void processUpdates(FacesContext faces) {
- processUpdates(faces, null);
- }
-
- protected void processValidators(FacesContext faces, Object argument) {
- if (!this.isRendered())
- return;
- this.iterate(faces, validateVisitor, argument);
- }
-
- public void processValidators(FacesContext faces) {
- processValidators(faces, null);
- }
-
- public void encodeBegin(FacesContext context) throws IOException {
- resetDataModel();
- // if(!keepSaved(context)){
- // childState.remove(getBaseClientId(context));
- // }
- // Mark component as used, if parent UIData change own range states not
- // accessed at
- // encode phase must be unsaved.
- getEncodedIds().add(getBaseClientId(context));
- // getComponentState().setUsed(true);
- super.encodeBegin(context);
- }
-
- /**
- * This method must create iterator for all non-data avare children of
- * this component ( header/footer facets for components and columns in
- * dataTable, facets for tree etc.
- *
- * @return iterator for all components not sensitive for row data.
- */
- protected abstract Iterator fixedChildren();
-
- /**
- * This method must create iterator for all children components,
- * processed "per row" It can be children of UIColumn in dataTable,
- * nodes in tree
- *
- * @return iterator for all components processed per row.
- */
- protected abstract Iterator dataChildren();
-
- private final static SavedState NullState = new SavedState();
-
- // from RI
- /**
- * This class keep values of {@link EditableValueHolder} row-sensitive
- * fields.
- *
- * @author shura
- *
- */
- private final static class SavedState implements Serializable {
-
- private Object submittedValue;
-
- private static final long serialVersionUID = 2920252657338389849L;
-
- Object getSubmittedValue() {
- return (this.submittedValue);
- }
-
- void setSubmittedValue(Object submittedValue) {
- this.submittedValue = submittedValue;
- }
-
- private boolean valid = true;
-
- boolean isValid() {
- return (this.valid);
- }
-
- void setValid(boolean valid) {
- this.valid = valid;
- }
-
- private Object value;
-
- Object getValue() {
- return (this.value);
- }
-
- public void setValue(Object value) {
- this.value = value;
- }
-
- private boolean localValueSet;
-
- boolean isLocalValueSet() {
- return (this.localValueSet);
- }
-
- public void setLocalValueSet(boolean localValueSet) {
- this.localValueSet = localValueSet;
- }
-
- public String toString() {
- return ("submittedValue: " + submittedValue + " value: " + value
- + " localValueSet: " + localValueSet);
- }
-
- public void populate(EditableValueHolder evh) {
- this.value = evh.getLocalValue();
- this.valid = evh.isValid();
- this.submittedValue = evh.getSubmittedValue();
- this.localValueSet = evh.isLocalValueSet();
- }
-
- public void apply(EditableValueHolder evh) {
- evh.setValue(this.value);
- evh.setValid(this.valid);
- evh.setSubmittedValue(this.submittedValue);
- evh.setLocalValueSet(this.localValueSet);
- }
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.component.UIData#queueEvent(javax.faces.event.FacesEvent)
- */
- public void queueEvent(FacesEvent event) {
- if (event.getComponent() != this) {
- event = new IndexedEvent(this, event, getRowKey());
- }
- // Send event directly to parent, to avoid wrapping in superclass.
- UIComponent parent = getParent();
- if (parent == null) {
- throw new IllegalStateException(
- "No parent component for queue event");
- } else {
- parent.queueEvent(event);
- }
- }
-
- public void broadcast(FacesEvent event) throws AbortProcessingException {
-
- if (!(event instanceof IndexedEvent)) {
- if (!broadcastLocal(event)) {
- super.broadcast(event);
- }
- return;
- }
-
- // Set up the correct context and fire our wrapped event
- IndexedEvent revent = (IndexedEvent) event;
- Object oldRowKey = getRowKey();
- FacesContext faces = FacesContext.getCurrentInstance();
- captureOrigValue(faces);
- Object eventRowKey = revent.getKey();
- setRowKey(faces, eventRowKey);
- FacesEvent rowEvent = revent.getTarget();
- rowEvent.getComponent().broadcast(rowEvent);
- // For Ajax events, keep row value.
- if (!(rowEvent.getPhaseId() == PhaseId.RENDER_RESPONSE)) {
- this._ajaxRowKey = eventRowKey;
- this._ajaxRowKeysMap.put(getBaseClientId(faces), eventRowKey);
- }
- setRowKey(faces, oldRowKey);
- restoreOrigValue(faces);
- // }
- return;
- }
-
- /**
- * Process events targetted for concrete implementation. Hook method
- * called from {@link #broadcast(FacesEvent)}
- *
- * @param event -
- * processed event.
- * @return true if event processed, false if component must continue
- * processing.
- */
- protected boolean broadcastLocal(FacesEvent event) {
- return false;
- }
-
- /**
- * Wrapper for event from child component, with value of current row
- * key.
- *
- * @author shura
- *
- */
- protected static final class IndexedEvent extends FacesEvent {
-
- private static final long serialVersionUID = -8318895390232552385L;
-
- private final FacesEvent target;
-
- private final Object key;
-
- public IndexedEvent(UIDataAdaptor owner, FacesEvent target, Object key) {
- super(owner);
- this.target = target;
- this.key = key;
- }
-
- public PhaseId getPhaseId() {
- return (this.target.getPhaseId());
- }
-
- public void setPhaseId(PhaseId phaseId) {
- this.target.setPhaseId(phaseId);
- }
-
- public boolean isAppropriateListener(FacesListener listener) {
- return this.target.isAppropriateListener(listener);
- }
-
- public void processListener(FacesListener listener) {
- UIDataAdaptor owner = (UIDataAdaptor) this.getComponent();
- Object prevIndex = owner._rowKey;
- try {
- owner.setRowKey(this.key);
- this.target.processListener(listener);
- } finally {
- owner.setRowKey(prevIndex);
- }
- }
-
- public Object getKey() {
- return key;
- }
-
- public FacesEvent getTarget() {
- return target;
- }
-
- }
-
- /**
- * "memento" pattern class for state of component.
- *
- * @author shura
- *
- */
- private static class DataState implements Serializable {
-
- /**
- *
- */
- private static final long serialVersionUID = 17070532L;
-
- private Object superState;
-
- private Map componentStates = new HashMap();
-
- private Set ajaxKeys;
-
- public String rowKeyVar;
-
- public String stateVar;
-
- }
-
- /**
- * Serialisable model and component state per iteration of parent
- * UIData.
- *
- * @author shura
- *
- */
- private static class PerIdState implements Serializable {
- /**
- *
- */
- private static final long serialVersionUID = 9037454770537726418L;
-
- /**
- * Flag setted to true if componentState implements StateHolder
- */
- private boolean stateInHolder = false;
-
- /**
- * Serializable componentState or
- */
- private Object componentState;
-
- private SerializableDataModel model;
- }
-
- public void restoreState(FacesContext faces, Object object) {
- DataState state = (DataState) object;
- super.restoreState(faces, state.superState);
- this._ajaxKeys = state.ajaxKeys;
- this._statesMap = new HashMap();
- this._rowKeyVar = state.rowKeyVar;
- this._stateVar = state.stateVar;
- // Restore serializable models and component states for all rows of
- // parent UIData ( single if this
- // component not child of iterable )
- for (Iterator iter = state.componentStates.entrySet().iterator(); iter
- .hasNext();) {
- Map.Entry stateEntry = (Map.Entry) iter.next();
- PerIdState idState = (PerIdState) stateEntry.getValue();
- DataComponentState compState;
- if (idState.stateInHolder) {
- // TODO - change RichFaces Tree component, for remove reference
- // to component from state.
- compState = createComponentState();
- ((StateHolder) compState).restoreState(faces,
- idState.componentState);
- } else {
- compState = (DataComponentState) idState.componentState;
- }
- Object key = stateEntry.getKey();
- this._statesMap.put(key, compState);
- this._modelsMap.put(key, idState.model);
- }
- }
-
- public Object saveState(FacesContext faces) {
- DataState state = new DataState();
- state.superState = super.saveState(faces);
- state.ajaxKeys = this._ajaxKeys;
- state.rowKeyVar = this._rowKeyVar;
- state.stateVar = this._stateVar;
- Set encodedIds = getEncodedIds();
- // Save all states of component and data model for all valies of
- // clientId, encoded in this request.
- for (Iterator iter = this._statesMap.entrySet().iterator(); iter
- .hasNext();) {
- Map.Entry stateEntry = (Map.Entry) iter.next();
- DataComponentState dataComponentState = ((DataComponentState) stateEntry
- .getValue());
- Object stateKey = stateEntry.getKey();
- if (encodedIds.isEmpty() || encodedIds.contains(stateKey)) {
- PerIdState idState = new PerIdState();
- idState.model = getExtendedDataModel().getSerializableModel(
- dataComponentState.getRange());
- // Save component state , depended if implemented interfaces.
- if (null == dataComponentState) {
- idState.componentState = null;
- } else if (dataComponentState instanceof Serializable) {
- idState.componentState = dataComponentState;
- } else if (dataComponentState instanceof StateHolder) {
- // TODO - change RichFaces Tree component, for remove
- // reference to component from state.
- // Change this code to reference for saveAttachedState.
- idState.componentState = ((StateHolder) dataComponentState)
- .saveState(faces);
- idState.stateInHolder = true;
- }
- if (null != idState.model || null != idState.componentState) {
- state.componentStates.put(stateKey, idState);
- }
- }
- }
- return state;
- }
-
- public void setParent(UIComponent parent) {
- super.setParent(parent);
- this._clientId = null;
- this._baseClientId = null;
- }
-
-
-}
Added: trunk/framework/impl/src/main/java/org/ajax4jsf/component/AjaxLoadBundleComponent.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/component/AjaxLoadBundleComponent.java (rev 0)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/component/AjaxLoadBundleComponent.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -0,0 +1,31 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.ajax4jsf.component;
+
+/**
+ * @author mikalaj
+ *
+ * Marker interface for UILoadBundle component
+ */
+public interface AjaxLoadBundleComponent {
+
+}
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/framework/renderer/AjaxChildrenRenderer.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/framework/renderer/AjaxChildrenRenderer.java 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/framework/renderer/AjaxChildrenRenderer.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -31,7 +31,6 @@
import javax.faces.context.FacesContext;
import org.ajax4jsf.Messages;
-import org.ajax4jsf.ajax.UILoadBundle;
import org.ajax4jsf.component.AjaxChildrenEncoder;
import org.ajax4jsf.component.AjaxOutput;
import org.ajax4jsf.renderkit.AjaxRenderer;
@@ -47,7 +46,7 @@
public static final Log log = LogFactory.getLog(AjaxChildrenRenderer.class);
public static final String[] SPECIAL_COMPONENTS_TYPES = {
- UILoadBundle.COMPONENT_TYPE, "org.apache.myfaces.AliasBean",
+ "org.ajax4jsf.Bundle"/*UILoadBundle.COMPONENT_TYPE*/, "org.apache.myfaces.AliasBean",
"org.apache.myfaces.AliasBeansScope" };
private static final String SPECIAL_TYPES_PARAMETER = "org.ajax4jsf.CONTROL_COMPONENTS";
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/framework/renderer/AjaxRendererUtils.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/framework/renderer/AjaxRendererUtils.java 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/framework/renderer/AjaxRendererUtils.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -44,9 +44,9 @@
import javax.servlet.http.HttpServletResponse;
import org.ajax4jsf.Messages;
-import org.ajax4jsf.ajax.UILoadBundle;
import org.ajax4jsf.component.AjaxComponent;
import org.ajax4jsf.component.AjaxContainer;
+import org.ajax4jsf.component.AjaxLoadBundleComponent;
import org.ajax4jsf.component.AjaxSupport;
import org.ajax4jsf.context.AjaxContext;
import org.ajax4jsf.framework.ajax.AjaxViewRoot;
@@ -892,7 +892,7 @@
* @param child
*/
private static void loadCildBundles(FacesContext context, UIComponent child) {
- if (child instanceof UILoadBundle) {
+ if (child instanceof AjaxLoadBundleComponent) {
try {
child.encodeBegin(context);
} catch (IOException e) {
Deleted: trunk/framework/test/src/main/java/org/ajax4jsf/tests/MockDataAdaptor.java
===================================================================
--- trunk/framework/test/src/main/java/org/ajax4jsf/tests/MockDataAdaptor.java 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/framework/test/src/main/java/org/ajax4jsf/tests/MockDataAdaptor.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -1,68 +0,0 @@
-/**
- * License Agreement.
- *
- * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.ajax4jsf.tests;
-
-import java.util.Iterator;
-
-import org.ajax4jsf.ajax.repeat.UIDataAdaptor;
-import org.ajax4jsf.model.DataComponentState;
-import org.ajax4jsf.model.ExtendedDataModel;
-
-/**
- * @author shura
- *
- */
-public class MockDataAdaptor extends UIDataAdaptor {
-
- /* (non-Javadoc)
- * @see org.ajax4jsf.ajax.repeat.UIDataAdaptor#createComponentState()
- */
- protected DataComponentState createComponentState() {
- // TODO Auto-generated method stub
- return new MockComponentState();
- }
-
- /* (non-Javadoc)
- * @see org.ajax4jsf.ajax.repeat.UIDataAdaptor#createDataModel()
- */
- protected ExtendedDataModel createDataModel() {
- // TODO Auto-generated method stub
- return new MockDataModel();
- }
-
- /* (non-Javadoc)
- * @see org.ajax4jsf.ajax.repeat.UIDataAdaptor#dataChildren()
- */
- protected Iterator dataChildren() {
- // TODO Auto-generated method stub
- return getChildren().iterator();
- }
-
- /* (non-Javadoc)
- * @see org.ajax4jsf.ajax.repeat.UIDataAdaptor#fixedChildren()
- */
- protected Iterator fixedChildren() {
- // TODO Auto-generated method stub
- return getFacets().values().iterator();
- }
-
-}
Deleted: trunk/framework/test/src/test/java/org/ajax4jsf/ajax/repeat/DataAdaptorTestCase.java
===================================================================
--- trunk/framework/test/src/test/java/org/ajax4jsf/ajax/repeat/DataAdaptorTestCase.java 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/framework/test/src/test/java/org/ajax4jsf/ajax/repeat/DataAdaptorTestCase.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -1,390 +0,0 @@
-/**
- * License Agreement.
- *
- * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.ajax4jsf.ajax.repeat;
-
-import java.util.ArrayList;
-
-import javax.faces.component.UIColumn;
-import javax.faces.component.UIData;
-import javax.faces.component.UIInput;
-import javax.faces.component.UIViewRoot;
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.model.DataComponentState;
-import org.ajax4jsf.model.ExtendedDataModel;
-import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
-import org.ajax4jsf.tests.MockComponentState;
-import org.ajax4jsf.tests.MockDataAdaptor;
-import org.ajax4jsf.tests.MockDataModel;
-import org.ajax4jsf.tests.MockUIInputRenderer;
-
-/**
- * @author shura
- *
- */
-public class DataAdaptorTestCase extends AbstractAjax4JsfTestCase {
-
- private UIDataAdaptor adaptor;
-
- private UIInput child;
-
- private int childInvoked;
-
- private UIInput facetChild;
-
- private int facetInvoked;
-
- private UIInput childChild;
-
- private int childChildInvoked;
-
- private UIInput childChildFacet;
-
- private int childChildFacetInvoked;
-
- UIData data;
- /**
- * @param name
- */
- public DataAdaptorTestCase(String name) {
- super(name);
- }
-
- /* (non-Javadoc)
- * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#setUp()
- */
- public void setUp() throws Exception {
- super.setUp();
- // Create mock DataAdaptor and childs.
- adaptor = new MockDataAdaptor();
- child = new UIInput(){
- public void processDecodes(FacesContext context) {
- childInvoked++;
- super.processDecodes(context);
- }
- };
- childInvoked = 0;
- child.setId("child");
- adaptor.getChildren().add(child);
- facetChild = new UIInput(){
- public void processDecodes(FacesContext context) {
- facetInvoked++;
- super.processDecodes(context);
- }
- };
- facetInvoked = 0;
- facetChild.setId("facetChild");
- adaptor.getFacets().put("facet", facetChild);
- childChild = new UIInput(){
- public void processDecodes(FacesContext context) {
- childChildInvoked++;
- super.processDecodes(context);
- }
- };;
- childChildInvoked = 0;
- childChild.setId("childChild");
- child.getChildren().add(childChild);
- childChildFacet = new UIInput(){
- public void processDecodes(FacesContext context) {
- childChildFacetInvoked++;
- super.processDecodes(context);
- }
- };;
- childChildFacetInvoked = 0;
- childChildFacet.setId("childChildFacet");
- childChild.getFacets().put("facet", childChildFacet);
- data = new UIData();
- renderKit.addRenderer(child.getFamily(), child.getRendererType(), new MockUIInputRenderer());
- renderKit.addRenderer(adaptor.getFamily(), adaptor.getRendererType(), new MockUIInputRenderer());
- }
-
- /* (non-Javadoc)
- * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#tearDown()
- */
- public void tearDown() throws Exception {
- super.tearDown();
- adaptor = null;
- child = null;
- childChild = null;
- childChildFacet = null;
- facetChild = null;
- }
-
- private void createTree(){
- facesContext.getViewRoot().getChildren().add(adaptor);
- adaptor.setId("adaptor");
- }
-
- private void createDataTree(){
- data.setId("data");
- adaptor.setId("adaptor");
- ArrayList value = new ArrayList(2);
- value.add("first");
- value.add("second");
- data.setValue(value);
- data.setVar("var");
- UIColumn column = new UIColumn();
- data.getChildren().add(column);
- column.getChildren().add(adaptor);
- facesContext.getViewRoot().getChildren().add(data);
- }
-
- /**
- * Test method for {@link org.ajax4jsf.ajax.repeat.UIDataAdaptor#isRowAvailable()}.
- */
- public void testIsRowAvailable() {
- adaptor.setRowKey(new Integer(0));
- assertTrue(adaptor.isRowAvailable());
- adaptor.setRowKey(new Integer(MockDataModel.ROWS-1));
- assertTrue(adaptor.isRowAvailable());
- adaptor.setRowKey(new Integer(MockDataModel.ROWS+1));
- assertFalse(adaptor.isRowAvailable());
- adaptor.setRowKey(null);
- assertFalse(adaptor.isRowAvailable());
- }
-
- /**
- * Test method for {@link org.ajax4jsf.ajax.repeat.UIDataAdaptor#getRowKey()}.
- */
- public void testGetRowKey() {
- adaptor.setRowIndex(0);
- assertEquals(new Integer(0), adaptor.getRowKey());
- adaptor.setRowIndex(-1);
- assertNull(adaptor.getRowKey());
- }
-
- /**
- * Test method for {@link org.ajax4jsf.ajax.repeat.UIDataAdaptor#setRowKey(java.lang.Object)}.
- */
- public void testSetRowKey() {
- adaptor.setRowKey(new Integer(1));
- assertEquals(1, adaptor.getRowIndex());
- adaptor.setRowKey(null);
- assertEquals(-1, adaptor.getRowIndex());
- }
-
- /**
- * Test method for {@link org.ajax4jsf.ajax.repeat.UIDataAdaptor#resetDataModel()}.
- */
- public void testResetDataModel() {
- adaptor.setRowKey(new Integer(1));
- adaptor.resetDataModel();
- assertEquals(0, adaptor.getRowIndex());
- }
-
- public void testGetBaseClientId(){
- createDataTree();
- data.setRowIndex(-1);
- assertEquals(adaptor.getBaseClientId(facesContext), "data:adaptor");
- data.setRowIndex(0);
- assertEquals(adaptor.getBaseClientId(facesContext), "data:0:adaptor");
- data.setRowIndex(1);
- assertEquals(adaptor.getBaseClientId(facesContext), "data:1:adaptor");
- adaptor.setRowIndex(1);
- assertEquals(adaptor.getBaseClientId(facesContext), "data:1:adaptor");
- }
-
-
- /**
- * Test method for {@link org.ajax4jsf.ajax.repeat.UIDataAdaptor#setExtendedDataModel(org.ajax4jsf.ajax.repeat.ExtendedDataModel)}.
- */
- public void testSetIterableDataModel() {
- createDataTree();
- data.setRowIndex(0);
- MockDataModel mockDataModel0 = new MockDataModel();
- adaptor.setExtendedDataModel(mockDataModel0);
- data.setRowIndex(1);
- MockDataModel mockDataModel1 = new MockDataModel();
- adaptor.setExtendedDataModel(mockDataModel1);
- data.setRowIndex(0);
- assertSame(mockDataModel0, adaptor.getExtendedDataModel());
- data.setRowIndex(1);
- assertSame(mockDataModel1, adaptor.getExtendedDataModel());
- }
-
- public void testSetDataModel(){
- MockDataModel mockDataModel1 = new MockDataModel();
- adaptor.setExtendedDataModel(mockDataModel1);
- assertSame(mockDataModel1, adaptor.getExtendedDataModel());
- }
-
- /**
- * Test method for {@link org.ajax4jsf.ajax.repeat.UIDataAdaptor#getExtendedDataModel()}.
- */
- public void testGetIterableDataModel() {
- ExtendedDataModel dataModel = adaptor.getExtendedDataModel();
- assertTrue(dataModel instanceof MockDataModel);
- }
-
- /**
- * Test method for {@link org.ajax4jsf.ajax.repeat.UIDataAdaptor#getComponentState()}.
- */
- public void testGetComponentState() {
- createDataTree();
- data.setRowIndex(0);
- DataComponentState state0 = adaptor.getComponentState();
- assertTrue(state0 instanceof MockComponentState);
- data.setRowIndex(1);
- DataComponentState state1 = adaptor.getComponentState();
- data.setRowIndex(0);
- assertSame(state0, adaptor.getComponentState());
- data.setRowIndex(1);
- assertSame(state1, adaptor.getComponentState());
- }
-
- /**
- * Test method for {@link org.ajax4jsf.ajax.repeat.UIDataAdaptor#createComponentState()}.
- */
- public void testCreateComponentState() {
- DataComponentState state = adaptor.createComponentState();
- assertTrue(state instanceof MockComponentState);
- }
-
- /**
- * Test method for {@link org.ajax4jsf.ajax.repeat.UIDataAdaptor#iterate(javax.faces.context.FacesContext, org.ajax4jsf.ajax.repeat.RepeaterInvoker)}.
- */
- public void testProcess() {
- createTree();
- MockComponentState mockState = (MockComponentState) adaptor.getComponentState();
- mockState.setCount(4);
- adaptor.processDecodes(facesContext);
- assertEquals(childInvoked, 4);
- assertEquals(facetInvoked, 1);
- }
-
- /**
- * Test method for {@link org.ajax4jsf.ajax.repeat.UIDataAdaptor#iterate(javax.faces.context.FacesContext, org.ajax4jsf.ajax.repeat.RepeaterInvoker)}.
- */
- public void testProcessMore() {
- createTree();
- MockComponentState mockState = (MockComponentState) adaptor.getComponentState();
- mockState.setCount(Integer.MAX_VALUE);
- adaptor.processDecodes(facesContext);
- assertEquals(childInvoked, MockDataModel.ROWS);
- assertEquals(facetInvoked, 1);
- }
-
-
- /**
- * Test method for {@link org.ajax4jsf.ajax.repeat.UIDataAdaptor#restoreState(javax.faces.context.FacesContext, java.lang.Object)}.
- * @throws IllegalAccessException
- * @throws InstantiationException
- */
- public void testRestoreStateFacesContextObject() throws Exception {
- createTree();
- MockComponentState mockState = (MockComponentState) adaptor.getComponentState();
- mockState.setCount(123);
- adaptor.encodeBegin(facesContext);
- UIViewRoot viewRoot = facesContext.getViewRoot();
- Object treeState = viewRoot.processSaveState(facesContext);
- UIViewRoot root = (UIViewRoot) viewRoot.getClass().newInstance();
- UIDataAdaptor restoredAdaptor = new MockDataAdaptor();
- root.getChildren().add(restoredAdaptor);
- root.processRestoreState(facesContext, treeState);
- mockState = (MockComponentState) restoredAdaptor.getComponentState();
- assertEquals(mockState.getCount(), 123);
- }
-
- /**
- * Test method for {@link org.ajax4jsf.ajax.repeat.UIDataAdaptor#saveState(javax.faces.context.FacesContext)}.
- */
- public void testSaveStateFacesContext() throws Exception {
- createDataTree();
- data.setRowIndex(0);
- MockComponentState mockState = (MockComponentState) adaptor.getComponentState();
- mockState.setCount(123);
- adaptor.encodeBegin(facesContext);
- data.setRowIndex(1);
- mockState = (MockComponentState) adaptor.getComponentState();
- mockState.setCount(321);
- adaptor.encodeBegin(facesContext);
- UIViewRoot viewRoot = facesContext.getViewRoot();
- Object treeState = viewRoot.processSaveState(facesContext);
- UIViewRoot root = (UIViewRoot) viewRoot.getClass().newInstance();
- UIData restoredData = new UIData();
- UIDataAdaptor restoredAdaptor = new MockDataAdaptor();
- root.getChildren().add(restoredData);
- UIColumn column = new UIColumn();
- restoredData.getChildren().add(column);
- column.getChildren().add(restoredAdaptor);
- root.processRestoreState(facesContext, treeState);
- restoredData.setRowIndex(0);
- mockState = (MockComponentState) restoredAdaptor.getComponentState();
- assertEquals(mockState.getCount(), 123);
- restoredData.setRowIndex(1);
- mockState = (MockComponentState) restoredAdaptor.getComponentState();
- assertEquals(mockState.getCount(), 321);
- }
-
- public void testSaveChildState(){
- createTree();
- child.setSubmittedValue("Submitted");
- child.setValid(true);
- child.setValue("Value");
- child.setLocalValueSet(true);
- adaptor.saveChildState(facesContext);
- child.setSubmittedValue("NonSubmitted");
- child.setValid(false);
- child.setValue(null);
- child.setLocalValueSet(false);
- adaptor.restoreChildState(facesContext);
- assertEquals(child.getSubmittedValue(), "Submitted");
- assertTrue(child.isValid());
- assertEquals(child.getValue(), "Value");
- assertTrue(child.isLocalValueSet());
- }
-
- public void testSaveChildChildState(){
- createTree();
- childChild.setSubmittedValue("Submitted");
- childChild.setValid(true);
- childChild.setValue("Value");
- childChild.setLocalValueSet(true);
- adaptor.saveChildState(facesContext);
- childChild.setSubmittedValue("NonSubmitted");
- childChild.setValid(false);
- childChild.setValue(null);
- childChild.setLocalValueSet(false);
- adaptor.restoreChildState(facesContext);
- assertEquals(childChild.getSubmittedValue(), "Submitted");
- assertTrue(childChild.isValid());
- assertEquals(childChild.getValue(), "Value");
- assertTrue(childChild.isLocalValueSet());
- }
- public void testSaveChildChildFacetState(){
- createTree();
- childChildFacet.setSubmittedValue("Submitted");
- childChildFacet.setValid(true);
- childChildFacet.setValue("Value");
- childChildFacet.setLocalValueSet(true);
- adaptor.saveChildState(facesContext);
- childChildFacet.setSubmittedValue("NonSubmitted");
- childChildFacet.setValid(false);
- childChildFacet.setValue(null);
- childChildFacet.setLocalValueSet(false);
- adaptor.restoreChildState(facesContext);
- assertEquals(childChildFacet.getSubmittedValue(), "Submitted");
- assertTrue(childChildFacet.isValid());
- assertEquals(childChildFacet.getValue(), "Value");
- assertTrue(childChildFacet.isLocalValueSet());
- }
-}
Modified: trunk/ui/core/src/main/config/component/actionParameter.xml
===================================================================
--- trunk/ui/core/src/main/config/component/actionParameter.xml 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/config/component/actionParameter.xml 2007-07-08 13:49:02 UTC (rev 1537)
@@ -7,11 +7,11 @@
<components>
<component>
- <name>org.ajax4jsf.ajax.ActionParameter</name>
+ <name>org.ajax4jsf.ActionParameter</name>
<classname>
- org.ajax4jsf.ajax.html.HtmlActionParameter
+ org.ajax4jsf.component.html.HtmlActionParameter
</classname>
- <superclass>org.ajax4jsf.ajax.UIActionParameter</superclass>
+ <superclass>org.ajax4jsf.component.UIActionParameter</superclass>
<description>
<![CDATA[
A combination of the functionality of two JSF tags, <f:actionListener> and <f:param>.
@@ -28,7 +28,7 @@
-->
<tag>
<name>actionparam</name>
- <classname>org.ajax4jsf.taglib.ajax.ActionParam</classname>
+ <classname>org.ajax4jsf.taglib.html.jsp.ActionParam</classname>
<superclass>
org.ajax4jsf.taglib.html.jsp.ActionParamTag
</superclass>
Modified: trunk/ui/core/src/main/config/component/commandButton.xml
===================================================================
--- trunk/ui/core/src/main/config/component/commandButton.xml 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/config/component/commandButton.xml 2007-07-08 13:49:02 UTC (rev 1537)
@@ -7,12 +7,12 @@
<components>
<component>
- <name>org.ajax4jsf.ajax.CommandButton</name>
+ <name>org.ajax4jsf.CommandButton</name>
<family>javax.faces.Command</family>
<classname>
- org.ajax4jsf.ajax.html.HtmlAjaxCommandButton
+ org.ajax4jsf.component.html.HtmlAjaxCommandButton
</classname>
- <superclass>org.ajax4jsf.ajax.UIAjaxCommandButton</superclass>
+ <superclass>org.ajax4jsf.component.UIAjaxCommandButton</superclass>
<description><![CDATA[
Renders an HTML "input" element.
<br />
@@ -55,7 +55,7 @@
<tag>
<name>commandButton</name>
<classname>
- org.ajax4jsf.taglib.ajax.AjaxCommandButton
+ org.ajax4jsf.taglib.html.jsp.AjaxCommandButton
</classname>
<superclass>
org.ajax4jsf.framework.taglib.UIComponentTagBase
Modified: trunk/ui/core/src/main/config/component/commandLink.xml
===================================================================
--- trunk/ui/core/src/main/config/component/commandLink.xml 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/config/component/commandLink.xml 2007-07-08 13:49:02 UTC (rev 1537)
@@ -7,12 +7,12 @@
<components>
<component>
- <name>org.ajax4jsf.ajax.CommandLink</name>
+ <name>org.ajax4jsf.CommandLink</name>
<family>javax.faces.Command</family>
<classname>
- org.ajax4jsf.ajax.html.HtmlAjaxCommandLink
+ org.ajax4jsf.component.html.HtmlAjaxCommandLink
</classname>
- <superclass>org.ajax4jsf.ajax.UIAjaxCommandLink</superclass>
+ <superclass>org.ajax4jsf.component.UIAjaxCommandLink</superclass>
<description><![CDATA[
Renders an HTML "a" anchor element that acts like a form
submit button when clicked.
@@ -54,7 +54,7 @@
<tag>
<name>commandLink</name>
<classname>
- org.ajax4jsf.taglib.ajax.AjaxCommandLink
+ org.ajax4jsf.taglib.html.jsp.AjaxCommandLink
</classname>
<superclass>
org.ajax4jsf.framework.taglib.UIComponentTagBase
Modified: trunk/ui/core/src/main/config/component/form.xml
===================================================================
--- trunk/ui/core/src/main/config/component/form.xml 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/config/component/form.xml 2007-07-08 13:49:02 UTC (rev 1537)
@@ -9,8 +9,8 @@
<component generate="true">
<name>org.ajax4jsf.Form</name>
<family>javax.faces.Form</family>
- <classname>org.ajax4jsf.ajax.html.AjaxForm</classname>
- <superclass>org.ajax4jsf.ajax.UIAjaxForm</superclass>
+ <classname>org.ajax4jsf.component.html.AjaxForm</classname>
+ <superclass>org.ajax4jsf.component.UIAjaxForm</superclass>
<description>
<![CDATA[
Ajax-related version of html form. Main difference with original component - all hidden fields,
@@ -25,7 +25,7 @@
</renderer>
<tag>
<name>form</name>
- <classname>org.ajax4jsf.taglib.ajax.FormTag</classname>
+ <classname>org.ajax4jsf.taglib.html.jsp.FormTag</classname>
<superclass>
org.ajax4jsf.framework.taglib.UIComponentTagBase
</superclass>
@@ -86,7 +86,7 @@
<tag>
<name>htmlCommandLink</name>
<classname>
- org.ajax4jsf.taglib.ajax.HtmlCommandLinkTag
+ org.ajax4jsf.taglib.html.jsp.HtmlCommandLinkTag
</classname>
<superclass>
org.ajax4jsf.framework.taglib.UIComponentTagBase
Modified: trunk/ui/core/src/main/config/component/function.xml
===================================================================
--- trunk/ui/core/src/main/config/component/function.xml 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/config/component/function.xml 2007-07-08 13:49:02 UTC (rev 1537)
@@ -7,10 +7,10 @@
<components>
<component>
- <name>org.ajax4jsf.ajax.Function</name>
+ <name>org.ajax4jsf.Function</name>
<family>org.ajax4jsf.components.AjaxFunction</family>
- <classname>org.ajax4jsf.ajax.html.HtmlAjaxFunction</classname>
- <superclass>org.ajax4jsf.ajax.UIAjaxFunction</superclass>
+ <classname>org.ajax4jsf.component.html.HtmlAjaxFunction</classname>
+ <superclass>org.ajax4jsf.component.UIAjaxFunction</superclass>
<description>
</description>
<displayname>Ajax JavaScript Function</displayname>
@@ -33,7 +33,7 @@
</renderer>
<tag>
<name>jsFunction</name>
- <classname>org.ajax4jsf.taglib.ajax.AjaxFunction</classname>
+ <classname>org.ajax4jsf.taglib.html.jsp.AjaxFunction</classname>
<superclass>
org.ajax4jsf.framework.taglib.UIComponentTagBase
</superclass>
Modified: trunk/ui/core/src/main/config/component/include.xml
===================================================================
--- trunk/ui/core/src/main/config/component/include.xml 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/config/component/include.xml 2007-07-08 13:49:02 UTC (rev 1537)
@@ -9,8 +9,8 @@
<component>
<name>org.ajax4jsf.Include</name>
<family>javax.faces.Output</family>
- <classname>org.ajax4jsf.ajax.html.Include</classname>
- <superclass>org.ajax4jsf.ajax.UIInclude</superclass>
+ <classname>org.ajax4jsf.component.html.Include</classname>
+ <superclass>org.ajax4jsf.component.UIInclude</superclass>
<description>
<![CDATA[
include content of external view. Navigation cases in included file change only viewId of included page,
@@ -26,7 +26,7 @@
<tag bodyContent="JSP">
<name>include</name>
<classname>
- org.ajax4jsf.taglib.ajax.HtmlIncludeTag
+ org.ajax4jsf.taglib.html.jsp.HtmlIncludeTag
</classname>
<superclass>org.ajax4jsf.taglib.html.jsp.IncludeTag</superclass>
<displayname>include content of external view</displayname>
Modified: trunk/ui/core/src/main/config/component/loadBundle.xml
===================================================================
--- trunk/ui/core/src/main/config/component/loadBundle.xml 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/config/component/loadBundle.xml 2007-07-08 13:49:02 UTC (rev 1537)
@@ -7,10 +7,10 @@
<components>
<component>
- <name>org.ajax4jsf.ajax.Bundle</name>
+ <name>org.ajax4jsf.Bundle</name>
<family>org.ajax4jsf.Bundle</family>
- <classname>org.ajax4jsf.ajax.html.AjaxLoadBundle</classname>
- <superclass>org.ajax4jsf.ajax.UILoadBundle</superclass>
+ <classname>org.ajax4jsf.component.html.AjaxLoadBundle</classname>
+ <superclass>org.ajax4jsf.component.UILoadBundle</superclass>
<description>
<![CDATA[ Load a resource bundle localized for the Locale of the current view, and expose it (as a Map)
in the request attributes of the current request.
@@ -18,7 +18,7 @@
</description>
<tag>
<name>loadBundle</name>
- <classname>org.ajax4jsf.taglib.ajax.LoadBundle</classname>
+ <classname>org.ajax4jsf.taglib.html.jsp.LoadBundle</classname>
<superclass>
org.ajax4jsf.framework.taglib.UIComponentTagBase
</superclass>
Modified: trunk/ui/core/src/main/config/component/loadScript.xml
===================================================================
--- trunk/ui/core/src/main/config/component/loadScript.xml 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/config/component/loadScript.xml 2007-07-08 13:49:02 UTC (rev 1537)
@@ -4,8 +4,8 @@
<component>
<name>org.ajax4jsf.LoadScript</name>
<family>org.ajax4jsf.LoadScript</family>
- <classname>org.ajax4jsf.ajax.html.HtmlLoadScript</classname>
- <superclass>org.ajax4jsf.ajax.UIResource</superclass>
+ <classname>org.ajax4jsf.component.html.HtmlLoadScript</classname>
+ <superclass>org.ajax4jsf.component.UIResource</superclass>
<description>
<![CDATA[
]]>
@@ -16,7 +16,7 @@
</renderer>
<tag>
<name>loadScript</name>
- <classname>org.ajax4jsf.taglib.ajax.LoadScriptTag</classname>
+ <classname>org.ajax4jsf.taglib.html.jsp.LoadScriptTag</classname>
<superclass>
org.ajax4jsf.framework.taglib.HtmlComponentTagBase
</superclass>
Modified: trunk/ui/core/src/main/config/component/loadStyle.xml
===================================================================
--- trunk/ui/core/src/main/config/component/loadStyle.xml 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/config/component/loadStyle.xml 2007-07-08 13:49:02 UTC (rev 1537)
@@ -4,8 +4,8 @@
<component>
<name>org.ajax4jsf.LoadStyle</name>
<family>org.ajax4jsf.LoadStyle</family>
- <classname>org.ajax4jsf.ajax.html.HtmlLoadStyle</classname>
- <superclass>org.ajax4jsf.ajax.UIResource</superclass>
+ <classname>org.ajax4jsf.component.html.HtmlLoadStyle</classname>
+ <superclass>org.ajax4jsf.component.UIResource</superclass>
<description>
<![CDATA[
]]>
@@ -16,7 +16,7 @@
</renderer>
<tag>
<name>loadStyle</name>
- <classname>org.ajax4jsf.taglib.ajax.LoadStyleTag</classname>
+ <classname>org.ajax4jsf.taglib.html.jsp.LoadStyleTag</classname>
<superclass>
org.ajax4jsf.framework.taglib.HtmlComponentTagBase
</superclass>
Modified: trunk/ui/core/src/main/config/component/log.xml
===================================================================
--- trunk/ui/core/src/main/config/component/log.xml 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/config/component/log.xml 2007-07-08 13:49:02 UTC (rev 1537)
@@ -9,8 +9,8 @@
<component>
<name>org.ajax4jsf.Log</name>
<family>org.ajax4jsf.Log</family>
- <classname>org.ajax4jsf.ajax.html.AjaxLog</classname>
- <superclass>org.ajax4jsf.ajax.UIAjaxLog</superclass>
+ <classname>org.ajax4jsf.component.html.AjaxLog</classname>
+ <superclass>org.ajax4jsf.component.UIAjaxLog</superclass>
<description>
<![CDATA[
Encode javaScript to open popup window with client-side Log information.
@@ -22,7 +22,7 @@
</renderer>
<tag>
<name>log</name>
- <classname>org.ajax4jsf.taglib.ajax.LogTag</classname>
+ <classname>org.ajax4jsf.taglib.html.jsp.LogTag</classname>
<superclass>
org.ajax4jsf.framework.taglib.UIComponentTagBase
</superclass>
Modified: trunk/ui/core/src/main/config/component/mediaOutput.xml
===================================================================
--- trunk/ui/core/src/main/config/component/mediaOutput.xml 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/config/component/mediaOutput.xml 2007-07-08 13:49:02 UTC (rev 1537)
@@ -9,9 +9,9 @@
<component>
<name>org.ajax4jsf.MediaOutput</name>
<family>org.ajax4jsf.Resource</family>
- <classname>org.ajax4jsf.ajax.html.MediaOutput</classname>
+ <classname>org.ajax4jsf.component.html.MediaOutput</classname>
<superclass>
- org.ajax4jsf.ajax.resource.UIMediaOutput
+ org.ajax4jsf.component.UIMediaOutput
</superclass>
<description>
<![CDATA[Class for create any link-type elements to user-generated resources :
@@ -29,7 +29,7 @@
<tag>
<name>mediaOutput</name>
<classname>
- org.ajax4jsf.taglib.ajax.MediaOutputTag
+ org.ajax4jsf.taglib.html.jsp.MediaOutputTag
</classname>
<superclass>
org.ajax4jsf.framework.taglib.UIComponentTagBase
Modified: trunk/ui/core/src/main/config/component/outputPanel.xml
===================================================================
--- trunk/ui/core/src/main/config/component/outputPanel.xml 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/config/component/outputPanel.xml 2007-07-08 13:49:02 UTC (rev 1537)
@@ -7,12 +7,12 @@
<components>
<component>
- <name>org.ajax4jsf.ajax.OutputPanel</name>
+ <name>org.ajax4jsf.OutputPanel</name>
<family>javax.faces.Panel</family>
<classname>
- org.ajax4jsf.ajax.html.HtmlAjaxOutputPanel
+ org.ajax4jsf.component.html.HtmlAjaxOutputPanel
</classname>
- <superclass>org.ajax4jsf.ajax.UIAjaxOutputPanel</superclass>
+ <superclass>org.ajax4jsf.component.UIAjaxOutputPanel</superclass>
<description>
<![CDATA[
Creates an AJAX-enabled part of the page. For a normal request,
@@ -43,7 +43,7 @@
<tag>
<name>outputPanel</name>
<classname>
- org.ajax4jsf.taglib.ajax.AjaxOutputPanel
+ org.ajax4jsf.taglib.html.jsp.AjaxOutputPanel
</classname>
<superclass>
org.ajax4jsf.framework.taglib.UIComponentTagBase
Modified: trunk/ui/core/src/main/config/component/page.xml
===================================================================
--- trunk/ui/core/src/main/config/component/page.xml 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/config/component/page.xml 2007-07-08 13:49:02 UTC (rev 1537)
@@ -9,8 +9,8 @@
<component>
<name>org.ajax4jsf.components.Page</name>
<family>org.ajax4jsf.components.AjaxRegion</family>
- <classname>org.ajax4jsf.ajax.html.HtmlPage</classname>
- <superclass>org.ajax4jsf.ajax.UIAjaxRegion</superclass>
+ <classname>org.ajax4jsf.component.html.HtmlPage</classname>
+ <superclass>org.ajax4jsf.component.UIAjaxRegion</superclass>
<description>
This component renders a full HTML page structure. It must
be the first (and only) child for the view root (JSP
@@ -52,7 +52,7 @@
</renderer>
<tag>
<name>page</name>
- <classname>org.ajax4jsf.taglib.ajax.AjaxPage</classname>
+ <classname>org.ajax4jsf.taglib.html.jsp.AjaxPage</classname>
<superclass>
org.ajax4jsf.framework.taglib.HtmlComponentTagBase
</superclass>
Modified: trunk/ui/core/src/main/config/component/poll.xml
===================================================================
--- trunk/ui/core/src/main/config/component/poll.xml 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/config/component/poll.xml 2007-07-08 13:49:02 UTC (rev 1537)
@@ -7,10 +7,10 @@
<components>
<component>
- <name>org.ajax4jsf.ajax.Poll</name>
+ <name>org.ajax4jsf.Poll</name>
<family>org.ajax4jsf.components.AjaxPoll</family>
- <classname>org.ajax4jsf.ajax.html.AjaxPoll</classname>
- <superclass>org.ajax4jsf.ajax.UIPoll</superclass>
+ <classname>org.ajax4jsf.component.html.AjaxPoll</classname>
+ <superclass>org.ajax4jsf.component.UIPoll</superclass>
<description>
Periodically perform AJAX request to server, to simulate
'poll' data.
@@ -35,7 +35,7 @@
</renderer>
<tag>
<name>poll</name>
- <classname>org.ajax4jsf.taglib.ajax.AjaxPollTag</classname>
+ <classname>org.ajax4jsf.taglib.html.jsp.AjaxPollTag</classname>
<superclass>
org.ajax4jsf.framework.taglib.UIComponentTagBase
</superclass>
Modified: trunk/ui/core/src/main/config/component/portlet.xml
===================================================================
--- trunk/ui/core/src/main/config/component/portlet.xml 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/config/component/portlet.xml 2007-07-08 13:49:02 UTC (rev 1537)
@@ -9,16 +9,16 @@
<component>
<name>org.ajax4jsf.Portlet</name>
<classname>
- org.ajax4jsf.ajax.html.HtmlPortlet
+ org.ajax4jsf.component.html.HtmlPortlet
</classname>
- <superclass>org.ajax4jsf.ajax.UIPortlet</superclass>
+ <superclass>org.ajax4jsf.component.UIPortlet</superclass>
<description>
<![CDATA[
]]>
</description>
<tag>
<name>portlet</name>
- <classname>org.ajax4jsf.taglib.ajax.Portlet</classname>
+ <classname>org.ajax4jsf.taglib.html.jsp.Portlet</classname>
<superclass>
org.ajax4jsf.framework.taglib.HtmlComponentTagBase
</superclass>
Modified: trunk/ui/core/src/main/config/component/push.xml
===================================================================
--- trunk/ui/core/src/main/config/component/push.xml 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/config/component/push.xml 2007-07-08 13:49:02 UTC (rev 1537)
@@ -7,10 +7,10 @@
<components>
<component>
- <name>org.ajax4jsf.ajax.Push</name>
+ <name>org.ajax4jsf.Push</name>
<family>org.ajax4jsf.components.AjaxPush</family>
- <classname>org.ajax4jsf.ajax.html.AjaxPush</classname>
- <superclass>org.ajax4jsf.ajax.UIPush</superclass>
+ <classname>org.ajax4jsf.component.html.AjaxPush</classname>
+ <superclass>org.ajax4jsf.component.UIPush</superclass>
<description>
Periodically perform AJAX request to server, to simulate
'push' data.
@@ -35,7 +35,7 @@
</renderer>
<tag>
<name>push</name>
- <classname>org.ajax4jsf.taglib.ajax.AjaxPushTag</classname>
+ <classname>org.ajax4jsf.taglib.html.jsp.AjaxPushTag</classname>
<superclass>
org.ajax4jsf.framework.taglib.UIComponentTagBase
</superclass>
Modified: trunk/ui/core/src/main/config/component/region.xml
===================================================================
--- trunk/ui/core/src/main/config/component/region.xml 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/config/component/region.xml 2007-07-08 13:49:02 UTC (rev 1537)
@@ -7,10 +7,10 @@
<components>
<component>
- <name>org.ajax4jsf.ajax.AjaxRegion</name>
- <family>org.ajax4jsf.components.AjaxRegion</family>
- <classname>org.ajax4jsf.ajax.html.HtmlAjaxRegion</classname>
- <superclass>org.ajax4jsf.ajax.UIAjaxRegion</superclass>
+ <name>org.ajax4jsf.AjaxRegion</name>
+ <family>org.ajax4jsf.AjaxRegion</family>
+ <classname>org.ajax4jsf.component.html.HtmlAjaxRegion</classname>
+ <superclass>org.ajax4jsf.component.UIAjaxRegion</superclass>
<description>
<![CDATA[Root view for ajax areas on the page. It must either be a
nested tag inside the <body> tag inside of the
@@ -52,7 +52,7 @@
</renderer>
<tag>
<name>region</name>
- <classname>org.ajax4jsf.taglib.ajax.AjaxRegion</classname>
+ <classname>org.ajax4jsf.taglib.html.jsp.AjaxRegion</classname>
<superclass>
org.ajax4jsf.framework.taglib.HtmlComponentTagBase
</superclass>
Modified: trunk/ui/core/src/main/config/component/repeat.xml
===================================================================
--- trunk/ui/core/src/main/config/component/repeat.xml 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/config/component/repeat.xml 2007-07-08 13:49:02 UTC (rev 1537)
@@ -7,10 +7,10 @@
<components>
<component>
- <name>org.ajax4jsf.ajax.Repeat</name>
+ <name>org.ajax4jsf.Repeat</name>
<family>javax.faces.Data</family>
- <classname>org.ajax4jsf.ajax.html.HtmlAjaxRepeat</classname>
- <superclass>org.ajax4jsf.ajax.repeat.UIRepeat</superclass>
+ <classname>org.ajax4jsf.component.html.HtmlAjaxRepeat</classname>
+ <superclass>org.ajax4jsf.component.UIRepeat</superclass>
<description>
<![CDATA[
]]>
@@ -33,7 +33,7 @@
</renderer>
<tag>
<name>repeat</name>
- <classname>org.ajax4jsf.taglib.ajax.AjaxRepeat</classname>
+ <classname>org.ajax4jsf.taglib.html.jsp.AjaxRepeat</classname>
<superclass>
org.ajax4jsf.framework.taglib.UIComponentTagBase
</superclass>
Modified: trunk/ui/core/src/main/config/component/status.xml
===================================================================
--- trunk/ui/core/src/main/config/component/status.xml 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/config/component/status.xml 2007-07-08 13:49:02 UTC (rev 1537)
@@ -7,10 +7,10 @@
<components>
<component>
- <name>org.ajax4jsf.ajax.Status</name>
+ <name>org.ajax4jsf.Status</name>
<family>javax.faces.Panel</family>
- <classname>org.ajax4jsf.ajax.html.HtmlAjaxStatus</classname>
- <superclass>org.ajax4jsf.ajax.UIAjaxStatus</superclass>
+ <classname>org.ajax4jsf.component.html.HtmlAjaxStatus</classname>
+ <superclass>org.ajax4jsf.component.UIAjaxStatus</superclass>
<description><![CDATA[
Renders area for indicating Ajax request status on the
client-side.
@@ -71,7 +71,7 @@
</renderer>
<tag>
<name>status</name>
- <classname>org.ajax4jsf.taglib.ajax.AjaxStatus</classname>
+ <classname>org.ajax4jsf.taglib.html.jsp.AjaxStatus</classname>
<superclass>
org.ajax4jsf.framework.taglib.UIComponentTagBase
</superclass>
Modified: trunk/ui/core/src/main/config/component/support.xml
===================================================================
--- trunk/ui/core/src/main/config/component/support.xml 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/config/component/support.xml 2007-07-08 13:49:02 UTC (rev 1537)
@@ -7,10 +7,10 @@
<components>
<component>
- <name>org.ajax4jsf.ajax.Support</name>
- <family>org.ajax4jsf.components.AjaxSupport</family>
- <classname>org.ajax4jsf.ajax.html.HtmlAjaxSupport</classname>
- <superclass>org.ajax4jsf.ajax.UIAjaxSupport</superclass>
+ <name>org.ajax4jsf.Support</name>
+ <family>org.ajax4jsf.AjaxSupport</family>
+ <classname>org.ajax4jsf.component.html.HtmlAjaxSupport</classname>
+ <superclass>org.ajax4jsf.component.UIAjaxSupport</superclass>
<description>
Adds the AJAX functionality for those UIComponent-based
componenent that have properties for JavaScript events.
@@ -58,7 +58,7 @@
</renderer>
<tag>
<name>support</name>
- <classname>org.ajax4jsf.taglib.ajax.AjaxSupport</classname>
+ <classname>org.ajax4jsf.taglib.html.jsp.AjaxSupport</classname>
<superclass>
org.ajax4jsf.taglib.html.jsp.AjaxSupportTag
</superclass>
Deleted: trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIActionParameter.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIActionParameter.java 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIActionParameter.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -1,237 +0,0 @@
-/**
- * License Agreement.
- *
- * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.ajax4jsf.ajax;
-
-import javax.faces.FacesException;
-import javax.faces.component.UIComponentBase;
-import javax.faces.component.UIParameter;
-import javax.faces.context.FacesContext;
-import javax.faces.convert.Converter;
-import javax.faces.el.ValueBinding;
-import javax.faces.event.AbortProcessingException;
-import javax.faces.event.ActionEvent;
-import javax.faces.event.ActionListener;
-
-import org.ajax4jsf.Messages;
-import org.ajax4jsf.framework.ajax.JavaScriptParameter;
-
-/**
- * @author shura (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.2 $ $Date: 2007/02/01 15:31:55 $
- *
- */
-public class UIActionParameter extends UIParameter implements ActionListener,
- JavaScriptParameter {
-
- public static final String COMPONENT_TYPE = "org.ajax4jsf.components.UIActionParameter";
-
- /***************************************************************************
- * Binding for update on ActionEvent
- */
- private ValueBinding _assignToBinding = null;
-
- public void setAssignToBinding(ValueBinding propertyBinding) {
- this._assignToBinding = propertyBinding;
- }
-
- public ValueBinding getAssignToBinding() {
- return _assignToBinding;
- }
-
- /** ********************************************************* */
-
- /***************************************************************************
- * Converter for update value with this parameter
- */
- private Converter _converter = null;
-
- public void setConverter(Converter converter) {
- this._converter = converter;
- }
-
- public Converter getConverter() {
- return _converter;
- }
-
- /** ********************************************************* */
-
- /***************************************************************************
- * Skip quota escaping of parameter value - for substitute JavaScript
- * exspression on submit
- */
- private Boolean _noEscape = null;
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.framework.ajax.JavaScriptParameter#setNoEscape(boolean)
- */
- public void setNoEscape(boolean noEscape) {
- this._noEscape = Boolean.valueOf(noEscape);
- }
-
- private static String NO_ESCAPE_ATTR = "noEscape";
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.framework.ajax.JavaScriptParameter#isNoEscape()
- */
- public boolean isNoEscape() {
- return isValueOrBinding(_noEscape, NO_ESCAPE_ATTR);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.component.UIParameter#getName()
- */
- public String getName() {
- String name = super.getName();
- // If name not set - use clientId. be Careful !
- if (null == name) {
- name = getClientId(FacesContext.getCurrentInstance());
- }
- return name;
- }
-
- public Object getValue() {
- Object value = super.getValue();
- // TODO - perform conversion if converter is present.
- if (null != value) {
- Class type = value.getClass();
- FacesContext context = getFacesContext();
- Converter converter = createConverter(context, type);
- if (null != converter) {
- value = converter.getAsString(context, this, value);
-
- }
-
- }
- return value;
- }
-
- /** ********************************************************* */
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.event.ActionListener#processAction(javax.faces.event.ActionEvent)
- */
- public void processAction(ActionEvent actionEvent)
- throws AbortProcessingException {
- FacesContext context = FacesContext.getCurrentInstance();
- ValueBinding updateBinding = getAssignToBinding();
- if (updateBinding != null && (!updateBinding.isReadOnly(context))) {
- Object requestValue = context.getExternalContext()
- .getRequestParameterMap().get(getName());
- if (requestValue != null && requestValue instanceof String) {
- Class type = updateBinding.getType(context);
- Converter converter = createConverter(context, type);
- if (null != converter) {
- requestValue = converter.getAsObject(context, this,
- (String) requestValue);
-
- }
- }
- if (null != requestValue) {
- updateBinding.setValue(context, requestValue);
-
- }
- }
- }
-
- /**
- * @param context
- * @param type
- * @return
- * @throws FacesException
- */
- private Converter createConverter(FacesContext context, Class type)
- throws FacesException {
- Converter converter = getConverter();
- if (converter == null && type != null && !type.equals(String.class)
- && !type.equals(Object.class)) {
- try {
- converter = context.getApplication().createConverter(type);
- } catch (Exception e) {
- throw new FacesException(Messages.getMessage(
- Messages.NO_CONVERTER_REGISTERED, type.getName()), e);
- }
- }
- return converter;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.component.UIComponentBase#restoreState(javax.faces.context.FacesContext)
- */
- public void restoreState(FacesContext context, Object state) {
- Object values[] = (Object[]) state;
- super.restoreState(context, values[0]);
- // restore fields values
- _assignToBinding = (ValueBinding) UIComponentBase.restoreAttachedState(
- context, values[1]);
- _noEscape = (Boolean) values[2];
- _converter = (Converter) UIComponentBase.restoreAttachedState(context,
- values[3]);
- ;
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.component.UIComponentBase#saveState(javax.faces.context.FacesContext)
- */
- public Object saveState(FacesContext context) {
- Object values[] = new Object[4];
- values[0] = super.saveState(context);
- // save fields values
- values[1] = UIComponentBase
- .saveAttachedState(context, _assignToBinding);
- values[2] = _noEscape;
- values[3] = UIComponentBase.saveAttachedState(context, _converter);
- return ((Object) (values));
- }
-
- /**
- * @param field -
- * value of field to get.
- * @param name -
- * name of field, to get from ValueBinding
- * @return boolean value, based on field or valuebinding.
- */
- private boolean isValueOrBinding(Boolean field, String name) {
- if (null != field) {
- return field.booleanValue();
- }
- ValueBinding vb = getValueBinding(name);
- if (null != vb) {
- return ((Boolean) vb.getValue(getFacesContext())).booleanValue();
- } else {
- return false;
- }
- }
-
-}
Deleted: trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIAjaxCommandButton.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIAjaxCommandButton.java 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIAjaxCommandButton.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -1,34 +0,0 @@
-/**
- * License Agreement.
- *
- * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.ajax4jsf.ajax;
-
-import org.ajax4jsf.component.AjaxActionComponent;
-
-/**
- * @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:58:28 $
- *
- */
-public abstract class UIAjaxCommandButton extends AjaxActionComponent {
- public static final String COMPONENT_TYPE="org.ajax4jsf.ajax.CommandButton";
-
-}
Deleted: trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIAjaxCommandLink.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIAjaxCommandLink.java 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIAjaxCommandLink.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -1,34 +0,0 @@
-/**
- * License Agreement.
- *
- * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.ajax4jsf.ajax;
-
-import org.ajax4jsf.component.AjaxActionComponent;
-
-/**
- * @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:58:26 $
- *
- */
-public abstract class UIAjaxCommandLink extends AjaxActionComponent {
-
- public static final String COMPONENT_TYPE="org.ajax4jsf.ajax.CommandLink";
-}
Deleted: trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIAjaxForm.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIAjaxForm.java 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIAjaxForm.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -1,176 +0,0 @@
-/**
- * License Agreement.
- *
- * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.ajax4jsf.ajax;
-
-import java.util.Iterator;
-
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIForm;
-import javax.faces.context.FacesContext;
-import javax.faces.event.AbortProcessingException;
-import javax.faces.event.FacesEvent;
-
-import org.ajax4jsf.component.AjaxComponent;
-import org.ajax4jsf.context.AjaxContext;
-import org.ajax4jsf.event.AjaxEvent;
-import org.ajax4jsf.event.AjaxListener;
-import org.ajax4jsf.event.AjaxSource;
-import org.ajax4jsf.framework.renderer.AjaxRendererUtils;
-
-
-/**
- * Quite different from default <code>HtmlForm</code> - process child components
- * not only for submitted form, but if submitted parent <code>AjaxContainer</code>
- * @author shura (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.3 $ $Date: 2007/02/06 16:23:22 $
- *
- */
-public abstract class UIAjaxForm extends UIForm implements AjaxComponent, AjaxSource
-{
- public static final String COMPONENT_TYPE = "org.ajax4jsf.Form";
-
- /* (non-Javadoc)
- * @see javax.faces.component.UIComponent#processDecodes(javax.faces.context.FacesContext)
- */
- public void processDecodes(javax.faces.context.FacesContext context)
- {
- if (context == null) {
- throw new NullPointerException("context");
- }
- decode(context);
- if (mustProcessed(context))
- {
- for (Iterator it = getFacetsAndChildren(); it.hasNext();)
- {
- UIComponent childOrFacet = (UIComponent) it.next();
- childOrFacet.processDecodes(context);
- }
- }
- }
-
-
- /* (non-Javadoc)
- * @see javax.faces.component.UIComponent#processValidators(javax.faces.context.FacesContext)
- */
- public void processValidators(javax.faces.context.FacesContext context)
- {
- if (context == null) throw new NullPointerException("context");
- if (mustProcessed(context))
- {
- for (Iterator it = getFacetsAndChildren(); it.hasNext();)
- {
- UIComponent childOrFacet = (UIComponent) it.next();
- childOrFacet.processValidators(context);
- }
- }
- }
-
-
-
- /* (non-Javadoc)
- * @see javax.faces.component.UIComponent#processUpdates(javax.faces.context.FacesContext)
- */
- public void processUpdates(javax.faces.context.FacesContext context)
- {
- if (context == null) throw new NullPointerException("context");
- if (mustProcessed(context))
- {
- for (Iterator it = getFacetsAndChildren(); it.hasNext();)
- {
- UIComponent childOrFacet = (UIComponent) it.next();
- childOrFacet.processUpdates(context);
- }
- }
- }
-
- /**
- * Test for condition processing decoders/validators/updates
- * @param context current <code>FacesContext</code>
- * @return true if submitted parent AjaxContainer or current form.
- */
- private boolean mustProcessed(FacesContext context)
- {
-// if ( !AjaxContext.getCurrentInstance(context).isAjaxRequest(context)) {
- if (!isSubmitted() ) {
- return false;
- }
-// }
- return true;
- }
-
-
- /* (non-Javadoc)
- * @see javax.faces.component.UIComponentBase#broadcast(javax.faces.event.FacesEvent)
- */
- public void broadcast(FacesEvent event) throws AbortProcessingException {
- // perform default
- super.broadcast(event);
- if (event instanceof AjaxEvent) {
- // complete re-Render fields. AjaxEvent deliver before render response.
- setupReRender();
- }
- }
-
-
- /**
- * Template methods for fill set of resions to render in subclasses.
- */
- protected void setupReRender() {
- FacesContext context = getFacesContext();
- AjaxContext.getCurrentInstance(context).addRegionsFromComponent(this);
- }
-
-
-
-
- /* (non-Javadoc)
- * @see org.ajax4jsf.framework.ajax.AjaxSource#addAjaxListener(org.ajax4jsf.framework.ajax.AjaxListener)
- */
- public void addAjaxListener(AjaxListener listener) {
- addFacesListener(listener);
- }
-
-
- /* (non-Javadoc)
- * @see org.ajax4jsf.framework.ajax.AjaxSource#getAjaxListeners()
- */
- public AjaxListener[] getAjaxListeners() {
- AjaxListener al[] = (AjaxListener [])
- getFacesListeners(AjaxListener.class);
- return (al);
-
- }
-
-
- /* (non-Javadoc)
- * @see org.ajax4jsf.framework.ajax.AjaxSource#removeAjaxListener(org.ajax4jsf.framework.ajax.AjaxListener)
- */
- public void removeAjaxListener(AjaxListener listener) {
- removeFacesListener(listener);
-
- }
-
- public abstract boolean isAjaxSubmit();
-
- public abstract void setAjaxSubmit(boolean ajax);
-
-}
Deleted: trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIAjaxFunction.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIAjaxFunction.java 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIAjaxFunction.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -1,38 +0,0 @@
-/**
- * License Agreement.
- *
- * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.ajax4jsf.ajax;
-
-import org.ajax4jsf.component.AjaxActionComponent;
-
-/**
- * @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.2 $ $Date: 2007/01/23 20:01:04 $
- *
- */
-public abstract class UIAjaxFunction extends AjaxActionComponent {
-
- public static final String COMPONENT_TYPE="org.ajax4jsf.ajax.Function";
-
- public abstract String getName();
-
- public abstract void setName(String name);
-}
Deleted: trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIAjaxLog.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIAjaxLog.java 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIAjaxLog.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -1,52 +0,0 @@
-/**
- * License Agreement.
- *
- * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.ajax4jsf.ajax;
-
-import javax.faces.component.UIComponentBase;
-
-/**
- * @author shura
- *
- */
-public abstract class UIAjaxLog extends UIComponentBase {
-
- public static final String COMPONENT_TYPE = "org.ajax4jsf.Log";
-
- public abstract String getHotkey();
-
- public abstract void setHotkey(String newvalue);
-
- public abstract String getName();
- public abstract void setName(String newvalue);
-
- public abstract String getWidth();
- public abstract void setWidth(String newvalue);
-
- public abstract String getHeight();
- public abstract void setHeight(String newvalue);
-
- public abstract String getLevel();
- public abstract void setLevel(String newvalue);
-
- public abstract boolean isPopup();
- public abstract void setPopup(boolean popup);
-}
Deleted: trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIAjaxOutputPanel.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIAjaxOutputPanel.java 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIAjaxOutputPanel.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -1,44 +0,0 @@
-/**
- * License Agreement.
- *
- * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.ajax4jsf.ajax;
-
-import javax.faces.component.UIPanel;
-
-import org.ajax4jsf.component.AjaxOutput;
-
-
-/**
- * @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:58:26 $
- *
- */
-public abstract class UIAjaxOutputPanel extends UIPanel implements AjaxOutput {
-
- public static final String COMPONENT_TYPE = "org.ajax4jsf.ajax.OutputPanel";
- /**
- * @return
- */
- public abstract String getLayout();
-
- public abstract void setLayout(String layout);
-
-}
Deleted: trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIAjaxRegion.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIAjaxRegion.java 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIAjaxRegion.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -1,250 +0,0 @@
-/**
- * License Agreement.
- *
- * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.ajax4jsf.ajax;
-
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Set;
-
-import javax.faces.FacesException;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIPanel;
-import javax.faces.component.UIViewRoot;
-import javax.faces.context.FacesContext;
-import javax.faces.el.MethodBinding;
-import javax.faces.event.AbortProcessingException;
-import javax.faces.event.FacesEvent;
-
-import org.ajax4jsf.component.AjaxContainer;
-import org.ajax4jsf.context.AjaxContext;
-import org.ajax4jsf.event.AjaxListener;
-import org.ajax4jsf.framework.ajax.AjaxContextImpl;
-import org.ajax4jsf.framework.ajax.AjaxRegionBrige;
-import org.ajax4jsf.framework.ajax.AjaxViewRoot;
-import org.ajax4jsf.framework.ajax.InvokerCallback;
-import org.ajax4jsf.framework.renderer.AjaxContainerRenderer;
-
-/**
- * @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.3 $ $Date: 2007/02/08 15:02:06 $
- *
- */
-public abstract class UIAjaxRegion extends UIPanel implements AjaxContainer {
-
- private AjaxRegionBrige brige;
-
- public static final String COMPONENT_TYPE = "org.ajax4jsf.components.AjaxRegion";
-
- /**
- *
- */
- public UIAjaxRegion() {
- brige = new AjaxRegionBrige(this);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.component.UIComponentBase#encodeBegin(javax.faces.context.FacesContext)
- */
-// public void encodeBegin(FacesContext context) throws IOException {
-// UIViewRoot root = context.getViewRoot();
-// if (root instanceof AjaxViewRoot) {
-// ((AjaxViewRoot) root).addAjaxRegion(this);
-// }
-// super.encodeBegin(context);
-// }
-
- private InvokerCallback _ajaxInvoker = new InvokerCallback() {
-
- public void invoke(FacesContext context, UIComponent component) {
- try {
- if (component instanceof AjaxContainer) {
- AjaxContainer ajax = (AjaxContainer) component;
- ajax.encodeAjax(context);
- } else {
- // Container not found, use Root for encode.
- encodeAjax(context);
- }
- } catch (IOException e) {
- throw new FacesException(e);
- }
- }
-
- public void invokeRoot(FacesContext context) {
- try {
- encodeAjax(context);
- } catch (IOException e) {
- throw new FacesException(e);
- }
- }
- };
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.component.UIComponentBase#encodeChildren(javax.faces.context.FacesContext)
- */
- public void encodeChildren(FacesContext context) throws IOException {
- // If this region is single child of ViewRoot, encode Ajax response for
- // submitted container.
- UIViewRoot viewRoot = context.getViewRoot();
- AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
- if ( (getParent() == viewRoot) &&
- (viewRoot instanceof AjaxViewRoot) &&
- ((AjaxViewRoot) viewRoot).isHavePage() &&
- (ajaxContext.isAjaxRequest())) {
- AjaxContextImpl.invokeOnRegionOrRoot((AjaxViewRoot) viewRoot, context, _ajaxInvoker);
- } else {
- super.encodeChildren(context);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.framework.ajax.AjaxViewBrige#broadcast(javax.faces.event.FacesEvent)
- */
- public void broadcast(FacesEvent event) throws AbortProcessingException {
- super.broadcast(event);
- brige.broadcast(event);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.framework.ajax.AjaxViewBrige#getAjaxListener()
- */
- public MethodBinding getAjaxListener() {
- return brige.getAjaxListener();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.framework.ajax.AjaxViewBrige#isImmediate()
- */
- public boolean isImmediate() {
- return brige.isImmediate();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.framework.ajax.AjaxViewBrige#isSubmitted()
- */
- public boolean isSubmitted() {
- return brige.isSubmitted();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.framework.ajax.AjaxViewBrige#restoreState(javax.faces.context.FacesContext,
- * java.lang.Object)
- */
- public void restoreState(FacesContext context, Object state) {
- Object[] mystate = (Object[]) state;
- super.restoreState(context, mystate[0]);
- brige.restoreState(context, mystate[1]);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.framework.ajax.AjaxViewBrige#saveState(javax.faces.context.FacesContext)
- */
- public Object saveState(FacesContext context) {
- Object[] state = new Object[2];
- state[0] = super.saveState(context);
- state[1] = brige.saveState(context);
- return state;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.framework.ajax.AjaxViewBrige#setAjaxListener(javax.faces.el.MethodBinding)
- */
- public void setAjaxListener(MethodBinding ajaxListener) {
- brige.setAjaxListener(ajaxListener);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.framework.ajax.AjaxViewBrige#setImmediate(boolean)
- */
- public void setImmediate(boolean immediate) {
- brige.setImmediate(immediate);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.framework.ajax.AjaxViewBrige#setSubmitted(boolean)
- */
- public void setSubmitted(boolean submitted) {
- brige.setSubmitted(submitted);
- }
-
- public void addAjaxListener(AjaxListener listener) {
- addFacesListener(listener);
- }
-
- public AjaxListener[] getAjaxListeners() {
- return (AjaxListener[]) getFacesListeners(AjaxListener.class);
- }
-
- public void removeAjaxListener(AjaxListener listener) {
- removeFacesListener(listener);
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.framework.ajax.AjaxViewBrige#isSelfRendered()
- */
- public boolean isSelfRendered() {
- return brige.isSelfRendered();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.framework.ajax.AjaxViewBrige#setSelfRendered(boolean)
- */
- public void setSelfRendered(boolean selfRendered) {
- brige.setSelfRendered(selfRendered);
- }
-
- public void encodeAjax(FacesContext context) throws IOException {
- String rendererType = getRendererType();
- if (rendererType != null) {
- ((AjaxContainerRenderer) getRenderer(context)).encodeAjax(context,
- this);
- }
-
- }
-
-}
Deleted: trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIAjaxStatus.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIAjaxStatus.java 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIAjaxStatus.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -1,379 +0,0 @@
-/**
- * License Agreement.
- *
- * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.ajax4jsf.ajax;
-
-import java.io.Serializable;
-
-import javax.faces.FacesException;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIComponentBase;
-import javax.faces.context.FacesContext;
-import javax.faces.el.ValueBinding;
-
-import org.ajax4jsf.Messages;
-import org.ajax4jsf.component.AjaxContainer;
-import org.ajax4jsf.framework.renderer.AjaxRendererUtils;
-
-
-/**
- *
- * Component for create request state status area.
- * can create 2 output text areas ( <span> ) with different text and styles.
- * if defined "start" or/and "stop" facets, it's use as conttent
- * for different state.
- * By default, "start" text/facet rendered with display = none style.
- * On client side, display style changed for elements on
- * start-stop request.
- * @author shura (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:58:25 $
- *
- */
-public class UIAjaxStatus extends UIComponentBase
-{
-
- private static final String COMPONENT_FAMILY = "javax.faces.Output";
- public static final String COMPONENT_TYPE = "org.ajax4jsf.components.AjaxStatus";
-
-
- /* (non-Javadoc)
- * @see javax.faces.component.UIComponent#getFamily()
- */
- public String getFamily()
- {
- return COMPONENT_FAMILY;
- }
-
- /**
- * id of form for wich status will displayed
- */
- private String _for = null;
-
- /**
- *
- * @param new value of id of form for wich status will displayed to set
- */
- public void setFor(String _for)
- {
- this._for = _for;
- }
-
- /**
- * @return value or result of valueBinding of id of form for wich status will displayed
- *
- */
- public String getFor()
- {
- return (String) getValueOrBinding(_for, "for");
- }
-
- /**
- * Text to output on start request
- */
- private String _startText = null;
-
- /**
- * setter method for property
- * @param new value of Text to output on start request to set
- */
- public void setStartText(String startText)
- {
- this._startText = startText;
- }
-
- /**
- * @return value or result of valueBinding of Text to output on start request
- */
- public String getStartText()
- {
- return (String) getValueOrBinding(_startText, "startText");
- }
-
- /**
- * Text to display on complete request
- */
- private String _stopText = null;
-
- /**
- * setter method for property
- * @param new value of Text to display on complete request to set
- */
- public void setStopText(String stopText)
- {
- this._stopText = stopText;
- }
-
- /**
- * @return value or result of valueBinding of Text to display on complete request
- */
- public String getStopText()
- {
- return (String) getValueOrBinding(_stopText, "stopText");
- }
- /**
- * Style for display on start request
- */
- private String _startStyle = null;
-
- /**
- * setter method for property
- * @param new value of Style for display on start request to set
- */
- public void setStartStyle(String startStyle)
- {
- this._startStyle = startStyle;
- }
-
- /**
- * @return value or result of valueBinding of Style for display on start request
- */
- public String getStartStyle()
- {
- return (String) getValueOrBinding(_startStyle, "startStyle");
- }
- /**
- * Style for displaying on complete
- */
- private String _stopStyle = null;
-
- /**
- * setter method for property
- * @param new value of Style for displaying on complete to set
- */
- public void setStopStyle(String stopStyle)
- {
- this._stopStyle = stopStyle;
- }
-
- /**
- * @return value or result of valueBinding of Style for displaying on complete
- */
- public String getStopStyle()
- {
- return (String) getValueOrBinding(_stopStyle, "stopStyle");
- }
- /**
- * Style class for display on request
- */
- private String _startStyleClass = null;
-
- /**
- * setter method for property
- * @param new value of Style class for display on request to set
- */
- public void setStartStyleClass(String startStyleClass)
- {
- this._startStyleClass = startStyleClass;
- }
-
- /**
- * @return value or result of valueBinding of Style class for display on request
- */
- public String getStartStyleClass()
- {
- return (String) getValueOrBinding(_startStyleClass, "startStyleClass");
- }
- /**
- * Style class for display on complete request
- */
- private String _stopStyleClass = null;
-
- /**
- * setter method for property
- * @param new value of Style class for display on complete request to set
- */
- public void setStopStyleClass(String stopStyleClass)
- {
- this._stopStyleClass = stopStyleClass;
- }
-
-
- /**
- * Force id to render in Html as is
- */
- private boolean _forceId = false;
- private boolean _forceIdSet = false;
-
- /**
- * setter method for property
- * @param new value of Force id to render in Html as is to set
- */
- public void setForceId(boolean forceId)
- {
- this._forceId = forceId;
- this._forceIdSet = true;
- }
-
- /**
- * @return value or result of valueBinding of Force id to render in Html as is
- */
- public boolean isForceId()
- {
- return isValueOrBinding(_forceId, _forceIdSet, "forceId");
- }
-
-
-
-
- private String _clientId = null;
-
- /* (non-Javadoc)
- * @see javax.faces.component.UIComponentBase#getClientId(javax.faces.context.FacesContext)
- */
- public String getClientId(FacesContext context) {
- if (null == _clientId) {
- String forValue = getFor();
- UIComponent container;
- if (null != forValue) {
- container = findComponent(forValue);
- // 'for' attribute must be pointed to real container in view tree
- if (null == container || !(container instanceof AjaxContainer)) {
- throw new FacesException(
- Messages.getMessage(Messages.FOR_TARGETS_NO_AJAX_CONTAINER, getId()));
- }
- _clientId = container.getClientId(context) + ":status";
-
- } else if (isForceId()) {
- _clientId = getRenderer(context).convertClientId(context,
- this.getId());
- } else if (null !=(container = (UIComponent) AjaxRendererUtils.findAjaxContainer(context,this))) {
- _clientId = container.getClientId(context) + ":status";
- } else {
- _clientId = super.getClientId(context);
- }
- }
- return _clientId;
- }
-
-
- /* (non-Javadoc)
- * reset clientId for calculate
- * @see javax.faces.component.UIComponentBase#setId(java.lang.String)
- */
- public void setId(String arg0) {
- super.setId(arg0);
- _clientId = null;
- }
-
- /* (non-Javadoc)
- * @see javax.faces.component.UIComponentBase#restoreState(javax.faces.context.FacesContext, java.lang.Object)
- */
- public void restoreState(FacesContext context, Object state)
- {
- State myState = (State) state;
- _for = myState._for;
- _startText = myState._startText;
- _stopText = myState._stopText;
- _startStyle = myState._startStyle;
- _stopStyle = myState._stopStyle;
- _startStyleClass = myState._startStyleClass;
- _stopStyleClass = myState._stopStyleClass;
- _forceId = myState._forceId;
- _forceIdSet = myState._forceIdSet;
- super.restoreState(context, myState.superState);
- }
-
- /* (non-Javadoc)
- * @see javax.faces.component.UIComponentBase#saveState(javax.faces.context.FacesContext)
- */
- public Object saveState(FacesContext context)
- {
- State state = new State();
- state._for = _for;
- state._startText = _startText;
- state._stopText = _stopText;
- state._startStyle = _startStyle;
- state._stopStyle = _stopStyle;
- state._startStyleClass = _startStyleClass;
- state._stopStyleClass = _stopStyleClass;
- state._forceId = _forceId;
- state._forceIdSet = _forceIdSet;
- state.superState = super.saveState(context);
- return state;
- }
-
- /**
- * @author shura (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:58:25 $
- * Memento pattern state class for save-restore component.
- */
- public static class State implements Serializable {
- /**
- *
- */
- private static final long serialVersionUID = 317266574102385358L;
- Object superState;
- String _for;
- String _startText;
- String _stopText;
- String _startStyle;
- String _stopStyle;
- String _startStyleClass;
- String _stopStyleClass;
- boolean _forceIdSet;
- boolean _forceId;
- }
-
- /**
- * @return value or result of valueBinding of Style class for display on complete request
- */
- public String getStopStyleClass()
- {
- return (String) getValueOrBinding(_stopStyleClass, "stopStyleClass");
- }
-
- /**
- * @param field - value of field to get.
- * @param name - name of field, to get from ValueBinding
- * @return field or value of binding expression.
- */
- private Object getValueOrBinding(Object field, String name){
- if( null != field){
- return field;
- }
- ValueBinding vb = getValueBinding(name);
- if (null != vb) {
- return vb.getValue(getFacesContext());
- } else {
- return null;
- }
-
- }
-
- /**
- * @param field - value of field to get.
- * @param name - name of field, to get from ValueBinding
- * @return boolean value, based on field or valuebinding.
- */
- private boolean isValueOrBinding(boolean field, boolean fieldSet, String name){
- if( fieldSet ){
- return field;
- }
- ValueBinding vb = getValueBinding(name);
- if (null != vb) {
- return ((Boolean)vb.getValue(getFacesContext())).booleanValue();
- } else {
- return false;
- }
-
- }
-
-}
Deleted: trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIAjaxSupport.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIAjaxSupport.java 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIAjaxSupport.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -1,233 +0,0 @@
-/**
- * License Agreement.
- *
- * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.ajax4jsf.ajax;
-
-import java.io.Serializable;
-
-import javax.faces.FacesException;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.el.ValueBinding;
-
-import org.ajax4jsf.Messages;
-import org.ajax4jsf.component.AjaxActionComponent;
-import org.ajax4jsf.component.AjaxSupport;
-import org.ajax4jsf.framework.ajax.EventValueBinding;
-import org.ajax4jsf.framework.renderer.AjaxRendererUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-
-/**
- * Component for append ajax functions to any control component.
- * Append action functionality to non-action control,
- * setup javascript events for parent component,
- * @author shura (latest modification by $Author: alexsmirnov $)
- * @version $Revision: 1.1.2.3 $ $Date: 2007/02/12 17:46:52 $
- *
- */
-public abstract class UIAjaxSupport extends AjaxActionComponent implements AjaxSupport
-{
-
- //~ Static fields/initializers ---------------------------------------------
-
- public static final String COMPONENT_TYPE = "org.ajax4jsf.ajax.Support";
- public static final String COMPONENT_FAMILY = "javax.faces.Command";
- public static final String DEFAULT_RENDERER_TYPE = "org.ajax4jsf.components.AjaxSupportRenderer";
- public static final String AJAX_SUPPORT_SET = "com.exadel.components.ajax.support.";
- private static final Log log = LogFactory.getLog(UIAjaxSupport.class);
-
- /**
- * Name of JavaScript function, called before submit Ajax request
- * description
- * @parameter
- * @return the acceptClass
- */
- public abstract String getOnsubmit();
-
- /**
- * @param newOnsubmit the value to set
- */
- public abstract void setOnsubmit(String newOnsubmit);
- /* (non-Javadoc)
- * @see javax.faces.component.UIComponentBase#setValueBinding(java.lang.String, javax.faces.el.ValueBinding)
- */
- public void setValueBinding(String arg0, ValueBinding arg1) {
- // var - not allowed name. must be literal.
- if("var".equals(arg0)){
- throw new FacesException(
- Messages.getMessage(Messages.VAR_MUST_BE_LITERAL, getClientId(getFacesContext())));
- }
- if("event".equals(arg0)){
- throw new FacesException(
- Messages.getMessage(Messages.EVENT_MUST_BE_LITERAL, getClientId(getFacesContext())));
- }
- super.setValueBinding(arg0, arg1);
- }
-
- /**
- * Create Special <code>ValueBinding</code> for build JavaScrept
- * event code in parent component from this.
- * @return <code>EventValueBinding</code> based on properties of current component
- */
- private ValueBinding getEventValueBinding()
- {
- if (log.isDebugEnabled())
- {
- log.debug(Messages.getMessage(Messages.CREATE_JAVASCRIPT_EVENT, getId()));
- }
- return new EventValueBinding(this);
- }
-
- /**
- * @return JavaScript eventString. Rebuild on every call, since
- * can be in loop ( as in dataTable ) with different parameters.
- */
- public String getEventString()
- {
- StringBuffer buildOnEvent = new StringBuffer();
- String onsubmit = getOnsubmit();
- // Insert script to call before submit ajax request.
- if (null != onsubmit) {
- buildOnEvent.append(onsubmit).append(";");
- }
- // Due to JSF RI 1.1 bug, clear cached clientId
- setId(getId());
- buildOnEvent.append(AjaxRendererUtils.buildOnEvent(this, getFacesContext(),
- getEvent()));
- String script = buildOnEvent.toString();
- return script;
- }
-
- /* (non-Javadoc)
- * @see javax.faces.component.UIComponentBase#decode(javax.faces.context.FacesContext)
- */
- public void decode(FacesContext context) {
- // Due to JSF RI 1.1 bug, clear cached clientId
- setId(getId());
- super.decode(context);
- }
-
- /**
- * After nornal setting <code>parent</code> property in case of
- * created component set Ajax properties for parent.
- * @see javax.faces.component.UIComponentBase#setParent(javax.faces.component.UIComponent)
- */
- public void setParent(UIComponent parent)
- {
- super.setParent(parent);
- if (null != parent && parent.getFamily() != null ) {
- if (log.isDebugEnabled()) {
- log.debug(Messages.getMessage(Messages.CALLED_SET_PARENT, parent.getClass().getName()));
- }
- // TODO If this comopnent configured, set properties for parent component.
- // NEW created component have parent, restored view - null in My faces.
- // and SUN RI not call at restore saved view.
- // In other case - set in restoreState method.
- // if (parent.getParent() != null)
- {
- if (log.isDebugEnabled()) {
- log.debug(Messages.getMessage(Messages.DETECT_NEW_COMPONENT));
- }
- setParentProperties(parent);
-
- }
- }
- }
-
- public void setParentProperties(UIComponent parent) {
- ValueBinding valueBinding;
-// Map parentAttributes = parent.getAttributes();
-/* if (parent instanceof ActionSource && null == getEvent())
- {
- log.debug("Set properties for parent as ActionSource");
- // Translate AJAX properties to parent component.
- if (_reRender != null)
- {
- parentAttributes
- .put(AjaxRendererUtils.AJAX_REGIONS_ATTRIBUTE,
- _reRender);
- }
- else if ((valueBinding = getValueBinding("reRender")) != null)
- {
- parent.setValueBinding(
- AjaxRendererUtils.AJAX_REGIONS_ATTRIBUTE,
- valueBinding);
- }
- if (_oncomplete != null)
- {
- parentAttributes
- .put(AjaxRendererUtils.ONCOMPLETE_ATTR_NAME,
- _oncomplete);
- }
- else if ((valueBinding = getValueBinding("oncomplete")) != null)
- {
- parent.setValueBinding(
- AjaxRendererUtils.ONCOMPLETE_ATTR_NAME,
- valueBinding);
- }
- if (_status != null)
- {
- parentAttributes.put(AjaxRendererUtils.STATUS_ATTR_NAME,
- _status);
- }
- else if ((valueBinding = getValueBinding("status")) != null)
- {
- parent.setValueBinding(AjaxRendererUtils.STATUS_ATTR_NAME,
- valueBinding);
- }
- if (_limitToListSet)
- {
- parentAttributes.put(
- AjaxRendererUtils.LIMITTOLIST_ATTR_NAME, Boolean
- .valueOf(_limitToList));
- }
- else if ((valueBinding = getValueBinding("limitToList")) != null)
- {
- parent.setValueBinding(
- AjaxRendererUtils.LIMITTOLIST_ATTR_NAME,
- valueBinding);
- }
- // Add Listener for all supported types.
- AjaxRegionListener listener = new AjaxRegionListener();
- ((ActionSource) parent).addActionListener(listener);
- }
- else*/ if (null != getEvent())
- {
- if (log.isDebugEnabled())
- {
- log.debug(Messages.getMessage(Messages.SET_VALUE_BINDING_FOR_EVENT, getEvent()));
- }
- // for non action/data components, or for non-default events - build listener for this instance.
- valueBinding = getEventValueBinding();
- // test for valid event attribute name.
- // TODO - test for compability with concrete element.
- parent.setValueBinding(getEvent(), valueBinding);
- }
-
- }
-
- protected UIComponent getSingleComponent() {
- return getParent();
- }
-
-}
Deleted: trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIInclude.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIInclude.java 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIInclude.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -1,304 +0,0 @@
-/**
- * License Agreement.
- *
- * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.ajax4jsf.ajax;
-
-import java.io.Serializable;
-
-import javax.faces.component.NamingContainer;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIComponentBase;
-import javax.faces.context.FacesContext;
-import javax.faces.el.ValueBinding;
-import javax.faces.event.AbortProcessingException;
-import javax.faces.event.FacesEvent;
-import javax.faces.event.FacesListener;
-import javax.faces.event.PhaseId;
-
-import org.ajax4jsf.component.AjaxOutput;
-import org.ajax4jsf.context.AjaxContext;
-import org.ajax4jsf.context.ViewIdHolder;
-
-/**
- * @author shura
- *
- */
-public abstract class UIInclude extends UIComponentBase implements
- ViewIdHolder, NamingContainer, AjaxOutput {
-
- public static final String COMPONENT_TYPE = "org.ajax4jsf.Include";
-
- public static final String LAYOUT_NONE ="none";
-
- public static final String LAYOUT_BLOCK ="block";
- public static final String LAYOUT_INLINE ="inline";
-
- private boolean wasNavigation = false;
-
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.framework.ajax.ViewIdHolder#skipNavigation(java.lang.String)
- */
- public boolean skipNavigation(String ViewId) {
- wasNavigation = true;
- return true;
- }
-
- private String _viewId = null;
-
- /*
- * viewId for included page. Setter for viewId @param viewId - new value
- */
- public void setViewId(String __viewId) {
- ValueBinding vb = getValueBinding("viewId");
- FacesContext facesContext = getFacesContext();
- if (null != vb && (!vb.isReadOnly(facesContext))) {
- // Change value of viewId in backed bean, if possible.
- vb.setValue(facesContext, __viewId);
- } else {
- this._viewId = __viewId;
- }
- }
-
- /*
- * viewId for included page. Getter for viewId @return viewId value from
- * local variable or value bindings
- */
- public String getViewId() {
- if (null != this._viewId) {
- return this._viewId;
- }
- ValueBinding vb = getValueBinding("viewId");
- if (null != vb) {
- return (String) vb.getValue(getFacesContext());
- } else {
- return null;
- }
- }
-
- private String _layout = null;
-
- /**
- * @return the layout
- */
- public String getLayout() {
- if (null != this._layout) {
- return this._layout;
- }
- ValueBinding vb = getValueBinding("layout");
- if (null != vb) {
- return (String) vb.getValue(getFacesContext());
- } else {
- return null;
- }
- }
-
- /**
- * @param layout the layout to set
- */
- public void setLayout(String layout) {
- _layout = layout;
- }
-
-
- public boolean isAjaxRendered() {
- return (!LAYOUT_NONE.equals(getLayout())) && wasNavigation;
- }
-
- public void setAjaxRendered(boolean ajaxRendered) {
- // unsupported
- }
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.component.UIComponentBase#broadcast(javax.faces.event.FacesEvent)
- */
- public void broadcast(FacesEvent event) throws AbortProcessingException {
- if (event instanceof EventWrapper) {
- FacesEvent wrapped = ((EventWrapper) event).getWrapped();
- FacesContext context = getFacesContext();
- ViewIdHolder holder = setupNavigation(context);
- wrapped.getComponent().broadcast(wrapped);
- restoreNavigation(context, holder);
- } else {
- super.broadcast(event);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.component.UIComponentBase#processDecodes(javax.faces.context.FacesContext)
- */
- public void processDecodes(FacesContext context) {
- wasNavigation = false;
- ViewIdHolder holder = setupNavigation(context);
- super.processDecodes(context);
- restoreNavigation(context, holder);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.component.UIComponentBase#processUpdates(javax.faces.context.FacesContext)
- */
- public void processUpdates(FacesContext context) {
- ViewIdHolder holder = setupNavigation(context);
- super.processUpdates(context);
- restoreNavigation(context, holder);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.component.UIComponentBase#processValidators(javax.faces.context.FacesContext)
- */
- public void processValidators(FacesContext context) {
- ViewIdHolder holder = setupNavigation(context);
- super.processValidators(context);
- restoreNavigation(context, holder);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.component.UIComponentBase#queueEvent(javax.faces.event.FacesEvent)
- */
- public void queueEvent(FacesEvent event) {
- EventWrapper wrapper = new EventWrapper(this, event);
- super.queueEvent(wrapper);
- }
-
-
- /* (non-Javadoc)
- * @see javax.faces.component.UIComponentBase#restoreState(javax.faces.context.FacesContext, java.lang.Object)
- */
- public void restoreState(FacesContext context, Object state) {
- Object[] componentState = (Object[]) state;
- super.restoreState(context, componentState[0]);
- this._viewId = (String) componentState[1];
- this._layout = (String) componentState[2];
- }
-
- /* (non-Javadoc)
- * @see javax.faces.component.UIComponentBase#saveState(javax.faces.context.FacesContext)
- */
- public Object saveState(FacesContext context) {
- Object[] componentState = new Object[3];
- componentState[0] = super.saveState(context);
- componentState[1] = _viewId;
- componentState[2] = _layout;
- return componentState;
- }
-
- /* (non-Javadoc)
- * @see javax.faces.component.UIComponent#getFamily()
- */
- public String getFamily() {
- // TODO Auto-generated method stub
- return null;
- }
-
- private ViewIdHolder setupNavigation(FacesContext context) {
- AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
- ViewIdHolder viewIdHolder = ajaxContext.getViewIdHolder();
- ajaxContext.setViewIdHolder(this);
- return viewIdHolder;
- }
-
- private void restoreNavigation(FacesContext context, ViewIdHolder viewIdHolder) {
- AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
- ajaxContext.setViewIdHolder(viewIdHolder);
-// if (wasNavigation) {
-// // Clear children to avoid have different components with same id
-// getChildren().clear();
-// }
- }
-
- private static class EventWrapper extends FacesEvent {
-
- private FacesEvent wrapped;
-
- public EventWrapper(UIComponent component, FacesEvent wrapped) {
- super(component);
- this.wrapped = wrapped;
- }
-
- /**
- * @return
- * @see javax.faces.event.FacesEvent#getPhaseId()
- */
- public PhaseId getPhaseId() {
- return wrapped.getPhaseId();
- }
-
- /**
- * @param listener
- * @return
- * @see javax.faces.event.FacesEvent#isAppropriateListener(javax.faces.event.FacesListener)
- */
- public boolean isAppropriateListener(FacesListener listener) {
- return wrapped.isAppropriateListener(listener);
- }
-
- /**
- * @param listener
- * @see javax.faces.event.FacesEvent#processListener(javax.faces.event.FacesListener)
- */
- public void processListener(FacesListener listener) {
- wrapped.processListener(listener);
- }
-
- /**
- *
- * @see javax.faces.event.FacesEvent#queue()
- */
- public void queue() {
- wrapped.queue();
- }
-
- /**
- * @param phaseId
- * @see javax.faces.event.FacesEvent#setPhaseId(javax.faces.event.PhaseId)
- */
- public void setPhaseId(PhaseId phaseId) {
- wrapped.setPhaseId(phaseId);
- }
-
- /**
- * @return the wrapped
- */
- public FacesEvent getWrapped() {
- return wrapped;
- }
- }
-
- /**
- * @return the wasNavigation
- */
- public boolean isWasNavigation() {
- return wasNavigation;
- }
-
-
-}
Deleted: trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIPoll.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIPoll.java 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIPoll.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -1,76 +0,0 @@
-/**
- * License Agreement.
- *
- * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.ajax4jsf.ajax;
-
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.component.AjaxActionComponent;
-import org.ajax4jsf.context.AjaxContext;
-
-/**
- * Component for periodically call AJAX events on server ( poll actions )
- * @author shura
- *
- */
-public abstract class UIPoll extends AjaxActionComponent {
-
- public static final String COMPONENT_TYPE="org.ajax4jsf.ajax.Poll";
-
-
- private transient boolean _submitted = false;
-
- /**
- * @return the submitted
- */
- public boolean isSubmitted() {
- return _submitted;
- }
-
-
- /**
- * @param submitted the submitted to set
- */
- public void setSubmitted(boolean submitted) {
- _submitted = submitted;
- }
-
- /**
- * @return time in mc for polling interval.
- */
- public abstract int getInterval();
-
- /**
- * @param interval time in mc for polling interval.
- */
- public abstract void setInterval(int interval);
-
- public abstract boolean isEnabled();
-
- public abstract void setEnabled(boolean enable);
-
- protected void setupReRender(FacesContext facesContext) {
- super.setupReRender(facesContext);
- AjaxContext.getCurrentInstance(facesContext).addComponentToAjaxRender(this);
- }
-
-
-}
Deleted: trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIPortlet.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIPortlet.java 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIPortlet.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -1,66 +0,0 @@
-/**
- *
- */
-package org.ajax4jsf.ajax;
-
-import java.lang.reflect.Method;
-
-import javax.faces.component.NamingContainer;
-import javax.faces.component.UIComponentBase;
-import javax.faces.context.FacesContext;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * @author asmirnov
- *
- */
-public class UIPortlet extends UIComponentBase implements NamingContainer {
-
- private static final Log _log = LogFactory.getLog(UIPortlet.class);
- /**
- * <p>The standard component type for this component.</p>
- */
- public static final String COMPONENT_TYPE = "org.ajax4jsf.Portlet";
-
-
- /**
- * <p>The standard component family for this component.</p>
- */
- public static final String COMPONENT_FAMILY = "org.ajax4jsf.Portlet";
-
- /* (non-Javadoc)
- * @see javax.faces.component.UIComponent#getFamily()
- */
- public String getFamily() {
- // TODO Auto-generated method stub
- return COMPONENT_FAMILY;
- }
-
- private String portletId = null;
-
- // ----------------------------------------------------- UIComponent Methods
- public String getClientId(FacesContext context) {
- if (portletId == null) {
- Object response = context.getExternalContext().getResponse();
- Class portletResponseClass = response.getClass();
- // Class.forName is used instead of instanceof to account for the case
- // where the porletPage tag is used in a webapp and portlet.jar is not
- // in classpath. In that scenario it will prevent ClassNotFoundException.
- try {
- Method method = portletResponseClass.getMethod("getNamespace", new Class[]{});
- portletId = (String) method.invoke(response, new Object[]{});
- } catch (Exception e) {
- if(_log.isDebugEnabled()){
- _log.debug("Response is not a portlet RenderResponse");
- }
- }
- if(null == portletId){
- return super.getClientId(context);
- }
- }
- return portletId;
- }
-
-}
Deleted: trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIPush.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIPush.java 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIPush.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -1,111 +0,0 @@
-/**
- * License Agreement.
- *
- * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.ajax4jsf.ajax;
-
-import java.io.IOException;
-
-import javax.faces.component.NamingContainer;
-import javax.faces.context.FacesContext;
-import javax.faces.el.MethodBinding;
-import javax.servlet.http.HttpSession;
-
-import org.ajax4jsf.component.AjaxActionComponent;
-import org.ajax4jsf.context.AjaxContext;
-import org.ajax4jsf.framework.ajax.xmlfilter.PollEventsManager;
-
-/**
- * Component for periodically call AJAX events on server ( poll actions )
- * @author shura
- *
- */
-public abstract class UIPush extends AjaxActionComponent {
-
- public static final String COMPONENT_TYPE="org.ajax4jsf.ajax.Push";
-
-
- private transient boolean _submitted = false;
-
- /**
- * @return the submitted
- */
- public boolean isSubmitted() {
- return _submitted;
- }
-
- public void encodeBegin(FacesContext context) throws IOException {
- MethodBinding producer = getEventProducer();
- // Subscribe events producer to push status listener.
- if(null != producer){
- producer.invoke(context, new Object[]{getListener(context)});
- }
- super.encodeBegin(context);
- }
-
- private PushEventsCounter getListener(FacesContext context){
- PollEventsManager eventsManeger = (PollEventsManager) context.getExternalContext().getApplicationMap().get(PollEventsManager.EVENTS_MANAGER_KEY);
- return eventsManeger.getListener(getListenerId(context));
- }
-
- public String getListenerId(FacesContext context){
- Object session = context.getExternalContext().getSession(false);
- StringBuffer id = new StringBuffer();
- if(null != session && session instanceof HttpSession){
- HttpSession httpSession = (HttpSession) session;
- id.append(httpSession.getId());
- }
- id.append(context.getViewRoot().getViewId());
- id.append(NamingContainer.SEPARATOR_CHAR);
- id.append(getClientId(context));
- return id.toString();
- }
- /**
- * @param submitted the submitted to set
- */
- public void setSubmitted(boolean submitted) {
- _submitted = submitted;
- }
-
- public abstract MethodBinding getEventProducer();
-
- public abstract void setEventProducer(MethodBinding producer);
- /**
- * @return time in mc for polling interval.
- */
- public abstract int getInterval();
-
- /**
- * @param interval time in mc for polling interval.
- */
- public abstract void setInterval(int interval);
-
- public abstract boolean isEnabled();
-
- public abstract void setEnabled(boolean enable);
-
- protected void setupReRender(FacesContext facesContext) {
- super.setupReRender(facesContext);
-// AjaxContext.getCurrentInstance(facesContext).addComponentToAjaxRender(this);
- //getListener(facesContext).processed();
- }
-
-
-}
Deleted: trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIResource.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIResource.java 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIResource.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -1,49 +0,0 @@
-/**
- * License Agreement.
- *
- * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.ajax4jsf.ajax;
-
-import javax.faces.component.UIComponentBase;
-
-/**
- * JSF component class
- *
- */
-public abstract class UIResource extends UIComponentBase {
-
- public static final String COMPONENT_TYPE = "org.ajax4jsf.Resource";
-
- public static final String COMPONENT_FAMILY = "org.ajax4jsf.Resource";
-
- /**
- * Get name of script to load
- * @parameter
- * @return the acceptClass
- */
- public abstract Object getSrc();
-
- /**
- * @param newSrc the value to set
- */
- public abstract void setSrc(Object newSrc);
-
-
-}
Copied: trunk/ui/core/src/main/java/org/ajax4jsf/component/UIActionParameter.java (from rev 1512, trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIActionParameter.java)
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/component/UIActionParameter.java (rev 0)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/component/UIActionParameter.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -0,0 +1,237 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.ajax4jsf.component;
+
+import javax.faces.FacesException;
+import javax.faces.component.UIComponentBase;
+import javax.faces.component.UIParameter;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.el.ValueBinding;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.ActionEvent;
+import javax.faces.event.ActionListener;
+
+import org.ajax4jsf.Messages;
+import org.ajax4jsf.framework.ajax.JavaScriptParameter;
+
+/**
+ * @author shura (latest modification by $Author: alexsmirnov $)
+ * @version $Revision: 1.1.2.2 $ $Date: 2007/02/01 15:31:55 $
+ *
+ */
+public class UIActionParameter extends UIParameter implements ActionListener,
+ JavaScriptParameter {
+
+ public static final String COMPONENT_TYPE = "org.ajax4jsf.components.UIActionParameter";
+
+ /***************************************************************************
+ * Binding for update on ActionEvent
+ */
+ private ValueBinding _assignToBinding = null;
+
+ public void setAssignToBinding(ValueBinding propertyBinding) {
+ this._assignToBinding = propertyBinding;
+ }
+
+ public ValueBinding getAssignToBinding() {
+ return _assignToBinding;
+ }
+
+ /** ********************************************************* */
+
+ /***************************************************************************
+ * Converter for update value with this parameter
+ */
+ private Converter _converter = null;
+
+ public void setConverter(Converter converter) {
+ this._converter = converter;
+ }
+
+ public Converter getConverter() {
+ return _converter;
+ }
+
+ /** ********************************************************* */
+
+ /***************************************************************************
+ * Skip quota escaping of parameter value - for substitute JavaScript
+ * exspression on submit
+ */
+ private Boolean _noEscape = null;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.framework.ajax.JavaScriptParameter#setNoEscape(boolean)
+ */
+ public void setNoEscape(boolean noEscape) {
+ this._noEscape = Boolean.valueOf(noEscape);
+ }
+
+ private static String NO_ESCAPE_ATTR = "noEscape";
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.framework.ajax.JavaScriptParameter#isNoEscape()
+ */
+ public boolean isNoEscape() {
+ return isValueOrBinding(_noEscape, NO_ESCAPE_ATTR);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.component.UIParameter#getName()
+ */
+ public String getName() {
+ String name = super.getName();
+ // If name not set - use clientId. be Careful !
+ if (null == name) {
+ name = getClientId(FacesContext.getCurrentInstance());
+ }
+ return name;
+ }
+
+ public Object getValue() {
+ Object value = super.getValue();
+ // TODO - perform conversion if converter is present.
+ if (null != value) {
+ Class type = value.getClass();
+ FacesContext context = getFacesContext();
+ Converter converter = createConverter(context, type);
+ if (null != converter) {
+ value = converter.getAsString(context, this, value);
+
+ }
+
+ }
+ return value;
+ }
+
+ /** ********************************************************* */
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.event.ActionListener#processAction(javax.faces.event.ActionEvent)
+ */
+ public void processAction(ActionEvent actionEvent)
+ throws AbortProcessingException {
+ FacesContext context = FacesContext.getCurrentInstance();
+ ValueBinding updateBinding = getAssignToBinding();
+ if (updateBinding != null && (!updateBinding.isReadOnly(context))) {
+ Object requestValue = context.getExternalContext()
+ .getRequestParameterMap().get(getName());
+ if (requestValue != null && requestValue instanceof String) {
+ Class type = updateBinding.getType(context);
+ Converter converter = createConverter(context, type);
+ if (null != converter) {
+ requestValue = converter.getAsObject(context, this,
+ (String) requestValue);
+
+ }
+ }
+ if (null != requestValue) {
+ updateBinding.setValue(context, requestValue);
+
+ }
+ }
+ }
+
+ /**
+ * @param context
+ * @param type
+ * @return
+ * @throws FacesException
+ */
+ private Converter createConverter(FacesContext context, Class type)
+ throws FacesException {
+ Converter converter = getConverter();
+ if (converter == null && type != null && !type.equals(String.class)
+ && !type.equals(Object.class)) {
+ try {
+ converter = context.getApplication().createConverter(type);
+ } catch (Exception e) {
+ throw new FacesException(Messages.getMessage(
+ Messages.NO_CONVERTER_REGISTERED, type.getName()), e);
+ }
+ }
+ return converter;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.component.UIComponentBase#restoreState(javax.faces.context.FacesContext)
+ */
+ public void restoreState(FacesContext context, Object state) {
+ Object values[] = (Object[]) state;
+ super.restoreState(context, values[0]);
+ // restore fields values
+ _assignToBinding = (ValueBinding) UIComponentBase.restoreAttachedState(
+ context, values[1]);
+ _noEscape = (Boolean) values[2];
+ _converter = (Converter) UIComponentBase.restoreAttachedState(context,
+ values[3]);
+ ;
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.component.UIComponentBase#saveState(javax.faces.context.FacesContext)
+ */
+ public Object saveState(FacesContext context) {
+ Object values[] = new Object[4];
+ values[0] = super.saveState(context);
+ // save fields values
+ values[1] = UIComponentBase
+ .saveAttachedState(context, _assignToBinding);
+ values[2] = _noEscape;
+ values[3] = UIComponentBase.saveAttachedState(context, _converter);
+ return ((Object) (values));
+ }
+
+ /**
+ * @param field -
+ * value of field to get.
+ * @param name -
+ * name of field, to get from ValueBinding
+ * @return boolean value, based on field or valuebinding.
+ */
+ private boolean isValueOrBinding(Boolean field, String name) {
+ if (null != field) {
+ return field.booleanValue();
+ }
+ ValueBinding vb = getValueBinding(name);
+ if (null != vb) {
+ return ((Boolean) vb.getValue(getFacesContext())).booleanValue();
+ } else {
+ return false;
+ }
+ }
+
+}
Copied: trunk/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxCommandButton.java (from rev 1512, trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIAjaxCommandButton.java)
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxCommandButton.java (rev 0)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxCommandButton.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -0,0 +1,33 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.ajax4jsf.component;
+
+
+/**
+ * @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
+ * @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:58:28 $
+ *
+ */
+public abstract class UIAjaxCommandButton extends AjaxActionComponent {
+ public static final String COMPONENT_TYPE="org.ajax4jsf.CommandButton";
+
+}
Copied: trunk/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxCommandLink.java (from rev 1512, trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIAjaxCommandLink.java)
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxCommandLink.java (rev 0)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxCommandLink.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -0,0 +1,33 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.ajax4jsf.component;
+
+
+/**
+ * @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
+ * @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:58:26 $
+ *
+ */
+public abstract class UIAjaxCommandLink extends AjaxActionComponent {
+
+ public static final String COMPONENT_TYPE="org.ajax4jsf.CommandLink";
+}
Copied: trunk/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxForm.java (from rev 1512, trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIAjaxForm.java)
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxForm.java (rev 0)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxForm.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -0,0 +1,174 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.ajax4jsf.component;
+
+import java.util.Iterator;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIForm;
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesEvent;
+
+import org.ajax4jsf.context.AjaxContext;
+import org.ajax4jsf.event.AjaxEvent;
+import org.ajax4jsf.event.AjaxListener;
+import org.ajax4jsf.event.AjaxSource;
+
+
+/**
+ * Quite different from default <code>HtmlForm</code> - process child components
+ * not only for submitted form, but if submitted parent <code>AjaxContainer</code>
+ * @author shura (latest modification by $Author: alexsmirnov $)
+ * @version $Revision: 1.1.2.3 $ $Date: 2007/02/06 16:23:22 $
+ *
+ */
+public abstract class UIAjaxForm extends UIForm implements AjaxComponent, AjaxSource
+{
+ public static final String COMPONENT_TYPE = "org.ajax4jsf.Form";
+
+ /* (non-Javadoc)
+ * @see javax.faces.component.UIComponent#processDecodes(javax.faces.context.FacesContext)
+ */
+ public void processDecodes(javax.faces.context.FacesContext context)
+ {
+ if (context == null) {
+ throw new NullPointerException("context");
+ }
+ decode(context);
+ if (mustProcessed(context))
+ {
+ for (Iterator it = getFacetsAndChildren(); it.hasNext();)
+ {
+ UIComponent childOrFacet = (UIComponent) it.next();
+ childOrFacet.processDecodes(context);
+ }
+ }
+ }
+
+
+ /* (non-Javadoc)
+ * @see javax.faces.component.UIComponent#processValidators(javax.faces.context.FacesContext)
+ */
+ public void processValidators(javax.faces.context.FacesContext context)
+ {
+ if (context == null) throw new NullPointerException("context");
+ if (mustProcessed(context))
+ {
+ for (Iterator it = getFacetsAndChildren(); it.hasNext();)
+ {
+ UIComponent childOrFacet = (UIComponent) it.next();
+ childOrFacet.processValidators(context);
+ }
+ }
+ }
+
+
+
+ /* (non-Javadoc)
+ * @see javax.faces.component.UIComponent#processUpdates(javax.faces.context.FacesContext)
+ */
+ public void processUpdates(javax.faces.context.FacesContext context)
+ {
+ if (context == null) throw new NullPointerException("context");
+ if (mustProcessed(context))
+ {
+ for (Iterator it = getFacetsAndChildren(); it.hasNext();)
+ {
+ UIComponent childOrFacet = (UIComponent) it.next();
+ childOrFacet.processUpdates(context);
+ }
+ }
+ }
+
+ /**
+ * Test for condition processing decoders/validators/updates
+ * @param context current <code>FacesContext</code>
+ * @return true if submitted parent AjaxContainer or current form.
+ */
+ private boolean mustProcessed(FacesContext context)
+ {
+// if ( !AjaxContext.getCurrentInstance(context).isAjaxRequest(context)) {
+ if (!isSubmitted() ) {
+ return false;
+ }
+// }
+ return true;
+ }
+
+
+ /* (non-Javadoc)
+ * @see javax.faces.component.UIComponentBase#broadcast(javax.faces.event.FacesEvent)
+ */
+ public void broadcast(FacesEvent event) throws AbortProcessingException {
+ // perform default
+ super.broadcast(event);
+ if (event instanceof AjaxEvent) {
+ // complete re-Render fields. AjaxEvent deliver before render response.
+ setupReRender();
+ }
+ }
+
+
+ /**
+ * Template methods for fill set of resions to render in subclasses.
+ */
+ protected void setupReRender() {
+ FacesContext context = getFacesContext();
+ AjaxContext.getCurrentInstance(context).addRegionsFromComponent(this);
+ }
+
+
+
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.framework.ajax.AjaxSource#addAjaxListener(org.ajax4jsf.framework.ajax.AjaxListener)
+ */
+ public void addAjaxListener(AjaxListener listener) {
+ addFacesListener(listener);
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.framework.ajax.AjaxSource#getAjaxListeners()
+ */
+ public AjaxListener[] getAjaxListeners() {
+ AjaxListener al[] = (AjaxListener [])
+ getFacesListeners(AjaxListener.class);
+ return (al);
+
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.framework.ajax.AjaxSource#removeAjaxListener(org.ajax4jsf.framework.ajax.AjaxListener)
+ */
+ public void removeAjaxListener(AjaxListener listener) {
+ removeFacesListener(listener);
+
+ }
+
+ public abstract boolean isAjaxSubmit();
+
+ public abstract void setAjaxSubmit(boolean ajax);
+
+}
Copied: trunk/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxFunction.java (from rev 1512, trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIAjaxFunction.java)
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxFunction.java (rev 0)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxFunction.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -0,0 +1,37 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.ajax4jsf.component;
+
+
+/**
+ * @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
+ * @version $Revision: 1.1.2.2 $ $Date: 2007/01/23 20:01:04 $
+ *
+ */
+public abstract class UIAjaxFunction extends AjaxActionComponent {
+
+ public static final String COMPONENT_TYPE="org.ajax4jsf.Function";
+
+ public abstract String getName();
+
+ public abstract void setName(String name);
+}
Copied: trunk/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxLog.java (from rev 1512, trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIAjaxLog.java)
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxLog.java (rev 0)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxLog.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -0,0 +1,52 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.ajax4jsf.component;
+
+import javax.faces.component.UIComponentBase;
+
+/**
+ * @author shura
+ *
+ */
+public abstract class UIAjaxLog extends UIComponentBase {
+
+ public static final String COMPONENT_TYPE = "org.ajax4jsf.Log";
+
+ public abstract String getHotkey();
+
+ public abstract void setHotkey(String newvalue);
+
+ public abstract String getName();
+ public abstract void setName(String newvalue);
+
+ public abstract String getWidth();
+ public abstract void setWidth(String newvalue);
+
+ public abstract String getHeight();
+ public abstract void setHeight(String newvalue);
+
+ public abstract String getLevel();
+ public abstract void setLevel(String newvalue);
+
+ public abstract boolean isPopup();
+ public abstract void setPopup(boolean popup);
+}
Copied: trunk/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxOutputPanel.java (from rev 1512, trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIAjaxOutputPanel.java)
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxOutputPanel.java (rev 0)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxOutputPanel.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -0,0 +1,42 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.ajax4jsf.component;
+
+import javax.faces.component.UIPanel;
+
+
+/**
+ * @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
+ * @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:58:26 $
+ *
+ */
+public abstract class UIAjaxOutputPanel extends UIPanel implements AjaxOutput {
+
+ public static final String COMPONENT_TYPE = "org.ajax4jsf.OutputPanel";
+ /**
+ * @return
+ */
+ public abstract String getLayout();
+
+ public abstract void setLayout(String layout);
+
+}
Copied: trunk/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxRegion.java (from rev 1512, trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIAjaxRegion.java)
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxRegion.java (rev 0)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxRegion.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -0,0 +1,247 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.ajax4jsf.component;
+
+import java.io.IOException;
+
+import javax.faces.FacesException;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIPanel;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+import javax.faces.el.MethodBinding;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesEvent;
+
+import org.ajax4jsf.context.AjaxContext;
+import org.ajax4jsf.event.AjaxListener;
+import org.ajax4jsf.framework.ajax.AjaxContextImpl;
+import org.ajax4jsf.framework.ajax.AjaxRegionBrige;
+import org.ajax4jsf.framework.ajax.AjaxViewRoot;
+import org.ajax4jsf.framework.ajax.InvokerCallback;
+import org.ajax4jsf.framework.renderer.AjaxContainerRenderer;
+
+/**
+ * @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
+ * @version $Revision: 1.1.2.3 $ $Date: 2007/02/08 15:02:06 $
+ *
+ */
+public abstract class UIAjaxRegion extends UIPanel implements AjaxContainer {
+
+ private AjaxRegionBrige brige;
+
+ public static final String COMPONENT_TYPE = "org.ajax4jsf.AjaxRegion";
+
+ /**
+ *
+ */
+ public UIAjaxRegion() {
+ brige = new AjaxRegionBrige(this);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.component.UIComponentBase#encodeBegin(javax.faces.context.FacesContext)
+ */
+// public void encodeBegin(FacesContext context) throws IOException {
+// UIViewRoot root = context.getViewRoot();
+// if (root instanceof AjaxViewRoot) {
+// ((AjaxViewRoot) root).addAjaxRegion(this);
+// }
+// super.encodeBegin(context);
+// }
+
+ private InvokerCallback _ajaxInvoker = new InvokerCallback() {
+
+ public void invoke(FacesContext context, UIComponent component) {
+ try {
+ if (component instanceof AjaxContainer) {
+ AjaxContainer ajax = (AjaxContainer) component;
+ ajax.encodeAjax(context);
+ } else {
+ // Container not found, use Root for encode.
+ encodeAjax(context);
+ }
+ } catch (IOException e) {
+ throw new FacesException(e);
+ }
+ }
+
+ public void invokeRoot(FacesContext context) {
+ try {
+ encodeAjax(context);
+ } catch (IOException e) {
+ throw new FacesException(e);
+ }
+ }
+ };
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.component.UIComponentBase#encodeChildren(javax.faces.context.FacesContext)
+ */
+ public void encodeChildren(FacesContext context) throws IOException {
+ // If this region is single child of ViewRoot, encode Ajax response for
+ // submitted container.
+ UIViewRoot viewRoot = context.getViewRoot();
+ AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
+ if ( (getParent() == viewRoot) &&
+ (viewRoot instanceof AjaxViewRoot) &&
+ ((AjaxViewRoot) viewRoot).isHavePage() &&
+ (ajaxContext.isAjaxRequest())) {
+ AjaxContextImpl.invokeOnRegionOrRoot((AjaxViewRoot) viewRoot, context, _ajaxInvoker);
+ } else {
+ super.encodeChildren(context);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.framework.ajax.AjaxViewBrige#broadcast(javax.faces.event.FacesEvent)
+ */
+ public void broadcast(FacesEvent event) throws AbortProcessingException {
+ super.broadcast(event);
+ brige.broadcast(event);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.framework.ajax.AjaxViewBrige#getAjaxListener()
+ */
+ public MethodBinding getAjaxListener() {
+ return brige.getAjaxListener();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.framework.ajax.AjaxViewBrige#isImmediate()
+ */
+ public boolean isImmediate() {
+ return brige.isImmediate();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.framework.ajax.AjaxViewBrige#isSubmitted()
+ */
+ public boolean isSubmitted() {
+ return brige.isSubmitted();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.framework.ajax.AjaxViewBrige#restoreState(javax.faces.context.FacesContext,
+ * java.lang.Object)
+ */
+ public void restoreState(FacesContext context, Object state) {
+ Object[] mystate = (Object[]) state;
+ super.restoreState(context, mystate[0]);
+ brige.restoreState(context, mystate[1]);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.framework.ajax.AjaxViewBrige#saveState(javax.faces.context.FacesContext)
+ */
+ public Object saveState(FacesContext context) {
+ Object[] state = new Object[2];
+ state[0] = super.saveState(context);
+ state[1] = brige.saveState(context);
+ return state;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.framework.ajax.AjaxViewBrige#setAjaxListener(javax.faces.el.MethodBinding)
+ */
+ public void setAjaxListener(MethodBinding ajaxListener) {
+ brige.setAjaxListener(ajaxListener);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.framework.ajax.AjaxViewBrige#setImmediate(boolean)
+ */
+ public void setImmediate(boolean immediate) {
+ brige.setImmediate(immediate);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.framework.ajax.AjaxViewBrige#setSubmitted(boolean)
+ */
+ public void setSubmitted(boolean submitted) {
+ brige.setSubmitted(submitted);
+ }
+
+ public void addAjaxListener(AjaxListener listener) {
+ addFacesListener(listener);
+ }
+
+ public AjaxListener[] getAjaxListeners() {
+ return (AjaxListener[]) getFacesListeners(AjaxListener.class);
+ }
+
+ public void removeAjaxListener(AjaxListener listener) {
+ removeFacesListener(listener);
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.framework.ajax.AjaxViewBrige#isSelfRendered()
+ */
+ public boolean isSelfRendered() {
+ return brige.isSelfRendered();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.framework.ajax.AjaxViewBrige#setSelfRendered(boolean)
+ */
+ public void setSelfRendered(boolean selfRendered) {
+ brige.setSelfRendered(selfRendered);
+ }
+
+ public void encodeAjax(FacesContext context) throws IOException {
+ String rendererType = getRendererType();
+ if (rendererType != null) {
+ ((AjaxContainerRenderer) getRenderer(context)).encodeAjax(context,
+ this);
+ }
+
+ }
+
+}
Copied: trunk/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxStatus.java (from rev 1512, trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIAjaxStatus.java)
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxStatus.java (rev 0)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxStatus.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -0,0 +1,378 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.ajax4jsf.component;
+
+import java.io.Serializable;
+
+import javax.faces.FacesException;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIComponentBase;
+import javax.faces.context.FacesContext;
+import javax.faces.el.ValueBinding;
+
+import org.ajax4jsf.Messages;
+import org.ajax4jsf.framework.renderer.AjaxRendererUtils;
+
+
+/**
+ *
+ * Component for create request state status area.
+ * can create 2 output text areas ( <span> ) with different text and styles.
+ * if defined "start" or/and "stop" facets, it's use as conttent
+ * for different state.
+ * By default, "start" text/facet rendered with display = none style.
+ * On client side, display style changed for elements on
+ * start-stop request.
+ * @author shura (latest modification by $Author: alexsmirnov $)
+ * @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:58:25 $
+ *
+ */
+public class UIAjaxStatus extends UIComponentBase
+{
+
+ private static final String COMPONENT_FAMILY = "javax.faces.Output";
+ public static final String COMPONENT_TYPE = "org.ajax4jsf.AjaxStatus";
+
+
+ /* (non-Javadoc)
+ * @see javax.faces.component.UIComponent#getFamily()
+ */
+ public String getFamily()
+ {
+ return COMPONENT_FAMILY;
+ }
+
+ /**
+ * id of form for wich status will displayed
+ */
+ private String _for = null;
+
+ /**
+ *
+ * @param new value of id of form for wich status will displayed to set
+ */
+ public void setFor(String _for)
+ {
+ this._for = _for;
+ }
+
+ /**
+ * @return value or result of valueBinding of id of form for wich status will displayed
+ *
+ */
+ public String getFor()
+ {
+ return (String) getValueOrBinding(_for, "for");
+ }
+
+ /**
+ * Text to output on start request
+ */
+ private String _startText = null;
+
+ /**
+ * setter method for property
+ * @param new value of Text to output on start request to set
+ */
+ public void setStartText(String startText)
+ {
+ this._startText = startText;
+ }
+
+ /**
+ * @return value or result of valueBinding of Text to output on start request
+ */
+ public String getStartText()
+ {
+ return (String) getValueOrBinding(_startText, "startText");
+ }
+
+ /**
+ * Text to display on complete request
+ */
+ private String _stopText = null;
+
+ /**
+ * setter method for property
+ * @param new value of Text to display on complete request to set
+ */
+ public void setStopText(String stopText)
+ {
+ this._stopText = stopText;
+ }
+
+ /**
+ * @return value or result of valueBinding of Text to display on complete request
+ */
+ public String getStopText()
+ {
+ return (String) getValueOrBinding(_stopText, "stopText");
+ }
+ /**
+ * Style for display on start request
+ */
+ private String _startStyle = null;
+
+ /**
+ * setter method for property
+ * @param new value of Style for display on start request to set
+ */
+ public void setStartStyle(String startStyle)
+ {
+ this._startStyle = startStyle;
+ }
+
+ /**
+ * @return value or result of valueBinding of Style for display on start request
+ */
+ public String getStartStyle()
+ {
+ return (String) getValueOrBinding(_startStyle, "startStyle");
+ }
+ /**
+ * Style for displaying on complete
+ */
+ private String _stopStyle = null;
+
+ /**
+ * setter method for property
+ * @param new value of Style for displaying on complete to set
+ */
+ public void setStopStyle(String stopStyle)
+ {
+ this._stopStyle = stopStyle;
+ }
+
+ /**
+ * @return value or result of valueBinding of Style for displaying on complete
+ */
+ public String getStopStyle()
+ {
+ return (String) getValueOrBinding(_stopStyle, "stopStyle");
+ }
+ /**
+ * Style class for display on request
+ */
+ private String _startStyleClass = null;
+
+ /**
+ * setter method for property
+ * @param new value of Style class for display on request to set
+ */
+ public void setStartStyleClass(String startStyleClass)
+ {
+ this._startStyleClass = startStyleClass;
+ }
+
+ /**
+ * @return value or result of valueBinding of Style class for display on request
+ */
+ public String getStartStyleClass()
+ {
+ return (String) getValueOrBinding(_startStyleClass, "startStyleClass");
+ }
+ /**
+ * Style class for display on complete request
+ */
+ private String _stopStyleClass = null;
+
+ /**
+ * setter method for property
+ * @param new value of Style class for display on complete request to set
+ */
+ public void setStopStyleClass(String stopStyleClass)
+ {
+ this._stopStyleClass = stopStyleClass;
+ }
+
+
+ /**
+ * Force id to render in Html as is
+ */
+ private boolean _forceId = false;
+ private boolean _forceIdSet = false;
+
+ /**
+ * setter method for property
+ * @param new value of Force id to render in Html as is to set
+ */
+ public void setForceId(boolean forceId)
+ {
+ this._forceId = forceId;
+ this._forceIdSet = true;
+ }
+
+ /**
+ * @return value or result of valueBinding of Force id to render in Html as is
+ */
+ public boolean isForceId()
+ {
+ return isValueOrBinding(_forceId, _forceIdSet, "forceId");
+ }
+
+
+
+
+ private String _clientId = null;
+
+ /* (non-Javadoc)
+ * @see javax.faces.component.UIComponentBase#getClientId(javax.faces.context.FacesContext)
+ */
+ public String getClientId(FacesContext context) {
+ if (null == _clientId) {
+ String forValue = getFor();
+ UIComponent container;
+ if (null != forValue) {
+ container = findComponent(forValue);
+ // 'for' attribute must be pointed to real container in view tree
+ if (null == container || !(container instanceof AjaxContainer)) {
+ throw new FacesException(
+ Messages.getMessage(Messages.FOR_TARGETS_NO_AJAX_CONTAINER, getId()));
+ }
+ _clientId = container.getClientId(context) + ":status";
+
+ } else if (isForceId()) {
+ _clientId = getRenderer(context).convertClientId(context,
+ this.getId());
+ } else if (null !=(container = (UIComponent) AjaxRendererUtils.findAjaxContainer(context,this))) {
+ _clientId = container.getClientId(context) + ":status";
+ } else {
+ _clientId = super.getClientId(context);
+ }
+ }
+ return _clientId;
+ }
+
+
+ /* (non-Javadoc)
+ * reset clientId for calculate
+ * @see javax.faces.component.UIComponentBase#setId(java.lang.String)
+ */
+ public void setId(String arg0) {
+ super.setId(arg0);
+ _clientId = null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.component.UIComponentBase#restoreState(javax.faces.context.FacesContext, java.lang.Object)
+ */
+ public void restoreState(FacesContext context, Object state)
+ {
+ State myState = (State) state;
+ _for = myState._for;
+ _startText = myState._startText;
+ _stopText = myState._stopText;
+ _startStyle = myState._startStyle;
+ _stopStyle = myState._stopStyle;
+ _startStyleClass = myState._startStyleClass;
+ _stopStyleClass = myState._stopStyleClass;
+ _forceId = myState._forceId;
+ _forceIdSet = myState._forceIdSet;
+ super.restoreState(context, myState.superState);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.component.UIComponentBase#saveState(javax.faces.context.FacesContext)
+ */
+ public Object saveState(FacesContext context)
+ {
+ State state = new State();
+ state._for = _for;
+ state._startText = _startText;
+ state._stopText = _stopText;
+ state._startStyle = _startStyle;
+ state._stopStyle = _stopStyle;
+ state._startStyleClass = _startStyleClass;
+ state._stopStyleClass = _stopStyleClass;
+ state._forceId = _forceId;
+ state._forceIdSet = _forceIdSet;
+ state.superState = super.saveState(context);
+ return state;
+ }
+
+ /**
+ * @author shura (latest modification by $Author: alexsmirnov $)
+ * @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:58:25 $
+ * Memento pattern state class for save-restore component.
+ */
+ public static class State implements Serializable {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 317266574102385358L;
+ Object superState;
+ String _for;
+ String _startText;
+ String _stopText;
+ String _startStyle;
+ String _stopStyle;
+ String _startStyleClass;
+ String _stopStyleClass;
+ boolean _forceIdSet;
+ boolean _forceId;
+ }
+
+ /**
+ * @return value or result of valueBinding of Style class for display on complete request
+ */
+ public String getStopStyleClass()
+ {
+ return (String) getValueOrBinding(_stopStyleClass, "stopStyleClass");
+ }
+
+ /**
+ * @param field - value of field to get.
+ * @param name - name of field, to get from ValueBinding
+ * @return field or value of binding expression.
+ */
+ private Object getValueOrBinding(Object field, String name){
+ if( null != field){
+ return field;
+ }
+ ValueBinding vb = getValueBinding(name);
+ if (null != vb) {
+ return vb.getValue(getFacesContext());
+ } else {
+ return null;
+ }
+
+ }
+
+ /**
+ * @param field - value of field to get.
+ * @param name - name of field, to get from ValueBinding
+ * @return boolean value, based on field or valuebinding.
+ */
+ private boolean isValueOrBinding(boolean field, boolean fieldSet, String name){
+ if( fieldSet ){
+ return field;
+ }
+ ValueBinding vb = getValueBinding(name);
+ if (null != vb) {
+ return ((Boolean)vb.getValue(getFacesContext())).booleanValue();
+ } else {
+ return false;
+ }
+
+ }
+
+}
Copied: trunk/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxSupport.java (from rev 1512, trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIAjaxSupport.java)
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxSupport.java (rev 0)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxSupport.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -0,0 +1,229 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.ajax4jsf.component;
+
+import javax.faces.FacesException;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.el.ValueBinding;
+
+import org.ajax4jsf.Messages;
+import org.ajax4jsf.framework.ajax.EventValueBinding;
+import org.ajax4jsf.framework.renderer.AjaxRendererUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+
+/**
+ * Component for append ajax functions to any control component.
+ * Append action functionality to non-action control,
+ * setup javascript events for parent component,
+ * @author shura (latest modification by $Author: alexsmirnov $)
+ * @version $Revision: 1.1.2.3 $ $Date: 2007/02/12 17:46:52 $
+ *
+ */
+public abstract class UIAjaxSupport extends AjaxActionComponent implements AjaxSupport
+{
+
+ //~ Static fields/initializers ---------------------------------------------
+
+ public static final String COMPONENT_TYPE = "org.ajax4jsf.Support";
+ public static final String COMPONENT_FAMILY = "org.ajax4jsf.AjaxSupport";
+ public static final String DEFAULT_RENDERER_TYPE = "org.ajax4jsf.components.AjaxSupportRenderer";
+ public static final String AJAX_SUPPORT_SET = "com.exadel.components.ajax.support.";
+ private static final Log log = LogFactory.getLog(UIAjaxSupport.class);
+
+ /**
+ * Name of JavaScript function, called before submit Ajax request
+ * description
+ * @parameter
+ * @return the acceptClass
+ */
+ public abstract String getOnsubmit();
+
+ /**
+ * @param newOnsubmit the value to set
+ */
+ public abstract void setOnsubmit(String newOnsubmit);
+ /* (non-Javadoc)
+ * @see javax.faces.component.UIComponentBase#setValueBinding(java.lang.String, javax.faces.el.ValueBinding)
+ */
+ public void setValueBinding(String arg0, ValueBinding arg1) {
+ // var - not allowed name. must be literal.
+ if("var".equals(arg0)){
+ throw new FacesException(
+ Messages.getMessage(Messages.VAR_MUST_BE_LITERAL, getClientId(getFacesContext())));
+ }
+ if("event".equals(arg0)){
+ throw new FacesException(
+ Messages.getMessage(Messages.EVENT_MUST_BE_LITERAL, getClientId(getFacesContext())));
+ }
+ super.setValueBinding(arg0, arg1);
+ }
+
+ /**
+ * Create Special <code>ValueBinding</code> for build JavaScrept
+ * event code in parent component from this.
+ * @return <code>EventValueBinding</code> based on properties of current component
+ */
+ private ValueBinding getEventValueBinding()
+ {
+ if (log.isDebugEnabled())
+ {
+ log.debug(Messages.getMessage(Messages.CREATE_JAVASCRIPT_EVENT, getId()));
+ }
+ return new EventValueBinding(this);
+ }
+
+ /**
+ * @return JavaScript eventString. Rebuild on every call, since
+ * can be in loop ( as in dataTable ) with different parameters.
+ */
+ public String getEventString()
+ {
+ StringBuffer buildOnEvent = new StringBuffer();
+ String onsubmit = getOnsubmit();
+ // Insert script to call before submit ajax request.
+ if (null != onsubmit) {
+ buildOnEvent.append(onsubmit).append(";");
+ }
+ // Due to JSF RI 1.1 bug, clear cached clientId
+ setId(getId());
+ buildOnEvent.append(AjaxRendererUtils.buildOnEvent(this, getFacesContext(),
+ getEvent()));
+ String script = buildOnEvent.toString();
+ return script;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.component.UIComponentBase#decode(javax.faces.context.FacesContext)
+ */
+ public void decode(FacesContext context) {
+ // Due to JSF RI 1.1 bug, clear cached clientId
+ setId(getId());
+ super.decode(context);
+ }
+
+ /**
+ * After nornal setting <code>parent</code> property in case of
+ * created component set Ajax properties for parent.
+ * @see javax.faces.component.UIComponentBase#setParent(javax.faces.component.UIComponent)
+ */
+ public void setParent(UIComponent parent)
+ {
+ super.setParent(parent);
+ if (null != parent && parent.getFamily() != null ) {
+ if (log.isDebugEnabled()) {
+ log.debug(Messages.getMessage(Messages.CALLED_SET_PARENT, parent.getClass().getName()));
+ }
+ // TODO If this comopnent configured, set properties for parent component.
+ // NEW created component have parent, restored view - null in My faces.
+ // and SUN RI not call at restore saved view.
+ // In other case - set in restoreState method.
+ // if (parent.getParent() != null)
+ {
+ if (log.isDebugEnabled()) {
+ log.debug(Messages.getMessage(Messages.DETECT_NEW_COMPONENT));
+ }
+ setParentProperties(parent);
+
+ }
+ }
+ }
+
+ public void setParentProperties(UIComponent parent) {
+ ValueBinding valueBinding;
+// Map parentAttributes = parent.getAttributes();
+/* if (parent instanceof ActionSource && null == getEvent())
+ {
+ log.debug("Set properties for parent as ActionSource");
+ // Translate AJAX properties to parent component.
+ if (_reRender != null)
+ {
+ parentAttributes
+ .put(AjaxRendererUtils.AJAX_REGIONS_ATTRIBUTE,
+ _reRender);
+ }
+ else if ((valueBinding = getValueBinding("reRender")) != null)
+ {
+ parent.setValueBinding(
+ AjaxRendererUtils.AJAX_REGIONS_ATTRIBUTE,
+ valueBinding);
+ }
+ if (_oncomplete != null)
+ {
+ parentAttributes
+ .put(AjaxRendererUtils.ONCOMPLETE_ATTR_NAME,
+ _oncomplete);
+ }
+ else if ((valueBinding = getValueBinding("oncomplete")) != null)
+ {
+ parent.setValueBinding(
+ AjaxRendererUtils.ONCOMPLETE_ATTR_NAME,
+ valueBinding);
+ }
+ if (_status != null)
+ {
+ parentAttributes.put(AjaxRendererUtils.STATUS_ATTR_NAME,
+ _status);
+ }
+ else if ((valueBinding = getValueBinding("status")) != null)
+ {
+ parent.setValueBinding(AjaxRendererUtils.STATUS_ATTR_NAME,
+ valueBinding);
+ }
+ if (_limitToListSet)
+ {
+ parentAttributes.put(
+ AjaxRendererUtils.LIMITTOLIST_ATTR_NAME, Boolean
+ .valueOf(_limitToList));
+ }
+ else if ((valueBinding = getValueBinding("limitToList")) != null)
+ {
+ parent.setValueBinding(
+ AjaxRendererUtils.LIMITTOLIST_ATTR_NAME,
+ valueBinding);
+ }
+ // Add Listener for all supported types.
+ AjaxRegionListener listener = new AjaxRegionListener();
+ ((ActionSource) parent).addActionListener(listener);
+ }
+ else*/ if (null != getEvent())
+ {
+ if (log.isDebugEnabled())
+ {
+ log.debug(Messages.getMessage(Messages.SET_VALUE_BINDING_FOR_EVENT, getEvent()));
+ }
+ // for non action/data components, or for non-default events - build listener for this instance.
+ valueBinding = getEventValueBinding();
+ // test for valid event attribute name.
+ // TODO - test for compability with concrete element.
+ parent.setValueBinding(getEvent(), valueBinding);
+ }
+
+ }
+
+ protected UIComponent getSingleComponent() {
+ return getParent();
+ }
+
+}
Copied: trunk/ui/core/src/main/java/org/ajax4jsf/component/UIDataAdaptor.java (from rev 1512, trunk/framework/impl/src/main/java/org/ajax4jsf/ajax/repeat/UIDataAdaptor.java)
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/component/UIDataAdaptor.java (rev 0)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/component/UIDataAdaptor.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -0,0 +1,1332 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.ajax4jsf.component;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import javax.faces.FacesException;
+import javax.faces.application.FacesMessage;
+import javax.faces.component.EditableValueHolder;
+import javax.faces.component.NamingContainer;
+import javax.faces.component.StateHolder;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIData;
+import javax.faces.context.FacesContext;
+import javax.faces.el.ValueBinding;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.FacesListener;
+import javax.faces.event.PhaseId;
+import javax.faces.model.DataModel;
+import javax.faces.model.ListDataModel;
+import javax.faces.render.Renderer;
+
+import org.ajax4jsf.framework.renderer.AjaxChildrenRenderer;
+import org.ajax4jsf.model.DataComponentState;
+import org.ajax4jsf.model.DataVisitor;
+import org.ajax4jsf.model.ExtendedDataModel;
+import org.ajax4jsf.model.SerializableDataModel;
+
+/**
+ * Base class for iterable components, like dataTable, Tomahawk dataList,
+ * Facelets repeat, tree etc., with support for partial rendering on AJAX
+ * responces for one or more selected iterations.
+ *
+ * @author shura
+ *
+ */
+public abstract class UIDataAdaptor extends UIData implements AjaxDataEncoder {
+
+ /**
+ *
+ */
+ public static final String COMPONENT_STATE_ATTRIBUTE = "componentState";
+
+ public final static DataModel EMPTY_MODEL = new ListDataModel(
+ Collections.EMPTY_LIST);
+
+ /**
+ * Base class for visit data model at phases decode, validation and
+ * update model
+ *
+ * @author shura
+ *
+ */
+ protected abstract class ComponentVisitor implements DataVisitor {
+
+ public void process(FacesContext context, Object rowKey, Object argument)
+ throws IOException {
+ setRowKey(context, rowKey);
+ if (isRowAvailable()) {
+ Iterator childIterator = dataChildren();
+ while (childIterator.hasNext()) {
+ UIComponent component = (UIComponent) childIterator.next();
+ processComponent(context, component, argument);
+ }
+
+ }
+ }
+
+ public abstract void processComponent(FacesContext context,
+ UIComponent c, Object argument) throws IOException;
+
+ }
+
+ /**
+ * Visitor for process decode on children components.
+ */
+ protected ComponentVisitor decodeVisitor = new ComponentVisitor() {
+
+ public void processComponent(FacesContext context, UIComponent c,
+ Object argument) {
+ c.processDecodes(context);
+ }
+
+ };
+
+ /**
+ * Visitor for process validation phase
+ */
+ protected ComponentVisitor validateVisitor = new ComponentVisitor() {
+
+ public void processComponent(FacesContext context, UIComponent c,
+ Object argument) {
+ c.processValidators(context);
+ }
+
+ };
+
+ /**
+ * Visitor for process update model phase.
+ */
+ protected ComponentVisitor updateVisitor = new ComponentVisitor() {
+
+ public void processComponent(FacesContext context, UIComponent c,
+ Object argument) {
+ c.processUpdates(context);
+ }
+
+ };
+
+ /**
+ * Base client id's of this component, for wich invoked encode...
+ * methods. Component will save state and serialisable models for this
+ * keys only.
+ */
+ private Set _encoded;
+
+ /**
+ * Storage for data model instances with different client id's of this
+ * component. In case of child for UIData component, this map will keep
+ * data models for different iterations between phases.
+ */
+ private Map _modelsMap = new HashMap();
+
+ /**
+ * Reference for curent data model
+ */
+ private ExtendedDataModel _currentModel = null;
+
+ /**
+ * States of this component for diferent iterations, same as for models.
+ */
+ private Map _statesMap = new HashMap();
+
+ /**
+ * Reference for current component state.
+ */
+ private DataComponentState _currentState = null;
+
+ /**
+ * Name of EL variable for current component state.
+ */
+ private String _stateVar;
+
+ private String _rowKeyVar;
+
+ /**
+ * Key for current value in model.
+ */
+ private Object _rowKey = null;
+
+ /**
+ * Values of row keys, encoded on ajax response rendering.
+ */
+ private Set _ajaxKeys = null;
+
+ private Object _ajaxRowKey = null;
+
+ private Map _ajaxRowKeysMap = new HashMap();
+
+ /**
+ * Get name of EL variable for component state.
+ *
+ * @return the varState
+ */
+ public String getStateVar() {
+ return _stateVar;
+ }
+
+ /**
+ * @param varStatus
+ * the varStatus to set
+ */
+ public void setStateVar(String varStatus) {
+ this._stateVar = varStatus;
+ }
+
+ /**
+ * @return the rowKeyVar
+ */
+ public String getRowKeyVar() {
+ return this._rowKeyVar;
+ }
+
+ /**
+ * @param rowKeyVar
+ * the rowKeyVar to set
+ */
+ public void setRowKeyVar(String rowKeyVar) {
+ this._rowKeyVar = rowKeyVar;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.component.UIData#getRowCount()
+ */
+ public int getRowCount() {
+ return getExtendedDataModel().getRowCount();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.component.UIData#getRowData()
+ */
+ public Object getRowData() {
+ return getExtendedDataModel().getRowData();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.component.UIData#isRowAvailable()
+ */
+ public boolean isRowAvailable() {
+ return this.getExtendedDataModel().isRowAvailable();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.component.UIData#setRowIndex(int)
+ */
+ public void setRowIndex(int index) {
+ FacesContext faces = FacesContext.getCurrentInstance();
+ ExtendedDataModel localModel = getExtendedDataModel();
+ // if(key == localModel.getRowIndex()){
+ // return;
+ // }
+ // save child state
+ this.saveChildState(faces);
+ // Set current model row by int, but immediately get value from model.
+ // for compability, complex models must provide values map between
+ // integer and key value.
+ localModel.setRowIndex(index);
+ this._rowKey = localModel.getRowKey();
+ this._clientId = null;
+ boolean rowSelected = this._rowKey != null;
+
+ setupVariable(faces, localModel, rowSelected);
+ // restore child state
+ this.restoreChildState(faces);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.component.UIData#getRowIndex()
+ */
+ public int getRowIndex() {
+ return getExtendedDataModel().getRowIndex();
+ }
+
+ /**
+ * Same as for int index, but for complex model key.
+ *
+ * @return
+ */
+ public Object getRowKey() {
+ return this._rowKey;
+ }
+
+ public void setRowKey(Object key) {
+ setRowKey(FacesContext.getCurrentInstance(), key);
+ }
+
+ /**
+ * Setup current roy by key. Perform same functionality as
+ * {@link UIData#setRowIndex(int)}, but for key object - it may be not
+ * only row number in sequence data, but, for example - path to current
+ * node in tree.
+ *
+ * @param faces -
+ * current FacesContext
+ * @param key
+ * new key value.
+ */
+ public void setRowKey(FacesContext faces, Object key) {
+ ExtendedDataModel localModel = getExtendedDataModel();
+ // save child state
+ this.saveChildState(faces);
+ this._rowKey = key;
+ this._clientId = null;
+ localModel.setRowKey(key);
+
+ boolean rowSelected = key != null;
+
+ setupVariable(faces, localModel, rowSelected);
+ // restore child state
+ this.restoreChildState(faces);
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.ajax.repeat.AjaxDataEncoder#getAjaxKeys()
+ */
+ public Set getAjaxKeys() {
+ Set keys = null;
+ if (this._ajaxKeys != null) {
+ keys = (this._ajaxKeys);
+ } else {
+ ValueBinding vb = getValueBinding("ajaxKeys");
+ if (vb != null) {
+ keys = (Set) (vb.getValue(getFacesContext()));
+ } else if(null != _ajaxRowKey){
+ // If none of above exist , use row with submitted AjaxComponent
+ keys = new HashSet(1);
+ keys.add(_ajaxRowKey);
+ }
+ }
+ return keys;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.ajax.repeat.AjaxDataEncoder#setAjaxKeys(java.util.Set)
+ */
+ public void setAjaxKeys(Set ajaxKeys) {
+ this._ajaxKeys = ajaxKeys;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.framework.ajax.AjaxChildrenEncoder#encodeAjaxChild(javax.faces.context.FacesContext,
+ * java.lang.String, java.util.Set, java.util.Set)
+ */
+ public void encodeAjaxChild(FacesContext context, String path,
+ final Set ids, final Set renderedAreas) throws IOException {
+ resetDataModel();
+
+ Renderer renderer = getRenderer(context);
+ if (null != renderer && renderer instanceof AjaxChildrenRenderer) {
+ // If renderer support partial encoding - call them.
+ AjaxChildrenRenderer childrenRenderer = (AjaxChildrenRenderer) renderer;
+ childrenRenderer.encodeAjaxChildren(context, this, path, ids,
+ renderedAreas);
+ } else {
+ // Use simple ajax children encoding for iterate other keys.
+ final AjaxChildrenRenderer childrenRenderer = getChildrenRenderer();
+ final String childrenPath = path + getId() + NamingContainer.SEPARATOR_CHAR;
+ ComponentVisitor ajaxVisitor = new ComponentVisitor() {
+
+ public void processComponent(FacesContext context,
+ UIComponent c, Object argument) throws IOException {
+ childrenRenderer.encodeAjaxComponent(context, c, childrenPath,
+ ids, renderedAreas);
+ }
+
+ };
+ Set ajaxKeys = getAjaxKeys();
+ if (null != ajaxKeys) {
+ captureOrigValue();
+ Object savedKey = getRowKey();
+ setRowKey(context, null);
+ Iterator fixedChildren = fixedChildren();
+ while (fixedChildren.hasNext()) {
+ UIComponent component = (UIComponent) fixedChildren.next();
+ ajaxVisitor.processComponent(context, component, null);
+ }
+ for (Iterator iter = ajaxKeys.iterator(); iter.hasNext();) {
+ Object key = (Object) iter.next();
+ ajaxVisitor.process(context, key, null);
+ }
+ setRowKey(savedKey);
+ restoreOrigValue();
+ } else {
+ iterate(context, ajaxVisitor, null);
+ }
+ }
+ }
+
+ /**
+ * Instance of default renderer in ajax responses.
+ */
+ private AjaxChildrenRenderer _childrenRenderer = null;
+
+ /**
+ * getter for simple {@link AjaxChildrenRenderer} instance in case of
+ * ajax responses. If default renderer not support search of children
+ * for encode in ajax response, component will use this instance by
+ * default.
+ *
+ * @return
+ */
+ protected AjaxChildrenRenderer getChildrenRenderer() {
+ if (_childrenRenderer == null) {
+ _childrenRenderer = new AjaxChildrenRenderer() {
+
+ protected Class getComponentClass() {
+ return UIDataAdaptor.class;
+ }
+
+ };
+
+ }
+
+ return _childrenRenderer;
+ }
+
+ /**
+ * @return Set of values for clientId's of this component, for wich was
+ * invoked "encode" methods.
+ */
+ protected Set getEncodedIds() {
+ if (_encoded == null) {
+ _encoded = new HashSet();
+ }
+
+ return _encoded;
+ }
+
+ /**
+ * Setup EL variable for different iteration. Value of row data and
+ * component state will be put into request scope attributes with names
+ * given by "var" and "varState" bean properties.
+ *
+ * @param faces
+ * current faces context
+ * @param localModel
+ * @param rowSelected
+ */
+ protected void setupVariable(FacesContext faces, DataModel localModel,
+ boolean rowSelected) {
+ Map attrs = faces.getExternalContext().getRequestMap();
+ if (rowSelected && isRowAvailable()) {
+ // Current row data.
+ setupVariable(getVar(), attrs, localModel.getRowData());
+ // Component state variable.
+ setupVariable(getStateVar(), attrs, getComponentState());
+ // Row key Data variable.
+ setupVariable(getRowKeyVar(), attrs, getRowKey());
+
+ } else {
+ removeVariable(getVar(), attrs);
+ removeVariable(getStateVar(), attrs);
+ removeVariable(getRowKeyVar(), attrs);
+ }
+ }
+
+ /**
+ * @param var
+ * @param attrs
+ * @param rowData
+ */
+ private void setupVariable(String var, Map attrs, Object rowData) {
+ if (var != null) {
+ attrs.put(var, rowData);
+ }
+ }
+
+ /**
+ * @param var
+ * @param attrs
+ * @param rowData
+ */
+ private void removeVariable(String var, Map attrs) {
+ if (var != null) {
+ attrs.remove(var);
+ }
+ }
+
+ /**
+ * Reset data model. this method must be called twice per request -
+ * before decode phase and before component encoding.
+ */
+ protected void resetDataModel() {
+ this.setExtendedDataModel(null);
+ }
+
+ /**
+ * Set data model. Model value will be stored in Map with key as current
+ * clientId for this component, to keep models between phases for same
+ * iteration in case if this component child for other UIData
+ *
+ * @param model
+ */
+ protected void setExtendedDataModel(ExtendedDataModel model) {
+ this._currentModel = model;
+ this._modelsMap.put(getBaseClientId(getFacesContext()), model);
+ }
+
+ /**
+ * Get current data model, or create it by {@link #createDataModel()}
+ * method. For different iterations in ancestor UIData ( if present )
+ * will be returned different models.
+ *
+ * @return current data model.
+ */
+ protected ExtendedDataModel getExtendedDataModel() {
+ if (this._currentModel == null) {
+ String baseClientId = getBaseClientId(getFacesContext());
+ ExtendedDataModel model = (ExtendedDataModel) this._modelsMap
+ .get(baseClientId);
+ if (null == model) {
+ model = createDataModel();
+ this._modelsMap.put(baseClientId, model);
+ }
+ this._currentModel = model;
+ }
+ return this._currentModel;
+ }
+
+ /**
+ * Hook mathod for create data model in concrete implementations.
+ *
+ * @return
+ */
+ protected abstract ExtendedDataModel createDataModel();
+
+ /**
+ * Set current state ( at most cases, visual representation ) of this
+ * component. Same as for DataModel, component will keep states for
+ * different iterations.
+ *
+ * @param state
+ */
+ public void setComponentState(DataComponentState state) {
+ this._currentState = state;
+ this._statesMap.put(getBaseClientId(getFacesContext()),
+ this._currentState);
+ }
+
+ /**
+ * @return current state of this component.
+ */
+ public DataComponentState getComponentState() {
+ DataComponentState state = null;
+ if (this._currentState == null) {
+ // Check for binding state to user bean.
+ ValueBinding valueBinding = getValueBinding(UIDataAdaptor.COMPONENT_STATE_ATTRIBUTE);
+ FacesContext facesContext = getFacesContext();
+ if (null != valueBinding) {
+ state = (DataComponentState) valueBinding
+ .getValue(facesContext);
+ if (null == state) {
+ // Create default state
+ state = createComponentState();
+ if (!valueBinding.isReadOnly(facesContext)) {
+ // Store created state in user bean.
+ valueBinding.setValue(facesContext, state);
+ }
+ }
+ } else {
+ // Check for stored state in map for parent iterations
+ String baseClientId = getBaseClientId(facesContext);
+ state = (DataComponentState) this._statesMap.get(baseClientId);
+ if (null == state) {
+ // Create default component state
+ state = createComponentState();
+ this._statesMap.put(baseClientId, state);
+ }
+ this._currentState = state;
+ }
+ } else {
+ state = this._currentState;
+ }
+ return state;
+ }
+
+ /**
+ * Hook method for create default state in concrete implementations.
+ *
+ * @return
+ */
+ protected abstract DataComponentState createComponentState();
+
+ private String _clientId = null;
+
+ public String getClientId(FacesContext faces) {
+ if (null == _clientId) {
+ StringBuffer id = new StringBuffer(getBaseClientId(faces));
+ Object rowKey = getRowKey();
+ if (rowKey != null) {
+ id.append(NamingContainer.SEPARATOR_CHAR).append(
+ rowKey.toString());
+ }
+ Renderer renderer;
+ if (null != (renderer = getRenderer(faces))) {
+ _clientId = renderer.convertClientId(faces, id.toString());
+ } else {
+ _clientId = id.toString();
+ }
+
+ }
+ return _clientId;
+ }
+
+ private String _baseClientId = null;
+
+ /**
+ * Get base clietntId of this component ( withowt iteration part )
+ *
+ * @param faces
+ * @return
+ */
+ public String getBaseClientId(FacesContext faces) {
+ // Return any previously cached client identifier
+ if (_baseClientId == null) {
+
+ // Search for an ancestor that is a naming container
+ UIComponent ancestorContainer = this;
+ StringBuffer parentIds = new StringBuffer();
+ while (null != (ancestorContainer = ancestorContainer.getParent())) {
+ if (ancestorContainer instanceof NamingContainer) {
+ parentIds.append(ancestorContainer.getClientId(faces))
+ .append(NamingContainer.SEPARATOR_CHAR);
+ break;
+ }
+ }
+ String id = getId();
+ if (null != id) {
+ _baseClientId = parentIds.append(id).toString();
+ } else {
+ _baseClientId = parentIds.append(
+ faces.getViewRoot().createUniqueId()).toString();
+ }
+ }
+ return (_baseClientId);
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.component.UIComponentBase#setId(java.lang.String)
+ */
+ public void setId(String id) {
+ // If component created by restoring tree or JSP, initial Id is null.
+ boolean haveId = null != super.getId();
+ super.setId(id);
+ _baseClientId = null;
+ _clientId = null;
+ if (haveId) {
+ // parent UIData ( if present ) will be set same Id at iteration
+ // -
+ // we use it for
+ // switch to different model and state.
+ String baseClientId = getBaseClientId(getFacesContext());
+ this._currentState = (DataComponentState) this._statesMap
+ .get(baseClientId);
+ this._currentModel = (ExtendedDataModel) this._modelsMap
+ .get(baseClientId);
+ if (null != this._currentModel) {
+ this._rowKey = this._currentModel.getRowKey();
+ // restoreChildState();
+ }
+ // Restore value for row with submitted AjaxComponent.
+ this._ajaxRowKey = _ajaxRowKeysMap.get(baseClientId);
+ }
+ }
+
+ private Object origValue;
+
+ /**
+ * Save current state of data variable.
+ */
+ public void captureOrigValue() {
+ captureOrigValue(FacesContext.getCurrentInstance());
+ }
+
+ /**
+ * Save current state of data variable.
+ *
+ * @param faces
+ * current faces context
+ */
+ public void captureOrigValue(FacesContext faces) {
+ String var = getVar();
+ if (var != null) {
+ Map attrs = faces.getExternalContext().getRequestMap();
+ this.origValue = attrs.get(var);
+ }
+ }
+
+ /**
+ * Restore value of data variable after processing phase.
+ */
+ public void restoreOrigValue() {
+ restoreOrigValue(FacesContext.getCurrentInstance());
+ }
+
+ /**
+ * Restore value of data variable after processing phase.
+ *
+ * @param faces
+ * current faces context
+ */
+ public void restoreOrigValue(FacesContext faces) {
+ String var = getVar();
+ if (var != null) {
+ Map attrs = faces.getExternalContext().getRequestMap();
+ if (this.origValue != null) {
+ attrs.put(var, this.origValue);
+ } else {
+ attrs.remove(var);
+ }
+ }
+ }
+
+ /**
+ * Saved values of {@link EditableValueHolder} fields per iterations.
+ */
+ private Map childState;
+
+ /**
+ * @param faces
+ * @return Saved values of {@link EditableValueHolder} fields per
+ * iterations.
+ */
+ protected Map getChildState(FacesContext faces) {
+ if (this.childState == null) {
+ this.childState = new HashMap();
+ }
+ String baseClientId = getBaseClientId(faces);
+ Map currentChildState = (Map) childState.get(baseClientId);
+ if (null == currentChildState) {
+ currentChildState = new HashMap();
+ childState.put(baseClientId, currentChildState);
+ }
+ return currentChildState;
+ }
+
+ /**
+ * Save values of {@link EditableValueHolder} fields before change
+ * current row.
+ *
+ * @param faces
+ */
+ protected void saveChildState(FacesContext faces) {
+
+ Iterator itr = dataChildren();
+ while (itr.hasNext()) {
+ Map childState = this.getChildState(faces);
+ this.saveChildState(faces, (UIComponent) itr.next(), childState);
+ }
+ }
+
+ /**
+ * Recursive method for Iterate on children for save
+ * {@link EditableValueHolder} fields states.
+ *
+ * @param faces
+ * @param c
+ * @param childState
+ */
+ private void saveChildState(FacesContext faces, UIComponent c,
+ Map childState) {
+
+ if (c instanceof EditableValueHolder && !c.isTransient()) {
+ String clientId = c.getClientId(faces);
+ SavedState ss = (SavedState) childState.get(clientId);
+ if (ss == null) {
+ ss = new SavedState();
+ childState.put(clientId, ss);
+ }
+ ss.populate((EditableValueHolder) c);
+ }
+
+ // continue hack
+ Iterator itr = c.getChildren().iterator();
+ while (itr.hasNext()) {
+ saveChildState(faces, (UIComponent) itr.next(), childState);
+ }
+ itr = c.getFacets().values().iterator();
+ while (itr.hasNext()) {
+ saveChildState(faces, (UIComponent) itr.next(), childState);
+ }
+ }
+
+ /**
+ * Restore values of {@link EditableValueHolder} fields after change
+ * current row.
+ *
+ * @param faces
+ */
+ protected void restoreChildState(FacesContext faces) {
+
+ Iterator itr = dataChildren();
+ while (itr.hasNext()) {
+ Map childState = this.getChildState(faces);
+ this.restoreChildState(faces, (UIComponent) itr.next(), childState);
+ }
+ }
+
+ /**
+ * Recursive part of
+ * {@link #restoreChildState(FacesContext, UIComponent, Map)}
+ *
+ * @param faces
+ * @param c
+ * @param childState
+ *
+ */
+ private void restoreChildState(FacesContext faces, UIComponent c,
+ Map childState) {
+ // reset id
+ String id = c.getId();
+ c.setId(id);
+
+ // hack
+ if (c instanceof EditableValueHolder) {
+ EditableValueHolder evh = (EditableValueHolder) c;
+ String clientId = c.getClientId(faces);
+ SavedState ss = (SavedState) childState.get(clientId);
+ if (ss != null) {
+ ss.apply(evh);
+ } else {
+ NullState.apply(evh);
+ }
+ }
+
+ // continue hack
+ Iterator itr = c.getChildren().iterator();
+ while (itr.hasNext()) {
+ restoreChildState(faces, (UIComponent) itr.next(), childState);
+ }
+ itr = c.getFacets().values().iterator();
+ while (itr.hasNext()) {
+ restoreChildState(faces, (UIComponent) itr.next(), childState);
+ }
+ }
+
+ /**
+ * Check for validation errors on children components. If true, saved
+ * values must be keep on render phase
+ *
+ * @param context
+ * @return
+ */
+ private boolean keepSaved(FacesContext context) {
+
+ Iterator clientIds = this.getChildState(context).keySet().iterator();
+ while (clientIds.hasNext()) {
+ String clientId = (String) clientIds.next();
+ Iterator messages = context.getMessages(clientId);
+ while (messages.hasNext()) {
+ FacesMessage message = (FacesMessage) messages.next();
+ if (message.getSeverity()
+ .compareTo(FacesMessage.SEVERITY_ERROR) >= 0) {
+ return (true);
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Perform iteration on all children components and all data rows with
+ * given visitor.
+ *
+ * @param faces
+ * @param visitor
+ */
+ protected void iterate(FacesContext faces, ComponentVisitor visitor,
+ Object argument) {
+
+ // stop if not rendered
+ if (!this.isRendered()) {
+ return;
+ }
+ // reset rowIndex
+ this.captureOrigValue(faces);
+ this.setRowKey(faces, null);
+ try {
+ Iterator fixedChildren = fixedChildren();
+ while (fixedChildren.hasNext()) {
+ UIComponent component = (UIComponent) fixedChildren.next();
+ visitor.processComponent(faces, component, argument);
+ }
+
+ walk(faces, visitor, argument);
+ } catch (Exception e) {
+ throw new FacesException(e);
+ } finally {
+ this.setRowKey(faces, null);
+ this.restoreOrigValue(faces);
+ }
+ }
+
+ /**
+ * Walk ( visit ) this component on all data-avare children for each
+ * row.
+ *
+ * @param faces
+ * @param visitor
+ * @throws IOException
+ */
+ public void walk(FacesContext faces, DataVisitor visitor, Object argument)
+ throws IOException {
+ getExtendedDataModel().walk(faces, visitor,
+ getComponentState().getRange(), argument);
+ }
+
+ protected void processDecodes(FacesContext faces, Object argument) {
+ if (!this.isRendered())
+ return;
+ this.resetComponent(faces);
+ this.iterate(faces, decodeVisitor, argument);
+ this.decode(faces);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.component.UIData#processDecodes(javax.faces.context.FacesContext)
+ */
+ public void processDecodes(FacesContext faces) {
+ processDecodes(faces, null);
+ }
+
+ /**
+ * Reset per-request fields in component.
+ *
+ * @param faces
+ *
+ */
+ protected void resetComponent(FacesContext faces) {
+ // resetDataModel();
+ if (null != this.childState) {
+ childState.remove(getBaseClientId(faces));
+ }
+ this._encoded = null;
+ }
+
+ protected void processUpdates(FacesContext faces, Object argument) {
+ if (!this.isRendered())
+ return;
+ this.iterate(faces, updateVisitor, argument);
+ ExtendedDataModel dataModel = getExtendedDataModel();
+ // If no validation errors, update values for serializable model,
+ // restored from view.
+ if (dataModel instanceof SerializableDataModel && (!keepSaved(faces))) {
+ SerializableDataModel serializableModel = (SerializableDataModel) dataModel;
+ serializableModel.update();
+ }
+ }
+
+ public void processUpdates(FacesContext faces) {
+ processUpdates(faces, null);
+ }
+
+ protected void processValidators(FacesContext faces, Object argument) {
+ if (!this.isRendered())
+ return;
+ this.iterate(faces, validateVisitor, argument);
+ }
+
+ public void processValidators(FacesContext faces) {
+ processValidators(faces, null);
+ }
+
+ public void encodeBegin(FacesContext context) throws IOException {
+ resetDataModel();
+ // if(!keepSaved(context)){
+ // childState.remove(getBaseClientId(context));
+ // }
+ // Mark component as used, if parent UIData change own range states not
+ // accessed at
+ // encode phase must be unsaved.
+ getEncodedIds().add(getBaseClientId(context));
+ // getComponentState().setUsed(true);
+ super.encodeBegin(context);
+ }
+
+ /**
+ * This method must create iterator for all non-data avare children of
+ * this component ( header/footer facets for components and columns in
+ * dataTable, facets for tree etc.
+ *
+ * @return iterator for all components not sensitive for row data.
+ */
+ protected abstract Iterator fixedChildren();
+
+ /**
+ * This method must create iterator for all children components,
+ * processed "per row" It can be children of UIColumn in dataTable,
+ * nodes in tree
+ *
+ * @return iterator for all components processed per row.
+ */
+ protected abstract Iterator dataChildren();
+
+ private final static SavedState NullState = new SavedState();
+
+ // from RI
+ /**
+ * This class keep values of {@link EditableValueHolder} row-sensitive
+ * fields.
+ *
+ * @author shura
+ *
+ */
+ private final static class SavedState implements Serializable {
+
+ private Object submittedValue;
+
+ private static final long serialVersionUID = 2920252657338389849L;
+
+ Object getSubmittedValue() {
+ return (this.submittedValue);
+ }
+
+ void setSubmittedValue(Object submittedValue) {
+ this.submittedValue = submittedValue;
+ }
+
+ private boolean valid = true;
+
+ boolean isValid() {
+ return (this.valid);
+ }
+
+ void setValid(boolean valid) {
+ this.valid = valid;
+ }
+
+ private Object value;
+
+ Object getValue() {
+ return (this.value);
+ }
+
+ public void setValue(Object value) {
+ this.value = value;
+ }
+
+ private boolean localValueSet;
+
+ boolean isLocalValueSet() {
+ return (this.localValueSet);
+ }
+
+ public void setLocalValueSet(boolean localValueSet) {
+ this.localValueSet = localValueSet;
+ }
+
+ public String toString() {
+ return ("submittedValue: " + submittedValue + " value: " + value
+ + " localValueSet: " + localValueSet);
+ }
+
+ public void populate(EditableValueHolder evh) {
+ this.value = evh.getLocalValue();
+ this.valid = evh.isValid();
+ this.submittedValue = evh.getSubmittedValue();
+ this.localValueSet = evh.isLocalValueSet();
+ }
+
+ public void apply(EditableValueHolder evh) {
+ evh.setValue(this.value);
+ evh.setValid(this.valid);
+ evh.setSubmittedValue(this.submittedValue);
+ evh.setLocalValueSet(this.localValueSet);
+ }
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.component.UIData#queueEvent(javax.faces.event.FacesEvent)
+ */
+ public void queueEvent(FacesEvent event) {
+ if (event.getComponent() != this) {
+ event = new IndexedEvent(this, event, getRowKey());
+ }
+ // Send event directly to parent, to avoid wrapping in superclass.
+ UIComponent parent = getParent();
+ if (parent == null) {
+ throw new IllegalStateException(
+ "No parent component for queue event");
+ } else {
+ parent.queueEvent(event);
+ }
+ }
+
+ public void broadcast(FacesEvent event) throws AbortProcessingException {
+
+ if (!(event instanceof IndexedEvent)) {
+ if (!broadcastLocal(event)) {
+ super.broadcast(event);
+ }
+ return;
+ }
+
+ // Set up the correct context and fire our wrapped event
+ IndexedEvent revent = (IndexedEvent) event;
+ Object oldRowKey = getRowKey();
+ FacesContext faces = FacesContext.getCurrentInstance();
+ captureOrigValue(faces);
+ Object eventRowKey = revent.getKey();
+ setRowKey(faces, eventRowKey);
+ FacesEvent rowEvent = revent.getTarget();
+ rowEvent.getComponent().broadcast(rowEvent);
+ // For Ajax events, keep row value.
+ if (!(rowEvent.getPhaseId() == PhaseId.RENDER_RESPONSE)) {
+ this._ajaxRowKey = eventRowKey;
+ this._ajaxRowKeysMap.put(getBaseClientId(faces), eventRowKey);
+ }
+ setRowKey(faces, oldRowKey);
+ restoreOrigValue(faces);
+ // }
+ return;
+ }
+
+ /**
+ * Process events targetted for concrete implementation. Hook method
+ * called from {@link #broadcast(FacesEvent)}
+ *
+ * @param event -
+ * processed event.
+ * @return true if event processed, false if component must continue
+ * processing.
+ */
+ protected boolean broadcastLocal(FacesEvent event) {
+ return false;
+ }
+
+ /**
+ * Wrapper for event from child component, with value of current row
+ * key.
+ *
+ * @author shura
+ *
+ */
+ protected static final class IndexedEvent extends FacesEvent {
+
+ private static final long serialVersionUID = -8318895390232552385L;
+
+ private final FacesEvent target;
+
+ private final Object key;
+
+ public IndexedEvent(UIDataAdaptor owner, FacesEvent target, Object key) {
+ super(owner);
+ this.target = target;
+ this.key = key;
+ }
+
+ public PhaseId getPhaseId() {
+ return (this.target.getPhaseId());
+ }
+
+ public void setPhaseId(PhaseId phaseId) {
+ this.target.setPhaseId(phaseId);
+ }
+
+ public boolean isAppropriateListener(FacesListener listener) {
+ return this.target.isAppropriateListener(listener);
+ }
+
+ public void processListener(FacesListener listener) {
+ UIDataAdaptor owner = (UIDataAdaptor) this.getComponent();
+ Object prevIndex = owner._rowKey;
+ try {
+ owner.setRowKey(this.key);
+ this.target.processListener(listener);
+ } finally {
+ owner.setRowKey(prevIndex);
+ }
+ }
+
+ public Object getKey() {
+ return key;
+ }
+
+ public FacesEvent getTarget() {
+ return target;
+ }
+
+ }
+
+ /**
+ * "memento" pattern class for state of component.
+ *
+ * @author shura
+ *
+ */
+ private static class DataState implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 17070532L;
+
+ private Object superState;
+
+ private Map componentStates = new HashMap();
+
+ private Set ajaxKeys;
+
+ public String rowKeyVar;
+
+ public String stateVar;
+
+ }
+
+ /**
+ * Serialisable model and component state per iteration of parent
+ * UIData.
+ *
+ * @author shura
+ *
+ */
+ private static class PerIdState implements Serializable {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 9037454770537726418L;
+
+ /**
+ * Flag setted to true if componentState implements StateHolder
+ */
+ private boolean stateInHolder = false;
+
+ /**
+ * Serializable componentState or
+ */
+ private Object componentState;
+
+ private SerializableDataModel model;
+ }
+
+ public void restoreState(FacesContext faces, Object object) {
+ DataState state = (DataState) object;
+ super.restoreState(faces, state.superState);
+ this._ajaxKeys = state.ajaxKeys;
+ this._statesMap = new HashMap();
+ this._rowKeyVar = state.rowKeyVar;
+ this._stateVar = state.stateVar;
+ // Restore serializable models and component states for all rows of
+ // parent UIData ( single if this
+ // component not child of iterable )
+ for (Iterator iter = state.componentStates.entrySet().iterator(); iter
+ .hasNext();) {
+ Map.Entry stateEntry = (Map.Entry) iter.next();
+ PerIdState idState = (PerIdState) stateEntry.getValue();
+ DataComponentState compState;
+ if (idState.stateInHolder) {
+ // TODO - change RichFaces Tree component, for remove reference
+ // to component from state.
+ compState = createComponentState();
+ ((StateHolder) compState).restoreState(faces,
+ idState.componentState);
+ } else {
+ compState = (DataComponentState) idState.componentState;
+ }
+ Object key = stateEntry.getKey();
+ this._statesMap.put(key, compState);
+ this._modelsMap.put(key, idState.model);
+ }
+ }
+
+ public Object saveState(FacesContext faces) {
+ DataState state = new DataState();
+ state.superState = super.saveState(faces);
+ state.ajaxKeys = this._ajaxKeys;
+ state.rowKeyVar = this._rowKeyVar;
+ state.stateVar = this._stateVar;
+ Set encodedIds = getEncodedIds();
+ // Save all states of component and data model for all valies of
+ // clientId, encoded in this request.
+ for (Iterator iter = this._statesMap.entrySet().iterator(); iter
+ .hasNext();) {
+ Map.Entry stateEntry = (Map.Entry) iter.next();
+ DataComponentState dataComponentState = ((DataComponentState) stateEntry
+ .getValue());
+ Object stateKey = stateEntry.getKey();
+ if (encodedIds.isEmpty() || encodedIds.contains(stateKey)) {
+ PerIdState idState = new PerIdState();
+ idState.model = getExtendedDataModel().getSerializableModel(
+ dataComponentState.getRange());
+ // Save component state , depended if implemented interfaces.
+ if (null == dataComponentState) {
+ idState.componentState = null;
+ } else if (dataComponentState instanceof Serializable) {
+ idState.componentState = dataComponentState;
+ } else if (dataComponentState instanceof StateHolder) {
+ // TODO - change RichFaces Tree component, for remove
+ // reference to component from state.
+ // Change this code to reference for saveAttachedState.
+ idState.componentState = ((StateHolder) dataComponentState)
+ .saveState(faces);
+ idState.stateInHolder = true;
+ }
+ if (null != idState.model || null != idState.componentState) {
+ state.componentStates.put(stateKey, idState);
+ }
+ }
+ }
+ return state;
+ }
+
+ public void setParent(UIComponent parent) {
+ super.setParent(parent);
+ this._clientId = null;
+ this._baseClientId = null;
+ }
+
+
+}
Copied: trunk/ui/core/src/main/java/org/ajax4jsf/component/UIInclude.java (from rev 1512, trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIInclude.java)
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/component/UIInclude.java (rev 0)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/component/UIInclude.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -0,0 +1,301 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.ajax4jsf.component;
+
+import javax.faces.component.NamingContainer;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIComponentBase;
+import javax.faces.context.FacesContext;
+import javax.faces.el.ValueBinding;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.FacesListener;
+import javax.faces.event.PhaseId;
+
+import org.ajax4jsf.context.AjaxContext;
+import org.ajax4jsf.context.ViewIdHolder;
+
+/**
+ * @author shura
+ *
+ */
+public abstract class UIInclude extends UIComponentBase implements
+ ViewIdHolder, NamingContainer, AjaxOutput {
+
+ public static final String COMPONENT_TYPE = "org.ajax4jsf.Include";
+
+ public static final String LAYOUT_NONE ="none";
+
+ public static final String LAYOUT_BLOCK ="block";
+ public static final String LAYOUT_INLINE ="inline";
+
+ private boolean wasNavigation = false;
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.framework.ajax.ViewIdHolder#skipNavigation(java.lang.String)
+ */
+ public boolean skipNavigation(String ViewId) {
+ wasNavigation = true;
+ return true;
+ }
+
+ private String _viewId = null;
+
+ /*
+ * viewId for included page. Setter for viewId @param viewId - new value
+ */
+ public void setViewId(String __viewId) {
+ ValueBinding vb = getValueBinding("viewId");
+ FacesContext facesContext = getFacesContext();
+ if (null != vb && (!vb.isReadOnly(facesContext))) {
+ // Change value of viewId in backed bean, if possible.
+ vb.setValue(facesContext, __viewId);
+ } else {
+ this._viewId = __viewId;
+ }
+ }
+
+ /*
+ * viewId for included page. Getter for viewId @return viewId value from
+ * local variable or value bindings
+ */
+ public String getViewId() {
+ if (null != this._viewId) {
+ return this._viewId;
+ }
+ ValueBinding vb = getValueBinding("viewId");
+ if (null != vb) {
+ return (String) vb.getValue(getFacesContext());
+ } else {
+ return null;
+ }
+ }
+
+ private String _layout = null;
+
+ /**
+ * @return the layout
+ */
+ public String getLayout() {
+ if (null != this._layout) {
+ return this._layout;
+ }
+ ValueBinding vb = getValueBinding("layout");
+ if (null != vb) {
+ return (String) vb.getValue(getFacesContext());
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * @param layout the layout to set
+ */
+ public void setLayout(String layout) {
+ _layout = layout;
+ }
+
+
+ public boolean isAjaxRendered() {
+ return (!LAYOUT_NONE.equals(getLayout())) && wasNavigation;
+ }
+
+ public void setAjaxRendered(boolean ajaxRendered) {
+ // unsupported
+ }
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.component.UIComponentBase#broadcast(javax.faces.event.FacesEvent)
+ */
+ public void broadcast(FacesEvent event) throws AbortProcessingException {
+ if (event instanceof EventWrapper) {
+ FacesEvent wrapped = ((EventWrapper) event).getWrapped();
+ FacesContext context = getFacesContext();
+ ViewIdHolder holder = setupNavigation(context);
+ wrapped.getComponent().broadcast(wrapped);
+ restoreNavigation(context, holder);
+ } else {
+ super.broadcast(event);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.component.UIComponentBase#processDecodes(javax.faces.context.FacesContext)
+ */
+ public void processDecodes(FacesContext context) {
+ wasNavigation = false;
+ ViewIdHolder holder = setupNavigation(context);
+ super.processDecodes(context);
+ restoreNavigation(context, holder);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.component.UIComponentBase#processUpdates(javax.faces.context.FacesContext)
+ */
+ public void processUpdates(FacesContext context) {
+ ViewIdHolder holder = setupNavigation(context);
+ super.processUpdates(context);
+ restoreNavigation(context, holder);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.component.UIComponentBase#processValidators(javax.faces.context.FacesContext)
+ */
+ public void processValidators(FacesContext context) {
+ ViewIdHolder holder = setupNavigation(context);
+ super.processValidators(context);
+ restoreNavigation(context, holder);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.component.UIComponentBase#queueEvent(javax.faces.event.FacesEvent)
+ */
+ public void queueEvent(FacesEvent event) {
+ EventWrapper wrapper = new EventWrapper(this, event);
+ super.queueEvent(wrapper);
+ }
+
+
+ /* (non-Javadoc)
+ * @see javax.faces.component.UIComponentBase#restoreState(javax.faces.context.FacesContext, java.lang.Object)
+ */
+ public void restoreState(FacesContext context, Object state) {
+ Object[] componentState = (Object[]) state;
+ super.restoreState(context, componentState[0]);
+ this._viewId = (String) componentState[1];
+ this._layout = (String) componentState[2];
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.component.UIComponentBase#saveState(javax.faces.context.FacesContext)
+ */
+ public Object saveState(FacesContext context) {
+ Object[] componentState = new Object[3];
+ componentState[0] = super.saveState(context);
+ componentState[1] = _viewId;
+ componentState[2] = _layout;
+ return componentState;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.component.UIComponent#getFamily()
+ */
+ public String getFamily() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ private ViewIdHolder setupNavigation(FacesContext context) {
+ AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
+ ViewIdHolder viewIdHolder = ajaxContext.getViewIdHolder();
+ ajaxContext.setViewIdHolder(this);
+ return viewIdHolder;
+ }
+
+ private void restoreNavigation(FacesContext context, ViewIdHolder viewIdHolder) {
+ AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
+ ajaxContext.setViewIdHolder(viewIdHolder);
+// if (wasNavigation) {
+// // Clear children to avoid have different components with same id
+// getChildren().clear();
+// }
+ }
+
+ private static class EventWrapper extends FacesEvent {
+
+ private FacesEvent wrapped;
+
+ public EventWrapper(UIComponent component, FacesEvent wrapped) {
+ super(component);
+ this.wrapped = wrapped;
+ }
+
+ /**
+ * @return
+ * @see javax.faces.event.FacesEvent#getPhaseId()
+ */
+ public PhaseId getPhaseId() {
+ return wrapped.getPhaseId();
+ }
+
+ /**
+ * @param listener
+ * @return
+ * @see javax.faces.event.FacesEvent#isAppropriateListener(javax.faces.event.FacesListener)
+ */
+ public boolean isAppropriateListener(FacesListener listener) {
+ return wrapped.isAppropriateListener(listener);
+ }
+
+ /**
+ * @param listener
+ * @see javax.faces.event.FacesEvent#processListener(javax.faces.event.FacesListener)
+ */
+ public void processListener(FacesListener listener) {
+ wrapped.processListener(listener);
+ }
+
+ /**
+ *
+ * @see javax.faces.event.FacesEvent#queue()
+ */
+ public void queue() {
+ wrapped.queue();
+ }
+
+ /**
+ * @param phaseId
+ * @see javax.faces.event.FacesEvent#setPhaseId(javax.faces.event.PhaseId)
+ */
+ public void setPhaseId(PhaseId phaseId) {
+ wrapped.setPhaseId(phaseId);
+ }
+
+ /**
+ * @return the wrapped
+ */
+ public FacesEvent getWrapped() {
+ return wrapped;
+ }
+ }
+
+ /**
+ * @return the wasNavigation
+ */
+ public boolean isWasNavigation() {
+ return wasNavigation;
+ }
+
+
+}
Added: trunk/ui/core/src/main/java/org/ajax4jsf/component/UILoadBundle.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/component/UILoadBundle.java (rev 0)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/component/UILoadBundle.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -0,0 +1,128 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.ajax4jsf.component;
+
+import java.io.IOException;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import javax.faces.component.UIComponentBase;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.Messages;
+import org.ajax4jsf.ajax.ResourceBundleMap;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * @author shura
+ *
+ */
+public abstract class UILoadBundle extends UIComponentBase implements AjaxLoadBundleComponent {
+
+ public static final String COMPONENT_FAMILY = "org.ajax4jsf.Bundle";
+
+ public static final String COMPONENT_TYPE = "org.ajax4jsf.Bundle";
+
+ private static final Log _log = LogFactory.getLog(UILoadBundle.class);
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.component.UIComponent#getFamily()
+ */
+ public String getFamily() {
+ // TODO Auto-generated method stub
+ return COMPONENT_FAMILY;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.component.UIComponentBase#encodeBegin(javax.faces.context.FacesContext)
+ */
+ public void encodeBegin(FacesContext context) throws IOException {
+ loadBundle(context);
+
+ }
+
+ public void decode(FacesContext context) {
+ loadBundle(context);
+ }
+ /**
+ * @param context
+ */
+ public void loadBundle(FacesContext context) {
+ UIViewRoot viewRoot = context.getViewRoot();
+ Locale locale = viewRoot.getLocale();
+ if (locale == null) {
+ locale = context.getApplication().getDefaultLocale();
+ }
+
+ ResourceBundle bundle;
+ try {
+ bundle = ResourceBundle.getBundle(getBasename(), locale, Thread
+ .currentThread().getContextClassLoader());
+ } catch (MissingResourceException e) {
+ _log.error(Messages.getMessage(Messages.COULD_NOT_LOAD_RESOURCE_BUNDLE, getBasename()));
+ return;
+ }
+
+ context.getExternalContext().getRequestMap().put(getVar(),
+ new ResourceBundleMap(bundle));
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.component.UIComponentBase#getRendererType()
+ */
+ public String getRendererType() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /**
+ * @return Returns the basename.
+ */
+ public abstract String getBasename();
+
+ /**
+ * @param basename
+ * The basename to set.
+ */
+ public abstract void setBasename(String basename);
+
+ /**
+ * @return Returns the var.
+ */
+ public abstract String getVar();
+
+ /**
+ * @param var
+ * The var to set.
+ */
+ public abstract void setVar(String var);
+
+}
Copied: trunk/ui/core/src/main/java/org/ajax4jsf/component/UIMediaOutput.java (from rev 1512, trunk/ui/core/src/main/java/org/ajax4jsf/ajax/resource/UIMediaOutput.java)
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/component/UIMediaOutput.java (rev 0)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/component/UIMediaOutput.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -0,0 +1,61 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.ajax4jsf.component;
+
+import javax.faces.component.UIOutput;
+
+import org.ajax4jsf.resource.ResourceComponent;
+
+/**
+ * @author shura
+ *
+ */
+public abstract class UIMediaOutput extends UIOutput implements ResourceComponent {
+
+ public static final String COMPONENT_TYPE = "org.ajax4jsf.MMedia";
+
+ /**
+ * Get URI attribute for resource ( src for images, href for links etc ).
+ * @return
+ */
+ public abstract String getUriAttribute();
+
+ /**
+ * Set URI attribute for resource ( src for images, href for links etc ).
+ * @param newvalue
+ */
+ public abstract void setUriAttribute(String newvalue);
+
+ /**
+ * Get Element name for rendering ( imj , a , object, applet ).
+ * @return
+ */
+ public abstract String getElement();
+
+ /**
+ * Set Element name for rendering ( imj , a , object, applet ).
+ * @param newvalue
+ */
+ public abstract void setElement(String newvalue);
+
+
+}
Copied: trunk/ui/core/src/main/java/org/ajax4jsf/component/UIPoll.java (from rev 1512, trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIPoll.java)
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/component/UIPoll.java (rev 0)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/component/UIPoll.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -0,0 +1,75 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.ajax4jsf.component;
+
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.context.AjaxContext;
+
+/**
+ * Component for periodically call AJAX events on server ( poll actions )
+ * @author shura
+ *
+ */
+public abstract class UIPoll extends AjaxActionComponent {
+
+ public static final String COMPONENT_TYPE="org.ajax4jsf.Poll";
+
+
+ private transient boolean _submitted = false;
+
+ /**
+ * @return the submitted
+ */
+ public boolean isSubmitted() {
+ return _submitted;
+ }
+
+
+ /**
+ * @param submitted the submitted to set
+ */
+ public void setSubmitted(boolean submitted) {
+ _submitted = submitted;
+ }
+
+ /**
+ * @return time in mc for polling interval.
+ */
+ public abstract int getInterval();
+
+ /**
+ * @param interval time in mc for polling interval.
+ */
+ public abstract void setInterval(int interval);
+
+ public abstract boolean isEnabled();
+
+ public abstract void setEnabled(boolean enable);
+
+ protected void setupReRender(FacesContext facesContext) {
+ super.setupReRender(facesContext);
+ AjaxContext.getCurrentInstance(facesContext).addComponentToAjaxRender(this);
+ }
+
+
+}
Copied: trunk/ui/core/src/main/java/org/ajax4jsf/component/UIPortlet.java (from rev 1512, trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIPortlet.java)
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/component/UIPortlet.java (rev 0)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/component/UIPortlet.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -0,0 +1,66 @@
+/**
+ *
+ */
+package org.ajax4jsf.component;
+
+import java.lang.reflect.Method;
+
+import javax.faces.component.NamingContainer;
+import javax.faces.component.UIComponentBase;
+import javax.faces.context.FacesContext;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class UIPortlet extends UIComponentBase implements NamingContainer {
+
+ private static final Log _log = LogFactory.getLog(UIPortlet.class);
+ /**
+ * <p>The standard component type for this component.</p>
+ */
+ public static final String COMPONENT_TYPE = "org.ajax4jsf.Portlet";
+
+
+ /**
+ * <p>The standard component family for this component.</p>
+ */
+ public static final String COMPONENT_FAMILY = "org.ajax4jsf.Portlet";
+
+ /* (non-Javadoc)
+ * @see javax.faces.component.UIComponent#getFamily()
+ */
+ public String getFamily() {
+ // TODO Auto-generated method stub
+ return COMPONENT_FAMILY;
+ }
+
+ private String portletId = null;
+
+ // ----------------------------------------------------- UIComponent Methods
+ public String getClientId(FacesContext context) {
+ if (portletId == null) {
+ Object response = context.getExternalContext().getResponse();
+ Class portletResponseClass = response.getClass();
+ // Class.forName is used instead of instanceof to account for the case
+ // where the porletPage tag is used in a webapp and portlet.jar is not
+ // in classpath. In that scenario it will prevent ClassNotFoundException.
+ try {
+ Method method = portletResponseClass.getMethod("getNamespace", new Class[]{});
+ portletId = (String) method.invoke(response, new Object[]{});
+ } catch (Exception e) {
+ if(_log.isDebugEnabled()){
+ _log.debug("Response is not a portlet RenderResponse");
+ }
+ }
+ if(null == portletId){
+ return super.getClientId(context);
+ }
+ }
+ return portletId;
+ }
+
+}
Copied: trunk/ui/core/src/main/java/org/ajax4jsf/component/UIPush.java (from rev 1512, trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIPush.java)
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/component/UIPush.java (rev 0)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/component/UIPush.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -0,0 +1,110 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.ajax4jsf.component;
+
+import java.io.IOException;
+
+import javax.faces.component.NamingContainer;
+import javax.faces.context.FacesContext;
+import javax.faces.el.MethodBinding;
+import javax.servlet.http.HttpSession;
+
+import org.ajax4jsf.ajax.PushEventsCounter;
+import org.ajax4jsf.framework.ajax.xmlfilter.PollEventsManager;
+
+/**
+ * Component for periodically call AJAX events on server ( poll actions )
+ * @author shura
+ *
+ */
+public abstract class UIPush extends AjaxActionComponent {
+
+ public static final String COMPONENT_TYPE="org.ajax4jsf.Push";
+
+
+ private transient boolean _submitted = false;
+
+ /**
+ * @return the submitted
+ */
+ public boolean isSubmitted() {
+ return _submitted;
+ }
+
+ public void encodeBegin(FacesContext context) throws IOException {
+ MethodBinding producer = getEventProducer();
+ // Subscribe events producer to push status listener.
+ if(null != producer){
+ producer.invoke(context, new Object[]{getListener(context)});
+ }
+ super.encodeBegin(context);
+ }
+
+ private PushEventsCounter getListener(FacesContext context){
+ PollEventsManager eventsManeger = (PollEventsManager) context.getExternalContext().getApplicationMap().get(PollEventsManager.EVENTS_MANAGER_KEY);
+ return eventsManeger.getListener(getListenerId(context));
+ }
+
+ public String getListenerId(FacesContext context){
+ Object session = context.getExternalContext().getSession(false);
+ StringBuffer id = new StringBuffer();
+ if(null != session && session instanceof HttpSession){
+ HttpSession httpSession = (HttpSession) session;
+ id.append(httpSession.getId());
+ }
+ id.append(context.getViewRoot().getViewId());
+ id.append(NamingContainer.SEPARATOR_CHAR);
+ id.append(getClientId(context));
+ return id.toString();
+ }
+ /**
+ * @param submitted the submitted to set
+ */
+ public void setSubmitted(boolean submitted) {
+ _submitted = submitted;
+ }
+
+ public abstract MethodBinding getEventProducer();
+
+ public abstract void setEventProducer(MethodBinding producer);
+ /**
+ * @return time in mc for polling interval.
+ */
+ public abstract int getInterval();
+
+ /**
+ * @param interval time in mc for polling interval.
+ */
+ public abstract void setInterval(int interval);
+
+ public abstract boolean isEnabled();
+
+ public abstract void setEnabled(boolean enable);
+
+ protected void setupReRender(FacesContext facesContext) {
+ super.setupReRender(facesContext);
+// AjaxContext.getCurrentInstance(facesContext).addComponentToAjaxRender(this);
+ //getListener(facesContext).processed();
+ }
+
+
+}
Copied: trunk/ui/core/src/main/java/org/ajax4jsf/component/UIRepeat.java (from rev 1512, trunk/ui/core/src/main/java/org/ajax4jsf/ajax/repeat/UIRepeat.java)
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/component/UIRepeat.java (rev 0)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/component/UIRepeat.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -0,0 +1,142 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.ajax4jsf.component;
+
+import java.sql.ResultSet;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.faces.context.FacesContext;
+import javax.faces.model.ArrayDataModel;
+import javax.faces.model.DataModel;
+import javax.faces.model.ListDataModel;
+import javax.faces.model.ResultDataModel;
+import javax.faces.model.ResultSetDataModel;
+import javax.faces.model.ScalarDataModel;
+import javax.servlet.jsp.jstl.sql.Result;
+
+import org.ajax4jsf.model.DataComponentState;
+import org.ajax4jsf.model.ExtendedDataModel;
+import org.ajax4jsf.model.Range;
+import org.ajax4jsf.model.SequenceDataModel;
+import org.ajax4jsf.model.SequenceRange;
+/**
+ * @author shura
+ *
+ */
+public class UIRepeat extends UIDataAdaptor {
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.ajax.repeat.UIDataAdaptor#createComponentState()
+ */
+ protected DataComponentState createComponentState() {
+ // Create component state based on this instance.
+ return new DataComponentState(){
+
+ public Range getRange() {
+ return new SequenceRange(getFirst(),getRows());
+ }
+
+ public boolean isTransient() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public void restoreState(FacesContext arg0, Object arg1) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public Object saveState(FacesContext arg0) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void setTransient(boolean arg0) {
+ // TODO Auto-generated method stub
+
+ }
+ };
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.ajax.repeat.UIDataAdaptor#createDataModel()
+ */
+ protected ExtendedDataModel createDataModel() {
+ return (ExtendedDataModel) getDataModel();
+ }
+
+ protected DataModel getDataModel(){
+ // Synthesize a DataModel around our current value if possible
+ // TODO - for jsf 1.2 use method from superclass ?
+ Object current = getValue();
+ DataModel model;
+ if (current == null) {
+ model = new SequenceDataModel(new ListDataModel(Collections.EMPTY_LIST));
+ } else if (current instanceof ExtendedDataModel) {
+ model = (DataModel) current;
+ } else if (current instanceof DataModel) {
+ model = new SequenceDataModel((DataModel) current);
+ } else if (current instanceof List) {
+ model = new SequenceDataModel(new ListDataModel((List) current));
+ } else if (Object[].class.isAssignableFrom(current.getClass())) {
+ model = new SequenceDataModel(new ArrayDataModel((Object[]) current));
+ } else if (current instanceof ResultSet) {
+ model = new SequenceDataModel(new ResultSetDataModel((ResultSet) current));
+ } else if (current instanceof Result) {
+ model = new SequenceDataModel(new ResultDataModel((Result) current));
+ } else {
+ model = new SequenceDataModel(new ScalarDataModel(current));
+ }
+ return (model);
+ }
+
+ protected void setDataModel(DataModel model) {
+ ExtendedDataModel iterableModel;
+ if( null == model){
+ iterableModel = null;
+ } else if (model instanceof ExtendedDataModel) {
+ iterableModel = (ExtendedDataModel) model;
+ } else {
+ iterableModel = new SequenceDataModel(model);
+ }
+ setExtendedDataModel(iterableModel);
+ }
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.ajax.repeat.UIDataAdaptor#dataChildren()
+ */
+ protected Iterator dataChildren() {
+ // TODO Auto-generated method stub
+ return getChildren().iterator();
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.ajax.repeat.UIDataAdaptor#fixedChildren()
+ */
+ protected Iterator fixedChildren() {
+ // TODO Auto-generated method stub
+ return getFacets().values().iterator();
+ }
+
+}
Copied: trunk/ui/core/src/main/java/org/ajax4jsf/component/UIResource.java (from rev 1512, trunk/ui/core/src/main/java/org/ajax4jsf/ajax/UIResource.java)
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/component/UIResource.java (rev 0)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/component/UIResource.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -0,0 +1,49 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.ajax4jsf.component;
+
+import javax.faces.component.UIComponentBase;
+
+/**
+ * JSF component class
+ *
+ */
+public abstract class UIResource extends UIComponentBase {
+
+ public static final String COMPONENT_TYPE = "org.ajax4jsf.Resource";
+
+ public static final String COMPONENT_FAMILY = "org.ajax4jsf.Resource";
+
+ /**
+ * Get name of script to load
+ * @parameter
+ * @return the acceptClass
+ */
+ public abstract Object getSrc();
+
+ /**
+ * @param newSrc the value to set
+ */
+ public abstract void setSrc(Object newSrc);
+
+
+}
Copied: trunk/ui/core/src/main/java/org/ajax4jsf/component/UISelector.java (from rev 1512, trunk/ui/core/src/main/java/org/ajax4jsf/ajax/repeat/UISelector.java)
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/component/UISelector.java (rev 0)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/component/UISelector.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -0,0 +1,115 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.ajax4jsf.component;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.faces.FacesException;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIComponentBase;
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.component.AjaxDataEncoder;
+import org.ajax4jsf.framework.renderer.AjaxChildrenRenderer;
+import org.apache.commons.beanutils.PropertyUtils;
+
+/**
+ * Base class for component, performed AJAX encoding on selected values in
+ * iterable components ( UIData, trees etc )
+ *
+ * @author shura
+ *
+ */
+public abstract class UISelector extends UIComponentBase implements
+ AjaxDataEncoder {
+
+ private static final AjaxChildrenRenderer childrenRenderer = new AjaxChildrenRenderer() {
+
+ protected Class getComponentClass() {
+ return UISelector.class;
+ }
+
+ };
+
+ /**
+ * Name of serRow ( or simple ) method for setup current value in iterable
+ * component
+ *
+ * @parameter
+ * @return the acceptClass
+ */
+ public abstract String getIterationProperty();
+
+ /**
+ * @param newSelectMethod
+ * the value to set
+ */
+ public abstract void setIterationProperty(String newSelectMethod);
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.framework.ajax.AjaxChildrenEncoder#encodeAjaxChild(javax.faces.context.FacesContext,
+ * java.lang.String, java.util.Set, java.util.Set)
+ */
+ public void encodeAjaxChild(FacesContext context, String path, Set ids,
+ Set renderedAreas) throws IOException {
+ if (getChildCount() != 1) {
+ throw new FacesException(
+ "Selector component must have one, and only one, child");
+ }
+ UIComponent child = (UIComponent) getChildren().get(0);
+ Set ajaxKeys = getAjaxKeys();
+ if (null != ajaxKeys) {
+ String iterationProperty = getIterationProperty();
+ try {
+ Object savedKey = PropertyUtils.getProperty(child,
+ iterationProperty);
+ for (Iterator iter = ajaxKeys.iterator(); iter.hasNext();) {
+ Object key = (Object) iter.next();
+ PropertyUtils.setProperty(child, iterationProperty, key);
+ if (true) {
+ childrenRenderer.encodeAjaxChildren(context, this, path,
+ ids, renderedAreas);
+ }
+
+ }
+ PropertyUtils.setProperty(child, iterationProperty, savedKey);
+
+ } catch (IllegalAccessException e) {
+ throw new FacesException(
+ "Illegal access to iteration selection property "+iterationProperty+" on component "+child.getClientId(context),e);
+ } catch (InvocationTargetException e) {
+ throw new FacesException(
+ "Error in iteration selection property "+iterationProperty+" on component "+child.getClientId(context),e.getCause());
+ } catch (NoSuchMethodException e) {
+ throw new FacesException(
+ "No iteration selection property "+iterationProperty+" on component "+child.getClientId(context),e);
+ }
+ }
+
+ }
+
+}
Modified: trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/AjaxFunctionRendererBase.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/AjaxFunctionRendererBase.java 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/AjaxFunctionRendererBase.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -29,7 +29,7 @@
import javax.faces.component.UIParameter;
import javax.faces.context.FacesContext;
-import org.ajax4jsf.ajax.UIAjaxFunction;
+import org.ajax4jsf.component.UIAjaxFunction;
import org.ajax4jsf.framework.renderer.AjaxRendererUtils;
import org.ajax4jsf.javascript.JSFunction;
import org.ajax4jsf.javascript.JSFunctionDefinition;
Modified: trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/LoadResourceRendererBase.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/LoadResourceRendererBase.java 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/LoadResourceRendererBase.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -27,10 +27,8 @@
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
-import org.ajax4jsf.ajax.UIResource;
-import org.ajax4jsf.framework.renderer.HeaderResourcesRendererBase;
+import org.ajax4jsf.component.UIResource;
import org.ajax4jsf.framework.renderer.RendererBase;
-import org.ajax4jsf.renderkit.HeaderResourceProducer;
import org.ajax4jsf.resource.InternetResource;
/**
Modified: trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxFormRenderer.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxFormRenderer.java 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxFormRenderer.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -35,7 +35,7 @@
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
-import org.ajax4jsf.ajax.UIAjaxForm;
+import org.ajax4jsf.component.UIAjaxForm;
import org.ajax4jsf.event.AjaxEvent;
import org.ajax4jsf.framework.renderer.AjaxComponentRendererBase;
import org.ajax4jsf.framework.renderer.AjaxRendererUtils;
Modified: trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxIncludeRenderer.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxIncludeRenderer.java 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxIncludeRenderer.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -27,7 +27,7 @@
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
-import org.ajax4jsf.ajax.UIInclude;
+import org.ajax4jsf.component.UIInclude;
import org.ajax4jsf.framework.renderer.RendererBase;
import org.ajax4jsf.framework.renderer.RendererUtils.HTML;
Modified: trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxOutputPanelRenderer.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxOutputPanelRenderer.java 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxOutputPanelRenderer.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -29,7 +29,7 @@
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
-import org.ajax4jsf.ajax.UIAjaxOutputPanel;
+import org.ajax4jsf.component.UIAjaxOutputPanel;
import org.ajax4jsf.context.AjaxContext;
import org.ajax4jsf.framework.renderer.RendererBase;
import org.ajax4jsf.framework.renderer.RendererUtils.HTML;
Modified: trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPageRenderer.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPageRenderer.java 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPageRenderer.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -32,10 +32,8 @@
import org.ajax4jsf.component.AjaxContainer;
import org.ajax4jsf.context.AjaxContext;
-import org.ajax4jsf.framework.ajax.AjaxViewRoot;
import org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter;
import org.ajax4jsf.framework.renderer.AjaxContainerRenderer;
-import org.ajax4jsf.framework.renderer.AjaxRendererUtils;
import org.ajax4jsf.framework.renderer.RendererUtils.HTML;
/**
Modified: trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPollRenderer.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPollRenderer.java 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPollRenderer.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -28,7 +28,7 @@
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
-import org.ajax4jsf.ajax.UIPoll;
+import org.ajax4jsf.component.UIPoll;
import org.ajax4jsf.framework.renderer.AjaxRendererUtils;
import org.ajax4jsf.framework.renderer.RendererUtils.HTML;
import org.ajax4jsf.javascript.JSFunction;
Modified: trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPushRenderer.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPushRenderer.java 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxPushRenderer.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -28,12 +28,11 @@
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
-import org.ajax4jsf.ajax.UIPush;
+import org.ajax4jsf.component.UIPush;
import org.ajax4jsf.framework.renderer.AjaxRendererUtils;
import org.ajax4jsf.framework.renderer.RendererUtils;
import org.ajax4jsf.framework.renderer.RendererUtils.HTML;
import org.ajax4jsf.javascript.JSFunction;
-import org.ajax4jsf.javascript.JSReference;
import org.ajax4jsf.renderkit.AjaxCommandRendererBase;
/**
Modified: trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxStatusRenderer.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxStatusRenderer.java 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxStatusRenderer.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -27,7 +27,7 @@
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
-import org.ajax4jsf.ajax.UIAjaxStatus;
+import org.ajax4jsf.component.UIAjaxStatus;
import org.ajax4jsf.framework.renderer.RendererBase;
import org.ajax4jsf.framework.renderer.RendererUtils.HTML;
import org.ajax4jsf.javascript.JSFunctionDefinition;
Modified: trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxSupportRenderer.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxSupportRenderer.java 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/AjaxSupportRenderer.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -51,7 +51,7 @@
protected Class getComponentClass() {
// TODO Auto-generated method stub
- return org.ajax4jsf.ajax.UIAjaxSupport.class;
+ return org.ajax4jsf.component.UIAjaxSupport.class;
}
}
Modified: trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/MediaOutputRenderer.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/MediaOutputRenderer.java 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/MediaOutputRenderer.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -33,7 +33,7 @@
import javax.faces.context.ResponseWriter;
import org.ajax4jsf.Messages;
-import org.ajax4jsf.ajax.resource.UIMediaOutput;
+import org.ajax4jsf.component.UIMediaOutput;
import org.ajax4jsf.framework.renderer.RendererBase;
import org.ajax4jsf.framework.renderer.RendererUtils.HTML;
import org.ajax4jsf.resource.InternetResource;
Modified: trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/RepeatRenderer.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/RepeatRenderer.java 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/html/RepeatRenderer.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -27,7 +27,7 @@
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
-import org.ajax4jsf.ajax.repeat.UIRepeat;
+import org.ajax4jsf.component.UIRepeat;
import org.ajax4jsf.framework.renderer.RendererBase;
import org.ajax4jsf.model.DataVisitor;
Modified: trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/ActionParamHandler.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/ActionParamHandler.java 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/ActionParamHandler.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -28,7 +28,7 @@
import javax.faces.convert.Converter;
import org.ajax4jsf.Messages;
-import org.ajax4jsf.ajax.UIActionParameter;
+import org.ajax4jsf.component.UIActionParameter;
import com.sun.facelets.FaceletContext;
import com.sun.facelets.el.LegacyValueBinding;
Modified: trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/IncludeHandler.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/IncludeHandler.java 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/IncludeHandler.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -27,12 +27,8 @@
import javax.el.VariableMapper;
import javax.faces.FacesException;
import javax.faces.component.UIComponent;
-import javax.faces.component.UIViewRoot;
-import javax.faces.context.FacesContext;
-import javax.servlet.jsp.JspException;
-import org.ajax4jsf.ajax.UIInclude;
-import org.ajax4jsf.framework.ajax.AjaxViewRoot;
+import org.ajax4jsf.component.UIInclude;
import com.sun.facelets.FaceletContext;
import com.sun.facelets.el.VariableMapperWrapper;
Modified: trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/MediaOutputHandler.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/MediaOutputHandler.java 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/facelets/MediaOutputHandler.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -23,7 +23,7 @@
import java.io.OutputStream;
-import org.ajax4jsf.ajax.resource.UIMediaOutput;
+import org.ajax4jsf.component.UIMediaOutput;
import com.sun.facelets.FaceletContext;
import com.sun.facelets.el.LegacyMethodBinding;
Modified: trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/ActionParamTag.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/ActionParamTag.java 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/ActionParamTag.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -29,7 +29,7 @@
import javax.faces.webapp.UIComponentTag;
import org.ajax4jsf.Messages;
-import org.ajax4jsf.ajax.UIActionParameter;
+import org.ajax4jsf.component.UIActionParameter;
import org.ajax4jsf.framework.taglib.UIComponentTagBase;
Modified: trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxFormTag.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxFormTag.java 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxFormTag.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -21,7 +21,7 @@
package org.ajax4jsf.taglib.html.jsp;
-import org.ajax4jsf.ajax.UIAjaxForm;
+import org.ajax4jsf.component.UIAjaxForm;
import org.ajax4jsf.framework.taglib.UIComponentTagBase;
Modified: trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxRegionTag.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxRegionTag.java 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxRegionTag.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -25,8 +25,8 @@
import javax.faces.el.MethodBinding;
import org.ajax4jsf.Messages;
-import org.ajax4jsf.ajax.UIAjaxRegion;
import org.ajax4jsf.component.AjaxContainer;
+import org.ajax4jsf.component.UIAjaxRegion;
import org.ajax4jsf.event.AjaxListener;
import org.ajax4jsf.framework.taglib.UIComponentTagBase;
import org.ajax4jsf.renderkit.html.AjaxRegionRenderer;
Modified: trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxStatusTag.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxStatusTag.java 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxStatusTag.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -23,7 +23,7 @@
import javax.faces.component.UIComponent;
-import org.ajax4jsf.ajax.UIAjaxStatus;
+import org.ajax4jsf.component.UIAjaxStatus;
import org.ajax4jsf.framework.taglib.HtmlComponentTagBase;
import org.ajax4jsf.renderkit.html.AjaxStatusRenderer;
Modified: trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxSupportTag.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxSupportTag.java 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/AjaxSupportTag.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -25,7 +25,7 @@
import javax.faces.webapp.UIComponentTag;
import org.ajax4jsf.Messages;
-import org.ajax4jsf.ajax.UIAjaxSupport;
+import org.ajax4jsf.component.UIAjaxSupport;
import org.ajax4jsf.framework.renderer.AjaxRendererUtils;
import org.ajax4jsf.framework.renderer.RendererUtils.HTML;
import org.ajax4jsf.framework.taglib.UIComponentTagBase;
Modified: trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/IncludeTag.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/IncludeTag.java 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/taglib/html/jsp/IncludeTag.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -24,7 +24,6 @@
import java.io.IOException;
import javax.faces.component.UIComponent;
-import javax.faces.component.UIViewRoot;
import javax.faces.context.FacesContext;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletRequest;
@@ -32,8 +31,7 @@
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
-import org.ajax4jsf.ajax.UIInclude;
-import org.ajax4jsf.framework.ajax.AjaxViewRoot;
+import org.ajax4jsf.component.UIInclude;
import org.ajax4jsf.framework.taglib.UIComponentTagBase;
/**
Modified: trunk/ui/core/src/main/templates/org/ajax4jsf/renderkit/html/button.jspx
===================================================================
--- trunk/ui/core/src/main/templates/org/ajax4jsf/renderkit/html/button.jspx 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/templates/org/ajax4jsf/renderkit/html/button.jspx 2007-07-08 13:49:02 UTC (rev 1537)
@@ -8,7 +8,7 @@
xmlns:x=" http://jsf.exadel.com/vcp"
class="org.ajax4jsf.renderkit.html.CommandButtonRenderer"
baseclass="org.ajax4jsf.renderkit.AjaxCommandRendererBase"
- component="org.ajax4jsf.ajax.UIAjaxCommandButton"
+ component="org.ajax4jsf.component.UIAjaxCommandButton"
xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0" >
<jsp:directive.page import="javax.faces.context.FacesContext,javax.faces.component.UIComponent"/>
<f:clientid var="clientId"/>
Modified: trunk/ui/core/src/main/templates/org/ajax4jsf/renderkit/html/function.jspx
===================================================================
--- trunk/ui/core/src/main/templates/org/ajax4jsf/renderkit/html/function.jspx 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/templates/org/ajax4jsf/renderkit/html/function.jspx 2007-07-08 13:49:02 UTC (rev 1537)
@@ -8,7 +8,7 @@
xmlns:x=" http://jsf.exadel.com/vcp"
class="org.ajax4jsf.renderkit.html.FunctionRenderer"
baseclass="org.ajax4jsf.renderkit.AjaxFunctionRendererBase"
- component="org.ajax4jsf.ajax.UIAjaxFunction"
+ component="org.ajax4jsf.component.UIAjaxFunction"
xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0" >
<jsp:directive.page import="javax.faces.context.FacesContext,javax.faces.component.UIComponent"/>
<f:clientid var="clientId"/>
Modified: trunk/ui/core/src/main/templates/org/ajax4jsf/renderkit/html/link.jspx
===================================================================
--- trunk/ui/core/src/main/templates/org/ajax4jsf/renderkit/html/link.jspx 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/templates/org/ajax4jsf/renderkit/html/link.jspx 2007-07-08 13:49:02 UTC (rev 1537)
@@ -8,7 +8,7 @@
xmlns:x=" http://jsf.exadel.com/vcp"
class="org.ajax4jsf.renderkit.html.CommandLinkRenderer"
baseclass="org.ajax4jsf.renderkit.AjaxCommandRendererBase"
- component="org.ajax4jsf.ajax.UIAjaxCommandLink"
+ component="org.ajax4jsf.component.UIAjaxCommandLink"
xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0" >
<jsp:directive.page import="javax.faces.context.FacesContext,javax.faces.component.UIComponent"/>
<f:clientid var="clientId"/>
Modified: trunk/ui/core/src/main/templates/org/ajax4jsf/renderkit/html/log.jspx
===================================================================
--- trunk/ui/core/src/main/templates/org/ajax4jsf/renderkit/html/log.jspx 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/core/src/main/templates/org/ajax4jsf/renderkit/html/log.jspx 2007-07-08 13:49:02 UTC (rev 1537)
@@ -8,7 +8,7 @@
xmlns:x=" http://jsf.exadel.com/vcp"
class="org.ajax4jsf.renderkit.html.LogRenderer"
baseclass="org.ajax4jsf.framework.renderer.AjaxComponentRendererBase"
- component="org.ajax4jsf.ajax.UIAjaxLog"
+ component="org.ajax4jsf.component.UIAjaxLog"
xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0" >
<jsp:directive.page import="javax.faces.context.FacesContext,javax.faces.component.UIComponent"/>
<f:clientid var="clientId"/>
Copied: trunk/ui/core/src/test/java/org/ajax4jsf/component/ActionListenerTest.java (from rev 1512, trunk/ui/core/src/test/java/org/ajax4jsf/ajax/ActionListenerTest.java)
===================================================================
--- trunk/ui/core/src/test/java/org/ajax4jsf/component/ActionListenerTest.java (rev 0)
+++ trunk/ui/core/src/test/java/org/ajax4jsf/component/ActionListenerTest.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -0,0 +1,152 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.ajax4jsf.component;
+
+import java.io.Serializable;
+
+import javax.faces.component.UICommand;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.convert.IntegerConverter;
+import javax.faces.event.ActionEvent;
+
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+
+/**
+ * @author shura
+ *
+ */
+public class ActionListenerTest extends AbstractAjax4JsfTestCase {
+
+ /**
+ * @param name
+ */
+ public ActionListenerTest(String name) {
+ super(name);
+ }
+
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#setUp()
+ */
+ public void setUp() throws Exception {
+ super.setUp();
+ }
+
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#tearDown()
+ */
+ public void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /**
+ * Test method for {@link org.ajax4jsf.component.UIActionParameter#getValue()}.
+ */
+ public void testGetValue() {
+ Bean bean = new Bean();
+ bean.setFirst(1);
+ bean.setSecond(2.0);
+ UIActionParameter param = new UIActionParameter();
+ param.setConverter(new TestConverter());
+ param.setValue(bean);
+ assertEquals("1;2.0", param.getValue());
+ }
+
+ public void testGetIntValue() throws Exception {
+ UIActionParameter param = new UIActionParameter();
+ application.addConverter(Integer.class, IntegerConverter.class.getName());
+ param.setValue(new Integer(1));
+ assertEquals("1", param.getValue());
+ }
+
+ static class TestConverter implements Converter {
+
+ /* (non-Javadoc)
+ * @see javax.faces.convert.Converter#getAsObject(javax.faces.context.FacesContext, javax.faces.component.UIComponent, java.lang.String)
+ */
+ public Object getAsObject(FacesContext context, UIComponent comp, String str) {
+ Bean bean = new Bean();
+ String[] values = str.split(";");
+ bean.setFirst(Integer.parseInt(values[0]));
+ bean.setSecond(Double.parseDouble(values[1]));
+ return bean;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.convert.Converter#getAsString(javax.faces.context.FacesContext, javax.faces.component.UIComponent, java.lang.Object)
+ */
+ public String getAsString(FacesContext context, UIComponent comp, Object value) {
+ Bean bean = (Bean) value;
+ return String.valueOf(bean.getFirst())+";"+String.valueOf(bean.getSecond());
+ }
+
+ }
+
+ public static class Bean implements Serializable {
+ int _first;
+ double _second;
+ /**
+ * @return the first
+ */
+ public int getFirst() {
+ return this._first;
+ }
+ /**
+ * @param first the first to set
+ */
+ public void setFirst(int first) {
+ this._first = first;
+ }
+ /**
+ * @return the second
+ */
+ public double getSecond() {
+ return this._second;
+ }
+ /**
+ * @param second the second to set
+ */
+ public void setSecond(double second) {
+ this._second = second;
+ }
+ }
+
+ /**
+ * Test method for {@link org.ajax4jsf.component.UIActionParameter#processAction(javax.faces.event.ActionEvent)}.
+ */
+ public void testProcessAction() {
+ UICommand command = new UICommand();
+ UIActionParameter param = new UIActionParameter();
+ param.setConverter(new IntegerConverter());
+ param.setName("param");
+ param.setAssignToBinding(application.createValueBinding("#{bean.first}"));
+ Bean bean = new Bean();
+ request.setAttribute("bean", bean);
+ request.addParameter("param", "123");
+ externalContext.getRequestParameterMap().put("param", "123");
+ command.addActionListener(param);
+ command.broadcast(new ActionEvent(command));
+ assertEquals(123, bean.getFirst());
+ }
+
+}
Copied: trunk/ui/core/src/test/java/org/ajax4jsf/component/DataAdaptorTestCase.java (from rev 1512, trunk/framework/test/src/test/java/org/ajax4jsf/ajax/repeat/DataAdaptorTestCase.java)
===================================================================
--- trunk/ui/core/src/test/java/org/ajax4jsf/component/DataAdaptorTestCase.java (rev 0)
+++ trunk/ui/core/src/test/java/org/ajax4jsf/component/DataAdaptorTestCase.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -0,0 +1,389 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.ajax4jsf.component;
+
+import java.util.ArrayList;
+
+import javax.faces.component.UIColumn;
+import javax.faces.component.UIData;
+import javax.faces.component.UIInput;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.model.DataComponentState;
+import org.ajax4jsf.model.ExtendedDataModel;
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+import org.ajax4jsf.tests.MockComponentState;
+import org.ajax4jsf.tests.MockDataModel;
+import org.ajax4jsf.tests.MockUIInputRenderer;
+
+/**
+ * @author shura
+ *
+ */
+public class DataAdaptorTestCase extends AbstractAjax4JsfTestCase {
+
+ private UIDataAdaptor adaptor;
+
+ private UIInput child;
+
+ private int childInvoked;
+
+ private UIInput facetChild;
+
+ private int facetInvoked;
+
+ private UIInput childChild;
+
+ private int childChildInvoked;
+
+ private UIInput childChildFacet;
+
+ private int childChildFacetInvoked;
+
+ UIData data;
+ /**
+ * @param name
+ */
+ public DataAdaptorTestCase(String name) {
+ super(name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#setUp()
+ */
+ public void setUp() throws Exception {
+ super.setUp();
+ // Create mock DataAdaptor and childs.
+ adaptor = new MockDataAdaptor();
+ child = new UIInput(){
+ public void processDecodes(FacesContext context) {
+ childInvoked++;
+ super.processDecodes(context);
+ }
+ };
+ childInvoked = 0;
+ child.setId("child");
+ adaptor.getChildren().add(child);
+ facetChild = new UIInput(){
+ public void processDecodes(FacesContext context) {
+ facetInvoked++;
+ super.processDecodes(context);
+ }
+ };
+ facetInvoked = 0;
+ facetChild.setId("facetChild");
+ adaptor.getFacets().put("facet", facetChild);
+ childChild = new UIInput(){
+ public void processDecodes(FacesContext context) {
+ childChildInvoked++;
+ super.processDecodes(context);
+ }
+ };;
+ childChildInvoked = 0;
+ childChild.setId("childChild");
+ child.getChildren().add(childChild);
+ childChildFacet = new UIInput(){
+ public void processDecodes(FacesContext context) {
+ childChildFacetInvoked++;
+ super.processDecodes(context);
+ }
+ };;
+ childChildFacetInvoked = 0;
+ childChildFacet.setId("childChildFacet");
+ childChild.getFacets().put("facet", childChildFacet);
+ data = new UIData();
+ renderKit.addRenderer(child.getFamily(), child.getRendererType(), new MockUIInputRenderer());
+ renderKit.addRenderer(adaptor.getFamily(), adaptor.getRendererType(), new MockUIInputRenderer());
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#tearDown()
+ */
+ public void tearDown() throws Exception {
+ super.tearDown();
+ adaptor = null;
+ child = null;
+ childChild = null;
+ childChildFacet = null;
+ facetChild = null;
+ }
+
+ private void createTree(){
+ facesContext.getViewRoot().getChildren().add(adaptor);
+ adaptor.setId("adaptor");
+ }
+
+ private void createDataTree(){
+ data.setId("data");
+ adaptor.setId("adaptor");
+ ArrayList value = new ArrayList(2);
+ value.add("first");
+ value.add("second");
+ data.setValue(value);
+ data.setVar("var");
+ UIColumn column = new UIColumn();
+ data.getChildren().add(column);
+ column.getChildren().add(adaptor);
+ facesContext.getViewRoot().getChildren().add(data);
+ }
+
+ /**
+ * Test method for {@link org.ajax4jsf.component.UIDataAdaptor#isRowAvailable()}.
+ */
+ public void testIsRowAvailable() {
+ adaptor.setRowKey(new Integer(0));
+ assertTrue(adaptor.isRowAvailable());
+ adaptor.setRowKey(new Integer(MockDataModel.ROWS-1));
+ assertTrue(adaptor.isRowAvailable());
+ adaptor.setRowKey(new Integer(MockDataModel.ROWS+1));
+ assertFalse(adaptor.isRowAvailable());
+ adaptor.setRowKey(null);
+ assertFalse(adaptor.isRowAvailable());
+ }
+
+ /**
+ * Test method for {@link org.ajax4jsf.component.UIDataAdaptor#getRowKey()}.
+ */
+ public void testGetRowKey() {
+ adaptor.setRowIndex(0);
+ assertEquals(new Integer(0), adaptor.getRowKey());
+ adaptor.setRowIndex(-1);
+ assertNull(adaptor.getRowKey());
+ }
+
+ /**
+ * Test method for {@link org.ajax4jsf.component.UIDataAdaptor#setRowKey(java.lang.Object)}.
+ */
+ public void testSetRowKey() {
+ adaptor.setRowKey(new Integer(1));
+ assertEquals(1, adaptor.getRowIndex());
+ adaptor.setRowKey(null);
+ assertEquals(-1, adaptor.getRowIndex());
+ }
+
+ /**
+ * Test method for {@link org.ajax4jsf.component.UIDataAdaptor#resetDataModel()}.
+ */
+ public void testResetDataModel() {
+ adaptor.setRowKey(new Integer(1));
+ adaptor.resetDataModel();
+ assertEquals(0, adaptor.getRowIndex());
+ }
+
+ public void testGetBaseClientId(){
+ createDataTree();
+ data.setRowIndex(-1);
+ assertEquals(adaptor.getBaseClientId(facesContext), "data:adaptor");
+ data.setRowIndex(0);
+ assertEquals(adaptor.getBaseClientId(facesContext), "data:0:adaptor");
+ data.setRowIndex(1);
+ assertEquals(adaptor.getBaseClientId(facesContext), "data:1:adaptor");
+ adaptor.setRowIndex(1);
+ assertEquals(adaptor.getBaseClientId(facesContext), "data:1:adaptor");
+ }
+
+
+ /**
+ * Test method for {@link org.ajax4jsf.component.UIDataAdaptor#setExtendedDataModel(org.ajax4jsf.ajax.repeat.ExtendedDataModel)}.
+ */
+ public void testSetIterableDataModel() {
+ createDataTree();
+ data.setRowIndex(0);
+ MockDataModel mockDataModel0 = new MockDataModel();
+ adaptor.setExtendedDataModel(mockDataModel0);
+ data.setRowIndex(1);
+ MockDataModel mockDataModel1 = new MockDataModel();
+ adaptor.setExtendedDataModel(mockDataModel1);
+ data.setRowIndex(0);
+ assertSame(mockDataModel0, adaptor.getExtendedDataModel());
+ data.setRowIndex(1);
+ assertSame(mockDataModel1, adaptor.getExtendedDataModel());
+ }
+
+ public void testSetDataModel(){
+ MockDataModel mockDataModel1 = new MockDataModel();
+ adaptor.setExtendedDataModel(mockDataModel1);
+ assertSame(mockDataModel1, adaptor.getExtendedDataModel());
+ }
+
+ /**
+ * Test method for {@link org.ajax4jsf.component.UIDataAdaptor#getExtendedDataModel()}.
+ */
+ public void testGetIterableDataModel() {
+ ExtendedDataModel dataModel = adaptor.getExtendedDataModel();
+ assertTrue(dataModel instanceof MockDataModel);
+ }
+
+ /**
+ * Test method for {@link org.ajax4jsf.component.UIDataAdaptor#getComponentState()}.
+ */
+ public void testGetComponentState() {
+ createDataTree();
+ data.setRowIndex(0);
+ DataComponentState state0 = adaptor.getComponentState();
+ assertTrue(state0 instanceof MockComponentState);
+ data.setRowIndex(1);
+ DataComponentState state1 = adaptor.getComponentState();
+ data.setRowIndex(0);
+ assertSame(state0, adaptor.getComponentState());
+ data.setRowIndex(1);
+ assertSame(state1, adaptor.getComponentState());
+ }
+
+ /**
+ * Test method for {@link org.ajax4jsf.component.UIDataAdaptor#createComponentState()}.
+ */
+ public void testCreateComponentState() {
+ DataComponentState state = adaptor.createComponentState();
+ assertTrue(state instanceof MockComponentState);
+ }
+
+ /**
+ * Test method for {@link org.ajax4jsf.component.UIDataAdaptor#iterate(javax.faces.context.FacesContext, org.ajax4jsf.ajax.repeat.RepeaterInvoker)}.
+ */
+ public void testProcess() {
+ createTree();
+ MockComponentState mockState = (MockComponentState) adaptor.getComponentState();
+ mockState.setCount(4);
+ adaptor.processDecodes(facesContext);
+ assertEquals(childInvoked, 4);
+ assertEquals(facetInvoked, 1);
+ }
+
+ /**
+ * Test method for {@link org.ajax4jsf.component.UIDataAdaptor#iterate(javax.faces.context.FacesContext, org.ajax4jsf.ajax.repeat.RepeaterInvoker)}.
+ */
+ public void testProcessMore() {
+ createTree();
+ MockComponentState mockState = (MockComponentState) adaptor.getComponentState();
+ mockState.setCount(Integer.MAX_VALUE);
+ adaptor.processDecodes(facesContext);
+ assertEquals(childInvoked, MockDataModel.ROWS);
+ assertEquals(facetInvoked, 1);
+ }
+
+
+ /**
+ * Test method for {@link org.ajax4jsf.component.UIDataAdaptor#restoreState(javax.faces.context.FacesContext, java.lang.Object)}.
+ * @throws IllegalAccessException
+ * @throws InstantiationException
+ */
+ public void testRestoreStateFacesContextObject() throws Exception {
+ createTree();
+ MockComponentState mockState = (MockComponentState) adaptor.getComponentState();
+ mockState.setCount(123);
+ adaptor.encodeBegin(facesContext);
+ UIViewRoot viewRoot = facesContext.getViewRoot();
+ Object treeState = viewRoot.processSaveState(facesContext);
+ UIViewRoot root = (UIViewRoot) viewRoot.getClass().newInstance();
+ UIDataAdaptor restoredAdaptor = new MockDataAdaptor();
+ root.getChildren().add(restoredAdaptor);
+ root.processRestoreState(facesContext, treeState);
+ mockState = (MockComponentState) restoredAdaptor.getComponentState();
+ assertEquals(mockState.getCount(), 123);
+ }
+
+ /**
+ * Test method for {@link org.ajax4jsf.component.UIDataAdaptor#saveState(javax.faces.context.FacesContext)}.
+ */
+ public void testSaveStateFacesContext() throws Exception {
+ createDataTree();
+ data.setRowIndex(0);
+ MockComponentState mockState = (MockComponentState) adaptor.getComponentState();
+ mockState.setCount(123);
+ adaptor.encodeBegin(facesContext);
+ data.setRowIndex(1);
+ mockState = (MockComponentState) adaptor.getComponentState();
+ mockState.setCount(321);
+ adaptor.encodeBegin(facesContext);
+ UIViewRoot viewRoot = facesContext.getViewRoot();
+ Object treeState = viewRoot.processSaveState(facesContext);
+ UIViewRoot root = (UIViewRoot) viewRoot.getClass().newInstance();
+ UIData restoredData = new UIData();
+ UIDataAdaptor restoredAdaptor = new MockDataAdaptor();
+ root.getChildren().add(restoredData);
+ UIColumn column = new UIColumn();
+ restoredData.getChildren().add(column);
+ column.getChildren().add(restoredAdaptor);
+ root.processRestoreState(facesContext, treeState);
+ restoredData.setRowIndex(0);
+ mockState = (MockComponentState) restoredAdaptor.getComponentState();
+ assertEquals(mockState.getCount(), 123);
+ restoredData.setRowIndex(1);
+ mockState = (MockComponentState) restoredAdaptor.getComponentState();
+ assertEquals(mockState.getCount(), 321);
+ }
+
+ public void testSaveChildState(){
+ createTree();
+ child.setSubmittedValue("Submitted");
+ child.setValid(true);
+ child.setValue("Value");
+ child.setLocalValueSet(true);
+ adaptor.saveChildState(facesContext);
+ child.setSubmittedValue("NonSubmitted");
+ child.setValid(false);
+ child.setValue(null);
+ child.setLocalValueSet(false);
+ adaptor.restoreChildState(facesContext);
+ assertEquals(child.getSubmittedValue(), "Submitted");
+ assertTrue(child.isValid());
+ assertEquals(child.getValue(), "Value");
+ assertTrue(child.isLocalValueSet());
+ }
+
+ public void testSaveChildChildState(){
+ createTree();
+ childChild.setSubmittedValue("Submitted");
+ childChild.setValid(true);
+ childChild.setValue("Value");
+ childChild.setLocalValueSet(true);
+ adaptor.saveChildState(facesContext);
+ childChild.setSubmittedValue("NonSubmitted");
+ childChild.setValid(false);
+ childChild.setValue(null);
+ childChild.setLocalValueSet(false);
+ adaptor.restoreChildState(facesContext);
+ assertEquals(childChild.getSubmittedValue(), "Submitted");
+ assertTrue(childChild.isValid());
+ assertEquals(childChild.getValue(), "Value");
+ assertTrue(childChild.isLocalValueSet());
+ }
+ public void testSaveChildChildFacetState(){
+ createTree();
+ childChildFacet.setSubmittedValue("Submitted");
+ childChildFacet.setValid(true);
+ childChildFacet.setValue("Value");
+ childChildFacet.setLocalValueSet(true);
+ adaptor.saveChildState(facesContext);
+ childChildFacet.setSubmittedValue("NonSubmitted");
+ childChildFacet.setValid(false);
+ childChildFacet.setValue(null);
+ childChildFacet.setLocalValueSet(false);
+ adaptor.restoreChildState(facesContext);
+ assertEquals(childChildFacet.getSubmittedValue(), "Submitted");
+ assertTrue(childChildFacet.isValid());
+ assertEquals(childChildFacet.getValue(), "Value");
+ assertTrue(childChildFacet.isLocalValueSet());
+ }
+}
Copied: trunk/ui/core/src/test/java/org/ajax4jsf/component/MockDataAdaptor.java (from rev 1512, trunk/framework/test/src/main/java/org/ajax4jsf/tests/MockDataAdaptor.java)
===================================================================
--- trunk/ui/core/src/test/java/org/ajax4jsf/component/MockDataAdaptor.java (rev 0)
+++ trunk/ui/core/src/test/java/org/ajax4jsf/component/MockDataAdaptor.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -0,0 +1,69 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.ajax4jsf.component;
+
+import java.util.Iterator;
+
+import org.ajax4jsf.model.DataComponentState;
+import org.ajax4jsf.model.ExtendedDataModel;
+import org.ajax4jsf.tests.MockComponentState;
+import org.ajax4jsf.tests.MockDataModel;
+
+/**
+ * @author shura
+ *
+ */
+public class MockDataAdaptor extends UIDataAdaptor {
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.ajax.repeat.UIDataAdaptor#createComponentState()
+ */
+ protected DataComponentState createComponentState() {
+ // TODO Auto-generated method stub
+ return new MockComponentState();
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.ajax.repeat.UIDataAdaptor#createDataModel()
+ */
+ protected ExtendedDataModel createDataModel() {
+ // TODO Auto-generated method stub
+ return new MockDataModel();
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.ajax.repeat.UIDataAdaptor#dataChildren()
+ */
+ protected Iterator dataChildren() {
+ // TODO Auto-generated method stub
+ return getChildren().iterator();
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.ajax.repeat.UIDataAdaptor#fixedChildren()
+ */
+ protected Iterator fixedChildren() {
+ // TODO Auto-generated method stub
+ return getFacets().values().iterator();
+ }
+
+}
Added: trunk/ui/core/src/test/java/org/ajax4jsf/component/RepeatTestCase.java
===================================================================
--- trunk/ui/core/src/test/java/org/ajax4jsf/component/RepeatTestCase.java (rev 0)
+++ trunk/ui/core/src/test/java/org/ajax4jsf/component/RepeatTestCase.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -0,0 +1,246 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.ajax4jsf.component;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.faces.component.UIColumn;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIInput;
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.renderkit.html.RepeatRenderer;
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+import org.ajax4jsf.tests.MockDataModel;
+import org.ajax4jsf.tests.MockUIInputRenderer;
+
+/**
+ * @author shura
+ *
+ */
+public class RepeatTestCase extends AbstractAjax4JsfTestCase {
+
+ private UIRepeat repeater;
+
+ private UIInput child;
+
+ private int childInvoked;
+
+ private UIInput facetChild;
+
+ private int facetInvoked;
+
+ private UIInput childChild;
+
+ private int childChildInvoked;
+
+ private UIInput childChildFacet;
+
+ private int childChildFacetInvoked;
+
+ private UIRepeat enclosedRepeater;
+ /**
+ * @param name
+ */
+ public RepeatTestCase(String name) {
+ super(name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#setUp()
+ */
+ public void setUp() throws Exception {
+ super.setUp();
+ // Create mock DataAdaptor and childs.
+ repeater = new UIRepeat();
+ child = new UIInput(){
+ public void processDecodes(FacesContext context) {
+ childInvoked++;
+ super.processDecodes(context);
+ }
+ };
+ childInvoked = 0;
+ child.setId("child");
+ repeater.getChildren().add(child);
+ facetChild = new UIInput(){
+ public void processDecodes(FacesContext context) {
+ facetInvoked++;
+ super.processDecodes(context);
+ }
+ };
+ facetInvoked = 0;
+ facetChild.setId("facetChild");
+ repeater.getFacets().put("facet", facetChild);
+ childChild = new UIInput(){
+ public void processDecodes(FacesContext context) {
+ childChildInvoked++;
+ super.processDecodes(context);
+ }
+ };;
+ childChildInvoked = 0;
+ childChild.setId("childChild");
+ child.getChildren().add(childChild);
+ childChildFacet = new UIInput(){
+ public void processDecodes(FacesContext context) {
+ childChildFacetInvoked++;
+ super.processDecodes(context);
+ }
+ };;
+ childChildFacetInvoked = 0;
+ childChildFacet.setId("childChildFacet");
+ childChild.getFacets().put("facet", childChildFacet);
+ enclosedRepeater = new UIRepeat();
+ renderKit.addRenderer(child.getFamily(), child.getRendererType(), new MockUIInputRenderer(){
+ public void decode(FacesContext context, UIComponent component) {
+ super.decode(context, component);
+ UIInput input = (UIInput) component;
+ String submittedValie = enclosedRepeater.getRowKey()+":"+repeater.getRowKey();
+ input.setSubmittedValue(submittedValie);
+ System.out.println("decode component "+component.getClientId(facesContext)+" with value "+submittedValie);
+ }
+ });
+ renderKit.addRenderer(repeater.getFamily(), repeater.getRendererType(), new RepeatRenderer());
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#tearDown()
+ */
+ public void tearDown() throws Exception {
+ super.tearDown();
+ repeater = null;
+ child = null;
+ childChild = null;
+ childChildFacet = null;
+ facetChild = null;
+ enclosedRepeater = null;
+ }
+
+
+ private void createDataTree(){
+ enclosedRepeater.setId("data");
+ repeater.setId("adaptor");
+ repeater.setVar("row");
+ ArrayList value = new ArrayList(2);
+ value.add("first");
+ value.add("second");
+ enclosedRepeater.setValue(value);
+ enclosedRepeater.setVar("var");
+ UIColumn column = new UIColumn();
+ enclosedRepeater.getChildren().add(column);
+ column.getChildren().add(repeater);
+ facesContext.getViewRoot().getChildren().add(enclosedRepeater);
+ }
+
+ private void printChildMap(Map childrenState){
+ System.out.println("{");
+ for (Iterator iter = childrenState.keySet().iterator(); iter.hasNext();) {
+ Object key = iter.next();
+ System.out.println(" "+key+" : "+childrenState.get(key));
+ }
+ System.out.println("}");
+ }
+ /**
+ * Test method for {@link javax.faces.component.UIData#processDecodes(javax.faces.context.FacesContext)}.
+ */
+ public void testProcessDecodesFacesContext() {
+ createDataTree();
+ repeater.setValue(new MockDataModel());
+// enclosedRepeater.setValue(new MockDataModel());
+ enclosedRepeater.processDecodes(facesContext);
+ enclosedRepeater.setRowIndex(1);
+ repeater.setRowIndex(1);
+ System.out.println("Saved child state for external repeater ");
+ printChildMap(enclosedRepeater.getChildState(facesContext));
+ System.out.println("Saved child state" );
+ printChildMap(repeater.getChildState(facesContext));
+ assertEquals("1:1", child.getSubmittedValue());
+ }
+
+ /**
+ * Test method for {@link javax.faces.component.UIData#processUpdates(javax.faces.context.FacesContext)}.
+ */
+ public void testProcessUpdatesFacesContext() {
+ createDataTree();
+ repeater.setValue(new MockDataModel());
+// enclosedRepeater.setValue(new MockDataModel());
+ enclosedRepeater.processDecodes(facesContext);
+ enclosedRepeater.processValidators(facesContext);
+ enclosedRepeater.processUpdates(facesContext);
+ enclosedRepeater.setRowIndex(1);
+ repeater.setRowIndex(1);
+ assertEquals("1:1", child.getValue());
+ enclosedRepeater.setRowIndex(0);
+ repeater.setRowIndex(2);
+ assertEquals("0:2", child.getValue());
+ }
+
+ /**
+ * Test method for {@link javax.faces.component.UIData#processUpdates(javax.faces.context.FacesContext)}.
+ */
+ public void testProcessValidatorsFacesContext() {
+ createDataTree();
+ repeater.setValue(new MockDataModel());
+// enclosedRepeater.setValue(new MockDataModel());
+ enclosedRepeater.processDecodes(facesContext);
+ enclosedRepeater.processValidators(facesContext);
+ enclosedRepeater.setRowIndex(1);
+ repeater.setRowIndex(1);
+ assertEquals("1:1", child.getLocalValue());
+ enclosedRepeater.setRowIndex(0);
+ repeater.setRowIndex(2);
+ assertEquals("0:2", child.getLocalValue());
+ }
+
+ public void testSetRowIndex() throws Exception {
+ createDataTree();
+ repeater.setValue(new MockDataModel());
+ enclosedRepeater.setRowIndex(1);
+ repeater.setRowIndex(1);
+ child.setValue("1:1");
+ repeater.setRowIndex(-1);
+ enclosedRepeater.setRowIndex(-1);
+ // -----------------------------
+ enclosedRepeater.setRowIndex(0);
+ repeater.setRowIndex(2);
+ child.setValue("0:2");
+ // -----------------------------
+ repeater.setRowIndex(-1);
+ enclosedRepeater.setRowIndex(-1);
+ System.out.println("Saved child state for external repeater ");
+ printChildMap(enclosedRepeater.getChildState(facesContext));
+ System.out.println("Saved child state" );
+ printChildMap(repeater.getChildState(facesContext));
+ // -----------------------------
+ enclosedRepeater.setRowIndex(1);
+ repeater.setRowIndex(1);
+ assertEquals("1:1", child.getValue());
+ repeater.setRowIndex(-1);
+ enclosedRepeater.setRowIndex(-1);
+ // -----------------------------
+ enclosedRepeater.setRowIndex(0);
+ repeater.setRowIndex(2);
+ assertEquals("0:2", child.getValue());
+
+ }
+}
Modified: trunk/ui/dataTable/src/main/java/org/richfaces/component/UIDataGrid.java
===================================================================
--- trunk/ui/dataTable/src/main/java/org/richfaces/component/UIDataGrid.java 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/component/UIDataGrid.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -21,7 +21,7 @@
package org.richfaces.component;
-import org.ajax4jsf.ajax.repeat.UIRepeat;
+import org.ajax4jsf.component.UIRepeat;
/**
* JSF component class
Modified: trunk/ui/dataTable/src/main/java/org/richfaces/component/UIDataList.java
===================================================================
--- trunk/ui/dataTable/src/main/java/org/richfaces/component/UIDataList.java 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/component/UIDataList.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -21,7 +21,7 @@
package org.richfaces.component;
-import org.ajax4jsf.ajax.repeat.UIRepeat;
+import org.ajax4jsf.component.UIRepeat;
/**
* JSF component class
Modified: trunk/ui/dataTable/src/main/java/org/richfaces/component/UIDataTable.java
===================================================================
--- trunk/ui/dataTable/src/main/java/org/richfaces/component/UIDataTable.java 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/component/UIDataTable.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -26,8 +26,8 @@
import javax.faces.component.UIColumn;
import javax.faces.component.UIComponent;
-import org.ajax4jsf.ajax.repeat.UIRepeat;
import org.ajax4jsf.component.AjaxSupport;
+import org.ajax4jsf.component.UIRepeat;
import org.apache.commons.collections.Predicate;
import org.apache.commons.collections.iterators.FilterIterator;
import org.apache.commons.collections.iterators.IteratorChain;
Modified: trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractDefinitionListRenderer.java
===================================================================
--- trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractDefinitionListRenderer.java 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractDefinitionListRenderer.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -27,7 +27,7 @@
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
-import org.ajax4jsf.ajax.repeat.UIDataAdaptor;
+import org.ajax4jsf.component.UIDataAdaptor;
import org.ajax4jsf.framework.renderer.RendererUtils.HTML;
/**
Modified: trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractGridRenderer.java
===================================================================
--- trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractGridRenderer.java 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractGridRenderer.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -27,7 +27,7 @@
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
-import org.ajax4jsf.ajax.repeat.UIDataAdaptor;
+import org.ajax4jsf.component.UIDataAdaptor;
import org.ajax4jsf.framework.renderer.RendererUtils.HTML;
import org.richfaces.component.UIDataGrid;
Modified: trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractListRenderer.java
===================================================================
--- trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractListRenderer.java 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractListRenderer.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -26,7 +26,7 @@
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
-import org.ajax4jsf.ajax.repeat.UIDataAdaptor;
+import org.ajax4jsf.component.UIDataAdaptor;
import org.ajax4jsf.framework.renderer.RendererUtils.HTML;
/**
Modified: trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractRowsRenderer.java
===================================================================
--- trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractRowsRenderer.java 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractRowsRenderer.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -28,7 +28,7 @@
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
-import org.ajax4jsf.ajax.repeat.UIDataAdaptor;
+import org.ajax4jsf.component.UIDataAdaptor;
import org.ajax4jsf.framework.renderer.HeaderResourcesRendererBase;
import org.ajax4jsf.framework.renderer.RendererBase;
import org.ajax4jsf.framework.renderer.RendererUtils;
Modified: trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/TableHolder.java
===================================================================
--- trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/TableHolder.java 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/TableHolder.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -23,7 +23,7 @@
import java.util.Map;
-import org.ajax4jsf.ajax.repeat.UIDataAdaptor;
+import org.ajax4jsf.component.UIDataAdaptor;
/**
* Private class for keep reference to table and intermediate iteration values ( current row styles, events etc )
Modified: trunk/ui/dataTable/src/test/java/org/richfaces/component/DataTableComponentTest.java
===================================================================
--- trunk/ui/dataTable/src/test/java/org/richfaces/component/DataTableComponentTest.java 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/dataTable/src/test/java/org/richfaces/component/DataTableComponentTest.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -36,8 +36,8 @@
import javax.faces.el.ValueBinding;
import javax.faces.model.ListDataModel;
-import org.ajax4jsf.ajax.UIAjaxSupport;
import org.ajax4jsf.component.AjaxSupport;
+import org.ajax4jsf.component.UIAjaxSupport;
import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
import org.apache.commons.collections.Predicate;
@@ -494,9 +494,7 @@
HtmlOutputText.class.getName(), null, null, null);
UIComponent column = column1;
UIComponent notAjaxSupport = notColumn;
- UIComponent ajaxSupport = createComponent(UIAjaxSupport.COMPONENT_TYPE,
- org.ajax4jsf.ajax.html.HtmlAjaxSupport.class.getName(), null,
- null, null);
+ UIComponent ajaxSupport = application.createComponent(UIAjaxSupport.COMPONENT_TYPE);
assertTrue(columnPredicate.evaluate(column));
assertTrue(!columnPredicate.evaluate(notColumn));
Modified: trunk/ui/tree/src/main/java/org/richfaces/component/UITree.java
===================================================================
--- trunk/ui/tree/src/main/java/org/richfaces/component/UITree.java 2007-07-08 13:31:55 UTC (rev 1536)
+++ trunk/ui/tree/src/main/java/org/richfaces/component/UITree.java 2007-07-08 13:49:02 UTC (rev 1537)
@@ -35,7 +35,7 @@
import javax.faces.event.FacesListener;
import javax.faces.event.PhaseId;
-import org.ajax4jsf.ajax.repeat.UIDataAdaptor;
+import org.ajax4jsf.component.UIDataAdaptor;
import org.ajax4jsf.event.AjaxEvent;
import org.ajax4jsf.framework.renderer.AjaxRendererUtils;
import org.ajax4jsf.model.DataComponentState;
17 years, 6 months
JBoss Rich Faces SVN: r1536 - in branches/3.0.2/richfaces/common: src/main and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-07-08 09:31:55 -0400 (Sun, 08 Jul 2007)
New Revision: 1536
Added:
branches/3.0.2/richfaces/common/src/main/javacc/
branches/3.0.2/richfaces/common/src/main/javacc/RichMacroDefinition.jj
Removed:
branches/3.0.2/richfaces/common/src/main/antlr/
Modified:
branches/3.0.2/richfaces/common/pom.xml
branches/3.0.2/richfaces/common/src/main/java/org/richfaces/renderkit/MacroDefinitionJSContentHandler.java
branches/3.0.2/richfaces/common/src/test/java/org/richfaces/renderkit/TemplateUtilTest.java
Log:
Migration form ANTLR to JavaCC
Modified: branches/3.0.2/richfaces/common/pom.xml
===================================================================
--- branches/3.0.2/richfaces/common/pom.xml 2007-07-07 18:25:58 UTC (rev 1535)
+++ branches/3.0.2/richfaces/common/pom.xml 2007-07-08 13:31:55 UTC (rev 1536)
@@ -10,38 +10,19 @@
<name>common classes</name>
<build>
<plugins>
- <plugin>
- <!-- temporary solution, until maven-antlr-plugin will not become mature -->
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <phase>generate-sources</phase>
- <configuration>
- <tasks>
- <java classname="org.antlr.Tool"
- classpathref="maven.plugin.classpath"
- fork="true"
- dir="src/main/antlr">
- <arg value="RichMacroDefinition.g"/>
- <arg line="-o ${project.build.directory}/generated-sources/antlr/org/richfaces"/>
- </java>
- </tasks>
- <sourceRoot>${project.build.directory}/generated-sources/antlr</sourceRoot>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- <dependencies>
- <dependency>
- <groupId>org.antlr</groupId>
- <artifactId>antlr</artifactId>
- <version>3.0</version>
- <scope>compile</scope>
- </dependency>
- </dependencies>
- </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>javacc-maven-plugin</artifactId>
+ <version>2.1</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>javacc</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration><packageName>org.richfaces.javacc</packageName></configuration>
+ </plugin>
</plugins>
</build>
@@ -56,7 +37,7 @@
<configuration>
<excludes combine.children="append">
<exclude>
- **/RichMacroDefinition*.java
+ **/javacc/**
</exclude>
</excludes>
</configuration>
Modified: branches/3.0.2/richfaces/common/src/main/java/org/richfaces/renderkit/MacroDefinitionJSContentHandler.java
===================================================================
--- branches/3.0.2/richfaces/common/src/main/java/org/richfaces/renderkit/MacroDefinitionJSContentHandler.java 2007-07-07 18:25:58 UTC (rev 1535)
+++ branches/3.0.2/richfaces/common/src/main/java/org/richfaces/renderkit/MacroDefinitionJSContentHandler.java 2007-07-08 13:31:55 UTC (rev 1536)
@@ -4,16 +4,12 @@
package org.richfaces.renderkit;
import java.io.IOException;
+import java.io.StringReader;
import java.io.Writer;
import java.util.Iterator;
import java.util.List;
-import org.antlr.runtime.ANTLRStringStream;
-import org.antlr.runtime.CommonTokenStream;
-import org.antlr.runtime.RecognitionException;
-import org.richfaces.RichMacroDefinitionLexer;
-import org.richfaces.RichMacroDefinitionParser;
-import org.richfaces.RichMacroDefinitionParser.expression_return;
+import org.richfaces.javacc.RichMacroDefinition;
import org.richfaces.json.JSContentHandler;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
@@ -34,16 +30,11 @@
}
private List parseExpressiion(String expressionString) throws SAXException {
- ANTLRStringStream stream = new ANTLRStringStream(expressionString);
- RichMacroDefinitionLexer lexer = new RichMacroDefinitionLexer(stream);
- RichMacroDefinitionParser macroParser = new RichMacroDefinitionParser(
- new CommonTokenStream(lexer));
try {
- expression_return expression = macroParser.expression();
- List result = expression.result;
+ List result = new RichMacroDefinition(new StringReader(expressionString)).expression();
return result;
- } catch (RecognitionException e) {
+ } catch (Exception e) {
throw new SAXException(e.getMessage(), e);
}
}
Added: branches/3.0.2/richfaces/common/src/main/javacc/RichMacroDefinition.jj
===================================================================
--- branches/3.0.2/richfaces/common/src/main/javacc/RichMacroDefinition.jj (rev 0)
+++ branches/3.0.2/richfaces/common/src/main/javacc/RichMacroDefinition.jj 2007-07-08 13:31:55 UTC (rev 1536)
@@ -0,0 +1,125 @@
+/**
+ * JavaCC file
+ */
+
+options {
+ JDK_VERSION="1.3";
+ STATIC = false;
+}
+
+PARSER_BEGIN(RichMacroDefinition)
+package org.richfaces.javacc;
+
+import java.util.*;
+import java.io.*;
+
+public class RichMacroDefinition {
+
+ private static String unescape(String arg) {
+ StringBuffer result = new StringBuffer(arg);
+ int idx = 0;
+ while ((idx = result.indexOf("\\", idx)) != -1) {
+ char ch = result.charAt(idx + 1);
+ result.replace(idx, idx + 2, String.valueOf(ch));
+
+ idx ++;
+ }
+
+ return result.toString();
+ }
+
+ public static void main(String args[]) throws ParseException, IOException {
+ System.out.println("Reading from standard input...");
+ String line = new BufferedReader(new InputStreamReader(System.in)).readLine();
+ RichMacroDefinition parser = new RichMacroDefinition(new StringReader(line));
+ Object def = parser.expression();
+ System.out.println(def);
+ }
+}
+PARSER_END(RichMacroDefinition)
+
+TOKEN :
+{
+
+ < SLASH: "\\" > |
+ < LEFT_BRACKET: "{" > |
+ < RIGHT_BRACKET: "}" > |
+ <LITERAL: ((~["{", "\\", "}"])+) | ("\\" ["{", "\\", "}"]) >
+}
+
+List expression():
+{
+ String m = null;
+ String t = null;
+ List elems = new ArrayList();
+}
+{
+
+ (
+ (
+ t = text() {
+ elems.add(t);
+ t = null;
+ }
+ |
+ m = macrodef () {
+ elems.add(new org.richfaces.renderkit.Expression(m));
+ m = null;
+ }
+ )
+ )*
+
+ {
+ return elems;
+ }
+}
+
+String text():
+{
+ String result = null;
+ StringBuffer sb = null;
+ Token t = null;
+}
+{
+ ( t = <LITERAL>
+ {
+ if (result == null) {
+ result = unescape(t.image);
+ } else {
+ if (sb == null) {
+ sb = new StringBuffer(result);
+ }
+
+ sb.append(unescape(t.image));
+ }
+
+ t = null;
+ }
+ )+
+
+ {
+ return (sb != null ? sb.toString() : result);
+ }
+}
+
+String macrodef():
+{
+ StringBuffer result = new StringBuffer();
+ String m = null;
+ String t = null;
+}
+{
+ //macrodef:
+ //LEFT_BRACKET (macrodefpart | text)+ RIGHT_BRACKET;
+ <LEFT_BRACKET> (
+ t = text () {
+ result.append(t); t = null;
+ }
+ |
+ m = macrodef() {
+ result.append("{" + m + "}"); m = null;
+ }
+
+ )+ <RIGHT_BRACKET>
+ { return result.toString(); }
+}
\ No newline at end of file
Modified: branches/3.0.2/richfaces/common/src/test/java/org/richfaces/renderkit/TemplateUtilTest.java
===================================================================
--- branches/3.0.2/richfaces/common/src/test/java/org/richfaces/renderkit/TemplateUtilTest.java 2007-07-07 18:25:58 UTC (rev 1535)
+++ branches/3.0.2/richfaces/common/src/test/java/org/richfaces/renderkit/TemplateUtilTest.java 2007-07-08 13:31:55 UTC (rev 1536)
@@ -21,17 +21,12 @@
package org.richfaces.renderkit;
-import java.io.IOException;
+import java.io.StringReader;
import java.util.List;
import junit.framework.TestCase;
-import org.antlr.runtime.ANTLRStringStream;
-import org.antlr.runtime.CommonTokenStream;
-import org.antlr.runtime.tree.Tree;
-import org.richfaces.RichMacroDefinitionLexer;
-import org.richfaces.RichMacroDefinitionParser;
-import org.richfaces.RichMacroDefinitionParser.expression_return;
+import org.richfaces.javacc.RichMacroDefinition;
/**
* @author Nick Belaevski - mailto:nbelaevski@exadel.com
@@ -40,29 +35,9 @@
*/
public class TemplateUtilTest extends TestCase {
- private String doWrite(String in) throws IOException {
- return in;
- }
- private void printTree(Tree tree, int indent) {
- int childCount = tree.getChildCount();
- for (int i = 0; i < indent; i++) {
- System.out.print('\t');
- System.out.print(tree.getText() + " : " + tree.getType());
- System.out.println();
- }
- for (int j = 1; j < childCount; j++) {
- printTree(tree.getChild(j), ++indent);
- }
- }
-
-
public void testAntlr() throws Exception {
- ANTLRStringStream stream = new ANTLRStringStream("{aa{b\\}}a}\\\\ a\\}b\\{c");
- RichMacroDefinitionLexer lexer = new RichMacroDefinitionLexer(stream);
- RichMacroDefinitionParser macroParser = new RichMacroDefinitionParser(new CommonTokenStream(lexer));
- expression_return expression = macroParser.expression();
- List result = expression.result;
+ List result = new RichMacroDefinition(new StringReader("{aa{b\\}}a}\\\\ a\\}b\\{c")).expression();
Expression holder = (Expression) result.get(0);
assertEquals("aa{b}}a", holder.getExpression());
assertEquals("\\ a}b{c", result.get(1));
17 years, 6 months