JBoss Rich Faces SVN: r17662 - root/ui-sandbox/inputs/trunk/autocomplete/src/main/resources/META-INF/resources/script.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2010-06-23 12:27:39 -0400 (Wed, 23 Jun 2010)
New Revision: 17662
Modified:
root/ui-sandbox/inputs/trunk/autocomplete/src/main/resources/META-INF/resources/script/1.html
root/ui-sandbox/inputs/trunk/autocomplete/src/main/resources/META-INF/resources/script/ComboBox.js
root/ui-sandbox/inputs/trunk/autocomplete/src/main/resources/META-INF/resources/script/SelectBase.js
Log:
https://jira.jboss.org/browse/RF-8875
Modified: root/ui-sandbox/inputs/trunk/autocomplete/src/main/resources/META-INF/resources/script/1.html
===================================================================
--- root/ui-sandbox/inputs/trunk/autocomplete/src/main/resources/META-INF/resources/script/1.html 2010-06-23 05:58:27 UTC (rev 17661)
+++ root/ui-sandbox/inputs/trunk/autocomplete/src/main/resources/META-INF/resources/script/1.html 2010-06-23 16:27:39 UTC (rev 17662)
@@ -56,12 +56,12 @@
<img src="images/bg_shadow.png" class="cb_list_shadow">
<div class="cb_list_position cb_list_width">
<div class="cb_list_decoration">
- <div class="cb_list_scroll cb_list_height">
+ <div id="myComboItems" class="cb_list_scroll cb_list_height">
<div class="cb_option cb_font">Option 1</div>
<div class="cb_option cb_font">Option 2</div>
<div class="cb_option cb_font">Option 3</div>
<div class="cb_option cb_font">Option 4</div>
- <div class="cb_option cb_font cb_select">Option 6</div>
+ <div class="cb_option cb_font">Option 6</div>
<div class="cb_option cb_font">Option 7</div>
<div class="cb_option cb_font">Option 8</div>
<div class="cb_option cb_font">Option 9</div>
@@ -71,7 +71,7 @@
</div>
</div>
<script type="text/javascript">
- new RichFaces.ui.ComboBox("myCombo", "myComboInput", {buttonId:'myComboButton'});
+ new RichFaces.ui.ComboBox("myCombo", "myComboInput", {buttonId:'myComboButton', selectedItemClass:'cb_select'});
</script>
</div><br/><select style="width:200px"><option>ccccc</option></select>
text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block
Modified: root/ui-sandbox/inputs/trunk/autocomplete/src/main/resources/META-INF/resources/script/ComboBox.js
===================================================================
--- root/ui-sandbox/inputs/trunk/autocomplete/src/main/resources/META-INF/resources/script/ComboBox.js 2010-06-23 05:58:27 UTC (rev 17661)
+++ root/ui-sandbox/inputs/trunk/autocomplete/src/main/resources/META-INF/resources/script/ComboBox.js 2010-06-23 16:27:39 UTC (rev 17662)
@@ -5,12 +5,14 @@
rf.ui.ComboBox = function(componentId, fieldId, options) {
this.namespace = "."+rf.Event.createNamespace(this.name, this.componentId);
// call constructor of parent class
- $super.constructor.call(this, componentId+"List", fieldId, options);
+ $super.constructor.call(this, componentId+ID.SELECT, fieldId, options);
$p.attachToDom(componentId);
this.componentId = componentId;
this.options = $.extend({}, defaultOptions, options);
//this.currentValue = rf.getDomElement(this.fieldId).value;
this.index = -1;
+ updateItemsList.call(this);
+ bindEventHandlers.call(this);
};
var $p ={};
@@ -22,8 +24,48 @@
var $super = rf.ui.ComboBox.$super;
var defaultOptions = {
+ selectedItemClass:'cb_select'
};
+ var ID = {
+ SELECT:'List',
+ ITEMS:'Items'
+ };
+
+ var bindEventHandlers = function () {
+ rf.Event.bindById(this.componentId+ID.ITEMS, "mouseover"+this.namespace, onClick, this);
+ };
+
+ var onClick = function(event) {
+ var element = event.target;
+ while (element.parentNode && element.parentNode!=event.currentTarget) {
+ element = element.parentNode;
+ };
+ if (element.parentNode) {
+ this.selectItem(this.items.index(element));
+ }
+ }
+
+ var updateItemsList = function () {
+ this.items = $(rf.getDomElement(this.componentId+ID.ITEMS)).children();
+ };
+
+ var scrollToSelectedItem = function() {
+ var offset = 0;
+ this.items.slice(0, this.index).each(function() {
+ offset += this.offsetHeight;
+ });
+ var itemsContainer = this.items.first().parent();
+ if(offset < itemsContainer.scrollTop()) {
+ itemsContainer.scrollTop(offset);
+ } else {
+ offset+=this.items.get(this.index).offsetHeight;
+ if(offset - itemsContainer.scrollTop() > itemsContainer.get(0).clientHeight) {
+ itemsContainer.scrollTop(offset - itemsContainer.innerHeight());
+ }
+ }
+ };
+
// Add new properties and methods
$.extend(rf.ui.SelectBase.prototype, (function () {
return {
@@ -35,11 +77,38 @@
return this.namespace;
},
- selectPrevItem: function () {
+ selectItem: function(index, isOffset) {
+ if (this.items.length==0) return;
+ if (this.index!=-1) {
+ this.items.eq(this.index).removeClass(this.options.selectedItemClass);
+ }
+
+ if (isOffset) {
+ this.index += offset;
+ if ( this.index<0 ) {
+ this.index = this.items.length - 1;
+ } else if (this.index >= this.items.length) {
+ this.index = 0;
+ }
+ } else {
+ if (index<0) {
+ index = 0;
+ } else if (index>=this.items.length) {
+ index = this.items.length - 1;
+ }
+ this.index = index;
+ }
+ this.items.eq(this.index).addClass(this.options.selectedItemClass);
+
+ scrollToSelectedItem.call(this);
},
+
+ selectPrevItem: function () {
+ this.selectItem(-1, true);
+ },
selectNextItem: function () {
-
+ this.selectItem(1, true);
},
selectPageUp: function () {
@@ -52,6 +121,19 @@
},
onChange: function () {
+ },
+
+ onShow: function () {
+ if (this.items.length>0) {
+ this.selectItem(0);
+ }
+ },
+
+ onHide: function () {
+ if (this.index!=-1) {
+ this.items.eq(this.index).removeClass(this.options.selectedItemClass);
+ this.index=-1;
+ }
}
};
})());
Modified: root/ui-sandbox/inputs/trunk/autocomplete/src/main/resources/META-INF/resources/script/SelectBase.js
===================================================================
--- root/ui-sandbox/inputs/trunk/autocomplete/src/main/resources/META-INF/resources/script/SelectBase.js 2010-06-23 05:58:27 UTC (rev 17661)
+++ root/ui-sandbox/inputs/trunk/autocomplete/src/main/resources/META-INF/resources/script/SelectBase.js 2010-06-23 16:27:39 UTC (rev 17662)
@@ -213,12 +213,18 @@
$(rf.getDomElement(this.selectId)).show();
this.isVisible = true;
this.scrollElements = rf.Event.bindScrollEventHandlers(this.selectId, this.hide, this, this.namespace);
+ if (this.onShow) {
+ this.onShow(event);
+ }
}
},
hide: function (event) {
rf.Event.unbindScrollEventHandlers(this.scrollElements, this);
$(rf.getDomElement(this.selectId)).hide();
this.isVisible = false;
+ if (this.onHide) {
+ this.onHide(event);
+ }
},
destroy: function () {
//TODO: add all unbind
14 years, 6 months
JBoss Rich Faces SVN: r17661 - root/docs/trunk/Component_Reference/en-US.
by richfaces-svn-commits@lists.jboss.org
Author: SeanRogers
Date: 2010-06-23 01:58:27 -0400 (Wed, 23 Jun 2010)
New Revision: 17661
Modified:
root/docs/trunk/Component_Reference/en-US/Component_Reference.xml
root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Actions.xml
root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Containers.xml
root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Resources.xml
root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Tables_and_grids.xml
Log:
Clean up after A2 release
Modified: root/docs/trunk/Component_Reference/en-US/Component_Reference.xml
===================================================================
--- root/docs/trunk/Component_Reference/en-US/Component_Reference.xml 2010-06-22 23:05:28 UTC (rev 17660)
+++ root/docs/trunk/Component_Reference/en-US/Component_Reference.xml 2010-06-23 05:58:27 UTC (rev 17661)
@@ -14,8 +14,10 @@
<xi:include href="chap-Component_Reference-Actions.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="chap-Component_Reference-Resources.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="chap-Component_Reference-Containers.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
-<!-- FIXME NOT IN A2 -->
-<!-- <xi:include href="chap-Component_Reference-Validation.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />-->
+ <!-- FIXME NOT IN A2 -->
+ <!--
+ <xi:include href="chap-Component_Reference-Validation.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ -->
<xi:include href="chap-Component_Reference-Processing_management.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
</part>
<part id="part-Component_Reference-rich_tag_library">
@@ -28,16 +30,17 @@
<!--
<xi:include href="chap-Component_Reference-Trees.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="chap-Component_Reference-Menus_and_toolbars.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- -->
- <!-- FIXME NOT IN A2
- <xi:include href="chap-Component_Reference-Output_and_messages.xml" xmlns:xi="http://www.w3.org/2001/XInclude" /> -->
- <!--
+ -->
+ <!-- FIXME NOT IN A2 -->
+ <!--
+ <xi:include href="chap-Component_Reference-Output_and_messages.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="chap-Component_Reference-Drag_and_drop.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="chap-Component_Reference-Layout_and_appearance.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- --><xi:include href="chap-Component_Reference-Functions.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ -->
+ <xi:include href="chap-Component_Reference-Functions.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<!--
<xi:include href="chap-Component_Reference-Functionality_extension.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- -->
+ -->
</part>
<xi:include href="Revision_History.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
</book>
Modified: root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Actions.xml
===================================================================
--- root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Actions.xml 2010-06-22 23:05:28 UTC (rev 17660)
+++ root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Actions.xml 2010-06-23 05:58:27 UTC (rev 17661)
@@ -74,36 +74,36 @@
</para>
</section>
-<!-- TODO NOT IN A2 -->
-<!-- <section id="sect-Component_Reference-Actions-a4jajaxListener">-->
-<!-- <title><sgmltag><a4j:ajaxListener></sgmltag></title>-->
-<!-- <itemizedlist>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- listener-class: <classname>org.ajax4jsf.event.AjaxListener</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- event-class: <classname>org.ajax4jsf.event.AjaxEvent</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- tag-class: <classname>org.ajax4jsf.taglib.html.jsp.AjaxListenerTag</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- </itemizedlist>-->
-<!-- <para>-->
-<!-- The <sgmltag><a4j:ajaxListener></sgmltag> component adds an action listener to a parent component. It works similar to the JavaServer Faces <sgmltag><f:actionListener></sgmltag> or <sgmltag><f:valueChangeListener></sgmltag> components, except that the invocation of <sgmltag><a4j:ajaxListener></sgmltag> is not canceled if validation of the <emphasis>Update Model</emphasis> phase fails. The <sgmltag><a4j:ajaxListener></sgmltag> component is guaranteed to be invoked with each Ajax response.-->
-<!-- </para>-->
-<!-- <para>-->
-<!-- Basic usage requires only the <varname>type</varname> attribute, which defines the fully-qualified Java class name for the listener. This Java class should implement the <classname>org.ajax4jsf.event.AjaxListener</classname> interface, which is a base listener for all listeners and is capable of receiving Ajax events. The object from which the event originated could be accessed using the <methodname>java.util.EventObject.getSource()</methodname> method.-->
-<!-- </para>-->
-<!-- <para>-->
-<!-- The <sgmltag><a4j:ajaxListener></sgmltag> component is not invoked for non-Ajax requests, or when the RichFaces works in the <emphasis>Ajax request generates non-Ajax response</emphasis> mode, so the <sgmltag><a4j:ajaxListener></sgmltag> invocation is a good indicator that an Ajax response is going to be processed.-->
-<!-- </para>-->
-<!-- </section>-->
+ <!-- TODO NOT IN A2 -->
+ <section id="sect-Component_Reference-Actions-a4jajaxListener">
+ <title><sgmltag><a4j:ajaxListener></sgmltag></title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ listener-class: <classname>org.ajax4jsf.event.AjaxListener</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ event-class: <classname>org.ajax4jsf.event.AjaxEvent</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ tag-class: <classname>org.ajax4jsf.taglib.html.jsp.AjaxListenerTag</classname>
+ </para>
+ </listitem>
+ </itemizedlist>
+ <para>
+ The <sgmltag><a4j:ajaxListener></sgmltag> component adds an action listener to a parent component. It works similar to the JavaServer Faces <sgmltag><f:actionListener></sgmltag> or <sgmltag><f:valueChangeListener></sgmltag> components, except that the invocation of <sgmltag><a4j:ajaxListener></sgmltag> is not canceled if validation of the <emphasis>Update Model</emphasis> phase fails. The <sgmltag><a4j:ajaxListener></sgmltag> component is guaranteed to be invoked with each Ajax response.
+ </para>
+ <para>
+ Basic usage requires only the <varname>type</varname> attribute, which defines the fully-qualified Java class name for the listener. This Java class should implement the <classname>org.ajax4jsf.event.AjaxListener</classname> interface, which is a base listener for all listeners and is capable of receiving Ajax events. The object from which the event originated could be accessed using the <methodname>java.util.EventObject.getSource()</methodname> method.
+ </para>
+ <para>
+ The <sgmltag><a4j:ajaxListener></sgmltag> component is not invoked for non-Ajax requests, or when the RichFaces works in the <emphasis>Ajax request generates non-Ajax response</emphasis> mode, so the <sgmltag><a4j:ajaxListener></sgmltag> invocation is a good indicator that an Ajax response is going to be processed.
+ </para>
+ </section>
<section id="sect-Component_Reference-Actions-a4jcommandButton">
<title><sgmltag><a4j:commandButton></sgmltag></title>
@@ -328,40 +328,39 @@
Incomplete
</para>
</section>
+
+ <section id="sect-Component_Reference-Actions-a4jhtmlCommandLink">
+ <title><sgmltag><a4j:htmlCommandLink></sgmltag></title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ component-type: <classname>org.ajax4jsf.HtmlCommandLink</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ component-family: <classname>javax.faces.Command</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ component-class: <classname>org.ajax4jsf.component.html.HtmlCommandLink</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ renderer-type: <classname>org.ajax4jsf.HtmlCommandLinkRenderer</classname>
+ </para>
+ </listitem>
+ </itemizedlist>
+ <para>
+ The <sgmltag><a4j:htmlCommandLink></sgmltag> component functions similarly to the standard <sgmltag><h:commandLink></sgmltag> component, but addresses some of the potential issues that can occur.
+ </para>
+ <para>
+ When using the standard component, hidden fields were not rendered to child elements if they were deemed unnecessary, so command links relating to content on the initial page could become broken if they were later updated through Ajax. The <sgmltag><a4j:htmlCommandLink></sgmltag> component addresses this by always rendering all hidden fields.
+ </para>
+ </section>
-<!-- FIXME NOT IS A2 -->
-<!-- <section id="sect-Component_Reference-Actions-a4jhtmlCommandLink">-->
-<!-- <title><sgmltag><a4j:htmlCommandLink></sgmltag></title>-->
-<!-- <itemizedlist>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- component-type: <classname>org.ajax4jsf.HtmlCommandLink</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- component-family: <classname>javax.faces.Command</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- component-class: <classname>org.ajax4jsf.component.html.HtmlCommandLink</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- renderer-type: <classname>org.ajax4jsf.HtmlCommandLinkRenderer</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- </itemizedlist>-->
-<!-- <para>-->
-<!-- The <sgmltag><a4j:htmlCommandLink></sgmltag> component functions similarly to the standard <sgmltag><h:commandLink></sgmltag> component, but addresses some of the potential issues that can occur.-->
-<!-- </para>-->
-<!-- <para>-->
-<!-- When using the standard component, hidden fields were not rendered to child elements if they were deemed unnecessary, so command links relating to content on the initial page could become broken if they were later updated through Ajax. The <sgmltag><a4j:htmlCommandLink></sgmltag> component addresses this by always rendering all hidden fields.-->
-<!-- </para>-->
-<!-- </section>-->
-
<section id="sect-Component_Reference-Actions-a4jjsFunction">
<title><sgmltag><a4j:jsFunction></sgmltag></title>
<itemizedlist>
Modified: root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Containers.xml
===================================================================
--- root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Containers.xml 2010-06-22 23:05:28 UTC (rev 17660)
+++ root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Containers.xml 2010-06-23 05:58:27 UTC (rev 17661)
@@ -7,109 +7,109 @@
This chapter details those components in the <classname>a4j</classname> tag library which define an area used as a container or wrapper for other components.
</para>
<!-- FIXME NOT IN A2 -->
-<!-- <section id="sect-Component_Reference-Containers-a4jform">-->
-<!-- <title><sgmltag><a4j:form></sgmltag></title>-->
-<!-- <itemizedlist>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- component-type: <classname>org.ajax4jsf.Form</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- component-family: <classname>javax.faces.Form</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- component-class: <classname>org.ajax4jsf.component.html.AjaxForm</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- renderer-type: <classname>org.ajax4jsf.FormRenderer</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- </itemizedlist>-->
-<!-- <para>-->
-<!-- The <sgmltag><a4j:form></sgmltag> builds on the functionality of the JavaServer Faces (<acronym>JSF</acronym>) component <sgmltag><h:form></sgmltag>, adding Ajax capabilities to the form.-->
-<!-- </para>-->
-<!-- <note>-->
-<!-- <title>Command link rendering fixed</title>-->
-<!-- <para>-->
-<!-- The <acronym>JSF</acronym> component <sgmltag><h:form></sgmltag>, on which the <sgmltag><a4j:form></sgmltag> component is based, had an issue whereby the <sgmltag><h:commandLink></sgmltag> component could not be re-rendered without re-rendering the entire form. <sgmltag><a4j:form></sgmltag> and <sgmltag><a4j:commandLink></sgmltag> fix this issue.-->
-<!-- </para>-->
-<!-- </note>-->
-<!-- <para>-->
-<!-- The <sgmltag><a4j:form></sgmltag> component can add indirect Ajax support to non-Ajax components on the form by setting <code>ajaxSubmit="true"</code>. It then uses the standard Ajax component attributes and updates components specified with the <varname>render</varname> attribute.-->
-<!-- </para>-->
-<!-- <important>-->
-<!-- <title><varname>ajaxSubmit</varname></title>-->
-<!-- <para>-->
-<!-- <sgmltag><a4j:form></sgmltag> should not use <code>ajaxSubmit="true"</code> if it contains other Ajax-capable components.-->
-<!-- </para>-->
-<!-- <para>-->
-<!-- Additionally, due to security reasons the file upload form element cannot be indirectly made Ajax-capable with <sgmltag><a4j:form></sgmltag>.-->
-<!-- </para>-->
-<!-- </important>-->
-<!-- </section>-->
-<!-- -->
-<!-- <section id="sect-Component_Reference-Containers-a4jinclude">-->
-<!-- <title><sgmltag><a4j:include></sgmltag></title>-->
-<!-- <itemizedlist>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- component-type: <classname>org.ajax4jsf.Include</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- component-family: <classname>javax.faces.Output</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- component-class: <classname>org.ajax4jsf.component.html.Include</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- renderer-type: <classname>org.ajax4jsf.components.AjaxIncludeRenderer</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- </itemizedlist>-->
-<!-- <para>-->
-<!-- The <sgmltag><a4j:include></sgmltag> component allows one view to be included as part of another page. This is useful for applications where multiple views might appear on the one page, with navigation between the views. Views can use partial page navigation in Ajax mode, or standard <acronym>JSF</acronym> navigation for navigation between views.-->
-<!-- </para>-->
-<!-- <para>-->
-<!-- The <varname>viewId</varname> attribute is required to reference the resource that will be included as a view on the page. It uses a full context-relative path to point to the resource, similar to the paths used for the <sgmltag><from-view-id></sgmltag> and <sgmltag><to-view-id></sgmltag> tags in the <filename>faces-config.xml</filename> <acronym>JSF</acronym> navigation rules.-->
-<!-- </para>-->
-<!-- <example id="exam-Component_Reference-a4jinclude-A_wizard_using_a4jinclude">-->
-<!-- <title>A wizard using <sgmltag><a4j:include></sgmltag></title>-->
-<!-- <para>-->
-<!-- The page uses <sgmltag><a4j:include></sgmltag> to include the first step of the wizard:-->
-<!-- </para>-->
-<!-- -->
-<!--<programlisting language="XML" role="XML">-->
-<!--<xi:include href="extras/exam-Component_Reference-a4jinclude-A_wizard_using_a4jinclude-0.xml_sample" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" />-->
-<!--</programlisting>-->
-<!-- <para>-->
-<!-- The first step is fully contained in a separate file, <filename>wstep1.xhtml</filename>. Subsequent steps are set up similarly with additional <guibutton>Previous</guibutton> buttons.-->
-<!-- </para>-->
-<!-- -->
-<!--<programlisting language="XML" role="XML">-->
-<!--<xi:include href="extras/exam-Component_Reference-a4jinclude-A_wizard_using_a4jinclude-1.xml_sample" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" />-->
-<!--</programlisting>-->
-<!-- <para>-->
-<!-- The navigation is defined in the <filename>faces-config.xml</filename> configuration file:-->
-<!-- </para>-->
-<!-- -->
-<!--<programlisting language="XML" role="XML">-->
-<!--<xi:include href="extras/exam-Component_Reference-a4jinclude-A_wizard_using_a4jinclude-2.xml_sample" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" />-->
-<!--</programlisting>-->
-<!-- </example>-->
-<!-- </section>-->
+ <section id="sect-Component_Reference-Containers-a4jform">
+ <title><sgmltag><a4j:form></sgmltag></title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ component-type: <classname>org.ajax4jsf.Form</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ component-family: <classname>javax.faces.Form</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ component-class: <classname>org.ajax4jsf.component.html.AjaxForm</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ renderer-type: <classname>org.ajax4jsf.FormRenderer</classname>
+ </para>
+ </listitem>
+ </itemizedlist>
+ <para>
+ The <sgmltag><a4j:form></sgmltag> builds on the functionality of the JavaServer Faces (<acronym>JSF</acronym>) component <sgmltag><h:form></sgmltag>, adding Ajax capabilities to the form.
+ </para>
+ <note>
+ <title>Command link rendering fixed</title>
+ <para>
+ The <acronym>JSF</acronym> component <sgmltag><h:form></sgmltag>, on which the <sgmltag><a4j:form></sgmltag> component is based, had an issue whereby the <sgmltag><h:commandLink></sgmltag> component could not be re-rendered without re-rendering the entire form. <sgmltag><a4j:form></sgmltag> and <sgmltag><a4j:commandLink></sgmltag> fix this issue.
+ </para>
+ </note>
+ <para>
+ The <sgmltag><a4j:form></sgmltag> component can add indirect Ajax support to non-Ajax components on the form by setting <code>ajaxSubmit="true"</code>. It then uses the standard Ajax component attributes and updates components specified with the <varname>render</varname> attribute.
+ </para>
+ <important>
+ <title><varname>ajaxSubmit</varname></title>
+ <para>
+ <sgmltag><a4j:form></sgmltag> should not use <code>ajaxSubmit="true"</code> if it contains other Ajax-capable components.
+ </para>
+ <para>
+ Additionally, due to security reasons the file upload form element cannot be indirectly made Ajax-capable with <sgmltag><a4j:form></sgmltag>.
+ </para>
+ </important>
+ </section>
+ <section id="sect-Component_Reference-Containers-a4jinclude">
+ <title><sgmltag><a4j:include></sgmltag></title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ component-type: <classname>org.ajax4jsf.Include</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ component-family: <classname>javax.faces.Output</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ component-class: <classname>org.ajax4jsf.component.html.Include</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ renderer-type: <classname>org.ajax4jsf.components.AjaxIncludeRenderer</classname>
+ </para>
+ </listitem>
+ </itemizedlist>
+ <para>
+ The <sgmltag><a4j:include></sgmltag> component allows one view to be included as part of another page. This is useful for applications where multiple views might appear on the one page, with navigation between the views. Views can use partial page navigation in Ajax mode, or standard <acronym>JSF</acronym> navigation for navigation between views.
+ </para>
+ <para>
+ The <varname>viewId</varname> attribute is required to reference the resource that will be included as a view on the page. It uses a full context-relative path to point to the resource, similar to the paths used for the <sgmltag><from-view-id></sgmltag> and <sgmltag><to-view-id></sgmltag> tags in the <filename>faces-config.xml</filename> <acronym>JSF</acronym> navigation rules.
+ </para>
+ <example id="exam-Component_Reference-a4jinclude-A_wizard_using_a4jinclude">
+ <title>A wizard using <sgmltag><a4j:include></sgmltag></title>
+ <para>
+ The page uses <sgmltag><a4j:include></sgmltag> to include the first step of the wizard:
+ </para>
+
+<programlisting language="XML" role="XML">
+<xi:include href="extras/exam-Component_Reference-a4jinclude-A_wizard_using_a4jinclude-0.xml_sample" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" />
+</programlisting>
+ <para>
+ The first step is fully contained in a separate file, <filename>wstep1.xhtml</filename>. Subsequent steps are set up similarly with additional <guibutton>Previous</guibutton> buttons.
+ </para>
+
+<programlisting language="XML" role="XML">
+<xi:include href="extras/exam-Component_Reference-a4jinclude-A_wizard_using_a4jinclude-1.xml_sample" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" />
+</programlisting>
+ <para>
+ The navigation is defined in the <filename>faces-config.xml</filename> configuration file:
+ </para>
+
+<programlisting language="XML" role="XML">
+<xi:include href="extras/exam-Component_Reference-a4jinclude-A_wizard_using_a4jinclude-2.xml_sample" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" />
+</programlisting>
+ </example>
+ </section>
+
<section id="sect-Component_Reference-Containers-a4joutputPanel">
<title><sgmltag><a4j:outputPanel></sgmltag></title>
<itemizedlist>
@@ -163,92 +163,92 @@
</section>
<!-- FIXME NOT IN A2 -->
-<!-- <section id="sect-Component_Reference-Containers-a4jpage">-->
-<!-- <title><sgmltag><a4j:page></sgmltag></title>-->
-<!-- <itemizedlist>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- component-type: <classname>org.ajax4jsf.components.Page</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- component-family: <classname>org.ajax4jsf.components.AjaxRegion</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- component-class: <classname>org.ajax4jsf.component.html.HtmlPage</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- renderer-type: <classname>org.ajax4jsf.components.AjaxPageRenderer</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- </itemizedlist>-->
-<!-- <para>-->
-<!-- The <sgmltag><a4j:page></sgmltag> component encodes a full HTML-page structure using only one tag. It renders complete <sgmltag><!DOCTYPE></sgmltag>, <sgmltag><html></sgmltag>, <sgmltag><head></sgmltag>, <sgmltag><title></sgmltag>, and <sgmltag><body></sgmltag> tags using the specified attributes and facets. Additionally, the <sgmltag><a4j:page></sgmltag> component solves an incompatibility issue between early versions of <productname>MyFaces</productname>-->
-<!-- and the <productname>Ajax4jsf</productname>-->
-<!-- framework.-->
-<!-- </para>-->
-<!-- <para>-->
-<!-- The <varname>pageTitle</varname> attribute is rendered as a <sgmltag><title></sgmltag> element. The component uses the <literal>head</literal> facet to define the contents of the HTML <sgmltag><head></sgmltag> element. The <literal>format</literal> facet defines the page layout format for encoding the <sgmltag><!DOCTYPE></sgmltag> element. There rest of the contents of the <sgmltag><a4j:page></sgmltag> component are rendered as part of the <sgmltag><body></sgmltag> element.-->
-<!-- </para>-->
-<!-- <example id="exam-Component_Reference-a4jpage-a4jpage_rendering">-->
-<!-- <title><sgmltag><a4j:page></sgmltag> rendering</title>-->
-<!-- <para>-->
-<!-- An <sgmltag><a4j:page></sgmltag> component can be defined as follows:-->
-<!-- </para>-->
-<!-- -->
-<!--<programlisting language="XML" role="XML"><xi:include href="extras/exam-Component_Reference-a4jpage-a4jpage_rendering-0.xml_sample" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" />-->
-<!--</programlisting>-->
-<!-- <para>-->
-<!-- This definition will render on an XHTML page as follows:-->
-<!-- </para>-->
-<!-- -->
-<!--<programlisting language="XML" role="XML"><xi:include href="extras/exam-Component_Reference-a4jpage-a4jpage_rendering-1.xml_sample" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" />-->
-<!--</programlisting>-->
-<!-- </example>-->
-<!-- <para>-->
-<!-- When using the <productname>Ajax4jsf</productname>-->
-<!-- framework with <productname>MyFaces</productname>-->
-<!-- version 1.2.2 and lower, the <sgmltag><f:view></sgmltag> JSP tag does not receive control for encoding contents during the <literal>RENDER_RESPONSE</literal> phase. As a result, Ajax fails to receive control and send responses. The <sgmltag><a4j:page></sgmltag> component solves this problem by wrapping the Ajax areas to be updated. Later versions of <productname>MyFaces</productname>-->
-<!-- do not have this problem, and as such do not require the use of the <sgmltag><a4j:page></sgmltag> component.-->
-<!-- </para>-->
-<!-- </section>-->
-<!-- -->
-<!-- <section id="sect-Component_Reference-Containers-a4jregion">-->
-<!-- <title><sgmltag><a4j:region></sgmltag></title>-->
-<!-- <itemizedlist>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- component-type: <classname>org.ajax4jsf.AjaxRegion</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- component-family: <classname>org.ajax4jsf.AjaxRegion</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- component-class: <classname>org.ajax4jsf.component.html.HtmlAjaxRegion</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- renderer-type: <classname>org.ajax4jsf.components.AjaxRegionRenderer</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- </itemizedlist>-->
-<!-- <para>-->
-<!-- The <sgmltag><a4j:region></sgmltag> component specifies a part of the document object model (<acronym>DOM</acronym>) tree to be processed on the server. The processing includes data handling during decoding, conversion, validation, and model updating. When not using <sgmltag><a4j:region></sgmltag>, the entire view functions as a region.-->
-<!-- </para>-->
-<!-- <para>-->
-<!-- The whole form is still submitted to the server, but only the specified region is processed. Regions can be nested, in which case only the immediate region of the component initiating the request will be processed.-->
-<!-- </para>-->
-<!-- </section>-->
+ <section id="sect-Component_Reference-Containers-a4jpage">
+ <title><sgmltag><a4j:page></sgmltag></title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ component-type: <classname>org.ajax4jsf.components.Page</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ component-family: <classname>org.ajax4jsf.components.AjaxRegion</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ component-class: <classname>org.ajax4jsf.component.html.HtmlPage</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ renderer-type: <classname>org.ajax4jsf.components.AjaxPageRenderer</classname>
+ </para>
+ </listitem>
+ </itemizedlist>
+ <para>
+ The <sgmltag><a4j:page></sgmltag> component encodes a full HTML-page structure using only one tag. It renders complete <sgmltag><!DOCTYPE></sgmltag>, <sgmltag><html></sgmltag>, <sgmltag><head></sgmltag>, <sgmltag><title></sgmltag>, and <sgmltag><body></sgmltag> tags using the specified attributes and facets. Additionally, the <sgmltag><a4j:page></sgmltag> component solves an incompatibility issue between early versions of <productname>MyFaces</productname>
+ and the <productname>Ajax4jsf</productname>
+ framework.
+ </para>
+ <para>
+ The <varname>pageTitle</varname> attribute is rendered as a <sgmltag><title></sgmltag> element. The component uses the <literal>head</literal> facet to define the contents of the HTML <sgmltag><head></sgmltag> element. The <literal>format</literal> facet defines the page layout format for encoding the <sgmltag><!DOCTYPE></sgmltag> element. There rest of the contents of the <sgmltag><a4j:page></sgmltag> component are rendered as part of the <sgmltag><body></sgmltag> element.
+ </para>
+ <example id="exam-Component_Reference-a4jpage-a4jpage_rendering">
+ <title><sgmltag><a4j:page></sgmltag> rendering</title>
+ <para>
+ An <sgmltag><a4j:page></sgmltag> component can be defined as follows:
+ </para>
+
+<programlisting language="XML" role="XML"><xi:include href="extras/exam-Component_Reference-a4jpage-a4jpage_rendering-0.xml_sample" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" />
+</programlisting>
+ <para>
+ This definition will render on an XHTML page as follows:
+ </para>
+
+<programlisting language="XML" role="XML"><xi:include href="extras/exam-Component_Reference-a4jpage-a4jpage_rendering-1.xml_sample" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" />
+</programlisting>
+ </example>
+ <para>
+ When using the <productname>Ajax4jsf</productname>
+ framework with <productname>MyFaces</productname>
+ version 1.2.2 and lower, the <sgmltag><f:view></sgmltag> JSP tag does not receive control for encoding contents during the <literal>RENDER_RESPONSE</literal> phase. As a result, Ajax fails to receive control and send responses. The <sgmltag><a4j:page></sgmltag> component solves this problem by wrapping the Ajax areas to be updated. Later versions of <productname>MyFaces</productname>
+ do not have this problem, and as such do not require the use of the <sgmltag><a4j:page></sgmltag> component.
+ </para>
+ </section>
+
+ <section id="sect-Component_Reference-Containers-a4jregion">
+ <title><sgmltag><a4j:region></sgmltag></title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ component-type: <classname>org.ajax4jsf.AjaxRegion</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ component-family: <classname>org.ajax4jsf.AjaxRegion</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ component-class: <classname>org.ajax4jsf.component.html.HtmlAjaxRegion</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ renderer-type: <classname>org.ajax4jsf.components.AjaxRegionRenderer</classname>
+ </para>
+ </listitem>
+ </itemizedlist>
+ <para>
+ The <sgmltag><a4j:region></sgmltag> component specifies a part of the document object model (<acronym>DOM</acronym>) tree to be processed on the server. The processing includes data handling during decoding, conversion, validation, and model updating. When not using <sgmltag><a4j:region></sgmltag>, the entire view functions as a region.
+ </para>
+ <para>
+ The whole form is still submitted to the server, but only the specified region is processed. Regions can be nested, in which case only the immediate region of the component initiating the request will be processed.
+ </para>
+ </section>
</chapter>
Modified: root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Resources.xml
===================================================================
--- root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Resources.xml 2010-06-22 23:05:28 UTC (rev 17660)
+++ root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Resources.xml 2010-06-23 05:58:27 UTC (rev 17661)
@@ -7,219 +7,219 @@
This chapter covers those components used to handle and manage resources and beans.
</para>
<!-- FIXME NOT IN A2 -->
-<!-- <section id="sect-Component_Reference-Resources-a4jloadBundle">-->
-<!-- <title><sgmltag><a4j:loadBundle></sgmltag></title>-->
-<!-- <itemizedlist>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- component-type: <classname>org.ajax4jsf.Bundle</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- component-family: <classname>org.ajax4jsf.Bundle</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- component-class: <classname>org.ajax4jsf.component.html.AjaxLoadBundle</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- </itemizedlist>-->
-<!-- <para>-->
-<!-- The <sgmltag><a4j:loadBundle></sgmltag> component is used to load resource bundles to aid in localization of an application. The bundles are localized to the locale of the current view, and properties are stored as a map in the current request attributes.-->
-<!-- </para>-->
-<!-- <para>-->
-<!-- The <sgmltag><a4j:loadBundle></sgmltag> component allows bundles to be accessed by Ajax requests working in their own address scopes. This solves the problem of using the <acronym>JSF</acronym> <sgmltag><h:loadBundle></sgmltag> component with Ajax, where bundle information loaded with the page was unavailable for later Ajax requests.-->
-<!-- </para>-->
-<!-- <para>-->
-<!-- Resource bundles are registered in the Faces configuration file, <filename>faces-config.xml</filename>.-->
-<!-- </para>-->
-<!-- <example id="exam-Component_Reference-a4jloadBundle-a4jloadBundle_example">-->
-<!-- <title><sgmltag><a4j:loadBundle></sgmltag> example</title>-->
-<!-- <para>-->
-<!-- This example shows a simple application capable of switching between different localized languages.-->
-<!-- </para>-->
-<!-- <procedure>-->
-<!-- <step id="step-Component_Reference-a4jloadBundle_example-Create_resource_bundles">-->
-<!-- <title>Create resource bundles</title>-->
-<!-- <para>-->
-<!-- String resource bundles are contained in files with a <filename class="extension">.properties</filename> extension. The files consist of a list of entries, each with a unique name and a corresponding value. A seperate file is required for each language. Append the filename with the locale identifier (<literal>en</literal> for English, for example).-->
-<!-- </para>-->
-<!-- <mediaobject>-->
-<!-- <imageobject>-->
-<!-- <imagedata fileref="images/figu-Component_Reference-a4jloadBundle-Create_resource_bundles.png" format="PNG" width="444" />-->
-<!-- </imageobject>-->
-<!-- <textobject>-->
-<!-- <para>-->
-<!-- Resource bundles for English (<literal>en</literal>), German (<literal>de</literal>), and Italian (<literal>it</literal>). A single entry (<literal>greeting</literal>) has been localized for each bundle.-->
-<!-- </para>-->
-<!-- </textobject>-->
-<!-- </mediaobject>-->
-<!-- </step>-->
-<!-- <step id="step-Component_Reference-a4jloadBundle_example-Register_bundles_in_Faces_configuration_file">-->
-<!-- <title>Register bundles in Faces configuration file</title>-->
-<!-- <para>-->
-<!-- The resource bundles need to be registered in the Faces configuration file, <filename>faces-config.xml</filename>. The filename is defined with the <sgmltag><message-bundle></sgmltag> tag, without the locale code and without the extension. The supported locale codes are listed with <sgmltag><supported-locale></sgmltag> tags.-->
-<!-- </para>-->
-<!-- -->
-<!--<programlisting language="XML" role="XML">-->
-<!--<xi:include href="extras/exam-Component_Reference-a4jloadBundle-a4jloadBundle_example-0.xml_sample" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" />-->
-<!--</programlisting>-->
-<!-- </step>-->
-<!-- <step id="step-Component_Reference-a4jloadBundle_example-Create_method_to_set_locale">-->
-<!-- <title>Create method to set locale</title>-->
-<!-- <para>-->
-<!-- The <acronym>JSF</acronym> <methodname>javax.faces.component.UIViewRoot.setLocale()</methodname> method can be used to update the locale through a Java class:-->
-<!-- </para>-->
-<!-- -->
-<!--<programlisting language="Java" role="JAVA">-->
-<!--<xi:include href="extras/exam-Component_Reference-a4jloadBundle-a4jloadBundle_example-1.js" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" />-->
-<!--</programlisting>-->
-<!-- </step>-->
-<!-- <step id="step-Component_Reference-a4jloadBundle_example-Add_a4jloadBundle_to_the_JSP_page">-->
-<!-- <title>Add <sgmltag><a4j:loadBundle></sgmltag> to the <acronym>JSP</acronym> page</title>-->
-<!-- <para>-->
-<!-- The <sgmltag><a4j:loadBundle></sgmltag> component is added to the application, and links to change the locale will update the displayed text.-->
-<!-- </para>-->
-<!-- -->
-<!--<programlisting language="XML" role="XML">-->
-<!--<xi:include href="extras/exam-Component_Reference-a4jloadBundle-a4jloadBundle_example-2.xml_sample" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" />-->
-<!--</programlisting>-->
-<!-- <mediaobject>-->
-<!-- <imageobject>-->
-<!-- <imagedata fileref="images/figu-Component_Reference-a4jloadBundle-Add_a4jloadBundle_to_the_JSP_page.png" format="PNG" />-->
-<!-- </imageobject>-->
-<!-- <textobject>-->
-<!-- <para>-->
-<!-- The output text displayed on a page. It can be changed by clicking the command link for either German, English, or Italian.-->
-<!-- </para>-->
-<!-- </textobject>-->
-<!-- </mediaobject>-->
-<!-- </step>-->
-<!-- </procedure>-->
-<!-- -->
-<!-- <para>-->
-<!-- Clicking on the different links will render the localized string as appropriate.-->
-<!-- </para>-->
-<!-- </example>-->
-<!-- </section>-->
-<!-- -->
-<!-- <section id="sect-Component_Reference-Resources-a4jloadScript">-->
-<!-- <title><sgmltag><a4j:loadScript></sgmltag></title>-->
-<!-- <itemizedlist>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- component-type: <classname>org.ajax4jsf.LoadScript</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- component-family: <classname>org.ajax4jsf.LoadScript</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- component-class: <classname>org.ajax4jsf.component.html.HtmlLoadScript</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- renderer-type: <classname>org.ajax4jsf.LoadScriptRenderer</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- </itemizedlist>-->
-<!-- <para>-->
-<!-- The <sgmltag><a4j:loadScript></sgmltag> component allows scripts to be loaded from external sources such as <filename>jar</filename> files.-->
-<!-- </para>-->
-<!-- <para>-->
-<!-- The required <varname>src</varname> attribute defines the path to the script. A leading slash (<literal>/</literal>) represents the root of the web context. The <code>resource://</code> prefix can be used to access a file in the RichFaces resource framework. The path is passed to the <methodname>getResourceURL()</methodname> method of the application's <classname>ViewHandler</classname>, with the result then being passed through the <methodname>encodeResourceURL()</methodname> method of <classname>ExternalContext</classname>.-->
-<!-- </para>-->
-<!-- <example id="exam-Component_Reference-a4jloadScript-a4jloadScript_example">-->
-<!-- <title><sgmltag><a4j:loadScript></sgmltag> example</title>-->
-<!-- -->
-<!--<programlisting language="XML" role="XML">-->
-<!--<a4j:loadScript src="resource:///org/mycompany/assets/script/focus.js" />-->
-<!--</programlisting>-->
-<!-- </example>-->
-<!-- </section>-->
-<!-- -->
-<!-- <section id="sect-Component_Reference-Resources-a4jloadStyle">-->
-<!-- <title><sgmltag><a4j:loadStyle></sgmltag></title>-->
-<!-- <itemizedlist>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- component-type: <classname>org.ajax4jsf.LoadStyle</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- component-family: <classname>org.ajax4jsf.LoadStyle</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- component-class: <classname>org.ajax4jsf.component.html.HtmlLoadStyle</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- renderer-type: <classname>org.ajax4jsf.LoadStyleRenderer</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- </itemizedlist>-->
-<!-- <para>-->
-<!-- The <sgmltag><a4j:loadStyle></sgmltag> component allows a style sheet to be loaded from an external source, such as a <filename>jar</filename> file. The style sheet links are inserted into the head element.-->
-<!-- </para>-->
-<!-- <para>-->
-<!-- The required <varname>src</varname> attribute defines the path to the script. A leading slash (<literal>/</literal>) represents the root of the web context. The <code>resource://</code> prefix can be used to access a file in the RichFaces resource framework. The path is passed to the <methodname>getResourceURL()</methodname> method of the application's <classname>ViewHandler</classname>, with the result then being passed through the <methodname>encodeResourceURL()</methodname> method of <classname>ExternalContext</classname>.-->
-<!-- </para>-->
-<!-- <example id="exam-Component_Reference-a4jloadStyle-a4jloadStyle_example">-->
-<!-- <title><sgmltag><a4j:loadStyle></sgmltag> example</title>-->
-<!-- -->
-<!--<programlisting language="XML" role="XML">-->
-<!--<a4j:loadStyle src="resource:///org/mycompany/assets/script/focus.js" />-->
-<!--</programlisting>-->
-<!-- </example>-->
-<!-- </section>-->
-<!-- -->
-<!-- <section id="sect-Component_Reference-Resources-a4jkeepAlive">-->
-<!-- <title><sgmltag><a4j:keepAlive></sgmltag></title>-->
-<!-- <itemizedlist>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- component-type: <classname>org.ajax4jsf.components.KeepAlive</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- component-family: <classname>org.ajax4jsf.components.AjaxKeepAlive</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- component-class: <classname>org.ajax4jsf.components.AjaxKeepAlive</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- </itemizedlist>-->
-<!-- <para>-->
-<!-- The <sgmltag><a4j:keepAlive></sgmltag> component allows the state of a managed bean to be retained between Ajax requests.-->
-<!-- </para>-->
-<!-- <para>-->
-<!-- Managed beans can be declared with the <literal>request</literal> scope in the <filename>faces-config.xml</filename> configuration file, using the <sgmltag><managed-bean-scope></sgmltag> tag. Any references to the bean instance after the request has ended will cause the server to throw an illegal argument exception. The <sgmltag><a4j:keepAlive></sgmltag> component avoids this be maintaining the state of the whole bean object for subsequent requests.-->
-<!-- </para>-->
-<!-- <para>-->
-<!-- The <varname>beanName</varname> attribute uses JSF Expression Language (<acronym>EL</acronym>) to define the request scope bean name to keep alive. The expression must resolve to a managed bean instance. The <varname>ajaxOnly</varname> attribute determines whether or not the value of the bean should be available during non-Ajaxx requests; if <code>ajaxOnly="true"</code>, the request-scope bean keeps its value during Ajax requests, but any non-Ajax requests will re-create the bean as a regular request-scope bean.-->
-<!-- </para>-->
-<!-- <example id="exam-Component_Reference-a4jkeepAlive-a4jkeepAlive_example">-->
-<!-- <title><sgmltag><a4j:keepAlive></sgmltag> example</title>-->
-<!-- -->
-<!--<programlisting language="XML" role="XML">-->
-<!--<a4j:keepAlive beanName="#{myClass.testBean}" />-->
-<!--</programlisting>-->
-<!-- </example>-->
-<!-- </section>-->
+ <section id="sect-Component_Reference-Resources-a4jloadBundle">
+ <title><sgmltag><a4j:loadBundle></sgmltag></title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ component-type: <classname>org.ajax4jsf.Bundle</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ component-family: <classname>org.ajax4jsf.Bundle</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ component-class: <classname>org.ajax4jsf.component.html.AjaxLoadBundle</classname>
+ </para>
+ </listitem>
+ </itemizedlist>
+ <para>
+ The <sgmltag><a4j:loadBundle></sgmltag> component is used to load resource bundles to aid in localization of an application. The bundles are localized to the locale of the current view, and properties are stored as a map in the current request attributes.
+ </para>
+ <para>
+ The <sgmltag><a4j:loadBundle></sgmltag> component allows bundles to be accessed by Ajax requests working in their own address scopes. This solves the problem of using the <acronym>JSF</acronym> <sgmltag><h:loadBundle></sgmltag> component with Ajax, where bundle information loaded with the page was unavailable for later Ajax requests.
+ </para>
+ <para>
+ Resource bundles are registered in the Faces configuration file, <filename>faces-config.xml</filename>.
+ </para>
+ <example id="exam-Component_Reference-a4jloadBundle-a4jloadBundle_example">
+ <title><sgmltag><a4j:loadBundle></sgmltag> example</title>
+ <para>
+ This example shows a simple application capable of switching between different localized languages.
+ </para>
+ <procedure>
+ <step id="step-Component_Reference-a4jloadBundle_example-Create_resource_bundles">
+ <title>Create resource bundles</title>
+ <para>
+ String resource bundles are contained in files with a <filename class="extension">.properties</filename> extension. The files consist of a list of entries, each with a unique name and a corresponding value. A seperate file is required for each language. Append the filename with the locale identifier (<literal>en</literal> for English, for example).
+ </para>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/figu-Component_Reference-a4jloadBundle-Create_resource_bundles.png" format="PNG" width="444" />
+ </imageobject>
+ <textobject>
+ <para>
+ Resource bundles for English (<literal>en</literal>), German (<literal>de</literal>), and Italian (<literal>it</literal>). A single entry (<literal>greeting</literal>) has been localized for each bundle.
+ </para>
+ </textobject>
+ </mediaobject>
+ </step>
+ <step id="step-Component_Reference-a4jloadBundle_example-Register_bundles_in_Faces_configuration_file">
+ <title>Register bundles in Faces configuration file</title>
+ <para>
+ The resource bundles need to be registered in the Faces configuration file, <filename>faces-config.xml</filename>. The filename is defined with the <sgmltag><message-bundle></sgmltag> tag, without the locale code and without the extension. The supported locale codes are listed with <sgmltag><supported-locale></sgmltag> tags.
+ </para>
+
+<programlisting language="XML" role="XML">
+<xi:include href="extras/exam-Component_Reference-a4jloadBundle-a4jloadBundle_example-0.xml_sample" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" />
+</programlisting>
+ </step>
+ <step id="step-Component_Reference-a4jloadBundle_example-Create_method_to_set_locale">
+ <title>Create method to set locale</title>
+ <para>
+ The <acronym>JSF</acronym> <methodname>javax.faces.component.UIViewRoot.setLocale()</methodname> method can be used to update the locale through a Java class:
+ </para>
+
+<programlisting language="Java" role="JAVA">
+<xi:include href="extras/exam-Component_Reference-a4jloadBundle-a4jloadBundle_example-1.js" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" />
+</programlisting>
+ </step>
+ <step id="step-Component_Reference-a4jloadBundle_example-Add_a4jloadBundle_to_the_JSP_page">
+ <title>Add <sgmltag><a4j:loadBundle></sgmltag> to the <acronym>JSP</acronym> page</title>
+ <para>
+ The <sgmltag><a4j:loadBundle></sgmltag> component is added to the application, and links to change the locale will update the displayed text.
+ </para>
+
+<programlisting language="XML" role="XML">
+<xi:include href="extras/exam-Component_Reference-a4jloadBundle-a4jloadBundle_example-2.xml_sample" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" />
+</programlisting>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/figu-Component_Reference-a4jloadBundle-Add_a4jloadBundle_to_the_JSP_page.png" format="PNG" />
+ </imageobject>
+ <textobject>
+ <para>
+ The output text displayed on a page. It can be changed by clicking the command link for either German, English, or Italian.
+ </para>
+ </textobject>
+ </mediaobject>
+ </step>
+ </procedure>
+
+ <para>
+ Clicking on the different links will render the localized string as appropriate.
+ </para>
+ </example>
+ </section>
+ <section id="sect-Component_Reference-Resources-a4jloadScript">
+ <title><sgmltag><a4j:loadScript></sgmltag></title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ component-type: <classname>org.ajax4jsf.LoadScript</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ component-family: <classname>org.ajax4jsf.LoadScript</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ component-class: <classname>org.ajax4jsf.component.html.HtmlLoadScript</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ renderer-type: <classname>org.ajax4jsf.LoadScriptRenderer</classname>
+ </para>
+ </listitem>
+ </itemizedlist>
+ <para>
+ The <sgmltag><a4j:loadScript></sgmltag> component allows scripts to be loaded from external sources such as <filename>jar</filename> files.
+ </para>
+ <para>
+ The required <varname>src</varname> attribute defines the path to the script. A leading slash (<literal>/</literal>) represents the root of the web context. The <code>resource://</code> prefix can be used to access a file in the RichFaces resource framework. The path is passed to the <methodname>getResourceURL()</methodname> method of the application's <classname>ViewHandler</classname>, with the result then being passed through the <methodname>encodeResourceURL()</methodname> method of <classname>ExternalContext</classname>.
+ </para>
+ <example id="exam-Component_Reference-a4jloadScript-a4jloadScript_example">
+ <title><sgmltag><a4j:loadScript></sgmltag> example</title>
+
+<programlisting language="XML" role="XML">
+<a4j:loadScript src="resource:///org/mycompany/assets/script/focus.js" />
+</programlisting>
+ </example>
+ </section>
+
+ <section id="sect-Component_Reference-Resources-a4jloadStyle">
+ <title><sgmltag><a4j:loadStyle></sgmltag></title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ component-type: <classname>org.ajax4jsf.LoadStyle</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ component-family: <classname>org.ajax4jsf.LoadStyle</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ component-class: <classname>org.ajax4jsf.component.html.HtmlLoadStyle</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ renderer-type: <classname>org.ajax4jsf.LoadStyleRenderer</classname>
+ </para>
+ </listitem>
+ </itemizedlist>
+ <para>
+ The <sgmltag><a4j:loadStyle></sgmltag> component allows a style sheet to be loaded from an external source, such as a <filename>jar</filename> file. The style sheet links are inserted into the head element.
+ </para>
+ <para>
+ The required <varname>src</varname> attribute defines the path to the script. A leading slash (<literal>/</literal>) represents the root of the web context. The <code>resource://</code> prefix can be used to access a file in the RichFaces resource framework. The path is passed to the <methodname>getResourceURL()</methodname> method of the application's <classname>ViewHandler</classname>, with the result then being passed through the <methodname>encodeResourceURL()</methodname> method of <classname>ExternalContext</classname>.
+ </para>
+ <example id="exam-Component_Reference-a4jloadStyle-a4jloadStyle_example">
+ <title><sgmltag><a4j:loadStyle></sgmltag> example</title>
+
+<programlisting language="XML" role="XML">
+<a4j:loadStyle src="resource:///org/mycompany/assets/script/focus.js" />
+</programlisting>
+ </example>
+ </section>
+
+ <section id="sect-Component_Reference-Resources-a4jkeepAlive">
+ <title><sgmltag><a4j:keepAlive></sgmltag></title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ component-type: <classname>org.ajax4jsf.components.KeepAlive</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ component-family: <classname>org.ajax4jsf.components.AjaxKeepAlive</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ component-class: <classname>org.ajax4jsf.components.AjaxKeepAlive</classname>
+ </para>
+ </listitem>
+ </itemizedlist>
+ <para>
+ The <sgmltag><a4j:keepAlive></sgmltag> component allows the state of a managed bean to be retained between Ajax requests.
+ </para>
+ <para>
+ Managed beans can be declared with the <literal>request</literal> scope in the <filename>faces-config.xml</filename> configuration file, using the <sgmltag><managed-bean-scope></sgmltag> tag. Any references to the bean instance after the request has ended will cause the server to throw an illegal argument exception. The <sgmltag><a4j:keepAlive></sgmltag> component avoids this be maintaining the state of the whole bean object for subsequent requests.
+ </para>
+ <para>
+ The <varname>beanName</varname> attribute uses JSF Expression Language (<acronym>EL</acronym>) to define the request scope bean name to keep alive. The expression must resolve to a managed bean instance. The <varname>ajaxOnly</varname> attribute determines whether or not the value of the bean should be available during non-Ajaxx requests; if <code>ajaxOnly="true"</code>, the request-scope bean keeps its value during Ajax requests, but any non-Ajax requests will re-create the bean as a regular request-scope bean.
+ </para>
+ <example id="exam-Component_Reference-a4jkeepAlive-a4jkeepAlive_example">
+ <title><sgmltag><a4j:keepAlive></sgmltag> example</title>
+
+<programlisting language="XML" role="XML">
+<a4j:keepAlive beanName="#{myClass.testBean}" />
+</programlisting>
+ </example>
+ </section>
+
<section id="sect-Component_Reference-Resources-a4jmediaOutput">
<title><sgmltag><a4j:mediaOutput></sgmltag></title>
<itemizedlist>
Modified: root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Tables_and_grids.xml
===================================================================
--- root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Tables_and_grids.xml 2010-06-22 23:05:28 UTC (rev 17660)
+++ root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Tables_and_grids.xml 2010-06-23 05:58:27 UTC (rev 17661)
@@ -253,419 +253,418 @@
</figure>
</blockquote>
</section>
+
+ <section id="sect-Component_Reference-Tables_and_grids-richcolumns">
+ <title><sgmltag><rich:columns></sgmltag></title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ component-type: <classname>org.richfaces.Column</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ tag-class: <classname>org.richfaces.taglib.ColumnsTagHandler</classname>
+ </para>
+ </listitem>
+ </itemizedlist>
+ <para>
+ The <sgmltag><rich:columns></sgmltag> component allows for dynamic sets of columns for tables. Columns and rows can be merged, and the look and feel can be highly customized. The component gets a list from a data model and creates a corresponding set of columns in a <sgmltag><rich:dataTable></sgmltag> component. The <sgmltag><rich:columns></sgmltag> component also supports <literal>header</literal> and <literal>footer</literal> facets.
+ </para>
+ <para>
+ Basic usage of the <sgmltag><rich:columns></sgmltag> component requires the <varname>value</varname> attribute, which points to the data model; the <varname>var</varname> attribute, which holds the current variable for the collection of data; and the <varname>index</varname> attribute, which holds the current counter. The <varname>id</varname> attribute is used for when the individuals rows require identifiers for Ajax events.
+ </para>
+ <example id="exam-Component_Reference-richcolumns-Basic_columns_example">
+ <title>Basic columns example</title>
+
+<programlisting language="XML" role="XML">
+<rich:dataTable value="#{dataTableScrollerBean.model}" var="model" width="750">
+ <rich:columns value="#{dataTableScrollerBean.columns}" var="columns" index="ind" id="column#{ind}">
+ <f:facet name="header">
+ <h:outputText value="#{columns.header}" />
+ </f:facet>
+ <h:outputText value="#{model[ind].model} " />
+ <h:outputText value="#{model[ind].mileage} miles " />
+ <h:outputText value="#{model[ind].price}$" />
+ </rich:columns>
+</rich:dataTable>
+</programlisting>
+ </example>
+ <para>
+ The output can be customized to display specific columns and rows. The <varname>columns</varname> attribute specifies the number of columns. The <varname>rowspan</varname> attribute specifies the number of rows to display; if the attribute is set to <literal>0</literal>, all remaining rows in the table are displayed. The <varname>begin</varname> and <varname>end</varname> attributes are used to specify the first and last zero-based iteration items to display in the table. Columns can be adjusted using the <varname>colspan</varname>, <varname>rowspan</varname>, and <varname>breakBefore</varname> attributes the same as with the <sgmltag><rich:column></sgmltag> component.
+ </para>
+ <para>
+ The <sgmltag><rich:columns></sgmltag> component can be used alongside <sgmltag><rich:column></sgmltag> components.
+ </para>
+ <example id="exam-Component_Reference-richcolumns-Using_richcolumns_and_richcolumn_together">
+ <title>Using <sgmltag><rich:columns></sgmltag> and <sgmltag><rich:column></sgmltag> together</title>
+
+<programlisting language="XML" role="XML">
+<rich:dataTable value="#{dataTableScrollerBean.model}" var="model" width="500px" rows="5">
+ <f:facet name="header">
+ <h:outputText value="Cars Available"></h:outputText>
+ </f:facet>
+ <rich:columns value="#{dataTableScrollerBean.columns}" var="columns" index="ind">
+ <f:facet name="header">
+ <h:outputText value="#{columns.header}" />
+ </f:facet>
+ <h:outputText value="#{model[ind].model} " />
+ </rich:columns>
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText value="Price" />
+ </f:facet>
+ <h:outputText value="Price" />
+ </rich:column>
+ <rich:columns value="#{dataTableScrollerBean.columns}" var="columns" index="ind">
+ <f:facet name="header">
+ <h:outputText value="#{columns.header}" />
+ </f:facet>
+ <h:outputText value="#{model[ind].mileage}$" />
+ </rich:columns>
+</rich:dataTable>
+</programlisting>
+ </example>
+ <para>
+ For details on filtering and sorting columns, refer to <xref linkend="sect-Component_Reference-Tables_and_grids-Table_filtering" /> and <xref linkend="sect-Component_Reference-Tables_and_grids-Table_sorting" />.
+ </para>
+ </section>
-<!-- FIXME NOT IN A2 -->
-<!-- <section id="sect-Component_Reference-Tables_and_grids-richcolumns">-->
-<!-- <title><sgmltag><rich:columns></sgmltag></title>-->
-<!-- <itemizedlist>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- component-type: <classname>org.richfaces.Column</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- tag-class: <classname>org.richfaces.taglib.ColumnsTagHandler</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- </itemizedlist>-->
-<!-- <para>-->
-<!-- The <sgmltag><rich:columns></sgmltag> component allows for dynamic sets of columns for tables. Columns and rows can be merged, and the look and feel can be highly customized. The component gets a list from a data model and creates a corresponding set of columns in a <sgmltag><rich:dataTable></sgmltag> component. The <sgmltag><rich:columns></sgmltag> component also supports <literal>header</literal> and <literal>footer</literal> facets.-->
-<!-- </para>-->
-<!-- <para>-->
-<!-- Basic usage of the <sgmltag><rich:columns></sgmltag> component requires the <varname>value</varname> attribute, which points to the data model; the <varname>var</varname> attribute, which holds the current variable for the collection of data; and the <varname>index</varname> attribute, which holds the current counter. The <varname>id</varname> attribute is used for when the individuals rows require identifiers for Ajax events.-->
-<!-- </para>-->
-<!-- <example id="exam-Component_Reference-richcolumns-Basic_columns_example">-->
-<!-- <title>Basic columns example</title>-->
-<!-- -->
-<!--<programlisting language="XML" role="XML">-->
-<!--<rich:dataTable value="#{dataTableScrollerBean.model}" var="model" width="750">-->
-<!-- <rich:columns value="#{dataTableScrollerBean.columns}" var="columns" index="ind" id="column#{ind}"> -->
-<!-- <f:facet name="header">-->
-<!-- <h:outputText value="#{columns.header}" />-->
-<!-- </f:facet>-->
-<!-- <h:outputText value="#{model[ind].model} " />-->
-<!-- <h:outputText value="#{model[ind].mileage} miles " />-->
-<!-- <h:outputText value="#{model[ind].price}$" /> -->
-<!-- </rich:columns> -->
-<!--</rich:dataTable>-->
-<!--</programlisting>-->
-<!-- </example>-->
-<!-- <para>-->
-<!-- The output can be customized to display specific columns and rows. The <varname>columns</varname> attribute specifies the number of columns. The <varname>rowspan</varname> attribute specifies the number of rows to display; if the attribute is set to <literal>0</literal>, all remaining rows in the table are displayed. The <varname>begin</varname> and <varname>end</varname> attributes are used to specify the first and last zero-based iteration items to display in the table. Columns can be adjusted using the <varname>colspan</varname>, <varname>rowspan</varname>, and <varname>breakBefore</varname> attributes the same as with the <sgmltag><rich:column></sgmltag> component.-->
-<!-- </para>-->
-<!-- <para>-->
-<!-- The <sgmltag><rich:columns></sgmltag> component can be used alongside <sgmltag><rich:column></sgmltag> components.-->
-<!-- </para>-->
-<!-- <example id="exam-Component_Reference-richcolumns-Using_richcolumns_and_richcolumn_together">-->
-<!-- <title>Using <sgmltag><rich:columns></sgmltag> and <sgmltag><rich:column></sgmltag> together</title>-->
-<!-- -->
-<!--<programlisting language="XML" role="XML">-->
-<!--<rich:dataTable value="#{dataTableScrollerBean.model}" var="model" width="500px" rows="5">-->
-<!-- <f:facet name="header">-->
-<!-- <h:outputText value="Cars Available"></h:outputText>-->
-<!-- </f:facet>-->
-<!-- <rich:columns value="#{dataTableScrollerBean.columns}" var="columns" index="ind">-->
-<!-- <f:facet name="header">-->
-<!-- <h:outputText value="#{columns.header}" />-->
-<!-- </f:facet>-->
-<!-- <h:outputText value="#{model[ind].model} " />-->
-<!-- </rich:columns>-->
-<!-- <rich:column>-->
-<!-- <f:facet name="header">-->
-<!-- <h:outputText value="Price" />-->
-<!-- </f:facet>-->
-<!-- <h:outputText value="Price" />-->
-<!-- </rich:column>-->
-<!-- <rich:columns value="#{dataTableScrollerBean.columns}" var="columns" index="ind">-->
-<!-- <f:facet name="header">-->
-<!-- <h:outputText value="#{columns.header}" />-->
-<!-- </f:facet>-->
-<!-- <h:outputText value="#{model[ind].mileage}$" />-->
-<!-- </rich:columns>-->
-<!--</rich:dataTable>-->
-<!--</programlisting>-->
-<!-- </example>-->
-<!-- <para>-->
-<!-- For details on filtering and sorting columns, refer to <xref linkend="sect-Component_Reference-Tables_and_grids-Table_filtering" /> and <xref linkend="sect-Component_Reference-Tables_and_grids-Table_sorting" />.-->
-<!-- </para>-->
-<!-- </section>-->
-<!-- -->
-<!-- <section id="sect-Component_Reference-Tables_and_grids-richdataDefinitionList">-->
-<!-- <title><sgmltag><rich:dataDefinitionList></sgmltag></title>-->
-<!-- <itemizedlist>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- component-type: <classname>org.richfaces.DataDefinitionList</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- component-class: <classname>org.richfaces.component.html.HtmlDataDefinitionList</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- component-family: <classname>org.richfaces.DataDefinitionList</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- renderer-type: <classname>org.richfaces.DataDefinitionListRenderer</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- tag-class: <classname>org.richfaces.taglib.DataDefinitionListTag</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- </itemizedlist>-->
-<!-- <para>-->
-<!-- The <sgmltag><rich:dataDefinitionList></sgmltag> component renders a list of items with definitions. The component uses a data model for managing the list items, which can be updated dynamically.-->
-<!-- </para>-->
-<!-- <para>-->
-<!-- The <varname>var</varname> attribute names a variable for iterating through the items in the data model. The items to iterate through are determined with the <varname>value</varname> attribute by using EL (Expression Lanugage). The <varname>first</varname> attribute specifies which item in the data model to show first, and the <varname>rows</varname> attribute specifies the number of items to list. The <varname>title</varname> attribute is used for a floating tool-tip. <xref linkend="exam-Component_Reference-richdataDefinitionList-richdataDefinitionList_example" /> shows a simple example using the <sgmltag><rich:dataDefinitionList></sgmltag> component.-->
-<!-- </para>-->
-<!-- <example id="exam-Component_Reference-richdataDefinitionList-richdataDefinitionList_example">-->
-<!-- <title><sgmltag><rich:dataDefinitionList></sgmltag> example</title>-->
-<!-- -->
-<!--<programlisting language="XML" role="XML"><xi:include href="extras/exam-Component_Reference-Trees-richdataDefinitionList_example.xml_sample" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" />-->
-<!--</programlisting>-->
-<!-- <blockquote>-->
-<!-- <figure id="figu-Component_Reference-richdataDefinitionList_example-richdataDefinitionList_example">-->
-<!-- <title><sgmltag><rich:dataDefinitionList></sgmltag> example</title>-->
-<!-- <mediaobject>-->
-<!-- <imageobject role="html">-->
-<!-- <imagedata fileref="images/figu-Component_Reference-Trees-richdataDefinitionList_example.png" format="PNG" />-->
-<!-- </imageobject>-->
-<!-- <imageobject role="fo">-->
-<!-- <imagedata fileref="images/figu-Component_Reference-Trees-richdataDefinitionList_example.png" format="PNG" />-->
-<!-- </imageobject>-->
-<!-- <textobject>-->
-<!-- <para>-->
-<!-- A list of cars with their price and mileage displayed as a data definition.-->
-<!-- </para>-->
-<!-- </textobject>-->
-<!-- </mediaobject>-->
-<!-- </figure>-->
-<!-- </blockquote>-->
-<!-- </example>-->
-<!-- </section>-->
-<!-- -->
-<!-- <section id="sect-Component_Reference-Tables_and_grids-richdataFilterSlider">-->
-<!-- <title><sgmltag><rich:dataFilterSlider></sgmltag></title>-->
-<!-- <itemizedlist>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- component-type: <classname>org.richfaces.DataFilterSlider</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- component-class: <classname>org.richfaces.component.html.HtmlDataFilterSlider</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- component-family: <classname>org.richfaces.DataFilterSlider</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- renderer-type: <classname>org.richfaces.DataFilterSliderRenderer</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- tag-class: <classname>org.richfaces.taglib.dataFilterSliderTag</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- </itemizedlist>-->
-<!-- <para>-->
-<!-- The <sgmltag><rich:dataFilterSlider></sgmltag> components is a slider control that can be used for filtering data in a table. The range and increment of the slider control are defined using the <varname>startRange</varname>, <varname>endRange</varname>, and <varname>increment</varname> attributes.-->
-<!-- </para>-->
-<!-- <para>-->
-<!-- The slider is bound to a <classname>UIData</classname> component specified with the <varname>for</varname> attribute. The <varname>forValRef</varname> attribute refers to the <varname>value</varname> attribute used by the target component, and the <varname>filterBy</varname> attribute specifies which object member to filter according to the slider.-->
-<!-- </para>-->
-<!-- <para>-->
-<!-- The <varname>handleValue</varname> attribute keeps the current handle position on the slider control; filtering is based on this value. The <varname>storeResults</varname> attribute allows the <sgmltag><rich:dataFilterSlider></sgmltag> component to keep the target <classname>UIData</classname> component in session.-->
-<!-- </para>-->
-<!-- <para>-->
-<!-- The event defined with the <varname>submitOnSlide</varname> attribute is triggered when the handle value on the slider is changed.-->
-<!-- </para>-->
-<!-- <example id="exam-Component_Reference-richdataFilterSlider-richdataFilterSlider_example">-->
-<!-- <title><sgmltag><rich:dataFilterSlider></sgmltag> example</title>-->
-<!-- -->
-<!--<programlisting language="XML" role="XML"><xi:include href="extras/exam-Component_Reference-Tables_and_grids-richdataFilterSlider_example.xml_sample" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" />-->
-<!--</programlisting>-->
-<!-- <blockquote>-->
-<!-- <figure id="figu-Component_Reference-richdataFilterSlider_example-richdataFilterSlider_example">-->
-<!-- <title><sgmltag><rich:dataFilterSlider></sgmltag> example</title>-->
-<!-- <mediaobject>-->
-<!-- <imageobject>-->
-<!-- <imagedata fileref="images/figu-Component_Reference-richdataFilterSlider-richdataFilterSlider_example.png" format="PNG" />-->
-<!-- </imageobject>-->
-<!-- <textobject>-->
-<!-- <para>-->
-<!-- A table of car details, filtered using a slider.-->
-<!-- </para>-->
-<!-- </textobject>-->
-<!-- </mediaobject>-->
-<!-- </figure>-->
-<!-- </blockquote>-->
-<!-- </example>-->
-<!-- </section>-->
-<!-- -->
-<!-- <section id="sect-Component_Reference-Tables_and_grids-richdataGrid">-->
-<!-- <title><sgmltag><rich:dataGrid></sgmltag></title>-->
-<!-- <itemizedlist>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- component-type: <classname>org.richfaces.DataGrid</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- component-class: <classname>org.richfaces.component.html.HtmlDataGrid</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- component-family: <classname>org.richfaces.DataGrid</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- renderer-type: <classname>org.richfaces.DataGridRenderer</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- tag-class: <classname>org.richfaces.taglib.DataGridTag</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- </itemizedlist>-->
-<!-- <para>-->
-<!-- The <sgmltag><rich:dataGrid></sgmltag> component is used to arrange data objects in a grid. Values in the grid can be updated dynamically from the data model, and Ajax updates can be limited to specific rows. The component supports <literal>header</literal>, <literal>footer</literal>, and <literal>caption</literal> facets.-->
-<!-- </para>-->
-<!-- <figure id="figu-Component_Reference-richdataGrid-The_richdataGrid_component">-->
-<!-- <title>The <sgmltag><rich:dataGrid></sgmltag> component</title>-->
-<!-- <mediaobject>-->
-<!-- <imageobject>-->
-<!-- <imagedata fileref="images/figu-Component_Reference-richdataGrid-The_richdataGrid_component.png" format="PNG" />-->
-<!-- </imageobject>-->
-<!-- <textobject>-->
-<!-- <para>-->
-<!-- The <sgmltag><rich:dataGrid></sgmltag> component displaying four elements in two columns, with a <literal>header</literal> facet, and <literal>footer</literal> facet containing a data-scrolling component.-->
-<!-- </para>-->
-<!-- </textobject>-->
-<!-- </mediaobject>-->
-<!-- </figure>-->
-<!-- <para>-->
-<!-- The <sgmltag><rich:dataGrid></sgmltag> component requires the <varname>value</varname> attribute, which points to the data model, and the <varname>var</varname> attribute, which holds the current variable for the collection of data. The number of columns for the grid is specifed with the <varname>columns</varname> attribute, and the number of elements to layout among the columns is determined with the <varname>elements</varname> attribute. The <varname>first</varname> attribute references the zero-based element in the data model from which the grid starts.-->
-<!-- </para>-->
-<!-- <example id="exam-Component_Reference-richdataGrid-richdataGrid_example">-->
-<!-- <title><sgmltag><rich:dataGrid></sgmltag> example</title>-->
-<!-- -->
-<!--<programlisting language="XML" role="XML">-->
-<!--<xi:include href="extras/exam-Component_Reference-richdataGrid-richdataGrid_example.xml_sample" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" />-->
-<!--</programlisting>-->
-<!-- <blockquote>-->
-<!-- <figure id="figu-Component_Reference-richdataGrid_example-richdataGrid_example">-->
-<!-- <title><sgmltag><rich:dataGrid></sgmltag> example</title>-->
-<!-- <mediaobject>-->
-<!-- <imageobject>-->
-<!-- <imagedata fileref="images/figu-Component_Reference-richdataGrid-richdataGrid_example.png" format="PNG" />-->
-<!-- </imageobject>-->
-<!-- <textobject>-->
-<!-- <para>-->
-<!-- The result of the <sgmltag><rich:dataGrid></sgmltag> example, with the <literal>header</literal> facet, <literal>footer</literal> facet, and first element annotated.-->
-<!-- </para>-->
-<!-- </textobject>-->
-<!-- </mediaobject>-->
-<!-- </figure>-->
-<!-- </blockquote>-->
-<!-- </example>-->
-<!-- <para>-->
-<!-- The <sgmltag><rich:dataGrid></sgmltag> component can be used with the <sgmltag><rich:dataScroller></sgmltag> component to display multiple pages of grids. Refer to <xref linkend="sect-Component_Reference-Tables_and_grids-richdataScroller" /> for details on the <sgmltag><rich:dataScroller></sgmltag> component.-->
-<!-- </para>-->
-<!-- <para>-->
-<!-- As the component is based on the <sgmltag><a4j:repeat></sgmltag> component, it can be partially updated with Ajax. The <varname>ajaxKeys</varname> attribute allows row keys to be defined, which are updated after an Ajax request.-->
-<!-- </para>-->
-<!-- <example id="exam-Component_Reference-richdataGrid-ajaxKeys_example">-->
-<!-- <title><varname>ajaxKeys</varname> example</title>-->
-<!-- -->
-<!--<programlisting language="XML" role="XML">-->
-<!--<rich:dataGrid value="#{dataTableScrollerBean.allCars}" var="car" ajaxKeys="#{listBean.list}" binding="#{listBean.dataGrid}" id="grid" elements="4" columns="2">-->
-<!-- ...-->
-<!--</rich:dataGrid>-->
-<!--...-->
-<!--<a4j:commandButton action="#{listBean.action}" reRender="grid" value="Submit"/>-->
-<!--</programlisting>-->
-<!-- </example>-->
-<!-- </section>-->
-<!-- -->
-<!-- <section id="sect-Component_Reference-Tables_and_grids-richdataList">-->
-<!-- <title><sgmltag><rich:dataList></sgmltag></title>-->
-<!-- <itemizedlist>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- component-type: <classname>org.richfaces.DataList</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- component-class: <classname>org.richfaces.component.html.HtmlDataList</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- component-family: <classname>org.richfaces.DataList</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- renderer-type: <classname>org.richfaces.DataListRenderer</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- tag-class: <classname>org.richfaces.taglib.DataListTag</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- </itemizedlist>-->
-<!-- <para>-->
-<!-- The <sgmltag><rich:dataList></sgmltag> component renders an unordered list of items. The component uses a data model for managing the list items, which can be updated dynamically.-->
-<!-- </para>-->
-<!-- <para>-->
-<!-- The <varname>type</varname> attribute refers to the appearance of the bullet points. The values of the attribute correspond to the <varname>type</varname> parameter for the <sgmltag><ul></sgmltag> HTML element:-->
-<!-- </para>-->
-<!-- <variablelist>-->
-<!-- <varlistentry>-->
-<!-- <term><literal>circle</literal></term>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- Displays an unfilled circle as a bullet point.-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- </varlistentry>-->
-<!-- <varlistentry>-->
-<!-- <term><literal>disc</literal></term>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- Displays a filled disc as a bullet point.-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- </varlistentry>-->
-<!-- <varlistentry>-->
-<!-- <term><literal>square</literal></term>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- Displays a square as a bullet point.-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- </varlistentry>-->
-<!-- </variablelist>-->
-<!-- <para>-->
-<!-- The <varname>var</varname> attribute names a variable for iterating through the items in the data model. The items to iterate through are determined with the <varname>value</varname> attribute by using EL (Expression Lanugage). The <varname>first</varname> attribute specifies which item in the data model to show first, and the <varname>rows</varname> attribute specifies the number of items to list. The <varname>title</varname> attribute is used for a floating tool-tip. <xref linkend="exam-Component_Reference-richdataDefinitionList-richdataDefinitionList_example" /> shows a simple example using the <sgmltag><rich:dataDefinitionList></sgmltag> component.-->
-<!-- </para>-->
-<!-- <example id="exam-Component_Reference-richdataList-richdataList_example">-->
-<!-- <title><sgmltag><rich:dataList></sgmltag> example</title>-->
-<!-- -->
-<!--<programlisting language="XML" role="XML"><xi:include href="extras/exam-Component_Reference-richdataList-richdataList_example.xml_sample" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" />-->
-<!--</programlisting>-->
-<!-- <blockquote>-->
-<!-- <figure id="figu-Component_Reference-richdataList_example-richdataList_example">-->
-<!-- <title><sgmltag><rich:dataList></sgmltag> example</title>-->
-<!-- <mediaobject>-->
-<!-- <imageobject>-->
-<!-- <imagedata fileref="images/figu-Component_Reference-richdataList-richdataList_example.png" format="PNG" />-->
-<!-- </imageobject>-->
-<!-- <textobject>-->
-<!-- <para>-->
-<!-- A list of cars displayed in a list with bullet points.-->
-<!-- </para>-->
-<!-- </textobject>-->
-<!-- </mediaobject>-->
-<!-- </figure>-->
-<!-- </blockquote>-->
-<!-- </example>-->
-<!-- </section>-->
-<!-- -->
-<!-- <section id="sect-Component_Reference-Tables_and_grids-richdataOrderedList">-->
-<!-- <title><sgmltag><rich:dataOrderedList></sgmltag></title>-->
-<!-- <itemizedlist>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- component-type: <classname>org.richfaces.DataOrderedList</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- component-class: <classname>org.richfaces.component.html.HtmlDataOrderedList</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- component-family: <classname>org.richfaces.DataOrderedList</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- renderer-type: <classname>org.richfaces.DataOrderedListRenderer</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- <listitem>-->
-<!-- <para>-->
-<!-- tag-class: <classname>org.richfaces.taglib.DataOrderedListTag</classname>-->
-<!-- </para>-->
-<!-- </listitem>-->
-<!-- </itemizedlist>-->
-<!-- <para>-->
-<!-- Incomplete-->
-<!-- </para>-->
-<!-- </section>-->
+ <section id="sect-Component_Reference-Tables_and_grids-richdataDefinitionList">
+ <title><sgmltag><rich:dataDefinitionList></sgmltag></title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ component-type: <classname>org.richfaces.DataDefinitionList</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ component-class: <classname>org.richfaces.component.html.HtmlDataDefinitionList</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ component-family: <classname>org.richfaces.DataDefinitionList</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ renderer-type: <classname>org.richfaces.DataDefinitionListRenderer</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ tag-class: <classname>org.richfaces.taglib.DataDefinitionListTag</classname>
+ </para>
+ </listitem>
+ </itemizedlist>
+ <para>
+ The <sgmltag><rich:dataDefinitionList></sgmltag> component renders a list of items with definitions. The component uses a data model for managing the list items, which can be updated dynamically.
+ </para>
+ <para>
+ The <varname>var</varname> attribute names a variable for iterating through the items in the data model. The items to iterate through are determined with the <varname>value</varname> attribute by using EL (Expression Lanugage). The <varname>first</varname> attribute specifies which item in the data model to show first, and the <varname>rows</varname> attribute specifies the number of items to list. The <varname>title</varname> attribute is used for a floating tool-tip. <xref linkend="exam-Component_Reference-richdataDefinitionList-richdataDefinitionList_example" /> shows a simple example using the <sgmltag><rich:dataDefinitionList></sgmltag> component.
+ </para>
+ <example id="exam-Component_Reference-richdataDefinitionList-richdataDefinitionList_example">
+ <title><sgmltag><rich:dataDefinitionList></sgmltag> example</title>
+
+<programlisting language="XML" role="XML"><xi:include href="extras/exam-Component_Reference-Trees-richdataDefinitionList_example.xml_sample" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" />
+</programlisting>
+ <blockquote>
+ <figure id="figu-Component_Reference-richdataDefinitionList_example-richdataDefinitionList_example">
+ <title><sgmltag><rich:dataDefinitionList></sgmltag> example</title>
+ <mediaobject>
+ <imageobject role="html">
+ <imagedata fileref="images/figu-Component_Reference-Trees-richdataDefinitionList_example.png" format="PNG" />
+ </imageobject>
+ <imageobject role="fo">
+ <imagedata fileref="images/figu-Component_Reference-Trees-richdataDefinitionList_example.png" format="PNG" />
+ </imageobject>
+ <textobject>
+ <para>
+ A list of cars with their price and mileage displayed as a data definition.
+ </para>
+ </textobject>
+ </mediaobject>
+ </figure>
+ </blockquote>
+ </example>
+ </section>
+ <section id="sect-Component_Reference-Tables_and_grids-richdataFilterSlider">
+ <title><sgmltag><rich:dataFilterSlider></sgmltag></title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ component-type: <classname>org.richfaces.DataFilterSlider</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ component-class: <classname>org.richfaces.component.html.HtmlDataFilterSlider</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ component-family: <classname>org.richfaces.DataFilterSlider</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ renderer-type: <classname>org.richfaces.DataFilterSliderRenderer</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ tag-class: <classname>org.richfaces.taglib.dataFilterSliderTag</classname>
+ </para>
+ </listitem>
+ </itemizedlist>
+ <para>
+ The <sgmltag><rich:dataFilterSlider></sgmltag> components is a slider control that can be used for filtering data in a table. The range and increment of the slider control are defined using the <varname>startRange</varname>, <varname>endRange</varname>, and <varname>increment</varname> attributes.
+ </para>
+ <para>
+ The slider is bound to a <classname>UIData</classname> component specified with the <varname>for</varname> attribute. The <varname>forValRef</varname> attribute refers to the <varname>value</varname> attribute used by the target component, and the <varname>filterBy</varname> attribute specifies which object member to filter according to the slider.
+ </para>
+ <para>
+ The <varname>handleValue</varname> attribute keeps the current handle position on the slider control; filtering is based on this value. The <varname>storeResults</varname> attribute allows the <sgmltag><rich:dataFilterSlider></sgmltag> component to keep the target <classname>UIData</classname> component in session.
+ </para>
+ <para>
+ The event defined with the <varname>submitOnSlide</varname> attribute is triggered when the handle value on the slider is changed.
+ </para>
+ <example id="exam-Component_Reference-richdataFilterSlider-richdataFilterSlider_example">
+ <title><sgmltag><rich:dataFilterSlider></sgmltag> example</title>
+
+<programlisting language="XML" role="XML"><xi:include href="extras/exam-Component_Reference-Tables_and_grids-richdataFilterSlider_example.xml_sample" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" />
+</programlisting>
+ <blockquote>
+ <figure id="figu-Component_Reference-richdataFilterSlider_example-richdataFilterSlider_example">
+ <title><sgmltag><rich:dataFilterSlider></sgmltag> example</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/figu-Component_Reference-richdataFilterSlider-richdataFilterSlider_example.png" format="PNG" />
+ </imageobject>
+ <textobject>
+ <para>
+ A table of car details, filtered using a slider.
+ </para>
+ </textobject>
+ </mediaobject>
+ </figure>
+ </blockquote>
+ </example>
+ </section>
+
+ <section id="sect-Component_Reference-Tables_and_grids-richdataGrid">
+ <title><sgmltag><rich:dataGrid></sgmltag></title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ component-type: <classname>org.richfaces.DataGrid</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ component-class: <classname>org.richfaces.component.html.HtmlDataGrid</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ component-family: <classname>org.richfaces.DataGrid</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ renderer-type: <classname>org.richfaces.DataGridRenderer</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ tag-class: <classname>org.richfaces.taglib.DataGridTag</classname>
+ </para>
+ </listitem>
+ </itemizedlist>
+ <para>
+ The <sgmltag><rich:dataGrid></sgmltag> component is used to arrange data objects in a grid. Values in the grid can be updated dynamically from the data model, and Ajax updates can be limited to specific rows. The component supports <literal>header</literal>, <literal>footer</literal>, and <literal>caption</literal> facets.
+ </para>
+ <figure id="figu-Component_Reference-richdataGrid-The_richdataGrid_component">
+ <title>The <sgmltag><rich:dataGrid></sgmltag> component</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/figu-Component_Reference-richdataGrid-The_richdataGrid_component.png" format="PNG" />
+ </imageobject>
+ <textobject>
+ <para>
+ The <sgmltag><rich:dataGrid></sgmltag> component displaying four elements in two columns, with a <literal>header</literal> facet, and <literal>footer</literal> facet containing a data-scrolling component.
+ </para>
+ </textobject>
+ </mediaobject>
+ </figure>
+ <para>
+ The <sgmltag><rich:dataGrid></sgmltag> component requires the <varname>value</varname> attribute, which points to the data model, and the <varname>var</varname> attribute, which holds the current variable for the collection of data. The number of columns for the grid is specifed with the <varname>columns</varname> attribute, and the number of elements to layout among the columns is determined with the <varname>elements</varname> attribute. The <varname>first</varname> attribute references the zero-based element in the data model from which the grid starts.
+ </para>
+ <example id="exam-Component_Reference-richdataGrid-richdataGrid_example">
+ <title><sgmltag><rich:dataGrid></sgmltag> example</title>
+
+<programlisting language="XML" role="XML">
+<xi:include href="extras/exam-Component_Reference-richdataGrid-richdataGrid_example.xml_sample" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" />
+</programlisting>
+ <blockquote>
+ <figure id="figu-Component_Reference-richdataGrid_example-richdataGrid_example">
+ <title><sgmltag><rich:dataGrid></sgmltag> example</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/figu-Component_Reference-richdataGrid-richdataGrid_example.png" format="PNG" />
+ </imageobject>
+ <textobject>
+ <para>
+ The result of the <sgmltag><rich:dataGrid></sgmltag> example, with the <literal>header</literal> facet, <literal>footer</literal> facet, and first element annotated.
+ </para>
+ </textobject>
+ </mediaobject>
+ </figure>
+ </blockquote>
+ </example>
+ <para>
+ The <sgmltag><rich:dataGrid></sgmltag> component can be used with the <sgmltag><rich:dataScroller></sgmltag> component to display multiple pages of grids. Refer to <xref linkend="sect-Component_Reference-Tables_and_grids-richdataScroller" /> for details on the <sgmltag><rich:dataScroller></sgmltag> component.
+ </para>
+ <para>
+ As the component is based on the <sgmltag><a4j:repeat></sgmltag> component, it can be partially updated with Ajax. The <varname>ajaxKeys</varname> attribute allows row keys to be defined, which are updated after an Ajax request.
+ </para>
+ <example id="exam-Component_Reference-richdataGrid-ajaxKeys_example">
+ <title><varname>ajaxKeys</varname> example</title>
+
+<programlisting language="XML" role="XML">
+<rich:dataGrid value="#{dataTableScrollerBean.allCars}" var="car" ajaxKeys="#{listBean.list}" binding="#{listBean.dataGrid}" id="grid" elements="4" columns="2">
+ ...
+</rich:dataGrid>
+...
+<a4j:commandButton action="#{listBean.action}" reRender="grid" value="Submit"/>
+</programlisting>
+ </example>
+ </section>
+
+ <section id="sect-Component_Reference-Tables_and_grids-richdataList">
+ <title><sgmltag><rich:dataList></sgmltag></title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ component-type: <classname>org.richfaces.DataList</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ component-class: <classname>org.richfaces.component.html.HtmlDataList</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ component-family: <classname>org.richfaces.DataList</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ renderer-type: <classname>org.richfaces.DataListRenderer</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ tag-class: <classname>org.richfaces.taglib.DataListTag</classname>
+ </para>
+ </listitem>
+ </itemizedlist>
+ <para>
+ The <sgmltag><rich:dataList></sgmltag> component renders an unordered list of items. The component uses a data model for managing the list items, which can be updated dynamically.
+ </para>
+ <para>
+ The <varname>type</varname> attribute refers to the appearance of the bullet points. The values of the attribute correspond to the <varname>type</varname> parameter for the <sgmltag><ul></sgmltag> HTML element:
+ </para>
+ <variablelist>
+ <varlistentry>
+ <term><literal>circle</literal></term>
+ <listitem>
+ <para>
+ Displays an unfilled circle as a bullet point.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><literal>disc</literal></term>
+ <listitem>
+ <para>
+ Displays a filled disc as a bullet point.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><literal>square</literal></term>
+ <listitem>
+ <para>
+ Displays a square as a bullet point.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ <para>
+ The <varname>var</varname> attribute names a variable for iterating through the items in the data model. The items to iterate through are determined with the <varname>value</varname> attribute by using EL (Expression Lanugage). The <varname>first</varname> attribute specifies which item in the data model to show first, and the <varname>rows</varname> attribute specifies the number of items to list. The <varname>title</varname> attribute is used for a floating tool-tip. <xref linkend="exam-Component_Reference-richdataDefinitionList-richdataDefinitionList_example" /> shows a simple example using the <sgmltag><rich:dataDefinitionList></sgmltag> component.
+ </para>
+ <example id="exam-Component_Reference-richdataList-richdataList_example">
+ <title><sgmltag><rich:dataList></sgmltag> example</title>
+
+<programlisting language="XML" role="XML"><xi:include href="extras/exam-Component_Reference-richdataList-richdataList_example.xml_sample" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" />
+</programlisting>
+ <blockquote>
+ <figure id="figu-Component_Reference-richdataList_example-richdataList_example">
+ <title><sgmltag><rich:dataList></sgmltag> example</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/figu-Component_Reference-richdataList-richdataList_example.png" format="PNG" />
+ </imageobject>
+ <textobject>
+ <para>
+ A list of cars displayed in a list with bullet points.
+ </para>
+ </textobject>
+ </mediaobject>
+ </figure>
+ </blockquote>
+ </example>
+ </section>
+
+ <section id="sect-Component_Reference-Tables_and_grids-richdataOrderedList">
+ <title><sgmltag><rich:dataOrderedList></sgmltag></title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ component-type: <classname>org.richfaces.DataOrderedList</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ component-class: <classname>org.richfaces.component.html.HtmlDataOrderedList</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ component-family: <classname>org.richfaces.DataOrderedList</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ renderer-type: <classname>org.richfaces.DataOrderedListRenderer</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ tag-class: <classname>org.richfaces.taglib.DataOrderedListTag</classname>
+ </para>
+ </listitem>
+ </itemizedlist>
+ <para>
+ Incomplete
+ </para>
+ </section>
+
<section id="sect-Component_Reference-Tables_and_grids-richdataScroller">
<title><sgmltag><rich:dataScroller></sgmltag></title>
<para>
14 years, 6 months
JBoss Rich Faces SVN: r17660 - in root/cdk/branches/RF8755/plugins/generator/src: main/java/org/richfaces/cdk/generate/freemarker and 5 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-06-22 19:05:28 -0400 (Tue, 22 Jun 2010)
New Revision: 17660
Added:
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/builder/model/Variables.java
Modified:
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/Generator.java
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/generate/freemarker/LibraryModelWrapper.java
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassVisitor.java
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/TemplateModule.java
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/VisitorFactoryImpl.java
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/builder/model/MethodBodyStatementsContainer.java
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/el/ELVisitor.java
root/cdk/branches/RF8755/plugins/generator/src/main/resources/META-INF/templates/component.ftl
root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/parser/el/test/ELParserTest.java
Log:
Template compiler optimization
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/Generator.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/Generator.java 2010-06-22 19:08:34 UTC (rev 17659)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/Generator.java 2010-06-22 23:05:28 UTC (rev 17660)
@@ -18,7 +18,7 @@
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+ */
package org.richfaces.cdk;
@@ -48,27 +48,33 @@
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.Stage;
+import com.google.inject.TypeLiteral;
import com.google.inject.name.Names;
+import com.google.inject.util.Providers;
/**
* @author asmirnov
* @version $Id$
- *
+ *
*/
public class Generator {
-
+
+ public static final String RENDERER_UTILS_CLASS = "rendererUtils";
+
+ public static final String OPTIONS = "OPTIONS";
+
private CdkClassLoader loader;
-
+
private Logger log = new JavaLogger();
-
+
private Injector injector;
private String namespace;
-
+
private Locale locale = Locale.getDefault();
-
+
private Charset charset = Charset.defaultCharset();
-
+
private Map<Outputs, FileManager> outputFolders = Maps.newEnumMap(Outputs.class);
private Map<Sources, FileManager> sources = Maps.newEnumMap(Sources.class);
@@ -76,19 +82,17 @@
private LibraryBuilder libraryBuilder;
private Map<String, String> options = Maps.newHashMap();
-
-
+
public Generator() {
EmptyFileManager emptyFileManager = new EmptyFileManager();
for (Sources source : Sources.values()) {
sources.put(source, emptyFileManager);
}
-
+
for (Outputs output : Outputs.values()) {
- outputFolders.put(output, emptyFileManager);
+ outputFolders.put(output, emptyFileManager);
}
}
-
public void setLoader(CdkClassLoader loader) {
this.loader = loader;
@@ -105,24 +109,17 @@
public void addSources(Sources type, Iterable<File> files, Iterable<File> folders) {
this.sources.put(type, new SourceFileManagerImpl(files, folders));
}
-
+
public void setOptions(Map<String, String> options) {
this.options = options;
-
+
}
-
public void init() {
- injector = Guice.createInjector(Stage.PRODUCTION,
- new CdkConfigurationModule(),
- new AptModule(),
- new ModelModule(),
- new ClassGeneratorModule(),
- new TagHandlerModule(),
- new FreeMakerModule(),
- new TemplateModule(),
- new XmlModule(),
- new TaglibModule());
+ injector =
+ Guice.createInjector(Stage.PRODUCTION, new CdkConfigurationModule(), new AptModule(), new ModelModule(),
+ new ClassGeneratorModule(), new TagHandlerModule(), new FreeMakerModule(), new TemplateModule(),
+ new XmlModule(), new TaglibModule());
if (!log.isDebugEnabled()) {
try {
@@ -135,12 +132,12 @@
// Create builder instance.
this.libraryBuilder = injector.getInstance(LibraryBuilder.class);
}
-
+
public void execute() {
checkNotNull(libraryBuilder, "initialized");
libraryBuilder.build();
-// libraryBuilder.generate(); // TODO ?
+ // libraryBuilder.generate(); // TODO ?
}
public static final class EmptyFileManager implements FileManager {
@@ -148,17 +145,17 @@
public Iterable<File> getFolders() {
return Collections.emptyList();
}
-
+
@Override
public Iterable<File> getFiles() {
return Collections.emptyList();
}
-
+
@Override
public File getFile(String path) throws FileNotFoundException {
throw new FileNotFoundException();
}
-
+
@Override
public Writer createOutput(String path, long lastModified) throws IOException {
throw new IOException("read-only");
@@ -182,11 +179,17 @@
}
bind(NamingConventions.class).to(RichFacesConventions.class);
bind(ModelValidator.class).to(ValidatorImpl.class);
-
- Names.bindProperties(binder(), options);
+
+ bind(new TypeLiteral<Map<String, String>>() {
+ }).annotatedWith(Names.named(OPTIONS)).toInstance(options);
+ bindOption(RENDERER_UTILS_CLASS);
}
-
-
+
+ private void bindOption(String name) {
+ bind(String.class).annotatedWith(Names.named(name)).toProvider(
+ Providers.of(options.get(name)));
+ }
+
}
public String getNamespace() {
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/generate/freemarker/LibraryModelWrapper.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/generate/freemarker/LibraryModelWrapper.java 2010-06-22 19:08:34 UTC (rev 17659)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/generate/freemarker/LibraryModelWrapper.java 2010-06-22 23:05:28 UTC (rev 17660)
@@ -21,33 +21,42 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
-
package org.richfaces.cdk.generate.freemarker;
import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.EventModel;
+import org.richfaces.cdk.model.FacesId;
import org.richfaces.cdk.model.ModelElementBase;
import org.richfaces.cdk.model.PropertyBase;
import org.richfaces.cdk.model.TagModel;
import freemarker.ext.beans.BeansWrapper;
+import freemarker.ext.beans.StringModel;
+import freemarker.ext.util.ModelFactory;
import freemarker.template.ObjectWrapper;
import freemarker.template.TemplateModel;
import freemarker.template.TemplateModelException;
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @author asmirnov(a)exadel.com
- *
+ *
*/
public class LibraryModelWrapper extends BeansWrapper implements ObjectWrapper {
+ static final ModelFactory STRING_MODEL_FACTORY = new ModelFactory() {
+ public TemplateModel create(Object object, ObjectWrapper wrapper) {
+ return new StringModel(object, (BeansWrapper) wrapper);
+ }
+ };
+
public LibraryModelWrapper() {
super();
setStrict(true);
setSimpleMapWrapper(true);
-// setNullModel(TemplateScalarModel.EMPTY_STRING);
+ // setNullModel(TemplateScalarModel.EMPTY_STRING);
setUseCache(true);
}
@@ -57,12 +66,14 @@
return create(obj, PropertyModel.FACTORY);
} else if (obj instanceof ClassName) {
return create(obj, ClassNameModel.FACTORY);
+ } else if (obj instanceof FacesId) {
+ return create(obj, STRING_MODEL_FACTORY);
} else if (obj instanceof EventModel) {
return create(obj, EventTemplateModel.FACTORY);
} else if (obj instanceof TagModel) {
return create(obj, TagTemplateModel.FACTORY);
} else if (obj instanceof ModelElementBase) {
- return create(obj,ModelElementBaseTemplateModel.FACTORY);
+ return create(obj, ModelElementBaseTemplateModel.FACTORY);
} else {
return super.wrap(obj);
}
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassVisitor.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassVisitor.java 2010-06-22 19:08:34 UTC (rev 17659)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassVisitor.java 2010-06-22 23:05:28 UTC (rev 17660)
@@ -49,7 +49,6 @@
import org.richfaces.cdk.attributes.Attribute;
import org.richfaces.cdk.attributes.Element;
import org.richfaces.cdk.attributes.Schema;
-import org.richfaces.cdk.attributes.SchemaSet;
import org.richfaces.cdk.model.EventName;
import org.richfaces.cdk.model.PropertyBase;
import org.richfaces.cdk.templatecompiler.builder.model.Argument;
@@ -79,7 +78,6 @@
import org.richfaces.cdk.templatecompiler.model.Template;
import org.richfaces.cdk.templatecompiler.model.TemplateVisitor;
import org.richfaces.cdk.util.Strings;
-import org.richfaces.cdk.xmlconfig.JAXB;
import com.google.common.base.Function;
import com.google.common.collect.Collections2;
@@ -146,30 +144,31 @@
private MethodBodyStatementsContainer currentStatement;
- private Schema attributesSchema = null;
+ private final Schema attributesSchema ;
private JavaClass generatedClass;
private CompositeInterface compositeInterface;
private final LinkedList<MethodBodyStatementsContainer> statements = Lists.newLinkedList();
private Map<String, Type> localsTypesMap;
- private ClassLoader classLoader;
+ private final ClassLoader classLoader;
private Set<HelperMethod> addedHelperMethods = EnumSet.noneOf(HelperMethod.class);
private Type lastCompiledExpressionType;
private int passThroughCounter;
- private Collection<PropertyBase> attributes;
+ private final Collection<PropertyBase> attributes;
+
+ private final VisitorFactoryImpl visitorFactoryImpl;
public RendererClassVisitor(CompositeInterface compositeInterface, Collection<PropertyBase> attributes,
- ClassLoader classLoader, JAXB jaxbBinding, Logger log) {
+ VisitorFactoryImpl factory) {
this.compositeInterface = compositeInterface;
this.attributes = attributes;
- this.classLoader = classLoader;
- this.log = log;
- // TODO - cache unmarshalled data (as CDKWorker?)
- SchemaSet schemaSet = jaxbBinding.unmarshal("urn:attributes:xhtml-el.xml", null, SchemaSet.class);
- this.attributesSchema = schemaSet.getSchemas().get(Template.XHTML_EL_NAMESPACE);
+ this.visitorFactoryImpl = factory;
+ this.classLoader = factory.classLoader;
+ this.log = factory.log;
+ this.attributesSchema = factory.attributesSchema;
}
private void initializeJavaClass() {
@@ -221,7 +220,7 @@
private String compileEl(String expression, Class<?> type) {
try {
ELVisitor elVisitor = new ELVisitor();
- elVisitor.parse(expression, localsTypesMap, TypesFactory.getType(type));
+ elVisitor.parse(expression, currentStatement, TypesFactory.getType(type));
lastCompiledExpressionType = elVisitor.getExpressionType();
String parsedExpression = elVisitor.getParsedExpression();
@@ -331,7 +330,7 @@
passThroughField.addModifier(JavaModifier.FINAL);
generatedClass.addImport("org.richfaces.renderkit.ComponentAttribute");
- generatedClass.addImport(RENDER_KIT_UTILS_CLASS_NAME);
+ addRendererUtilsImport();
generatedClass.addImport(Collections.class);
// TODO - get rid of FQNs for classes via imports
@@ -360,6 +359,12 @@
return fieldName;
}
+ private void addRendererUtilsImport() {
+ if (!Strings.isEmpty(this.visitorFactoryImpl.rendererUtilsClassName)) {
+ generatedClass.addImport("static " + this.visitorFactoryImpl.rendererUtilsClassName + ".*");
+ }
+ }
+
private void createMethodContext() {
this.currentStatement = new MethodBody();
this.localsTypesMap = new HashMap<String, Type>();
@@ -518,7 +523,7 @@
} else {
String attributeLocalName = attributeName.getLocalPart();
if (writtenAttributes.add(attributeLocalName)) {
- generatedClass.addImport(RENDER_KIT_UTILS_CLASS_NAME);
+ addRendererUtilsImport();
currentStatement.addStatement(new WriteAttributeStatement(attributeLocalName, compileEl(
attributeValue.toString(), Object.class)));
}
@@ -544,7 +549,7 @@
if (!actualAttributesMap.isEmpty()) {
String passThroughFieldName = createPassThroughField(actualAttributesMap);
- generatedClass.addImport(RENDER_KIT_UTILS_CLASS_NAME);
+ addRendererUtilsImport();
currentStatement.addStatement(new WriteAttributesSetStatement(passThroughFieldName));
}
}
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/TemplateModule.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/TemplateModule.java 2010-06-22 19:08:34 UTC (rev 17659)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/TemplateModule.java 2010-06-22 23:05:28 UTC (rev 17660)
@@ -27,6 +27,7 @@
import org.richfaces.cdk.ModelBuilder;
import com.google.inject.AbstractModule;
+import com.google.inject.Singleton;
import com.google.inject.TypeLiteral;
import com.google.inject.multibindings.Multibinder;
@@ -45,7 +46,7 @@
Multibinder<ModelBuilder> modelBinder = Multibinder.newSetBinder(binder(), ModelBuilder.class);
modelBinder.addBinding().to(RendererTemplateParser.class);
Multibinder.newSetBinder(binder(), CdkWriter.class).addBinding().to(RendererClassGenerator.class);
- bind(new TypeLiteral<TemplateVisitorFactory<RendererClassVisitor>>(){}).to(VisitorFactoryImpl.class);
+ bind(new TypeLiteral<TemplateVisitorFactory<RendererClassVisitor>>(){}).to(VisitorFactoryImpl.class).in(Singleton.class);
bind(FreeMarkerRenderer.class).to(JavaClassConfiguration.class);
}
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/VisitorFactoryImpl.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/VisitorFactoryImpl.java 2010-06-22 19:08:34 UTC (rev 17659)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/VisitorFactoryImpl.java 2010-06-22 23:05:28 UTC (rev 17660)
@@ -26,12 +26,18 @@
import java.util.Collection;
import org.richfaces.cdk.CdkClassLoader;
+import org.richfaces.cdk.Generator;
import org.richfaces.cdk.Logger;
+import org.richfaces.cdk.attributes.Schema;
+import org.richfaces.cdk.attributes.SchemaSet;
import org.richfaces.cdk.model.PropertyBase;
import org.richfaces.cdk.templatecompiler.model.CompositeInterface;
+import org.richfaces.cdk.templatecompiler.model.Template;
import org.richfaces.cdk.xmlconfig.JAXB;
import com.google.inject.Inject;
+import com.google.inject.internal.Nullable;
+import com.google.inject.name.Named;
/**
* <p class="changed_added_4_0"></p>
@@ -40,9 +46,10 @@
*/
public class VisitorFactoryImpl implements TemplateVisitorFactory<RendererClassVisitor> {
- private CdkClassLoader classLoader;
- private JAXB jaxbBinding;
- private Logger log;
+ final CdkClassLoader classLoader;
+ final Logger log;
+ final Schema attributesSchema;
+ final String rendererUtilsClassName;
/**
* <p class="changed_added_4_0"></p>
@@ -51,10 +58,12 @@
* @param log
*/
@Inject
- public VisitorFactoryImpl(CdkClassLoader classLoader, JAXB jaxbBinding, Logger log) {
+ public VisitorFactoryImpl(CdkClassLoader classLoader, JAXB jaxbBinding, Logger log,(a)Named(Generator.RENDERER_UTILS_CLASS) @Nullable String rendererUtilsClassName) {
this.classLoader = classLoader;
- this.jaxbBinding = jaxbBinding;
this.log = log;
+ SchemaSet schemaSet = jaxbBinding.unmarshal("urn:attributes:xhtml-el.xml", null, SchemaSet.class);
+ this.attributesSchema = schemaSet.getSchemas().get(Template.XHTML_EL_NAMESPACE);
+ this.rendererUtilsClassName = rendererUtilsClassName;
}
/* (non-Javadoc)
@@ -62,7 +71,7 @@
*/
@Override
public RendererClassVisitor createVisitor(CompositeInterface composite, Collection<PropertyBase> attributes) {
- return new RendererClassVisitor(composite, attributes, classLoader, jaxbBinding, log);
+ return new RendererClassVisitor(composite, attributes, this);
}
}
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/builder/model/MethodBodyStatementsContainer.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/builder/model/MethodBodyStatementsContainer.java 2010-06-22 19:08:34 UTC (rev 17659)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/builder/model/MethodBodyStatementsContainer.java 2010-06-22 23:05:28 UTC (rev 17660)
@@ -23,22 +23,36 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
import org.richfaces.cdk.templatecompiler.FreeMarkerRenderer;
+import org.richfaces.cdk.templatecompiler.el.ParsingException;
+import org.richfaces.cdk.templatecompiler.el.Type;
+import com.google.common.collect.Maps;
+
/**
* @author Nick Belaevski
* @since 4.0
*/
-public class MethodBodyStatementsContainer implements MethodBodyStatement {
+public class MethodBodyStatementsContainer implements MethodBodyStatement, Variables {
private List<MethodBodyStatement> statements = new ArrayList<MethodBodyStatement>();
+
+ private MethodBodyStatementsContainer parent;
+
+ private final Map<String, Type> localVariablesMap = Maps.newHashMap();
+
public List<MethodBodyStatement> getStatements() {
return statements;
}
public void addStatement(MethodBodyStatement statement) {
+ if (statement instanceof MethodBodyStatementsContainer) {
+ MethodBodyStatementsContainer container = (MethodBodyStatementsContainer) statement;
+ container.setParent(this);
+ }
statements.add(statement);
}
@@ -54,6 +68,22 @@
addStatement(index, new MethodBodyStatementImpl(statementCode));
}
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @param parent the parent to set
+ */
+ public void setParent(MethodBodyStatementsContainer parent) {
+ this.parent = parent;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the parent
+ */
+ public MethodBodyStatementsContainer getParent() {
+ return parent;
+ }
+
public boolean isEmpty() {
return statements.isEmpty();
}
@@ -71,4 +101,29 @@
return sb.toString();
}
+
+ @Override
+ public Type getVariable(String name) throws ParsingException {
+ Type type = localVariablesMap.get(name);
+ if(null == type && null != parent){
+ type = parent.getVariable(name);
+ }
+ return type;
+ }
+
+ @Override
+ public boolean isDefined(String name) throws ParsingException {
+ boolean defined = localVariablesMap.containsKey(name);
+ if(!defined && null != parent){
+ defined = parent.isDefined(name);
+ }
+ return defined;
+ }
+
+ @Override
+ public Type setVariable(String name, Type type) throws ParsingException {
+ Type variable = getVariable(name);
+ localVariablesMap.put(name, type);
+ return variable;
+ }
}
Added: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/builder/model/Variables.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/builder/model/Variables.java (rev 0)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/builder/model/Variables.java 2010-06-22 23:05:28 UTC (rev 17660)
@@ -0,0 +1,14 @@
+package org.richfaces.cdk.templatecompiler.builder.model;
+
+import org.richfaces.cdk.templatecompiler.el.ParsingException;
+import org.richfaces.cdk.templatecompiler.el.Type;
+
+public interface Variables {
+
+ public Type getVariable(String name) throws ParsingException;
+
+ public boolean isDefined(String name) throws ParsingException;
+
+ public Type setVariable(String name, Type type) throws ParsingException;
+
+}
Property changes on: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/builder/model/Variables.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/el/ELVisitor.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/el/ELVisitor.java 2010-06-22 19:08:34 UTC (rev 17659)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/el/ELVisitor.java 2010-06-22 23:05:28 UTC (rev 17660)
@@ -26,12 +26,12 @@
import java.text.MessageFormat;
import java.util.EnumSet;
-import java.util.Map;
import java.util.Set;
import org.jboss.el.parser.AstCompositeExpression;
import org.jboss.el.parser.ELParser;
import org.jboss.el.parser.Node;
+import org.richfaces.cdk.templatecompiler.builder.model.Variables;
import org.richfaces.cdk.templatecompiler.el.node.ITreeNode;
import org.richfaces.cdk.templatecompiler.el.types.TypesFactory;
/**
@@ -45,7 +45,7 @@
private Type expressionType = null;
- private Map<String, Type> variables = null;
+ private Variables variables = null;
private Set<HelperMethod> usedHelperMethods = EnumSet.noneOf(HelperMethod.class);
@@ -59,15 +59,8 @@
this.expressionType = variableType;
}
- /**
- * @return the variables
- */
- public Map<String, Type> getVariables() {
- return variables;
- }
-
public Type getVariable(String name) throws ParsingException {
- Type variableType = variables.get(name);
+ Type variableType = variables.getVariable(name);
if (variableType == null) {
throw new ParsingException(MessageFormat.format(
"No type found in context for identifier ''{0}'', handling as generic Object", name));
@@ -98,11 +91,11 @@
* @return generated Java code.
* @throws ParsingException - if error occurred during parsing.
*/
- public void parse(String expression, Map<String, Type> contextMap, Type expectedType) throws ParsingException {
+ public void parse(String expression, Variables contextVariables, Type expectedType) throws ParsingException {
reset();
Node ret = ELParser.parse(expression);
- variables = contextMap;
+ variables = contextVariables;
if (ret instanceof AstCompositeExpression && ret.jjtGetNumChildren() >= 2) {
//AstCompositeExpression with 2+ children is a mixed expression
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/resources/META-INF/templates/component.ftl
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/resources/META-INF/templates/component.ftl 2010-06-22 19:08:34 UTC (rev 17659)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/resources/META-INF/templates/component.ftl 2010-06-22 23:05:28 UTC (rev 17660)
@@ -39,9 +39,11 @@
return COMPONENT_FAMILY;
}</#if>
+ <#if rendererType?exists>
public ${targetClass.simpleName}() {
+ super();
setRendererType("${rendererType}");
- }
+ }</#if>
<#if (eventNames?size > 0)>
private static final Collection<String> EVENT_NAMES = Collections.unmodifiableCollection(Arrays.asList(
Modified: root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/parser/el/test/ELParserTest.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/parser/el/test/ELParserTest.java 2010-06-22 19:08:34 UTC (rev 17659)
+++ root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/parser/el/test/ELParserTest.java 2010-06-22 23:05:28 UTC (rev 17660)
@@ -31,6 +31,7 @@
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
+import org.richfaces.cdk.templatecompiler.builder.model.Variables;
import org.richfaces.cdk.templatecompiler.el.ELVisitor;
import org.richfaces.cdk.templatecompiler.el.ParsingException;
import org.richfaces.cdk.templatecompiler.el.Type;
@@ -45,8 +46,26 @@
}
private void parseExpression(String expression, Class<?> returnType) throws ParsingException {
- Map<String, Type> contextMap = new HashMap<String, Type>();
+ final Map<String, Type> contextMap = new HashMap<String, Type>();
+ Variables variables = new Variables(){
+
+ @Override
+ public Type getVariable(String name) throws ParsingException {
+ return contextMap.get(name);
+ }
+
+ @Override
+ public boolean isDefined(String name) throws ParsingException {
+ return contextMap.containsKey(name);
+ }
+
+ @Override
+ public Type setVariable(String name, Type type) throws ParsingException {
+ return contextMap.put(name, type);
+ }
+
+ };
contextMap.put("action", TypesFactory.getType(org.richfaces.cdk.templatecompiler.parser.el.test.Bean.class));
contextMap.put("clientId", TypesFactory.getType(String.class));
contextMap.put("test", TypesFactory.getType(boolean.class));
@@ -55,7 +74,7 @@
contextMap.put("super", TypesFactory.getType(Object.class));
contextMap.put("objectVar", TypesFactory.getType(Object.class));
- visitor.parse(expression, contextMap, TypesFactory.getType(returnType));
+ visitor.parse(expression, variables, TypesFactory.getType(returnType));
}
@Before
14 years, 6 months
JBoss Rich Faces SVN: r17659 - in root/cdk/branches/RF8755/plugins/generator/src: main/java/org/richfaces/cdk/apt/processors and 13 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-06-22 15:08:34 -0400 (Tue, 22 Jun 2010)
New Revision: 17659
Added:
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/NormalizedStringAdapter.java
Modified:
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/NamingConventions.java
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/RichFacesConventions.java
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/RendererProcessor.java
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibGeneratorVisitor.java
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentLibrary.java
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/model/ListenerModel.java
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/model/RendererModel.java
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassGenerator.java
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/builder/model/JavaClass.java
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/Attribute.java
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CdkObjectElement.java
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/ClientBehavior.java
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CompositeInterface.java
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/ImportAttributes.java
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/ResourceDependency.java
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ClassAdapter.java
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ComponentBean.java
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/FacesIdAdapter.java
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/RendererAdapter.java
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/RendererBean.java
root/cdk/branches/RF8755/plugins/generator/src/main/resources/META-INF/templates/component.ftl
root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/apt/processors/ComponentProcessorTest.java
root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ComponentClassGeneratorTest.java
root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/model/validator/ModelValidatorTest.java
root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/RendererTemplateParserTest.java
root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/model/TemplateTest.java
root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/ComponentAdapterTest.java
root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/FacesConfigTest.java
root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/JaxbMarshalTest.java
Log:
refactor models to use actual classes for id's and types
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/NamingConventions.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/NamingConventions.java 2010-06-22 15:36:05 UTC (rev 17658)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/NamingConventions.java 2010-06-22 19:08:34 UTC (rev 17659)
@@ -27,7 +27,6 @@
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.FacesId;
import org.richfaces.cdk.model.InvalidNameException;
-import org.richfaces.cdk.model.RendererModel;
/**
* <p class="changed_added_4_0">
@@ -75,7 +74,7 @@
* @return
* @throws InvalidNameException
*/
- public String inferUIComponentFamily(FacesId componentType) throws InvalidNameException;
+ public FacesId inferUIComponentFamily(FacesId componentType) throws InvalidNameException;
/**
* <p class="changed_added_4_0"></p>
@@ -92,19 +91,19 @@
public String inferRendererTypeByComponentType(FacesId componentType);
- public String inferComponentFamily(RendererModel.Type type);
+ public String inferComponentFamily(FacesId type);
- public String inferTemplate(RendererModel.Type type);
+ public String inferTemplate(FacesId type);
public String inferRendererTypeByTemplatePath(String templateName);
- public String inferRendererName(RendererModel.Type type);
+ public String inferRendererName(FacesId type);
public String inferComponentTypeByRendererClass(String s);
public String inferComponentFamilyByRendererClass(String s);
- public String inferRendererBaseName(RendererModel.Type type);
+ public String inferRendererBaseName(FacesId type);
public FacesId inferBehaviorType(ClassName targetClass);
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/RichFacesConventions.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/RichFacesConventions.java 2010-06-22 15:36:05 UTC (rev 17658)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/RichFacesConventions.java 2010-06-22 19:08:34 UTC (rev 17659)
@@ -9,7 +9,6 @@
import org.richfaces.cdk.model.FacesId;
import org.richfaces.cdk.model.InvalidNameException;
import org.richfaces.cdk.model.Name;
-import org.richfaces.cdk.model.RendererModel;
import org.richfaces.cdk.model.Name.Classifier;
import org.richfaces.cdk.util.Strings;
@@ -96,11 +95,11 @@
}
@Override
- public String inferUIComponentFamily(FacesId componentType) {
+ public FacesId inferUIComponentFamily(FacesId componentType) {
if (null == componentType) {
throw new IllegalArgumentException();
}
- return componentType.toString();
+ return componentType;
}
@Override
@@ -148,11 +147,11 @@
return componentType + "Renderer";
}
- public String inferComponentFamily(RendererModel.Type type) {
+ public String inferComponentFamily(FacesId type) {
return null;
}
- public String inferTemplate(RendererModel.Type type) {
+ public String inferTemplate(FacesId type) {
return null;
}
@@ -160,11 +159,11 @@
return null;
}
- public String inferRendererName(RendererModel.Type type) {
+ public String inferRendererName(FacesId type) {
return null;
}
- public String inferRendererBaseName(RendererModel.Type type) {
+ public String inferRendererBaseName(FacesId type) {
return null;
}
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java 2010-06-22 15:36:05 UTC (rev 17658)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java 2010-06-22 19:08:34 UTC (rev 17659)
@@ -49,7 +49,6 @@
import org.richfaces.cdk.model.ComponentModel;
import org.richfaces.cdk.model.FacesId;
import org.richfaces.cdk.model.FacetModel;
-import org.richfaces.cdk.model.RendererModel;
import org.richfaces.cdk.util.Strings;
import com.google.inject.Inject;
@@ -127,15 +126,7 @@
}
private void setRendererType(ComponentModel component, JsfRenderer jsfRenderer) {
- // TODO if jsfRenderer.empty set by naming convention
-
- String type;
- if (jsfRenderer != null && !Strings.isEmpty(jsfRenderer.type())) {
- type = jsfRenderer.type();
- } else {
- type = getNamingConventions().inferRendererTypeByComponentType(component.getType());
- }
- component.setRendererType(new RendererModel.Type(type));
+ component.setRendererType(FacesId.parseId(jsfRenderer.type()));
}
private void processAttributes(TypeElement componentElement, ComponentModel component, JsfComponent annotation) {
@@ -173,13 +164,13 @@
void setComponentType(TypeElement componentElement, ComponentModel component, String type) {
if (!Strings.isEmpty(type)) {
- component.setType(FacesId.parseId(type));
+ component.setId(FacesId.parseId(type));
} else if (null != componentElement) {
// static final String COMPONENT_FAMILY = "...";
Object value = getSourceUtils().getConstant(componentElement, COMPONENT_TYPE);
if (value != null) {
- component.setType(FacesId.parseId(value.toString()));
+ component.setId(FacesId.parseId(value.toString()));
}
}
}
@@ -222,12 +213,12 @@
final void setComponeneFamily(TypeElement componentElement, ComponentModel component, String family) {
if (!Strings.isEmpty(family)) {
- component.setFamily(family);
+ component.setFamily(FacesId.parseId(family));
} else if (null != componentElement) {
// static final String COMPONENT_FAMILY = "...";
Object value = getSourceUtils().getConstant(componentElement, COMPONENT_FAMILY);
if (null != value) {
- component.setFamily(value.toString());
+ component.setFamily(FacesId.parseId(value.toString()));
}
}
}
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/RendererProcessor.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/RendererProcessor.java 2010-06-22 15:36:05 UTC (rev 17658)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/RendererProcessor.java 2010-06-22 19:08:34 UTC (rev 17659)
@@ -38,6 +38,7 @@
import org.richfaces.cdk.annotations.JsfRenderer;
import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.ComponentLibrary;
+import org.richfaces.cdk.model.FacesId;
import org.richfaces.cdk.model.RendererModel;
import org.richfaces.cdk.templatecompiler.RendererTemplateParser;
import org.richfaces.cdk.util.Strings;
@@ -152,18 +153,16 @@
private void setComponentFamily(TypeElement rendererElement, RendererModel rendererModel, JsfRenderer annotation) {
String family = annotation.family();
if (!Strings.isEmpty(family)) {
- rendererModel.setFamily(family);
+ rendererModel.setFamily(FacesId.parseId(family));
return;
- }
+ } else {
- Object value = getSourceUtils().getConstant(rendererElement, COMPONENT_FAMILY);
- if (value != null) {
- rendererModel.setFamily(value.toString());
- return;
+ Object value = getSourceUtils().getConstant(rendererElement, COMPONENT_FAMILY);
+ if (value != null) {
+ rendererModel.setFamily(FacesId.parseId(value.toString()));
+ return;
+ }
}
-
-// rendererModel.setFamily(getNamingConventions()
-// .inferComponentFamilyByRendererClass(rendererElement.getQualifiedName().toString()));
}
private String getRendererType(TypeElement rendererElement, JsfRenderer annotation) {
@@ -177,11 +176,11 @@
return value.toString();
}
- return null; //getNamingConventions().inferRendererTypeByRendererClass(asClassDesctiption(rendererElement));
+ return null;
}
private void setRendererType(TypeElement rendererElement, RendererModel rendererModel, JsfRenderer annotation) {
- rendererModel.setType(new RendererModel.Type(getRendererType(rendererElement, annotation)));
+ rendererModel.setId(FacesId.parseId(getRendererType(rendererElement, annotation)));
}
protected String getComponentType(TypeElement componentElement) {
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibGeneratorVisitor.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibGeneratorVisitor.java 2010-06-22 15:36:05 UTC (rev 17658)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibGeneratorVisitor.java 2010-06-22 19:08:34 UTC (rev 17659)
@@ -33,12 +33,12 @@
import org.richfaces.cdk.model.ConverterModel;
import org.richfaces.cdk.model.DescriptionGroup;
import org.richfaces.cdk.model.EventModel;
+import org.richfaces.cdk.model.FacesId;
import org.richfaces.cdk.model.FunctionModel;
import org.richfaces.cdk.model.PropertyBase;
import org.richfaces.cdk.model.SimpleVisitor;
import org.richfaces.cdk.model.TagModel;
import org.richfaces.cdk.model.ValidatorModel;
-import org.richfaces.cdk.model.RendererModel.Type;
import org.richfaces.cdk.util.Strings;
/**
@@ -111,10 +111,10 @@
// Most libraries use <handler-class> INSTEAD of <component>
Element component = tag.addElement(COMPONENT);
component.addElement(COMPONENT_TYPE).addText(model.getId().getType());
- Type rendererType = model.getRendererType();
+ FacesId rendererType = model.getRendererType();
// RendererModel renderer = componentLibrary.getRenderer(model.getFamily(), model.getId().getType());
if (null != rendererType) {
- component.addElement(RENDERER_TYPE).addText(rendererType.getType());
+ component.addElement(RENDERER_TYPE).addText(rendererType.toString());
}
addTagHandler(component, tagModel);
appendAttributs(tag, model);
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentLibrary.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentLibrary.java 2010-06-22 15:36:05 UTC (rev 17658)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentLibrary.java 2010-06-22 19:08:34 UTC (rev 17659)
@@ -152,19 +152,23 @@
return components;
}
- public ComponentModel getComponentModel(String componentFamily) {
- if (componentFamily == null) {
+ public ComponentModel getComponentByFamily(FacesId family) {
+ if (family == null) {
return null;
}
for (ComponentModel component : components) {
- if (componentFamily.equals(component.getFamily())) {
+ if (family.equals(component.getFamily())) {
return component;
}
}
return null;
}
+ public ComponentModel getComponentByFamily(String componentFamily) {
+ return getComponentByFamily(FacesId.parseId(componentFamily));
+ }
+
/**
* <p class="changed_added_4_0">
* </p>
@@ -217,14 +221,8 @@
if (res.size() > 1) {
for (RendererModel renderer : res) {
String rendererComponentType = renderer.getComponentType();
- if (rendererComponentType == null) {
- if (renderer.getType().getType().startsWith(componentType)) {
- return renderer; // TODO do it throw naming convention
- }
- } else {
- if (rendererComponentType.equals(componentType)) {
- return renderer;
- }
+ if (componentType.equals(rendererComponentType)) {
+ return renderer;
}
}
}
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java 2010-06-22 15:36:05 UTC (rev 17658)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java 2010-06-22 19:08:34 UTC (rev 17659)
@@ -1,6 +1,5 @@
package org.richfaces.cdk.model;
-import org.richfaces.cdk.model.RendererModel.Type;
/**
* That class represents JSF component in the CDK.
@@ -32,9 +31,9 @@
* relation.
* </p>
*/
- private String family;
+ private FacesId family;
- private RendererModel.Type rendererType;
+ private FacesId rendererType;
public ComponentModel(FacesId key) {
this.setId(key);
@@ -65,39 +64,20 @@
@Override
public boolean same(ComponentModel other) {
- if (null != getType() && null != other.getType()) {
+ if (null != getId() && null != other.getId()) {
// Both types not null, compare them.
- return getType().equals(other.getType());
+ return getId().equals(other.getId());
}
// one or both types are null, compare classes.
return null != getTargetClass() && getTargetClass().equals(other.getTargetClass());
}
/**
- * <p class="changed_added_4_0">Delegeted to setId</p>
- * @param type the type to set
- * @deprecated Use {@link ModelElementBase#setId(FacesId)} instead.
- */
- public void setType(FacesId type) {
- setId(type);
- }
-
- /**
* <p class="changed_added_4_0"></p>
- * @return
- * @deprecated Use {@link ModelElementBase#getId()} instead.
- */
- public FacesId getType() {
- return getId();
- }
-
-
- /**
- * <p class="changed_added_4_0"></p>
* @return the rendererType
*/
@Merge
- public Type getRendererType() {
+ public FacesId getRendererType() {
return this.rendererType;
}
@@ -105,7 +85,7 @@
* <p class="changed_added_4_0"></p>
* @param renderer the rendererType to set
*/
- public void setRendererType(Type renderer) {
+ public void setRendererType(FacesId renderer) {
this.rendererType = renderer;
}
@@ -118,7 +98,7 @@
* @return the family
*/
@Merge
- public String getFamily() {
+ public FacesId getFamily() {
return family;
}
@@ -129,33 +109,12 @@
* @param family
* the family to set
*/
- public void setFamily(String family) {
+ public void setFamily(FacesId family) {
this.family = family;
}
/**
- * <p class="changed_added_4_0">Alias for TargetClass.
- * </p>
- *
- * @return the componentClass
- * @deprecated
- */
- @Merge
- public ClassName getComponentClass() {
- return getTargetClass();
- }
-
- /**
* <p class="changed_added_4_0"></p>
- * @param name
- * @deprecated
- */
- public void setComponentClass(ClassName name) {
- setTargetClass(name);
- }
-
- /**
- * <p class="changed_added_4_0"></p>
* @return the facets
*/
public ModelCollection<FacetModel> getFacets() {
@@ -195,6 +154,6 @@
@Override
public String toString() {
- return "Component {type: " + getType() + ", family: " + getFamily() + "}";
+ return "Component {type: " + getId() + ", family: " + getFamily() + "}";
}
}
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/model/ListenerModel.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/model/ListenerModel.java 2010-06-22 15:36:05 UTC (rev 17658)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/model/ListenerModel.java 2010-06-22 19:08:34 UTC (rev 17659)
@@ -36,10 +36,10 @@
/**
* <p class="changed_added_4_0"></p>
*/
- private Type type;
+ private FacesId id;
- public ListenerModel(Type type) {
- this.type = type;
+ public ListenerModel(FacesId type) {
+ this.id = type;
}
public ListenerModel() {
@@ -53,16 +53,16 @@
* (non-Javadoc)
* @see org.richfaces.cdk.model.ModelElement#getType()
*/
- public Type getType() {
- return type;
+ public FacesId getId() {
+ return id;
}
/**
* <p class="changed_added_4_0"></p>
- * @param type the type to set
+ * @param id the id to set
*/
- public void setType(Type type) {
- this.type = type;
+ public void setId(FacesId type) {
+ this.id = type;
}
@Override
@@ -75,11 +75,5 @@
public boolean same(ListenerModel other) {
return equals(other);
}
-
- public static final class Type extends FacesId {
- public Type(String name) {
- super(name);
- }
- }
}
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/model/RendererModel.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/model/RendererModel.java 2010-06-22 15:36:05 UTC (rev 17658)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/model/RendererModel.java 2010-06-22 19:08:34 UTC (rev 17659)
@@ -37,7 +37,7 @@
private static final long serialVersionUID = -5802466539382148578L;
- private String family;
+ private FacesId family;
private String componentType;
@@ -51,22 +51,10 @@
public RendererModel() { }
- public RendererModel(Type type) {
- setType(type);
+ public RendererModel(FacesId type) {
+ setId(type);
}
- public Type getKey() {
- return getType();
- }
-
- public void setType(Type type) {
- this.setId(type);
- }
-
- public Type getType() {
- return (Type) getId();
- }
-
@Merge
public Template getTemplate() {
return template;
@@ -77,11 +65,11 @@
}
@Merge
- public String getFamily() {
+ public FacesId getFamily() {
return family;
}
- public void setFamily(String family) {
+ public void setFamily(FacesId family) {
this.family = family;
}
@@ -143,13 +131,13 @@
@Override
public boolean same(RendererModel other) {
- if (null != getType() && null != other.getType()) {
+ if (null != getId() && null != other.getId()) {
// compare families ?
if (null != getFamily() && null != other.getFamily() && !getFamily().equals(other.getFamily())) {
return false;
}
// Both types not null, compare them.
- return getType().equals(other.getType());
+ return getId().equals(other.getId());
}
// one or both types are null, compare classes.
if (null != getRendererClass() && getRendererClass().equals(other.getRendererClass())) {
@@ -171,27 +159,8 @@
return new AttributeModel();
}
- /**
- * <p class="changed_added_4_0">FacesId for lookup renderer in the model.</p>
- * @author asmirnov(a)exadel.com
- *
- */
- public static class Type extends FacesId {
-
- private static final long serialVersionUID = -7819560321446149642L;
-
- /**
- * <p class="changed_added_4_0"></p>
- * TODO - use family as part of key ?
- * @param type
- */
- public Type(String type) {
- super(type);
- }
- }
-
@Override
public String toString() {
- return "Renderer {type: " + getType() + ", family: " + getFamily() + "}";
+ return "Renderer {type: " + getId() + ", family: " + getFamily() + "}";
}
}
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassGenerator.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassGenerator.java 2010-06-22 15:36:05 UTC (rev 17658)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassGenerator.java 2010-06-22 19:08:34 UTC (rev 17659)
@@ -77,7 +77,7 @@
}
private ComponentModel findComponentByRenderer(RendererModel renderer, ComponentLibrary library) {
- return library.getComponentModel(renderer.getFamily());
+ return library.getComponentByFamily(renderer.getFamily());
}
/*
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java 2010-06-22 15:36:05 UTC (rev 17658)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java 2010-06-22 19:08:34 UTC (rev 17659)
@@ -26,9 +26,7 @@
import java.io.File;
import java.text.MessageFormat;
import java.util.Collection;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -70,29 +68,28 @@
*/
public class RendererTemplateParser implements ModelBuilder {
- private static final Pattern PARAMETERS_STRING_PATTERN = Pattern.compile("\\( ( [^\\)]* ) \\) \\s*$",
- Pattern.COMMENTS);
+ private static final Pattern PARAMETERS_STRING_PATTERN =
+ Pattern.compile("\\( ( [^\\)]* ) \\) \\s*$", Pattern.COMMENTS);
private static final Pattern COMMA_SEPARATED_PATTERN = Pattern.compile("\\s*,\\s*", Pattern.COMMENTS);
- // todo cahche
- private static final Map<String, Template> PROCESSED_TEMPLATES = new HashMap<String, Template>();
-
private ComponentLibrary library;
-
+
private JAXB jaxbBinding;
-
+
private Logger log;
-
+
private FileManager sources;
-
+
private FragmentParser fragmentParser;
-// @Inject
+ // @Inject
private NamingConventions namingConventions;
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @param library
* @param jaxbBinding
* @param log
@@ -100,8 +97,7 @@
*/
@Inject
public RendererTemplateParser(ComponentLibrary library, JAXB jaxbBinding, Logger log,
- @Source(Sources.RENDERER_TEMPLATES) FileManager sources,
- FragmentParser fragmentParser) {
+ @Source(Sources.RENDERER_TEMPLATES) FileManager sources, FragmentParser fragmentParser) {
this.library = library;
this.jaxbBinding = jaxbBinding;
this.log = log;
@@ -126,27 +122,26 @@
}
private List<ClassName> parseSignature(String signatureString) {
- if (signatureString == null || signatureString.trim().length() == 0) {
- return null;
- }
List<ClassName> result = Lists.newArrayList();
- Matcher parametersStringMatcher = PARAMETERS_STRING_PATTERN.matcher(signatureString);
- if (!parametersStringMatcher.find()) {
- // TODO - handle exception
- throw new IllegalArgumentException(MessageFormat.format("Signature string {0} cannot be parsed!",
- signatureString));
- }
+ if (!Strings.isEmpty(signatureString)) {
+ Matcher parametersStringMatcher = PARAMETERS_STRING_PATTERN.matcher(signatureString);
+ if (!parametersStringMatcher.find()) {
+ // TODO - handle exception
+ throw new IllegalArgumentException(MessageFormat.format("Signature string {0} cannot be parsed!",
+ signatureString));
+ }
- String parametersString = parametersStringMatcher.group(1).trim();
- if (parametersString.length() != 0) {
- String[] parameters = COMMA_SEPARATED_PATTERN.split(parametersString);
- for (String parameter : parameters) {
- String trimmedParameter = parameter.trim();
- result.add(new ClassName(trimmedParameter));
+ String parametersString = parametersStringMatcher.group(1);
+ if (parametersString.trim().length() != 0) {
+ String[] parameters = COMMA_SEPARATED_PATTERN.split(parametersString);
+ for (String parameter : parameters) {
+ String trimmedParameter = parameter.trim();
+ result.add(ClassName.parseName(trimmedParameter));
+ }
}
- }
+ }
return result;
}
@@ -171,17 +166,17 @@
log.debug(" - file = " + absolutePath);
log.debug(" - renderer = " + rendererModel);
- RendererModel existedModel = library.accept(new SimpleVisitor<RendererModel,String>() {
+ RendererModel existedModel = library.accept(new SimpleVisitor<RendererModel, String>() {
@Override
- public RendererModel visitRender(RendererModel model,String absolutePath) {
+ public RendererModel visitRender(RendererModel model, String absolutePath) {
Template template = model.getTemplate();
- if(null != template && absolutePath.equals(template.getTemplatePath())){
+ if (null != template && absolutePath.equals(template.getTemplatePath())) {
return model;
} else {
return null;
}
}
- },absolutePath);
+ }, absolutePath);
if (null != existedModel) {
log.debug(" - Template was already processed.");
return;
@@ -204,16 +199,15 @@
}
renderer.setTemplate(template);
setRendererType(template, compositeInterface, renderer);
- setFamily(compositeInterface, renderer); //TODO set default values according to template name
+ setFamily(compositeInterface, renderer); // TODO set default values according to template name
setRendererClass(compositeInterface, renderer);
setRendererBaseClass(compositeInterface, renderer);
-
Boolean rendersChildren = compositeInterface.getRendersChildren();
if (rendersChildren != null) {
renderer.setRendersChildren(rendersChildren);
}
-
+
List<ImportAttributes> attributesImports = compositeInterface.getAttributesImports();
if (attributesImports != null) {
for (ImportAttributes attributesImport : attributesImports) {
@@ -224,7 +218,7 @@
}
}
}
-
+
List<Attribute> templateAttributes = compositeInterface.getAttributes();
if (templateAttributes != null) {
for (Attribute templateAttribute : templateAttributes) {
@@ -260,47 +254,26 @@
rendererProperty.setRequired(templateAttribute.isRequired());
List<ClassName> parsedSignature = parseSignature(templateAttribute.getMethodSignature());
- if (parsedSignature != null) {
- rendererProperty.getSignature().addAll(parsedSignature);
- }
+ rendererProperty.getSignature().addAll(parsedSignature);
- String templateAttributeType = templateAttribute.getType();
- if (templateAttributeType != null) {
- rendererProperty.setType(new ClassName(templateAttributeType));
- }
+ rendererProperty.setType(templateAttribute.getType());
return rendererProperty;
}
private void setRendererClass(CompositeInterface compositeInterface, RendererModel renderer) {
- String javaClass = compositeInterface.getJavaClass();
- if (javaClass == null) {
- javaClass = getNamingConventions().inferRendererName(renderer.getType());
- }
- renderer.setRendererClass(new ClassName(javaClass));
+ renderer.setRendererClass(compositeInterface.getJavaClass());
}
private void setRendererBaseClass(CompositeInterface compositeInterface, RendererModel renderer) {
- String baseClass = compositeInterface.getBaseClass();
- if (baseClass == null) {
- baseClass = getNamingConventions().inferRendererBaseName(renderer.getType());
- }
- renderer.setBaseClass(new ClassName(baseClass));
+ renderer.setBaseClass(compositeInterface.getBaseClass());
}
private void setFamily(CompositeInterface compositeInterface, RendererModel renderer) {
- String family = compositeInterface.getComponentFamily();
- if (family == null) {
- family = getNamingConventions().inferComponentFamily(renderer.getType());
- }
- renderer.setFamily(family);
+ renderer.setFamily(compositeInterface.getComponentFamily());
}
private void setRendererType(Template template, CompositeInterface compositeInterface, RendererModel renderer) {
- String type = compositeInterface.getRendererType();
- if (Strings.isEmpty(type)) {
- type = getNamingConventions().inferRendererTypeByTemplatePath(template.getTemplatePath());
- }
- renderer.setType(new RendererModel.Type(type));
+ renderer.setId(compositeInterface.getRendererType());
}
protected Template parseTemplate(File file) throws CdkException {
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/builder/model/JavaClass.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/builder/model/JavaClass.java 2010-06-22 15:36:05 UTC (rev 17658)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/builder/model/JavaClass.java 2010-06-22 19:08:34 UTC (rev 17659)
@@ -27,6 +27,8 @@
import java.util.Set;
import java.util.TreeSet;
+import org.richfaces.cdk.model.ClassName;
+
/**
* Java Class model.
* Intended for building java classes.
@@ -70,6 +72,10 @@
setSuperClass(new JavaClass(superClass));
}
+ public JavaClass(ClassName javaClass) {
+ this(javaClass.getSimpleName(), new JavaPackage(javaClass.getPackage()));
+ }
+
private static String getFullName(JavaPackage javaPackage, String className) {
StringBuilder fullName = new StringBuilder();
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/Attribute.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/Attribute.java 2010-06-22 15:36:05 UTC (rev 17658)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/Attribute.java 2010-06-22 19:08:34 UTC (rev 17659)
@@ -28,7 +28,11 @@
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import org.richfaces.cdk.model.ClassName;
+import org.richfaces.cdk.xmlconfig.model.ClassAdapter;
+
/**
* <p class="changed_added_4_0"></p>
*
@@ -38,6 +42,7 @@
private static final long serialVersionUID = -8183353368681247171L;
+ @XmlJavaTypeAdapter(NormalizedStringAdapter.class)
@XmlAttribute(required = true)
private String name;
@@ -47,9 +52,11 @@
@XmlAttribute
private String shortDescription;
+ @XmlJavaTypeAdapter(NormalizedStringAdapter.class)
@XmlAttribute(name = "default")
private String defaultValue;
+ @XmlJavaTypeAdapter(NormalizedStringAdapter.class)
@XmlAttribute(name = "method-signature")
private String methodSignature;
@@ -66,7 +73,8 @@
private boolean expert;
@XmlAttribute
- private String type = Object.class.getName();
+ @XmlJavaTypeAdapter(ClassAdapter.class)
+ private ClassName type = new ClassName(Object.class);
@XmlElement(name = "clientBehavior", namespace = Template.COMPOSITE_NAMESPACE)
private List<ClientBehavior> clientBehaviors;
@@ -238,7 +246,7 @@
*
* @return the type
*/
- public String getType() {
+ public ClassName getType() {
return type;
}
@@ -247,7 +255,7 @@
*
* @param type the type to set
*/
- public void setType(String type) {
+ public void setType(ClassName type) {
this.type = type;
}
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CdkObjectElement.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CdkObjectElement.java 2010-06-22 15:36:05 UTC (rev 17658)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CdkObjectElement.java 2010-06-22 19:08:34 UTC (rev 17659)
@@ -24,6 +24,7 @@
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlValue;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.richfaces.cdk.CdkException;
@@ -35,6 +36,7 @@
public class CdkObjectElement implements ModelElement {
@XmlAttribute(required = true)
+ @XmlJavaTypeAdapter(NormalizedStringAdapter.class)
private String name;
@XmlAttribute
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/ClientBehavior.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/ClientBehavior.java 2010-06-22 15:36:05 UTC (rev 17658)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/ClientBehavior.java 2010-06-22 19:08:34 UTC (rev 17659)
@@ -22,6 +22,7 @@
package org.richfaces.cdk.templatecompiler.model;
import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
/**
* @author Nick Belaevski
@@ -39,6 +40,7 @@
* @return the event
*/
@XmlAttribute
+ @XmlJavaTypeAdapter(NormalizedStringAdapter.class)
public String getEvent() {
return event;
}
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CompositeInterface.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CompositeInterface.java 2010-06-22 15:36:05 UTC (rev 17658)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CompositeInterface.java 2010-06-22 19:08:34 UTC (rev 17659)
@@ -27,10 +27,16 @@
import java.util.List;
import javax.faces.render.RenderKitFactory;
-import javax.faces.render.Renderer;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import org.richfaces.cdk.model.ClassName;
+import org.richfaces.cdk.model.FacesId;
+import org.richfaces.cdk.xmlconfig.model.ClassAdapter;
+import org.richfaces.cdk.xmlconfig.model.FacesIdAdapter;
+
+
/**
* <p class="changed_added_4_0"></p>
*
@@ -41,7 +47,7 @@
private static final long serialVersionUID = -5578359507253872500L;
- private String componentFamily;
+ private FacesId componentFamily;
private List<Attribute> attributes;
@@ -51,11 +57,11 @@
private String renderKitId = RenderKitFactory.HTML_BASIC_RENDER_KIT;
- private String javaClass;
+ private ClassName javaClass;
- private String baseClass = Renderer.class.getName();
+ private ClassName baseClass;
- private String rendererType;
+ private FacesId rendererType;
private Boolean rendersChildren = null;
@@ -64,8 +70,9 @@
*
* @return the family
*/
+ @XmlJavaTypeAdapter(FacesIdAdapter.class)
@XmlElement(name = "component-family", namespace = Template.CDK_NAMESPACE)
- public String getComponentFamily() {
+ public FacesId getComponentFamily() {
return this.componentFamily;
}
@@ -74,7 +81,7 @@
*
* @param family the family to set
*/
- public void setComponentFamily(String family) {
+ public void setComponentFamily(FacesId family) {
this.componentFamily = family;
}
@@ -123,6 +130,7 @@
*
* @return the renderKitId
*/
+ @XmlJavaTypeAdapter(NormalizedStringAdapter.class)
@XmlElement(name = "renderkit-id", namespace = Template.CDK_NAMESPACE)
public String getRenderKitId() {
return this.renderKitId;
@@ -142,8 +150,9 @@
*
* @return the javaClass
*/
+ @XmlJavaTypeAdapter(ClassAdapter.class)
@XmlElement(name = "class", namespace = Template.CDK_NAMESPACE)
- public String getJavaClass() {
+ public ClassName getJavaClass() {
return this.javaClass;
}
@@ -152,7 +161,7 @@
*
* @param javaClass the javaClass to set
*/
- public void setJavaClass(String javaClass) {
+ public void setJavaClass(ClassName javaClass) {
this.javaClass = javaClass;
}
@@ -161,8 +170,9 @@
*
* @return the rendererType
*/
+ @XmlJavaTypeAdapter(FacesIdAdapter.class)
@XmlElement(name = "renderer-type", namespace = Template.CDK_NAMESPACE)
- public String getRendererType() {
+ public FacesId getRendererType() {
return this.rendererType;
}
@@ -171,7 +181,7 @@
*
* @param rendererType the rendererType to set
*/
- public void setRendererType(String rendererType) {
+ public void setRendererType(FacesId rendererType) {
this.rendererType = rendererType;
}
@@ -180,8 +190,9 @@
*
* @return the baseClass
*/
+ @XmlJavaTypeAdapter(ClassAdapter.class)
@XmlElement(name = "superclass", namespace = Template.CDK_NAMESPACE)
- public String getBaseClass() {
+ public ClassName getBaseClass() {
return this.baseClass;
}
@@ -190,7 +201,7 @@
*
* @param baseClass the baseClass to set
*/
- public void setBaseClass(String baseClass) {
+ public void setBaseClass(ClassName baseClass) {
this.baseClass = baseClass;
}
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/ImportAttributes.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/ImportAttributes.java 2010-06-22 15:36:05 UTC (rev 17658)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/ImportAttributes.java 2010-06-22 19:08:34 UTC (rev 17659)
@@ -22,6 +22,7 @@
package org.richfaces.cdk.templatecompiler.model;
import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
/**
* @author Nick Belaevski
@@ -34,6 +35,7 @@
/**
* @return the source
*/
+ @XmlJavaTypeAdapter(NormalizedStringAdapter.class)
@XmlAttribute(name = "src")
public String getSource() {
return source;
Added: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/NormalizedStringAdapter.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/NormalizedStringAdapter.java (rev 0)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/NormalizedStringAdapter.java 2010-06-22 19:08:34 UTC (rev 17659)
@@ -0,0 +1,18 @@
+package org.richfaces.cdk.templatecompiler.model;
+
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+
+import org.richfaces.cdk.util.Strings;
+
+public class NormalizedStringAdapter extends XmlAdapter<String, String> {
+
+ @Override
+ public String marshal(String text) {
+ return Strings.isEmpty(text)?null:text.trim();
+ }
+
+ @Override
+ public String unmarshal(String v) throws Exception {
+ return Strings.isEmpty(v)?null:v.trim();
+ }
+}
\ No newline at end of file
Property changes on: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/NormalizedStringAdapter.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/ResourceDependency.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/ResourceDependency.java 2010-06-22 15:36:05 UTC (rev 17658)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/ResourceDependency.java 2010-06-22 19:08:34 UTC (rev 17659)
@@ -26,6 +26,7 @@
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
/**
* @author Nick Belaevski
@@ -48,6 +49,7 @@
* @return the name
*/
@XmlAttribute(name = "name", required = true)
+ @XmlJavaTypeAdapter(NormalizedStringAdapter.class)
public String getName() {
return name;
}
@@ -67,6 +69,7 @@
* @return the libraryName
*/
@XmlAttribute(name = "library")
+ @XmlJavaTypeAdapter(NormalizedStringAdapter.class)
public String getLibrary() {
return library;
}
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ClassAdapter.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ClassAdapter.java 2010-06-22 15:36:05 UTC (rev 17658)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ClassAdapter.java 2010-06-22 19:08:34 UTC (rev 17659)
@@ -40,6 +40,7 @@
@Override
public ClassName unmarshal(String v) throws Exception {
- return new ClassName(v);
+
+ return new ClassName(v.trim());
}
}
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ComponentBean.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ComponentBean.java 2010-06-22 15:36:05 UTC (rev 17658)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ComponentBean.java 2010-06-22 19:08:34 UTC (rev 17659)
@@ -47,31 +47,31 @@
* @author asmirnov(a)exadel.com
*/
@XmlType(name = "faces-config-componentType", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE,
- propOrder = {"type", "targetClass", "facets", "facesAttributes", "properties", "extension"})
+ propOrder = {"id", "targetClass", "facets", "facesAttributes", "properties", "extension"})
@XmlJavaTypeAdapter(ComponentAdapter.class)
public class ComponentBean extends ElementBeanBase<ComponentBean.ComponentExtension> {
private List<FacetModel> facets = Lists.newArrayList();
private ClassName targetClass;
- private FacesId type;
+ private FacesId id;
/**
* <p class="changed_added_4_0"></p>
*
- * @return the type
+ * @return the id
*/
@XmlElement(name = "component-type", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE, required = true)
- public FacesId getType() {
- return type;
+ public FacesId getId() {
+ return id;
}
/**
* <p class="changed_added_4_0"></p>
*
- * @param type the type to set
+ * @param id the id to set
*/
- public void setType(FacesId type) {
- this.type = type;
+ public void setId(FacesId type) {
+ this.id = type;
}
@Override
@@ -148,14 +148,14 @@
private String rendererType;
private List<EventModel> events = Lists.newArrayList();
private List<TagModel> tags = Lists.newArrayList();
- private String family;
+ private FacesId family;
/**
* <p class="changed_added_4_0"></p>
*
* @param family the family to set
*/
- public void setFamily(String family) {
+ public void setFamily(FacesId family) {
this.family = family;
}
@@ -165,7 +165,7 @@
* @return the family
*/
@XmlElement(name = "component-family", namespace = ComponentLibrary.CDK_EXTENSIONS_NAMESPACE)
- public String getFamily() {
+ public FacesId getFamily() {
return family;
}
@@ -174,7 +174,7 @@
*
* @param rendererType the rendererTypes to set
*/
- @XmlElement(name = "renderer-type", namespace = ComponentLibrary.CDK_EXTENSIONS_NAMESPACE)
+ @XmlElement(name = "renderer-id", namespace = ComponentLibrary.CDK_EXTENSIONS_NAMESPACE)
public void setRendererType(String rendererType) {
this.rendererType = rendererType;
}
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/FacesIdAdapter.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/FacesIdAdapter.java 2010-06-22 15:36:05 UTC (rev 17658)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/FacesIdAdapter.java 2010-06-22 19:08:34 UTC (rev 17659)
@@ -41,6 +41,6 @@
@Override
public FacesId unmarshal(String v) throws Exception {
- return new FacesId(v);
+ return new FacesId(v.trim());
}
}
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/RendererAdapter.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/RendererAdapter.java 2010-06-22 15:36:05 UTC (rev 17658)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/RendererAdapter.java 2010-06-22 19:08:34 UTC (rev 17659)
@@ -23,10 +23,7 @@
package org.richfaces.cdk.xmlconfig.model;
-import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.RendererModel;
-import org.richfaces.cdk.model.RendererModel.Type;
-import org.richfaces.cdk.util.Strings;
/**
* <p class="changed_added_4_0">
@@ -46,25 +43,4 @@
return RendererModel.class;
}
- @Override
- protected void postMarshal(RendererModel model, RendererBean bean) {
- ClassName baseClass = model.getBaseClass();
- ClassName rendererClass = model.getRendererClass();
- if (!model.isGenerate() && !isEmpty(baseClass) && isEmpty(rendererClass)) {
- bean.setRendererClass(baseClass);
- }
- }
-
- private static boolean isEmpty(ClassName className) {
- return className == null || Strings.isEmpty(className.getName());
- }
-
- @Override
- protected void postUnmarshal(RendererBean bean, RendererModel model) {
- // Copy type.
- String type = bean.getType();
- if (null != type) {
- model.setType(new Type(type.trim()));
- }
- }
}
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/RendererBean.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/RendererBean.java 2010-06-22 15:36:05 UTC (rev 17658)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/RendererBean.java 2010-06-22 19:08:34 UTC (rev 17659)
@@ -33,6 +33,7 @@
import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.ConfigExtension;
+import org.richfaces.cdk.model.FacesId;
import org.richfaces.cdk.model.TagModel;
/**
@@ -42,33 +43,33 @@
* @author asmirnov(a)exadel.com
*/
@XmlType(name = "faces-config-rendererType", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE,
- propOrder = {"family", "type", "rendererClass", /*"facet",*/"facesAttributes", "extension"})
+ propOrder = {"family", "id", "rendererClass", /*"facet",*/"facesAttributes", "extension"})
public class RendererBean extends
ElementBeanBase<RendererBean.RendererExtension> {
- private String family;
+ private FacesId family;
private ClassName rendererClass;
- private String type;
+ private String id;
/**
* <p class="changed_added_4_0">
* </p>
*
- * @return the type
+ * @return the id
*/
@XmlElement(name = "renderer-type", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE)
- public String getType() {
- return type;
+ public String getId() {
+ return id;
}
/**
* <p class="changed_added_4_0">
* </p>
*
- * @param type the type to set
+ * @param id the id to set
*/
- public void setType(String type) {
- this.type = type;
+ public void setId(String type) {
+ this.id = type;
}
/**
@@ -78,7 +79,7 @@
* @return the family
*/
@XmlElement(name = "component-family", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE)
- public String getFamily() {
+ public FacesId getFamily() {
return family;
}
@@ -88,7 +89,7 @@
*
* @param family the family to set
*/
- public void setFamily(String family) {
+ public void setFamily(FacesId family) {
this.family = family;
}
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/resources/META-INF/templates/component.ftl
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/resources/META-INF/templates/component.ftl 2010-06-22 15:36:05 UTC (rev 17658)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/resources/META-INF/templates/component.ftl 2010-06-22 19:08:34 UTC (rev 17659)
@@ -29,7 +29,7 @@
public class ${targetClass.simpleName} extends ${baseClass.simpleName}
<#if (implemented?size > 0)>implements <@concat seq=implemented ; interface>${interface.simpleName}</@concat></#if> {
- public static final String COMPONENT_TYPE="${type}";
+ public static final String COMPONENT_TYPE="${id}";
<#if family?exists>
public static final String COMPONENT_FAMILY="${family}";
Modified: root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/apt/processors/ComponentProcessorTest.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/apt/processors/ComponentProcessorTest.java 2010-06-22 15:36:05 UTC (rev 17658)
+++ root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/apt/processors/ComponentProcessorTest.java 2010-06-22 19:08:34 UTC (rev 17659)
@@ -47,6 +47,7 @@
import org.richfaces.cdk.apt.SourceUtils.BeanProperty;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.ComponentModel;
+import org.richfaces.cdk.model.FacesId;
import org.richfaces.cdk.model.FacetModel;
import org.richfaces.cdk.xmlconfig.JAXB;
@@ -230,7 +231,7 @@
processor.setComponeneFamily(componentElement, model, FOO_HTML_BAR);
verify(utils, componentElement, jaxb, annotation);
- assertEquals(FOO_HTML_BAR, model.getFamily());
+ assertEquals(FacesId.parseId(FOO_HTML_BAR), model.getFamily());
}
@Test
@@ -242,7 +243,7 @@
processor.setComponeneFamily(componentElement, model, "");
verify(utils, componentElement, jaxb, annotation);
- assertEquals(FOO_HTML_BAR, model.getFamily());
+ assertEquals(FacesId.parseId(FOO_HTML_BAR), model.getFamily());
}
@Test
Modified: root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ComponentClassGeneratorTest.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ComponentClassGeneratorTest.java 2010-06-22 15:36:05 UTC (rev 17658)
+++ root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/generate/java/ComponentClassGeneratorTest.java 2010-06-22 19:08:34 UTC (rev 17659)
@@ -44,7 +44,6 @@
import org.richfaces.cdk.model.EventName;
import org.richfaces.cdk.model.FacesId;
import org.richfaces.cdk.model.PropertyBase;
-import org.richfaces.cdk.model.RendererModel;
import com.google.inject.Inject;
@@ -66,7 +65,7 @@
component.setGenerate(true);
component.setTargetClass(ClassName.parseName("org.richfaces.cdk.generate.java.GeneratedComponent"));
component.setBaseClass(ClassName.parseName(UIOutput.class.getName()));
- component.setRendererType(new RendererModel.Type("foo.barRenderer"));
+ component.setRendererType(FacesId.parseId("foo.barRenderer"));
PropertyBase attribute = component.getOrCreateAttribute("testValue");
attribute.setType(new ClassName(Object.class));
Modified: root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/model/validator/ModelValidatorTest.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/model/validator/ModelValidatorTest.java 2010-06-22 15:36:05 UTC (rev 17658)
+++ root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/model/validator/ModelValidatorTest.java 2010-06-22 19:08:34 UTC (rev 17659)
@@ -48,6 +48,8 @@
@RunWith(CdkTestRunner.class)
public class ModelValidatorTest extends CdkTestBase {
+ private static final FacesId FOO_BAZ = FacesId.parseId("foo.baz");
+
@Mock
protected Logger log;
@@ -84,13 +86,13 @@
FacesId type = FacesId.parseId("foo.Bar");
component.setTargetClass(className);
expect(namiingConventions.inferComponentType(className)).andReturn(type);
- expect(namiingConventions.inferUIComponentFamily(type)).andReturn("foo.baz");
+ expect(namiingConventions.inferUIComponentFamily(type)).andReturn(FOO_BAZ);
replay(log, utils, namiingConventions);
// Validator should set component type from base class.
validator.verifyComponentType(component);
verify(log, utils, namiingConventions);
- assertEquals(type, component.getType());
- assertEquals("foo.baz", component.getFamily());
+ assertEquals(type, component.getId());
+ assertEquals(FOO_BAZ, component.getFamily());
}
}
Modified: root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/RendererTemplateParserTest.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/RendererTemplateParserTest.java 2010-06-22 15:36:05 UTC (rev 17658)
+++ root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/RendererTemplateParserTest.java 2010-06-22 19:08:34 UTC (rev 17659)
@@ -127,7 +127,7 @@
assertNotNull(actionProperty);
assertNoEventNames(actionProperty);
- assertEquals(Lists.newArrayList(), actionProperty.getSignature());
+ assertEquals(0, actionProperty.getSignature().size());
}
/**
@@ -281,7 +281,7 @@
assertEquals(new ClassName("org.richfaces.renderkit.html.DummyRendererImpl"), renderer.getRendererClass());
assertTrue(renderer.isRendersChildren());
- assertEquals("org.richfaces.Dummy", renderer.getFamily());
+ assertEquals(FacesId.parseId("org.richfaces.Dummy"), renderer.getFamily());
assertSame(template, renderer.getTemplate());
Collection<PropertyBase> attributes = renderer.getAttributes();
Modified: root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/model/TemplateTest.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/model/TemplateTest.java 2010-06-22 15:36:05 UTC (rev 17658)
+++ root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/model/TemplateTest.java 2010-06-22 19:08:34 UTC (rev 17659)
@@ -28,6 +28,8 @@
import java.util.List;
import org.junit.Test;
+import org.richfaces.cdk.model.ClassName;
+import org.richfaces.cdk.model.FacesId;
import org.richfaces.cdk.xmlconfig.JaxbTestBase;
/**
@@ -41,7 +43,7 @@
public static final String TEMPLATE_PROLOG =
"<cdk:root xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:cdk=\"http://richfaces.org/cdk/core\" xmlns:c=\"http://richfaces.org/cdk/jstl/core\" xmlns:cc=\"http://richfaces.org/cdk/jsf/composite\"><cc:interface>";
- private static final Object DEFAULT_ATTRIBUTE_TYPE = Object.class.getName();
+ private static final Object DEFAULT_ATTRIBUTE_TYPE = new ClassName(Object.class);
private static final String TEMPLATE_EPILOG = "</cc:implementation></cdk:root>";
private static final String TEMPLATE_MIDDLE = "</cc:interface><cc:implementation>";
@@ -123,7 +125,7 @@
assertEquals("disabled", attribute.getName());
assertNull(attribute.getDefaultValue());
assertNull(attribute.getMethodSignature());
- assertEquals("boolean", attribute.getType());
+ assertEquals(ClassName.parseName("boolean"), attribute.getType());
assertNull(attribute.getTargets());
assertFalse(attribute.isRequired());
assertFalse(attribute.isExpert());
@@ -134,7 +136,7 @@
assertEquals("delay", attribute.getName());
assertNull(attribute.getDefaultValue());
assertNull(attribute.getMethodSignature());
- assertEquals("java.lang.Integer", attribute.getType());
+ assertEquals(ClassName.parseName("java.lang.Integer"), attribute.getType());
assertNull(attribute.getTargets());
assertFalse(attribute.isRequired());
assertFalse(attribute.isExpert());
@@ -233,10 +235,10 @@
CompositeInterface interfaceSection = template.getInterface();
assertNotNull(interfaceSection);
- assertEquals("org.richfaces.renderkit.html.TreeRenderer", interfaceSection.getJavaClass());
- assertEquals("org.richfaces.renderkit.TreeRendererBase", interfaceSection.getBaseClass());
- assertEquals("org.richfaces.TreeFamily", interfaceSection.getComponentFamily());
- assertEquals("org.richfaces.TreeRenderer", interfaceSection.getRendererType());
+ assertEquals(ClassName.parseName("org.richfaces.renderkit.html.TreeRenderer"), interfaceSection.getJavaClass());
+ assertEquals(ClassName.parseName("org.richfaces.renderkit.TreeRendererBase"), interfaceSection.getBaseClass());
+ assertEquals(FacesId.parseId("org.richfaces.TreeFamily"), interfaceSection.getComponentFamily());
+ assertEquals(FacesId.parseId("org.richfaces.TreeRenderer"), interfaceSection.getRendererType());
assertEquals("RF4_XHTML", interfaceSection.getRenderKitId());
assertEquals(Boolean.FALSE, interfaceSection.getRendersChildren());
Modified: root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/ComponentAdapterTest.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/ComponentAdapterTest.java 2010-06-22 15:36:05 UTC (rev 17658)
+++ root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/ComponentAdapterTest.java 2010-06-22 19:08:34 UTC (rev 17659)
@@ -19,7 +19,7 @@
private static final String BAZ = "baz";
private static final String FOO_BAR = "foo.Bar";
private static final String FOO_DESCTIPTION = "foo.Desctiption";
- private static final String FOO_FAMILY = "foo.Family";
+ private static final FacesId FOO_FAMILY = FacesId.parseId("foo.Family");
private static final String FOO_UI_BAR = "foo.UIBar";
@Test
@@ -32,7 +32,7 @@
component.setFamily(FOO_FAMILY);
ComponentAdapter componentAdapter = new ComponentAdapter();
ComponentBean componentBean = componentAdapter.marshal(component);
- assertEquals(FOO_BAR, componentBean.getType().toString());
+ assertEquals(FOO_BAR, componentBean.getId().toString());
Collection<PropertyBase> attributes = componentBean.getAttributes();
Modified: root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/FacesConfigTest.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/FacesConfigTest.java 2010-06-22 15:36:05 UTC (rev 17658)
+++ root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/FacesConfigTest.java 2010-06-22 19:08:34 UTC (rev 17659)
@@ -38,6 +38,7 @@
import org.richfaces.cdk.Mock;
import org.richfaces.cdk.Source;
import org.richfaces.cdk.Sources;
+import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.ComponentModel;
import org.richfaces.cdk.model.FacesId;
@@ -96,9 +97,9 @@
ComponentModel component = library.getComponents().get(0);
- assertEquals("javax.faces.Panel", component.getType().toString());
- assertEquals("javax.faces.Panel", component.getFamily());
- assertEquals("javax.faces.component.UIPanel", component.getTargetClass().getName());
+ assertEquals(FacesId.parseId("javax.faces.Panel"), component.getId());
+ assertEquals(FacesId.parseId("javax.faces.Panel"), component.getFamily());
+ assertEquals(ClassName.parseName("javax.faces.component.UIPanel"), component.getTargetClass());
assertEquals("panel.gif", component.getIcon().getSmallIcon());
assertEquals("panel-large.gif", component.getIcon().getLargeIcon());
assertEquals("Panel component", component.getDescription());
Modified: root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/JaxbMarshalTest.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/JaxbMarshalTest.java 2010-06-22 15:36:05 UTC (rev 17658)
+++ root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/JaxbMarshalTest.java 2010-06-22 19:08:34 UTC (rev 17659)
@@ -31,7 +31,7 @@
ComponentModel component = new ComponentModel(FacesId.parseId("foo.bar"));
library.getComponents().add(component);
RenderKitModel renderKit = library.addRenderKit("HTML");
- RendererModel renderer = new RendererModel(new RendererModel.Type("foo.Renderer"));
+ RendererModel renderer = new RendererModel(FacesId.parseId("foo.Renderer"));
renderKit.getRenderers().add(renderer);
StringWriter writer = new StringWriter();
14 years, 6 months
JBoss Rich Faces SVN: r17658 - root/ui-sandbox/inputs/trunk/autocomplete/src/main/resources/META-INF/resources/script.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2010-06-22 11:36:05 -0400 (Tue, 22 Jun 2010)
New Revision: 17658
Added:
root/ui-sandbox/inputs/trunk/autocomplete/src/main/resources/META-INF/resources/script/ComboBox.js
root/ui-sandbox/inputs/trunk/autocomplete/src/main/resources/META-INF/resources/script/SelectBase.js
Removed:
root/ui-sandbox/inputs/trunk/autocomplete/src/main/resources/META-INF/resources/script/autocomplete.js
Modified:
root/ui-sandbox/inputs/trunk/autocomplete/src/main/resources/META-INF/resources/script/1.html
Log:
https://jira.jboss.org/browse/RF-8875
Modified: root/ui-sandbox/inputs/trunk/autocomplete/src/main/resources/META-INF/resources/script/1.html
===================================================================
--- root/ui-sandbox/inputs/trunk/autocomplete/src/main/resources/META-INF/resources/script/1.html 2010-06-21 23:53:25 UTC (rev 17657)
+++ root/ui-sandbox/inputs/trunk/autocomplete/src/main/resources/META-INF/resources/script/1.html 2010-06-22 15:36:05 UTC (rev 17658)
@@ -10,7 +10,8 @@
<script type="text/javascript" src="..\..\..\..\..\..\..\..\..\..\core\trunk\impl\src\main\resources\META-INF\resources\richfaces-event.js "></script>
<script type="text/javascript" src="..\..\..\..\..\..\..\..\..\..\core\trunk\impl\src\main\resources\META-INF\resources\richfaces-base-component.js "></script>
<script type="text/javascript" src="richfaces-selection.js"></script>
- <script type="text/javascript" src="autocomplete.js"></script>
+ <script type="text/javascript" src="SelectBase.js"></script>
+ <script type="text/javascript" src="ComboBox.js"></script>
<style>
* {font-size : 11px; font-family : verdana; color : #000000}
@@ -70,9 +71,9 @@
</div>
</div>
<script type="text/javascript">
- new RichFaces.ui.AutoComplete("myComboList", "myComboInput", {buttonId:'myComboButton'});
+ new RichFaces.ui.ComboBox("myCombo", "myComboInput", {buttonId:'myComboButton'});
</script>
-</div>
+</div><br/><select style="width:200px"><option>ccccc</option></select>
text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block
text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block
</div>
Added: root/ui-sandbox/inputs/trunk/autocomplete/src/main/resources/META-INF/resources/script/ComboBox.js
===================================================================
--- root/ui-sandbox/inputs/trunk/autocomplete/src/main/resources/META-INF/resources/script/ComboBox.js (rev 0)
+++ root/ui-sandbox/inputs/trunk/autocomplete/src/main/resources/META-INF/resources/script/ComboBox.js 2010-06-22 15:36:05 UTC (rev 17658)
@@ -0,0 +1,58 @@
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+ // Constructor definition
+ rf.ui.ComboBox = function(componentId, fieldId, options) {
+ this.namespace = "."+rf.Event.createNamespace(this.name, this.componentId);
+ // call constructor of parent class
+ $super.constructor.call(this, componentId+"List", fieldId, options);
+ $p.attachToDom(componentId);
+ this.componentId = componentId;
+ this.options = $.extend({}, defaultOptions, options);
+ //this.currentValue = rf.getDomElement(this.fieldId).value;
+ this.index = -1;
+ };
+
+ var $p ={};
+
+ // Extend component class and add protected methods from parent class to our container
+ $p = rf.ui.SelectBase.extend(rf.ui.SelectBase, rf.ui.ComboBox, $p);
+
+ // define super class link
+ var $super = rf.ui.ComboBox.$super;
+
+ var defaultOptions = {
+ };
+
+ // Add new properties and methods
+ $.extend(rf.ui.SelectBase.prototype, (function () {
+ return {
+ name:"CompoBox",
+ destroy: function () {
+ $super.destroy.call(this);
+ },
+ getNamespace: function () {
+ return this.namespace;
+ },
+
+ selectPrevItem: function () {
+
+ },
+ selectNextItem: function () {
+
+ },
+ selectPageUp: function () {
+
+ },
+ selectPageDown: function () {
+
+ },
+ prepareToShow: function (event) {
+
+ },
+
+ onChange: function () {
+ }
+ };
+ })());
+})(jQuery, RichFaces);
\ No newline at end of file
Copied: root/ui-sandbox/inputs/trunk/autocomplete/src/main/resources/META-INF/resources/script/SelectBase.js (from rev 17636, root/ui-sandbox/inputs/trunk/autocomplete/src/main/resources/META-INF/resources/script/autocomplete.js)
===================================================================
--- root/ui-sandbox/inputs/trunk/autocomplete/src/main/resources/META-INF/resources/script/SelectBase.js (rev 0)
+++ root/ui-sandbox/inputs/trunk/autocomplete/src/main/resources/META-INF/resources/script/SelectBase.js 2010-06-22 15:36:05 UTC (rev 17658)
@@ -0,0 +1,245 @@
+// TODO: move this extend to RichFaces.Event for exapmle
+$.extend(RichFaces.Event, {
+ bindScrollEventHandlers: function(element, handler, component) {
+ var elements = [];
+ element = RichFaces.getDomElement(element).parentNode;
+ while (element && element!=window.document.body)
+ {
+ if (element.offsetWidth!=element.scrollWidth || element.offsetHeight!=element.scrollHeight)
+ {
+ elements.push(element);
+ RichFaces.Event.bind(element, "scroll"+component.getNamespace(), handler, component);
+ }
+ element = element.parentNode;
+ }
+ return elements;
+ },
+ unbindScrollEventHandlers: function(elements, component) {
+ RichFaces.Event.unbind(elements, component.getNamespace());
+ elements = null;
+ }
+});
+
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ // Constructor definition
+ rf.ui.SelectBase = function(selectId, fieldId, options) {
+ // call constructor of parent class
+ $super.constructor.call(this, selectId);
+ this.selectId = selectId;
+ this.fieldId = fieldId;
+ this.options = $.extend({}, defaultOptions, options);
+ this.namespace = this.namespace || "."+rf.Event.createNamespace(this.name, this.selectId);
+ this.currentValue = rf.getDomElement(this.fieldId).value;
+ bindEventHandlers.call(this);
+ };
+
+ var $p ={};
+
+ // Extend component class and add protected methods from parent class to our container
+ $p = rf.BaseComponent.extend(rf.BaseComponent, rf.ui.SelectBase, $p);
+
+ // define super class link
+ var $super = rf.ui.SelectBase.$super;
+
+ var defaultOptions = {
+ };
+
+ var KEYS = {
+ BACKSPACE: 8,
+ TAB: 9,
+ RETURN: 13,
+ ESC: 27,
+ PAGEUP: 33,
+ PAGEDOWN: 34,
+ LEFT: 37,
+ UP: 38,
+ RIGHT: 39,
+ DOWN: 40,
+ DEL: 46,
+ };
+
+ var bindEventHandlers = function() {
+ if (this.options.buttonId) {
+ rf.Event.bindById(this.options.buttonId, "mousedown"+this.namespace, onButtonShow, this);
+ rf.Event.bindById(this.options.buttonId, "mouseup"+this.namespace, onSelectMouseUp, this);
+ }
+
+ var inputEventHandlers = {};
+ inputEventHandlers["focus"+this.namespace] = onFocus;
+ inputEventHandlers["blur"+this.namespace] = onBlur;
+ inputEventHandlers["click"+this.namespace] = onClick;
+ inputEventHandlers[($.browser.opera ? "keypress" : "keydown")+this.namespace] = onKeyDown;
+ rf.Event.bindById(this.fieldId, inputEventHandlers, this);
+
+ inputEventHandlers = {};
+ inputEventHandlers["click"+this.namespace] = onSelectClick;
+ inputEventHandlers["mousedown"+this.namespace] = onSelectMouseDown;
+ inputEventHandlers["mouseup"+this.namespace] = onSelectMouseUp;
+ rf.Event.bindById(this.selectId, inputEventHandlers, this);
+ }
+
+ var onSelectClick = function () {
+ };
+ var onSelectMouseDown = function () {
+ this.isMouseDown = true;
+ console && console.log && console.log("onMouseDown");
+ };
+ var onSelectMouseUp = function () {
+ //this.isMouseDown = false;
+ rf.getDomElement(this.fieldId).focus();
+ console && console.log && console.log("onMouseUp");
+ };
+
+ var onButtonShow = function (event) {
+ this.isMouseDown = true;
+ console && console.log && console.log("onButtonShow - "+this.timeoutId);
+ if (this.timeoutId) {
+ window.clearTimeout(this.timeoutId);
+ this.timeoutId = null;
+ rf.getDomElement(this.fieldId).focus();
+ }
+
+ if (this.isVisible) {
+ this.hide(event);
+ } else {
+ this.show(event);
+ //rf.getDomElement(this.fieldId).focus();
+ }
+ };
+
+ var onFocus = function (event) {
+ console && console.log && console.log("onFocus");
+ };
+
+ var onBlur = function (event) {
+ console && console.log && console.log("onBlur");
+ if (this.isMouseDown) {
+ rf.getDomElement(this.fieldId).focus();
+ this.isMouseDown = false;
+ console && console.log && console.log("---------> and focus");
+ } else if (this.isVisible && !this.isMouseDown/*&& checkOnBlur.call(this, event)*/) {
+ var _this = this;
+ this.timeoutId = window.setTimeout(function(){_this.hide();}, 200);
+ }
+ };
+
+ var onClick = function (event) {
+ };
+
+ var onChange = function (event) {
+ var value = rf.getDomElement(this.fieldId).value;
+ var flag = value != this.currentValue;
+ if (event.which == KEYS.LEFT || event.which == KEYS.RIGHT || flag) {
+ // TODO: call onchange
+ if (flag && !this.isVisible) {
+ this.show();
+ }
+ if (flag) {
+ this.currentValue = value;
+ }
+ }
+ }
+
+
+ /*var checkOnBlur = function (event) {
+ var e = $(rf.getDomElement(this.options.buttonId));
+ return (e == event.target) || $(event.target).closest(e);
+ };*/
+
+ var onKeyDown = function (event) {
+ switch(event.which) {
+ case KEYS.UP:
+ event.preventDefault();
+ if (this.isVisible) {
+ this.selectPrevItem();
+ }
+ break;
+ case KEYS.DOWN:
+ event.preventDefault();
+ if (this.isVisible) {
+ this.selectNextItem();
+ } else {
+ this.show();
+ }
+ break;
+ case KEYS.PAGEUP:
+ event.preventDefault();
+ if (this.isVisible) {
+ this.selectPageUp();
+ }
+ break;
+ case KEYS.PAGEDOWN:
+ event.preventDefault();
+ if (this.isVisible) {
+ this.selectPageDown();
+ }
+ break;
+ case KEYS.TAB:
+ case KEYS.RETURN:
+ event.preventDefault();
+ /*if( selectCurrent() ) {
+ event.preventDefault();
+ //TODO: bind form submit event handler to cancel form submit under the opera
+ cancelSubmit = true;
+ return false;
+ }*/
+ this.hide();
+ break;
+ case KEYS.ESC:
+ this.hide();
+ break;
+ default:
+ if (!this.options.selectOnly) {
+ if (this.options.changeDelay) {
+ var _this = this;
+ this.changeTimerId = window.setTimeout(function(){onChange.call(_this, event);}, this.options.changeDelay)
+ } else {
+ onChange.call(this, event);
+ }
+ }
+ break;
+ }
+ }
+
+ // Add new properties and methods
+ $.extend(rf.ui.SelectBase.prototype, (function () {
+ return {
+ name:"SelectBase",
+ show: function (event) {
+ if (this.prepareToShow(event)!=false) {
+ $(rf.getDomElement(this.selectId)).show();
+ this.isVisible = true;
+ this.scrollElements = rf.Event.bindScrollEventHandlers(this.selectId, this.hide, this, this.namespace);
+ }
+ },
+ hide: function (event) {
+ rf.Event.unbindScrollEventHandlers(this.scrollElements, this);
+ $(rf.getDomElement(this.selectId)).hide();
+ this.isVisible = false;
+ },
+ destroy: function () {
+ //TODO: add all unbind
+ rf.Event.unbindById(this.options.buttonId, this.namespace);
+ rf.Event.unbindById(this.fieldId, this.namespace);
+ $super.destroy.call(this);
+ },
+ getNamespace: function () {
+ return this.namespace;
+ },
+
+ selectPrevItem: function () {
+ },
+ selectNextItem: function () {
+ },
+ selectPageUp: function () {
+ },
+ selectPageDown: function () {
+ },
+ prepareToShow: function () {
+ }
+ };
+ })());
+})(jQuery, RichFaces);
\ No newline at end of file
Deleted: root/ui-sandbox/inputs/trunk/autocomplete/src/main/resources/META-INF/resources/script/autocomplete.js
===================================================================
--- root/ui-sandbox/inputs/trunk/autocomplete/src/main/resources/META-INF/resources/script/autocomplete.js 2010-06-21 23:53:25 UTC (rev 17657)
+++ root/ui-sandbox/inputs/trunk/autocomplete/src/main/resources/META-INF/resources/script/autocomplete.js 2010-06-22 15:36:05 UTC (rev 17658)
@@ -1,226 +0,0 @@
-// TODO: move this extend to RichFaces.Event for exapmle
-$.extend(RichFaces.Event, {
- bindScrollEventHandlers: function(element, handler, component) {
- var elements = [];
- element = RichFaces.getDomElement(element).parentNode;
- while (element && element!=window.document.body)
- {
- if (element.offsetWidth!=element.scrollWidth || element.offsetHeight!=element.scrollHeight)
- {
- elements.push(element);
- RichFaces.Event.bind(element, "scroll"+component.getNamespace(), handler, component);
- }
- element = element.parentNode;
- }
- return elements;
- },
- unbindScrollEventHandlers: function(elements, component) {
- RichFaces.Event.unbind(elements, component.getNamespace());
- elements = null;
- }
-});
-
-(function ($, rf) {
-
- rf.ui = rf.ui || {};
- // Constructor definition
- rf.ui.AutoComplete = function(componentId, fieldId, options) {
- // call constructor of parent class
- $super.constructor.call(this, componentId);
- $p.attachToDom(componentId);
- this.componentId = componentId;
- this.fieldId = fieldId;
- this.options = $.extend({}, defaultOptions, options);
- this.namespace = "."+rf.Event.createNamespace(this.name, this.componentId);
- bindEventHandlers.call(this);
- };
-
- var $p ={};
-
- // Extend component class and add protected methods from parent class to our container
- $p = rf.BaseComponent.extend(rf.BaseComponent, rf.ui.AutoComplete, $p);
-
- // define super class link
- var $super = rf.ui.AutoComplete.$super;
-
- var defaultOptions = {
- };
-
- var KEYS = {
- BACKSPACE: 8,
- TAB: 9,
- RETURN: 13,
- ESC: 27,
- PAGEUP: 33,
- PAGEDOWN: 34,
- UP: 38,
- DOWN: 40,
- DEL: 46
- };
-
- var bindEventHandlers = function() {
- if (this.options.buttonId) {
- rf.Event.bindById(this.options.buttonId, "mousedown"+this.namespace, onButtonShow, this);
- rf.Event.bindById(this.options.buttonId, "mouseup"+this.namespace, onSelectMouseUp, this);
- }
-
- var inputEventHandlers = {};
- inputEventHandlers["focus"+this.namespace] = onFocus;
- inputEventHandlers["blur"+this.namespace] = onBlur;
- inputEventHandlers["click"+this.namespace] = onClick;
- inputEventHandlers[($.browser.opera ? "keypress" : "keydown")+this.namespace] = onKeyDown;
- rf.Event.bindById(this.fieldId, inputEventHandlers, this);
-
- inputEventHandlers = {};
- inputEventHandlers["click"+this.namespace] = onSelectClick;
- inputEventHandlers["mousedown"+this.namespace] = onSelectMouseDown;
- inputEventHandlers["mouseup"+this.namespace] = onSelectMouseUp;
- rf.Event.bindById(this.componentId, inputEventHandlers, this);
- }
-
- var onSelectClick = function () {
- };
- var onSelectMouseDown = function () {
- this.isMouseDown = true;
- console && console.log && console.log("onMouseDown");
- };
- var onSelectMouseUp = function () {
- //this.isMouseDown = false;
- rf.getDomElement(this.fieldId).focus();
- console && console.log && console.log("onMouseUp");
- };
-
- var onButtonShow = function (event) {
- this.isMouseDown = true;
- console && console.log && console.log("onButtonShow - "+this.timeoutId);
- if (this.timeoutId) {
- window.clearTimeout(this.timeoutId);
- this.timeoutId = null;
- rf.getDomElement(this.fieldId).focus();
- }
-
- if (this.isVisible) {
- this.hide(event);
- } else {
- this.show(event);
- //rf.getDomElement(this.fieldId).focus();
- }
- };
-
- var onFocus = function (event) {
- console && console.log && console.log("onFocus");
- };
-
- var onBlur = function (event) {
- console && console.log && console.log("onBlur");
- if (this.isMouseDown) {
- rf.getDomElement(this.fieldId).focus();
- this.isMouseDown = false;
- console && console.log && console.log("---------> and focus");
- } else if (this.isVisible && !this.isMouseDown/*&& checkOnBlur.call(this, event)*/) {
- var _this = this;
- this.timeoutId = window.setTimeout(function(){_this.hide();}, 200);
- }
- };
-
- var onClick = function (event) {
- };
-
- var onChange = function () {
- if (!this.isVisible) {
- this.show();
- }
- }
-
- /*var checkOnBlur = function (event) {
- var e = $(rf.getDomElement(this.options.buttonId));
- return (e == event.target) || $(event.target).closest(e);
- };*/
-
- var selectPrevItem = function () {
- };
- var selectNextItem = function () {
- };
- var selectPageUp = function () {
- };
- var selectPageDown = function () {
- };
-
- var onKeyDown = function (event) {
- switch(event.which) {
- case KEYS.UP:
- event.preventDefault();
- if (this.isVisible) {
- selectPrevItem();
- }
- break;
- case KEYS.DOWN:
- event.preventDefault();
- if (this.isVisible) {
- selectNextItem();
- }
- break;
- case KEYS.PAGEUP:
- event.preventDefault();
- if (this.isVisible) {
- selectPageUp();
- }
- break;
- case KEYS.PAGEDOWN:
- event.preventDefault();
- if (this.isVisible) {
- selectPageDown();
- }
- break;
- case KEYS.TAB:
- case KEYS.RETURN:
- event.preventDefault();
- /*if( selectCurrent() ) {
- event.preventDefault();
- //TODO: bind form submit event handler to cancel form submit under the opera
- cancelSubmit = true;
- return false;
- }*/
- this.hide();
- break;
- case KEYS.ESC:
- this.hide();
- break;
- default:
- if (!this.options.selectOnly) {
- if (this.options.changeDelay) {
- var _this = this;
- this.changeTimerId = window.setTimeout(function(){onChange.call(_this);}, this.options.changeDelay)
- } else {
- onChange.call(this);
- }
- }
- break;
- }
- }
-
- // Add new properties and methods
- $.extend(rf.ui.AutoComplete.prototype, (function () {
- return {
- name:"AutoComplete",
- show: function (event) {
- $(rf.getDomElement(this.componentId)).show();
- this.isVisible = true;
- this.scrollElements = rf.Event.bindScrollEventHandlers(this.componentId, this.hide, this);
- },
- hide: function (event) {
- rf.Event.unbindScrollEventHandlers(this.scrollElements, this);
- $(rf.getDomElement(this.componentId)).hide();
- this.isVisible = false;
- },
- destroy: function () {
- rf.Event.unbindById(this.options.buttonId, this.namespace);
- rf.Event.unbindById(this.fieldId, this.namespace);
- $super.destroy.call(this);
- },
- getNamespace: function () {
- return this.namespace;
- }
- };
- })());
-})(jQuery, RichFaces);
\ No newline at end of file
14 years, 6 months
JBoss Rich Faces SVN: r17657 - in root/cdk/branches/RF8755/plugins: generator/src/main/java/org/richfaces/cdk/templatecompiler/model and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-06-21 19:53:25 -0400 (Mon, 21 Jun 2010)
New Revision: 17657
Modified:
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassVisitor.java
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CompositeInterface.java
root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/model/TemplateTest.java
root/cdk/branches/RF8755/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/templates/testComponent.xml
Log:
put loop variable into context
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassVisitor.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassVisitor.java 2010-06-21 22:38:29 UTC (rev 17656)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassVisitor.java 2010-06-21 23:53:25 UTC (rev 17657)
@@ -769,6 +769,7 @@
pushStatement(new ForEachStatement(itemsExpression, cdkForEachElement.getVar(), collectionElementClass
.getName()));
+ localsTypesMap.put(cdkForEachElement.getVar(), lastCompiledExpressionType.getContainerType());
}
/*
@@ -780,6 +781,7 @@
@Override
public void endElement(CdkForEachElement cdkForEachElement) {
+ localsTypesMap.remove(cdkForEachElement.getVar());
popStatement();
}
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CompositeInterface.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CompositeInterface.java 2010-06-21 22:38:29 UTC (rev 17656)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CompositeInterface.java 2010-06-21 23:53:25 UTC (rev 17657)
@@ -29,7 +29,6 @@
import javax.faces.render.RenderKitFactory;
import javax.faces.render.Renderer;
import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
/**
@@ -103,7 +102,7 @@
*
* @return the resourceDependencies
*/
- @XmlElementWrapper(name = "resource-dependencies", namespace = Template.CDK_NAMESPACE)
+// @XmlElementWrapper(name = "resource-dependencies", namespace = Template.CDK_NAMESPACE)
@XmlElement(name = "resource-dependency", namespace = Template.CDK_NAMESPACE)
public List<ResourceDependency> getResourceDependencies() {
return resourceDependencies;
Modified: root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/model/TemplateTest.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/model/TemplateTest.java 2010-06-21 22:38:29 UTC (rev 17656)
+++ root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/model/TemplateTest.java 2010-06-21 23:53:25 UTC (rev 17657)
@@ -353,13 +353,11 @@
@Test
public void testResourceDependencies() throws Exception {
Template template =
- unmarshal(Template.class, TEMPLATE_PROLOG + "<cdk:resource-dependencies>"
- + "<cdk:resource-dependency name=\"jquery.js\" />"
+ unmarshal(Template.class, TEMPLATE_PROLOG + "<cdk:resource-dependency name=\"jquery.js\" />"
+ "<cdk:resource-dependency name=\"richfaces.css\" library=\"org.richfaces\" />"
+ "<cdk:resource-dependency name=\"richfaces.js\" library=\"org.richfaces\" target=\"body\" /> "
- + "</cdk:resource-dependencies> " +
- TEMPLATE_MIDDLE + TEMPLATE_EPILOG);
+ + TEMPLATE_MIDDLE + TEMPLATE_EPILOG);
CompositeInterface interfaceSection = template.getInterface();
assertNotNull(interfaceSection);
Modified: root/cdk/branches/RF8755/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/templates/testComponent.xml
===================================================================
--- root/cdk/branches/RF8755/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/templates/testComponent.xml 2010-06-21 22:38:29 UTC (rev 17656)
+++ root/cdk/branches/RF8755/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/templates/testComponent.xml 2010-06-21 23:53:25 UTC (rev 17657)
@@ -2,10 +2,13 @@
<cdk:root xmlns="http://www.w3.org/1999/xhtml" xmlns:cdk="http://richfaces.org/cdk/core"
xmlns:c="http://richfaces.org/cdk/jstl/core" xmlns:cc="http://richfaces.org/cdk/jsf/composite">
<cc:interface>
- <cdk:class>org.richfaces.cdk.test.renderkit.rf4_xhtml.TestRenderer</cdk:class>
+ <cdk:class>org.richfaces.cdk.test.renderkit.rf4_xhtml.TestRenderer
+ </cdk:class>
<cdk:superclass>javax.faces.render.Renderer</cdk:superclass>
- <cdk:component-family>org.richfaces.cdk.test.Test</cdk:component-family>
- <cdk:component-type>org.richfaces.cdk.test.TestComponent</cdk:component-type>
+ <cdk:component-family>org.richfaces.cdk.test.Test
+ </cdk:component-family>
+ <cdk:component-type>org.richfaces.cdk.test.TestComponent
+ </cdk:component-type>
<cdk:renderer-type>org.richfaces.TestRenderer</cdk:renderer-type>
<cdk:renderkit-id>RF4_XHTML</cdk:renderkit-id>
<cdk:renders-children>false</cdk:renders-children>
@@ -21,28 +24,28 @@
displayName="Expert attribute" expert="true" />
<cc:attribute name="preferred" shortDescription="It's a preferred attribute"
displayName="Preferred attribute" preferred="true" />
- <cdk:resource-dependencies>
- <cdk:resource-dependency name="jquery.js" />
- <cdk:resource-dependency name="richfaces.css"
- library="org.richfaces" />
- <cdk:resource-dependency name="richfaces.js"
- library="org.richfaces" target="body" />
- </cdk:resource-dependencies>
+ <cdk:resource-dependency name="jquery.js" />
+ <cdk:resource-dependency name="richfaces.css"
+ library="org.richfaces" />
+ <cdk:resource-dependency name="richfaces.js"
+ library="org.richfaces" target="body" />
</cc:interface>
<cc:implementation>
- start
- <c:if test="#{component.attributes['ifTest'] != null}">if content</c:if>
- <c:choose>
- <c:when test="#{component.attributes['anotherTest'] != null}">when content</c:when>
- <c:when test="#{component.attributes['coolTest'] != null}">
- <c:if test="#{component.attributes['nestedIfTest'] != null}">nested if content</c:if>
- </c:when>
- <c:otherwise>otherwise content</c:otherwise>
- </c:choose>
- <c:forEach items="#{component.children}" var="iterationVar">
- forEach content
+ <div id="#{clientId}" style="#{component.style}" class="#{component.styleClass}">
+ <c:if test="#{component.attributes['ifTest'] != null}">if content</c:if>
+ <c:choose>
+ <c:when test="#{component.attributes['anotherTest'] != null}">when content</c:when>
+ <c:when test="#{component.attributes['coolTest'] != null}">
+ <c:if test="#{component.attributes['nestedIfTest'] != null}">nested if content</c:if>
+ </c:when>
+ <c:otherwise>otherwise content</c:otherwise>
+ </c:choose>
+ <ul>
+ <c:forEach items="#{component.children}" var="iterationVar">
+ <li>forEach content #{iterationVar.encodeAll(facesContext)}</li>
</c:forEach>
- finish
+ </ul>
+ </div>
</cc:implementation>
</cdk:root>
\ No newline at end of file
14 years, 6 months
JBoss Rich Faces SVN: r17656 - root/cdk/branches/RF8755/plugins/annotations/src/main/java/org/richfaces/cdk/annotations.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-06-21 18:38:29 -0400 (Mon, 21 Jun 2010)
New Revision: 17656
Added:
root/cdk/branches/RF8755/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/RendererSpecificComponent.java
Removed:
root/cdk/branches/RF8755/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/SubComponent.java
Modified:
root/cdk/branches/RF8755/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfComponent.java
Log:
Rename SubComponent to RendererSpecificComponent
Modified: root/cdk/branches/RF8755/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfComponent.java
===================================================================
--- root/cdk/branches/RF8755/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfComponent.java 2010-06-21 22:32:30 UTC (rev 17655)
+++ root/cdk/branches/RF8755/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/JsfComponent.java 2010-06-21 22:38:29 UTC (rev 17656)
@@ -172,6 +172,6 @@
* <p class="changed_added_4_0"></p>
* @return
*/
- public SubComponent[] components() default {};
+ public RendererSpecificComponent[] components() default {};
}
Copied: root/cdk/branches/RF8755/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/RendererSpecificComponent.java (from rev 17654, root/cdk/branches/RF8755/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/SubComponent.java)
===================================================================
--- root/cdk/branches/RF8755/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/RendererSpecificComponent.java (rev 0)
+++ root/cdk/branches/RF8755/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/RendererSpecificComponent.java 2010-06-21 22:38:29 UTC (rev 17656)
@@ -0,0 +1,133 @@
+/*
+ * $Id$
+ *
+ * License Agreement.
+ *
+ * Rich Faces - 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.richfaces.cdk.annotations;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * <p class="changed_added_4_0">
+ * That annotation defines class that is generated from the concrete class defined in the {@link JsfComponent}
+ * </p>
+ *
+ * @author asmirnov(a)exadel.com
+ */
+(a)Retention(RetentionPolicy.SOURCE)
+public @interface RendererSpecificComponent {
+
+
+
+ /**
+ * <p class="changed_added_4_0">
+ * Type of the component. This is mandatory parameter because CDK uses <em>component-type</em> as primary key for
+ * components library model.
+ * </p>
+ * <p class="todo">
+ * TODO if this value is an empty, component type will be inferred from class name.
+ * </p>
+ *
+ * @return component type.
+ */
+ public String type() default "";
+
+
+ /**
+ * <p class="changed_added_4_0">
+ * Name of the generated component implementation class.
+ * </p>
+ *
+ * @return
+ */
+ public String generate() default "";
+
+ /**
+ * <p class="changed_added_4_0">
+ * Description used by IDE.
+ * </p>
+ *
+ * @return
+ */
+ public Description description() default @Description();
+
+ /**
+ * <p class="changed_added_4_0">
+ * Cenerated Junit test.
+ * </p>
+ *
+ * @return
+ */
+ public Test test() default @Test(testClass = "");
+
+ /**
+ * <p class="changed_added_4_0">
+ * JsfRenderer associated with this component.
+ * </p>
+ *
+ * @return
+ */
+ public JsfRenderer renderer() default @JsfRenderer();
+
+ /**
+ * <p class="changed_added_4_0">
+ * View Description Language, JSP or Facelets, tags.
+ * </p>
+ *
+ * @return
+ */
+ public Tag[] tag() default { @Tag };
+
+
+ /**
+ * <p class="changed_added_4_0">
+ * Component facets.
+ * </p>
+ *
+ * @return
+ */
+ public Facet[] facets() default {};
+
+ /**
+ * <p class="changed_added_4_0">
+ * defines fragments of faces-config.xml that contain standard attribute definitions. CDK also tries to read
+ * META-INF/cdk/attributes/[classname].xml file for all component superclasses and interfaces, therefore it is not
+ * necessary to explicit include definitions for UIComponent and any other standard JSF classes. CDK defines couple
+ * of its own "urn" namespaces: "urn:resource:" for classpath resources, "urn:config:" for for project configuration
+ * folder and "urn:attributes:" for META-INF/cdk/attributes/ in the annotations library.
+ * </p>
+ *
+ * @return
+ */
+ public String[] attributes() default {};
+
+ /**
+ * <p class="changed_added_4_0">
+ * Interfaces that should be implemented in the generated component class. CDK processes all {@link Attribute} and
+ * {@link Facet} annotations in these interfaces
+ * </p>
+ *
+ * @return
+ */
+ public Class<?>[] interfaces() default {};
+
+}
Property changes on: root/cdk/branches/RF8755/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/RendererSpecificComponent.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ LastChangedDate LastChangedRevision LastChangedBy HeadURL Id
Deleted: root/cdk/branches/RF8755/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/SubComponent.java
===================================================================
--- root/cdk/branches/RF8755/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/SubComponent.java 2010-06-21 22:32:30 UTC (rev 17655)
+++ root/cdk/branches/RF8755/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/SubComponent.java 2010-06-21 22:38:29 UTC (rev 17656)
@@ -1,133 +0,0 @@
-/*
- * $Id$
- *
- * License Agreement.
- *
- * Rich Faces - 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.richfaces.cdk.annotations;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-/**
- * <p class="changed_added_4_0">
- * That annotation defines class that is generated from the concrete class defined in the {@link JsfComponent}
- * </p>
- *
- * @author asmirnov(a)exadel.com
- */
-(a)Retention(RetentionPolicy.SOURCE)
-public @interface SubComponent {
-
-
-
- /**
- * <p class="changed_added_4_0">
- * Type of the component. This is mandatory parameter because CDK uses <em>component-type</em> as primary key for
- * components library model.
- * </p>
- * <p class="todo">
- * TODO if this value is an empty, component type will be inferred from class name.
- * </p>
- *
- * @return component type.
- */
- public String type() default "";
-
-
- /**
- * <p class="changed_added_4_0">
- * Name of the generated component implementation class.
- * </p>
- *
- * @return
- */
- public String generate() default "";
-
- /**
- * <p class="changed_added_4_0">
- * Description used by IDE.
- * </p>
- *
- * @return
- */
- public Description description() default @Description();
-
- /**
- * <p class="changed_added_4_0">
- * Cenerated Junit test.
- * </p>
- *
- * @return
- */
- public Test test() default @Test(testClass = "");
-
- /**
- * <p class="changed_added_4_0">
- * JsfRenderer associated with this component.
- * </p>
- *
- * @return
- */
- public JsfRenderer renderer() default @JsfRenderer();
-
- /**
- * <p class="changed_added_4_0">
- * View Description Language, JSP or Facelets, tags.
- * </p>
- *
- * @return
- */
- public Tag[] tag() default { @Tag };
-
-
- /**
- * <p class="changed_added_4_0">
- * Component facets.
- * </p>
- *
- * @return
- */
- public Facet[] facets() default {};
-
- /**
- * <p class="changed_added_4_0">
- * defines fragments of faces-config.xml that contain standard attribute definitions. CDK also tries to read
- * META-INF/cdk/attributes/[classname].xml file for all component superclasses and interfaces, therefore it is not
- * necessary to explicit include definitions for UIComponent and any other standard JSF classes. CDK defines couple
- * of its own "urn" namespaces: "urn:resource:" for classpath resources, "urn:config:" for for project configuration
- * folder and "urn:attributes:" for META-INF/cdk/attributes/ in the annotations library.
- * </p>
- *
- * @return
- */
- public String[] attributes() default {};
-
- /**
- * <p class="changed_added_4_0">
- * Interfaces that should be implemented in the generated component class. CDK processes all {@link Attribute} and
- * {@link Facet} annotations in these interfaces
- * </p>
- *
- * @return
- */
- public Class<?>[] interfaces() default {};
-
-}
14 years, 6 months
JBoss Rich Faces SVN: r17655 - in root/cdk/branches/RF8755/plugins: generator/src/main/java/org/richfaces/cdk/apt/processors and 6 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-06-21 18:32:30 -0400 (Mon, 21 Jun 2010)
New Revision: 17655
Added:
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/apt/AbstractPage.java
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/apt/CdkProcessorImpl.java
Modified:
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/apt/AptModule.java
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/apt/CdkProcessor.java
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/apt/TaskFactoryImpl.java
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/JsfSubComponent.java
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentLibrary.java
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/FacesConfigGenerator.java
root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/apt/CdkProcessorTest.java
root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/apt/TaskFactoryTest.java
root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/apt/processors/ComponentProcessorTest.java
root/cdk/branches/RF8755/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/AbstractTestComponent.java
root/cdk/branches/RF8755/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/GenerateMojo.java
Log:
Create output folders by default, process project without java files, do not generate faces-config.xml for empty library.
Added: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/apt/AbstractPage.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/apt/AbstractPage.java (rev 0)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/apt/AbstractPage.java 2010-06-21 22:32:30 UTC (rev 17655)
@@ -0,0 +1,35 @@
+/*
+ * $Id$
+ *
+ * License Agreement.
+ *
+ * Rich Faces - 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.richfaces.cdk.apt;
+
+import javax.faces.component.UIComponentBase;
+
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public abstract class AbstractPage extends UIComponentBase {
+
+}
Property changes on: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/apt/AbstractPage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/apt/AptModule.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/apt/AptModule.java 2010-06-21 12:36:34 UTC (rev 17654)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/apt/AptModule.java 2010-06-21 22:32:30 UTC (rev 17655)
@@ -23,8 +23,6 @@
package org.richfaces.cdk.apt;
-import javax.annotation.processing.Processor;
-
import org.richfaces.cdk.LibraryBuilder;
import org.richfaces.cdk.apt.processors.AttributesProcessor;
import org.richfaces.cdk.apt.processors.AttributesProcessorImpl;
@@ -67,7 +65,7 @@
setBinder.addBinding().to(FunctionProcessor.class);
setBinder.addBinding().to(EventProcessor.class);
- bind(Processor.class).to(CdkProcessor.class);
+ bind(CdkProcessor.class).to(CdkProcessorImpl.class);
bind(AttributesProcessor.class).to(AttributesProcessorImpl.class);
bind(DescriptionProcessor.class).to(DescriptionProcessorImpl.class);
bind(CompilationTaskFactory.class).to(TaskFactoryImpl.class);
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/apt/CdkProcessor.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/apt/CdkProcessor.java 2010-06-21 12:36:34 UTC (rev 17654)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/apt/CdkProcessor.java 2010-06-21 22:32:30 UTC (rev 17655)
@@ -23,31 +23,8 @@
package org.richfaces.cdk.apt;
-import java.lang.annotation.Annotation;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-import java.util.Collections;
-import java.util.Set;
+import javax.annotation.processing.Processor;
-import javax.annotation.processing.AbstractProcessor;
-import javax.annotation.processing.ProcessingEnvironment;
-import javax.annotation.processing.RoundEnvironment;
-import javax.lang.model.SourceVersion;
-import javax.lang.model.element.Element;
-import javax.lang.model.element.ElementKind;
-import javax.lang.model.element.TypeElement;
-import javax.tools.Diagnostic.Kind;
-
-import org.richfaces.cdk.CdkProcessingException;
-import org.richfaces.cdk.LibraryBuilder;
-import org.richfaces.cdk.Logger;
-import org.richfaces.cdk.ModelBuilder;
-import org.richfaces.cdk.ModelValidator;
-import org.richfaces.cdk.apt.processors.CdkAnnotationProcessor;
-import org.richfaces.cdk.model.ComponentLibrary;
-
-import com.google.inject.Inject;
-
/**
* <p class="changed_added_4_0">
* Base class for all CDK Annotation processors. That class provides access to current CDK context and utility methods
@@ -57,144 +34,8 @@
* @author asmirnov(a)exadel.com
*
*/
-public class CdkProcessor extends AbstractProcessor {
+public interface CdkProcessor extends Processor {
- private static final Set<String> PROCESSED_ANNOTATION = Collections.singleton("*");
+ public void processNonJavaSources();
- @Inject
- private Logger log;
-
- @Inject
- private Set<CdkAnnotationProcessor> processors;
-
- // TODO - set library as parameter.
- @Inject
- private ComponentLibrary library;
-
- @Inject
- private Set<ModelBuilder> builders;
-
- @Inject
- private SourceUtilsProvider sourceUtilsProducer;
-
- @Inject
- private ModelValidator validator;
-
- @Inject
- private LibraryBuilder builder;
-
- @Override
- public synchronized void init(ProcessingEnvironment processingEnv) {
- super.init(processingEnv);
- sourceUtilsProducer.setProcessingEnv(processingEnv);
- }
-
- @Override
- public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
- if (!roundEnv.processingOver()) {
- // Process annotations.
- for (CdkAnnotationProcessor process : processors) {
- processAnnotation(process, roundEnv);
- }
- // parse non-java sources
- for (ModelBuilder builder : builders) {
- log.debug("Run builder "+builder.getClass().getName());
- builder.build();
- }
- // validator should be called even if previvous phases finish with errors, to collect all possible problems.
- log.debug("Validate model");
- validator.verify(library);
- } else if (0 == log.getErrorCount()) {
- // processing over, generate files.
- log.debug("Generate output files");
- builder.generate(library);
-
- }
- return false;
- }
-
- protected void processAnnotation(CdkAnnotationProcessor processor, RoundEnvironment environment) {
- Class<? extends Annotation> processedAnnotation = processor.getProcessedAnnotation();
- log.debug("Process all elements annotated with "+processedAnnotation.getName());
- Target target = processedAnnotation.getAnnotation(Target.class);
- try {
- Set<? extends Element> rootElements = environment.getRootElements();
- for (Element element : rootElements) {
- if (isAppropriateTarget(element, target)){
- processElement(processor, processedAnnotation, element);
- } else {
- for (Element enclosedElement : element.getEnclosedElements()) {
- if (isAppropriateTarget(enclosedElement, target)){
- processElement(processor, processedAnnotation, enclosedElement);
- }
- }
- }
- }
- } catch (Exception e) {
- processingEnv.getMessager().printMessage(Kind.ERROR,
- "Errorr processing annotation " + processedAnnotation + ": " + e);
- }
- }
-
- private void processElement(CdkAnnotationProcessor processor, Class<? extends Annotation> processedAnnotation,
- Element element) {
- if (null != element.getAnnotation(processedAnnotation)) {
- try {
- log.debug("Process "+element.getSimpleName()+" annotated with "+processedAnnotation.getName());
- processor.process(element, library);
- } catch (CdkProcessingException e) {
- sendError(element, e);
- }
- }
- }
-
- private boolean isAppropriateTarget(Element element,Target target){
- boolean match = false;
- ElementKind kind = element.getKind();
- if(null != target){
- for(ElementType targetType : target.value()){
- switch (targetType) {
- case TYPE:
- match |= ElementKind.CLASS.equals(kind)||ElementKind.INTERFACE.equals(kind)||ElementKind.ENUM.equals(kind);
- break;
- case PACKAGE:
- match |= ElementKind.PACKAGE.equals(kind);
- break;
- case METHOD:
- match |= ElementKind.METHOD.equals(kind);
- break;
- case FIELD:
- match |= ElementKind.FIELD.equals(kind);
- break;
- default:
- break;
- }
- }
- } else {
- // Annotation without @Target match any element.
- match =
- ElementKind.CLASS.equals(kind) || ElementKind.INTERFACE.equals(kind) || ElementKind.ENUM.equals(kind)
- || ElementKind.PACKAGE.equals(kind) || ElementKind.METHOD.equals(kind)
- || ElementKind.FIELD.equals(kind);
- }
- return match;
- }
-
- protected void sendError(Element componentElement, CdkProcessingException e) {
- // rise error and continue.
- processingEnv.getMessager().printMessage(javax.tools.Diagnostic.Kind.ERROR, e.getMessage(), componentElement);
- }
-
- @Override
- public Set<String> getSupportedAnnotationTypes() {
- return PROCESSED_ANNOTATION;
- }
-
- @Override
- public SourceVersion getSupportedSourceVersion() {
-
- // CDK supports Java 5 or 6 source code.
- return SourceVersion.RELEASE_6;
- }
-
}
Copied: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/apt/CdkProcessorImpl.java (from rev 17654, root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/apt/CdkProcessor.java)
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/apt/CdkProcessorImpl.java (rev 0)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/apt/CdkProcessorImpl.java 2010-06-21 22:32:30 UTC (rev 17655)
@@ -0,0 +1,209 @@
+/*
+ * $Id$
+ *
+ * License Agreement.
+ *
+ * Rich Faces - 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.richfaces.cdk.apt;
+
+import java.lang.annotation.Annotation;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+import java.util.Collections;
+import java.util.Set;
+
+import javax.annotation.processing.AbstractProcessor;
+import javax.annotation.processing.ProcessingEnvironment;
+import javax.annotation.processing.RoundEnvironment;
+import javax.lang.model.SourceVersion;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.ElementKind;
+import javax.lang.model.element.TypeElement;
+import javax.tools.Diagnostic.Kind;
+
+import org.richfaces.cdk.CdkProcessingException;
+import org.richfaces.cdk.LibraryBuilder;
+import org.richfaces.cdk.Logger;
+import org.richfaces.cdk.ModelBuilder;
+import org.richfaces.cdk.ModelValidator;
+import org.richfaces.cdk.apt.processors.CdkAnnotationProcessor;
+import org.richfaces.cdk.model.ComponentLibrary;
+
+import com.google.inject.Inject;
+
+/**
+ * <p class="changed_added_4_0">
+ * Base class for all CDK Annotation processors. That class provides access to current CDK context and utility methods
+ * for Java source models.
+ * </p>
+ *
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public class CdkProcessorImpl extends AbstractProcessor implements CdkProcessor {
+
+ private static final Set<String> PROCESSED_ANNOTATION = Collections.singleton("*");
+
+ @Inject
+ private Logger log;
+
+ @Inject
+ private Set<CdkAnnotationProcessor> processors;
+
+ // TODO - set library as parameter.
+ @Inject
+ private ComponentLibrary library;
+
+ @Inject
+ private Set<ModelBuilder> builders;
+
+ @Inject
+ private SourceUtilsProvider sourceUtilsProducer;
+
+ @Inject
+ private ModelValidator validator;
+
+ @Inject
+ private LibraryBuilder builder;
+
+ @Override
+ public synchronized void init(ProcessingEnvironment processingEnv) {
+ super.init(processingEnv);
+ sourceUtilsProducer.setProcessingEnv(processingEnv);
+ }
+
+ @Override
+ public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+ if (!roundEnv.processingOver()) {
+ // Process annotations.
+ for (CdkAnnotationProcessor process : processors) {
+ processAnnotation(process, roundEnv);
+ }
+ } else {
+ // parse non-java sources
+ processNonJavaSources();
+ }
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.cdk.apt.CdkProcessor#processNonJavaSources()
+ */
+ public void processNonJavaSources() {
+ for (ModelBuilder builder : builders) {
+ log.debug("Run builder "+builder.getClass().getName());
+ builder.build();
+ }
+ // validator should be called even if previvous phases finish with errors, to collect all possible problems.
+ log.debug("Validate model");
+ validator.verify(library);
+ if(0 == log.getErrorCount()) {
+ // processing over, generate files.
+ log.debug("Generate output files");
+ builder.generate(library);
+ }
+
+ }
+
+ protected void processAnnotation(CdkAnnotationProcessor processor, RoundEnvironment environment) {
+ Class<? extends Annotation> processedAnnotation = processor.getProcessedAnnotation();
+ log.debug("Process all elements annotated with "+processedAnnotation.getName());
+ Target target = processedAnnotation.getAnnotation(Target.class);
+ try {
+ Set<? extends Element> rootElements = environment.getRootElements();
+ for (Element element : rootElements) {
+ if (isAppropriateTarget(element, target)){
+ processElement(processor, processedAnnotation, element);
+ } else {
+ for (Element enclosedElement : element.getEnclosedElements()) {
+ if (isAppropriateTarget(enclosedElement, target)){
+ processElement(processor, processedAnnotation, enclosedElement);
+ }
+ }
+ }
+ }
+ } catch (Exception e) {
+ processingEnv.getMessager().printMessage(Kind.ERROR,
+ "Errorr processing annotation " + processedAnnotation + ": " + e);
+ }
+ }
+
+ private void processElement(CdkAnnotationProcessor processor, Class<? extends Annotation> processedAnnotation,
+ Element element) {
+ if (null != element.getAnnotation(processedAnnotation)) {
+ try {
+ log.debug("Process "+element.getSimpleName()+" annotated with "+processedAnnotation.getName());
+ processor.process(element, library);
+ } catch (CdkProcessingException e) {
+ sendError(element, e);
+ }
+ }
+ }
+
+ private boolean isAppropriateTarget(Element element,Target target){
+ boolean match = false;
+ ElementKind kind = element.getKind();
+ if(null != target){
+ for(ElementType targetType : target.value()){
+ switch (targetType) {
+ case TYPE:
+ match |= ElementKind.CLASS.equals(kind)||ElementKind.INTERFACE.equals(kind)||ElementKind.ENUM.equals(kind);
+ break;
+ case PACKAGE:
+ match |= ElementKind.PACKAGE.equals(kind);
+ break;
+ case METHOD:
+ match |= ElementKind.METHOD.equals(kind);
+ break;
+ case FIELD:
+ match |= ElementKind.FIELD.equals(kind);
+ break;
+ default:
+ break;
+ }
+ }
+ } else {
+ // Annotation without @Target match any element.
+ match =
+ ElementKind.CLASS.equals(kind) || ElementKind.INTERFACE.equals(kind) || ElementKind.ENUM.equals(kind)
+ || ElementKind.PACKAGE.equals(kind) || ElementKind.METHOD.equals(kind)
+ || ElementKind.FIELD.equals(kind);
+ }
+ return match;
+ }
+
+ protected void sendError(Element componentElement, CdkProcessingException e) {
+ // rise error and continue.
+ processingEnv.getMessager().printMessage(javax.tools.Diagnostic.Kind.ERROR, e.getMessage(), componentElement);
+ }
+
+ @Override
+ public Set<String> getSupportedAnnotationTypes() {
+ return PROCESSED_ANNOTATION;
+ }
+
+ @Override
+ public SourceVersion getSupportedSourceVersion() {
+
+ // CDK supports Java 5 or 6 source code.
+ return SourceVersion.RELEASE_6;
+ }
+
+}
Property changes on: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/apt/CdkProcessorImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ LastChangedDate LastChangedRevision LastChangedBy HeadURL Id
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/apt/TaskFactoryImpl.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/apt/TaskFactoryImpl.java 2010-06-21 12:36:34 UTC (rev 17654)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/apt/TaskFactoryImpl.java 2010-06-21 22:32:30 UTC (rev 17655)
@@ -52,6 +52,8 @@
import org.richfaces.cdk.Source;
import org.richfaces.cdk.Sources;
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterables;
import com.google.inject.Inject;
/**
@@ -86,8 +88,7 @@
}
}
- private static List<String> compilerOptions =
- new ArrayList<String>(Arrays.asList("-proc:only", "-implicit:class"));
+ private static List<String> compilerOptions = new ArrayList<String>(Arrays.asList("-proc:only", "-implicit:class"));
@Inject
private Logger log;
@@ -100,7 +101,7 @@
@Inject
private CdkClassLoader classPathLoader;
-
+
@Inject
@Output(Outputs.JAVA_CLASSES)
private FileManager outputFolder;
@@ -110,13 +111,13 @@
private FileManager sourceFolders;
@Inject
- private Processor cdkProcessor;
+ private CdkProcessor cdkProcessor;
private JavaCompiler javaCompiler;
private StandardJavaFileManager fileManager;
- private DiagnosticListener<JavaFileObject> diagnosticListener = new DiagnosticListenerImplementation();
+ private final DiagnosticListener<JavaFileObject> diagnosticListener = new DiagnosticListenerImplementation();
/*
* (non-Javadoc)
@@ -125,19 +126,41 @@
*/
@Override
public CompilationTask get() throws AptException {
- diagnosticListener = new DiagnosticListenerImplementation();
- Iterable<? extends JavaFileObject> sourceObjects = getFileManager()
- .getJavaFileObjectsFromFiles(sourceFolders.getFiles());
+ if (sourceFolders.getFiles().iterator().hasNext()) {
+ Iterable<? extends JavaFileObject> sourceObjects =
+ getFileManager().getJavaFileObjectsFromFiles(sourceFolders.getFiles());
- if (log.isDebugEnabled()) {
- compilerOptions.add("-verbose");
+ if (log.isDebugEnabled()) {
+ compilerOptions.add("-verbose");
+ }
+
+ CompilationTask task =
+ getJavaCompiler().getTask(null, getFileManager(), diagnosticListener, compilerOptions, null,
+ sourceObjects);
+ task.setLocale(locale);
+ task.setProcessors(Collections.singleton(cdkProcessor));
+ return task;
+ } else {
+ // no Java sources, try to build from xml files
+ return new CompilationTask() {
+
+ @Override
+ public void setProcessors(Iterable<? extends Processor> processors) {
+ // do nothing
+ }
+
+ @Override
+ public void setLocale(Locale locale) {
+
+ }
+
+ @Override
+ public Boolean call() {
+ cdkProcessor.processNonJavaSources();
+ return 0 == log.getErrorCount();
+ }
+ };
}
-
- CompilationTask task = getJavaCompiler()
- .getTask(null, getFileManager(), diagnosticListener, compilerOptions, null, sourceObjects);
- task.setLocale(locale);
- task.setProcessors(Collections.singleton(cdkProcessor));
- return task;
}
private StandardJavaFileManager getFileManager() {
@@ -147,7 +170,17 @@
fileManager.setLocation(StandardLocation.CLASS_PATH, classPathLoader.getFiles());
Iterable<File> outputFolders = outputFolder.getFolders();
if (null != outputFolders) {
- fileManager.setLocation(StandardLocation.SOURCE_OUTPUT, outputFolders);
+ // Append only existed folders to output.
+ Iterable<File> existedFolders = Iterables.filter(outputFolders, new Predicate<File>() {
+
+ @Override
+ public boolean apply(File input) {
+ return input.exists();
+ }
+ });
+ if (existedFolders.iterator().hasNext()) {
+ fileManager.setLocation(StandardLocation.SOURCE_OUTPUT, outputFolders);
+ }
}
fileManager.setLocation(StandardLocation.SOURCE_PATH, sourceFolders.getFolders());
} catch (IOException e) {
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java 2010-06-21 12:36:34 UTC (rev 17654)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java 2010-06-21 22:32:30 UTC (rev 17655)
@@ -40,7 +40,7 @@
import org.richfaces.cdk.annotations.Facet;
import org.richfaces.cdk.annotations.JsfComponent;
import org.richfaces.cdk.annotations.JsfRenderer;
-import org.richfaces.cdk.annotations.SubComponent;
+import org.richfaces.cdk.annotations.RendererSpecificComponent;
import org.richfaces.cdk.annotations.Tag;
import org.richfaces.cdk.apt.SourceUtils;
import org.richfaces.cdk.apt.SourceUtils.BeanProperty;
@@ -87,7 +87,7 @@
library.getComponents().add(component);
// Process the second level annotations.
- for (final SubComponent subcomponent : annotation.components()) {
+ for (final RendererSpecificComponent subcomponent : annotation.components()) {
JsfComponent subAnnotation = new JsfSubComponent(subcomponent, annotation);
ComponentModel subcomponentModel = new ComponentModel();
subcomponentModel.setBaseClass(component.getTargetClass());
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/JsfSubComponent.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/JsfSubComponent.java 2010-06-21 12:36:34 UTC (rev 17654)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/apt/processors/JsfSubComponent.java 2010-06-21 22:32:30 UTC (rev 17655)
@@ -30,12 +30,12 @@
import org.richfaces.cdk.annotations.Facet;
import org.richfaces.cdk.annotations.JsfComponent;
import org.richfaces.cdk.annotations.JsfRenderer;
-import org.richfaces.cdk.annotations.SubComponent;
+import org.richfaces.cdk.annotations.RendererSpecificComponent;
import org.richfaces.cdk.annotations.Tag;
import org.richfaces.cdk.annotations.Test;
/**
- * This calss wraps {@link SubComponent} annotation so it would be used by {@link ComponentProcessor} methods, so they
+ * This calss wraps {@link RendererSpecificComponent} annotation so it would be used by {@link ComponentProcessor} methods, so they
* can be reused for different types of the component annotations.
*
* @author akolonitsky
@@ -43,11 +43,11 @@
*/
public class JsfSubComponent implements JsfComponent {
- private final SubComponent subcomponent;
+ private final RendererSpecificComponent subcomponent;
private final JsfComponent parent;
- public JsfSubComponent(SubComponent subcomponent, JsfComponent parent) {
+ public JsfSubComponent(RendererSpecificComponent subcomponent, JsfComponent parent) {
this.subcomponent = subcomponent;
this.parent = parent;
}
@@ -109,8 +109,8 @@
}
@Override
- public SubComponent[] components() {
- return new SubComponent[0];
+ public RendererSpecificComponent[] components() {
+ return new RendererSpecificComponent[0];
}
@Override
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentLibrary.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentLibrary.java 2010-06-21 12:36:34 UTC (rev 17654)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentLibrary.java 2010-06-21 22:32:30 UTC (rev 17655)
@@ -352,7 +352,21 @@
public long lastModified() {
return lastModified;
}
+
+ /**
+ * <p class="changed_added_4_0">Check that library is empty</p>
+ * @param this
+ * @return
+ */
+ public boolean isEmpty() {
+ return this.getComponents().isEmpty() && this.getBehaviors().isEmpty()
+ && this.getConverters().isEmpty() && this.getEvents().isEmpty() && this.getFunctions().isEmpty()
+ && this.getListeners().isEmpty() && this.getRenderKits().isEmpty()
+ && this.getValidators().isEmpty() && (null == this.getExtension() || this.getExtension().getExtensions().isEmpty());
+ }
+
+
static <T extends ModelElement<T>> void merge(Collection<T> target, Collection<T> source) {
for (T element : source) {
T targetElement = null;
Modified: root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/FacesConfigGenerator.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/FacesConfigGenerator.java 2010-06-21 12:36:34 UTC (rev 17654)
+++ root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/FacesConfigGenerator.java 2010-06-21 22:32:30 UTC (rev 17655)
@@ -21,8 +21,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
-
package org.richfaces.cdk.xmlconfig;
import java.io.Writer;
@@ -40,24 +38,24 @@
/**
* <p class="changed_added_4_0">
* </p>
- *
+ *
* @author asmirnov(a)exadel.com
- *
+ *
*/
public class FacesConfigGenerator implements CdkWriter {
-
- public static final String FACES_SCHEMA_LOCATION = ComponentLibrary.FACES_CONFIG_NAMESPACE + " "
- + ComponentLibrary.FACES_CONFIG_SCHEMA_LOCATION;
+ public static final String FACES_SCHEMA_LOCATION =
+ ComponentLibrary.FACES_CONFIG_NAMESPACE + " " + ComponentLibrary.FACES_CONFIG_SCHEMA_LOCATION;
+
private static final String FACES_CONFIG_XML = "META-INF/faces-config.xml";
@Inject
private JAXB jaxbBinding;
+ @Inject
+ @Output(Outputs.RESOURCES)
+ private FileManager outputFileManager;
- @Inject @Output(Outputs.RESOURCES)
- private FileManager outputFileManager;
-
private FacesConfigAdapter libraryAdapter;
public FacesConfigGenerator() {
@@ -66,27 +64,40 @@
/*
* (non-Javadoc)
- *
- * @see
- * org.richfaces.cdk.CdkWriter#render(org.richfaces.cdk.model.ComponentLibrary
- * )
+ *
+ * @see org.richfaces.cdk.CdkWriter#render(org.richfaces.cdk.model.ComponentLibrary )
*/
@Override
public void render(ComponentLibrary library) throws CdkException {
- // TODO - check modification time.
- try {
- Writer facesConfigXml = outputFileManager.createOutput(FACES_CONFIG_XML, library.lastModified());
+ // do not render empty config.
+ if (!library.isEmpty()) {
+ try {
+ Writer facesConfigXml = outputFileManager.createOutput(FACES_CONFIG_XML, library.lastModified());
- if (null != facesConfigXml) {
- jaxbBinding.marshal(facesConfigXml, FACES_SCHEMA_LOCATION, libraryAdapter.marshal(library));
+ if (null != facesConfigXml) {
+ jaxbBinding.marshal(facesConfigXml, FACES_SCHEMA_LOCATION, libraryAdapter.marshal(library));
+ }
+ } catch (Exception e) {
+ if (e instanceof CdkException) {
+ throw (CdkException) e;
+ } else {
+ throw new CdkException(e);
+ }
}
- } catch (Exception e) {
- if (e instanceof CdkException) {
- throw (CdkException) e;
- } else {
- throw new CdkException(e);
- }
}
}
+
+ /**
+ * <p class="changed_added_4_0">Check that library is empty</p>
+ * @param library
+ * @return
+ */
+ private boolean empty(ComponentLibrary library) {
+
+ return library.getComponents().isEmpty() && library.getBehaviors().isEmpty()
+ && library.getConverters().isEmpty() && library.getEvents().isEmpty() && library.getFunctions().isEmpty()
+ && library.getListeners().isEmpty() && library.getRenderKits().isEmpty()
+ && library.getValidators().isEmpty() && library.getExtension().getExtensions().isEmpty();
+ }
}
Modified: root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/apt/CdkProcessorTest.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/apt/CdkProcessorTest.java 2010-06-21 12:36:34 UTC (rev 17654)
+++ root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/apt/CdkProcessorTest.java 2010-06-21 22:32:30 UTC (rev 17655)
@@ -28,7 +28,6 @@
import java.util.Collections;
import java.util.Set;
-import javax.annotation.processing.Processor;
import javax.annotation.processing.RoundEnvironment;
import javax.lang.model.element.ElementKind;
import javax.lang.model.element.TypeElement;
@@ -84,7 +83,7 @@
@Mock
private TypeElement element;
- @Mock
+ @Stub
private Logger log;
@Stub
@@ -103,8 +102,7 @@
@Override
public void configure(Binder binder) {
super.configure(binder);
- binder.bind(CdkProcessor.class).in(Singleton.class);
- binder.bind(Processor.class).to(CdkProcessor.class);
+ binder.bind(CdkProcessor.class).to(CdkProcessorImpl.class).in(Singleton.class);
CdkAnnotationProcessor cdkProcessor = createMock(CdkAnnotationProcessor.class);
binder.bind(CdkAnnotationProcessor.class).toInstance(cdkProcessor);
binder.bind(new TypeLiteral<Set<CdkAnnotationProcessor>>() {
@@ -124,8 +122,8 @@
expect(element.getSimpleName()).andStubReturn(new TestName("foo"));
cdkProcessor.process(element, library);
expectLastCall();
- validator.verify(library);
- expectLastCall();
+// validator.verify(library);
+// expectLastCall();
replay(element, roundEnv, builder, validator, cdkProcessor);
processor.process(Collections.singleton(element), roundEnv);
verify(element, roundEnv, builder, validator, cdkProcessor);
@@ -138,8 +136,8 @@
expect((Set<TypeElement>) roundEnv.getRootElements()).andReturn(Collections.singleton(element));
expect(element.getKind()).andReturn(ElementKind.CLASS);
expect(element.getAnnotation(TestAnnotation.class)).andReturn(null);
- validator.verify(library);
- expectLastCall();
+// validator.verify(library);
+// expectLastCall();
replay(element, roundEnv, builder, validator, cdkProcessor);
processor.process(Collections.singleton(element), roundEnv);
verify(element, roundEnv, builder, validator, cdkProcessor);
@@ -148,6 +146,8 @@
@Test
public void testProcessOver() throws Exception {
expect(roundEnv.processingOver()).andReturn(true);
+ validator.verify(library);
+ expectLastCall();
expect(log.getErrorCount()).andReturn(0);
log.debug((CharSequence) anyObject());
expectLastCall().asStub();
@@ -163,6 +163,8 @@
@Test
public void testProcessOver2() throws Exception {
expect(roundEnv.processingOver()).andReturn(true);
+ validator.verify(library);
+ expectLastCall();
expect(log.getErrorCount()).andReturn(1);
replay(log, element, roundEnv, builder, validator, cdkProcessor);
processor.process(Collections.singleton(element), roundEnv);
Modified: root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/apt/TaskFactoryTest.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/apt/TaskFactoryTest.java 2010-06-21 12:36:34 UTC (rev 17654)
+++ root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/apt/TaskFactoryTest.java 2010-06-21 22:32:30 UTC (rev 17655)
@@ -30,7 +30,6 @@
import java.util.Set;
import javax.annotation.processing.ProcessingEnvironment;
-import javax.annotation.processing.Processor;
import javax.annotation.processing.RoundEnvironment;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.TypeElement;
@@ -67,7 +66,7 @@
private static final String SUB_CLASS_JAVA = "org/richfaces/cdk/apt/TestSubClass.java";
@Mock
- Processor processor;
+ CdkProcessor processor;
@Inject
private TaskFactoryImpl factory;
Modified: root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/apt/processors/ComponentProcessorTest.java
===================================================================
--- root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/apt/processors/ComponentProcessorTest.java 2010-06-21 12:36:34 UTC (rev 17654)
+++ root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/apt/processors/ComponentProcessorTest.java 2010-06-21 22:32:30 UTC (rev 17655)
@@ -167,7 +167,7 @@
/**
* Test method for
- * {@link org.richfaces.cdk.apt.CdkProcessor#process(java.util.Set, javax.annotation.processing.RoundEnvironment)} .
+ * {@link org.richfaces.cdk.apt.CdkProcessorImpl#process(java.util.Set, javax.annotation.processing.RoundEnvironment)} .
*
* @throws Exception
*/
@@ -185,7 +185,7 @@
/**
* Test method for
- * {@link org.richfaces.cdk.apt.CdkProcessor#process(java.util.Set, javax.annotation.processing.RoundEnvironment)} .
+ * {@link org.richfaces.cdk.apt.CdkProcessorImpl#process(java.util.Set, javax.annotation.processing.RoundEnvironment)} .
*
* @throws Exception
*/
@@ -205,7 +205,7 @@
/**
* Test method for
- * {@link org.richfaces.cdk.apt.CdkProcessor#process(java.util.Set, javax.annotation.processing.RoundEnvironment)} .
+ * {@link org.richfaces.cdk.apt.CdkProcessorImpl#process(java.util.Set, javax.annotation.processing.RoundEnvironment)} .
*
* @throws Exception
*/
Modified: root/cdk/branches/RF8755/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/AbstractTestComponent.java
===================================================================
--- root/cdk/branches/RF8755/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/AbstractTestComponent.java 2010-06-21 12:36:34 UTC (rev 17654)
+++ root/cdk/branches/RF8755/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/AbstractTestComponent.java 2010-06-21 22:32:30 UTC (rev 17655)
@@ -33,7 +33,7 @@
import org.richfaces.cdk.annotations.Facet;
import org.richfaces.cdk.annotations.JsfComponent;
import org.richfaces.cdk.annotations.JsfRenderer;
-import org.richfaces.cdk.annotations.SubComponent;
+import org.richfaces.cdk.annotations.RendererSpecificComponent;
import org.richfaces.cdk.annotations.Tag;
import org.richfaces.cdk.test.event.TestEvent;
@@ -53,13 +53,13 @@
fires=TestEvent.class,
interfaces=ValueHolder.class,
components={
- @SubComponent(type = "org.richfaces.cdk.test.TestHtmlAbbr",
+ @RendererSpecificComponent(type = "org.richfaces.cdk.test.TestHtmlAbbr",
description=@Description(displayName="Test HTML5 abbreviation",largeIcon="large.gif",smallIcon="spall.png"),
tag=@Tag(name="abbr",generate=true,handler="org.richfaces.cdk.test.facelets.AbbrTagHandler"),
generate="org.richfaces.cdk.test.component.html.HtmlTestAbbr",
interfaces=Html5Attributes.class,
renderer=@JsfRenderer(type="org.richfaces.cdk.test.HtmlAbbrRenderer")),
- @SubComponent(type = "org.richfaces.cdk.test.TestHtmlDfn",
+ @RendererSpecificComponent(type = "org.richfaces.cdk.test.TestHtmlDfn",
tag=@Tag(name="dfn"),
generate="org.richfaces.cdk.test.component.html.HtmlTestDfn",
attributes="html5.xml")
Modified: root/cdk/branches/RF8755/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/GenerateMojo.java
===================================================================
--- root/cdk/branches/RF8755/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/GenerateMojo.java 2010-06-21 12:36:34 UTC (rev 17654)
+++ root/cdk/branches/RF8755/plugins/maven-cdk-plugin/src/main/java/org/richfaces/builder/mojo/GenerateMojo.java 2010-06-21 22:32:30 UTC (rev 17655)
@@ -51,14 +51,14 @@
/**
* <p class="changed_added_4_0">
* </p>
- *
+ *
* @author asmirnov(a)exadel.com
* @goal generate
* @requiresDependencyResolution compile
* @phase generate-sources
*/
public class GenerateMojo extends AbstractMojo {
- private static final String[] JAVA_INCLUDES = new String[]{"**/*.java"};
+ private static final String[] JAVA_INCLUDES = new String[] { "**/*.java" };
private static final String MAIN_CONFIG = "src/main/config";
private static final String MAIN_TEMPLATES = "src/main/templates";
private static final String[] STRINGS_ARRAY = new String[0];
@@ -66,7 +66,7 @@
/**
* Project classpath.
- *
+ *
* @parameter expression="${project.compileClasspathElements}"
* @required
* @readonly
@@ -75,7 +75,7 @@
/**
* The source directories containing the sources to be compiled.
- *
+ *
* @parameter expression="${project.compileSourceRoots}"
* @required
* @readonly
@@ -83,10 +83,9 @@
protected List<String> compileSourceRoots;
/**
- * The list of JSF configuration files that will be processed by CDK.
- * By default, CDK looks for all files in the <code>src/main/config</code> folder
- * with "xml" extension.
- *
+ * The list of JSF configuration files that will be processed by CDK. By default, CDK looks for all files in the
+ * <code>src/main/config</code> folder with "xml" extension.
+ *
* @parameter
*/
protected FileSet[] facesConfigs;
@@ -103,7 +102,7 @@
/**
* The directory for compiled classes.
- *
+ *
* @parameter expression="${project.build.outputDirectory}"
* @required
* @readonly
@@ -112,14 +111,14 @@
/**
* Directory where the output Java Files will be located.
- *
+ *
* @parameter expression="${project.build.directory}/generated-sources/main/java"
*/
protected File outputJavaDirectory;
/**
* Directory where the output Java Files will be located.
- *
+ *
* @parameter expression="${project.build.directory}/generated-sources/main/resources"
*/
protected File outputResourcesDirectory;
@@ -131,40 +130,39 @@
/**
* Directory where the output Java Files will be located.
- *
+ *
* @parameter expression="${project.build.directory}/generated-sources/test/resources"
*/
protected File outputTestResourcesDirectory;
/**
* Top maven project.
- *
+ *
* @parameter expression="${project}"
* @readonly
*/
protected MavenProject project;
/**
- * List of filename patterns that will be excluded from process by annotations processor.
- * By default, all *.java files will be processed.
- *
+ * List of filename patterns that will be excluded from process by annotations processor. By default, all *.java
+ * files will be processed.
+ *
* @parameter
*/
protected String[] sourceExcludes;
/**
- * List of filename patterns that will be included to process by annotations processor.
- * By default, all *.java files will be processed.
- *
+ * List of filename patterns that will be included to process by annotations processor. By default, all *.java files
+ * will be processed.
+ *
* @parameter
*/
protected String[] sourceIncludes;
/**
- * The list of JsfRenderer template files that will be processed by CDK.
- * By default, CDK looks for all files in the <code>src/main/templates</code> folder
- * with "xml" extension.
- *
+ * The list of JsfRenderer template files that will be processed by CDK. By default, CDK looks for all files in the
+ * <code>src/main/templates</code> folder with "xml" extension.
+ *
* @parameter
*/
protected FileSet[] templates;
@@ -176,7 +174,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see org.apache.maven.plugin.Mojo#execute()
*/
@Override
@@ -203,13 +201,11 @@
}
}
-
generator.addSources(Sources.JAVA_SOURCES, findJavaFiles(), folders);
- // TODO - detect templates and configs directories.
+ // detect templates and configs directories.
generator.addSources(Sources.RENDERER_TEMPLATES, findTemplateFiles(), null);
generator.addSources(Sources.FACES_CONFIGS, findFacesConfigFiles(), null);
-
// Setup output folders.
setOutput(generator, outputJavaDirectory, Outputs.JAVA_CLASSES);
setOutput(generator, outputResourcesDirectory, Outputs.RESOURCES);
@@ -226,70 +222,83 @@
}
try {
- if (this.library != null
- && this.library.getTaglib() != null
+ if (this.library != null && this.library.getTaglib() != null
&& this.library.getTaglib().getShortName() != null) {
-
+
generator.setNamespace(this.library.getTaglib().getShortName());
}
// Build JSF library.
-// LibraryBuilder builder = LibraryBuilder.createInstance(context);
+ // LibraryBuilder builder = LibraryBuilder.createInstance(context);
generator.init();
generator.execute();
- if(logger.getErrorCount()>0){
+ if (logger.getErrorCount() > 0) {
throw new MojoFailureException("Errors occurred while JSF library was built");
}
// Tell project about generated files.
- project.addCompileSourceRoot(outputJavaDirectory.getAbsolutePath());
+ if (outputJavaDirectory.exists()) {
+ project.addCompileSourceRoot(outputJavaDirectory.getAbsolutePath());
- Resource resource = new Resource();
+ }
- resource.setDirectory(outputResourcesDirectory.getAbsolutePath());
- project.addResource(resource);
- project.addTestCompileSourceRoot(outputTestDirectory.getAbsolutePath());
+ if (outputResourcesDirectory.exists()) {
+ Resource resource = new Resource();
- Resource testResource = new Resource();
+ resource.setDirectory(outputResourcesDirectory.getAbsolutePath());
+ project.addResource(resource);
- testResource.setDirectory(outputTestResourcesDirectory.getAbsolutePath());
- project.addTestResource(testResource);
+ }
+ if (outputTestDirectory.exists()) {
+ project.addTestCompileSourceRoot(outputTestDirectory.getAbsolutePath());
+
+ }
+ if (outputTestResourcesDirectory.exists()) {
+ Resource testResource = new Resource();
+
+ testResource.setDirectory(outputTestResourcesDirectory.getAbsolutePath());
+ project.addTestResource(testResource);
+
+ }
} catch (CdkException e) {
throw new MojoExecutionException("CDK build error", e);
}
}
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @param generator
* @throws MojoFailureException
*/
private void setupPlugins(Generator generator) throws MojoFailureException {
- // TODO - get additional modules, as Maven components ?
+ // TODO - get additional modules, as Maven components ?
}
/**
- * <p class="changed_added_4_0">This utility method sets output directory for particular type.
- * I such directory does not exist, it is created.</p>
- *
+ * <p class="changed_added_4_0">
+ * This utility method sets output directory for particular type. I such directory does not exist, it is created.
+ * </p>
+ *
* @param generator
* @param directory
* @param type
*/
private static void setOutput(Generator generator, File directory, Outputs type) {
- if (!directory.exists()) {
- directory.mkdirs();
- }
+ // if (!directory.exists()) {
+ // directory.mkdirs();
+ // }
generator.addOutputFolder(type, directory);
}
-// /**
-// * <p class="changed_added_4_0">This method checks library configuration and sets default values if necessary.</p>
-// */
-// protected void checkLibraryConfig() {
-//
-// // TODO Auto-generated method stub
-// }
+ // /**
+ // * <p class="changed_added_4_0">This method checks library configuration and sets default values if necessary.</p>
+ // */
+ // protected void checkLibraryConfig() {
+ //
+ // // TODO Auto-generated method stub
+ // }
private File resolveRelativePath(File file) {
File result = file;
@@ -309,7 +318,7 @@
fileSet.setDirectory(MAIN_TEMPLATES);
fileSet.addInclude(XML_INCLUDES);
- templates = new FileSet[]{fileSet};
+ templates = new FileSet[] { fileSet };
}
}
@@ -323,7 +332,6 @@
for (String compileRoot : compileSourceRoots) {
File rootFolder = new File(compileRoot);
String[] sources = doScan(includes, sourceExcludes, rootFolder);
-
for (String src : sources) {
javaSources.add(new File(rootFolder, src));
}
@@ -341,7 +349,7 @@
fileSet.setDirectory(MAIN_CONFIG);
fileSet.addInclude(XML_INCLUDES);
- facesConfigs = new FileSet[]{fileSet};
+ facesConfigs = new FileSet[] { fileSet };
}
}
@@ -389,7 +397,7 @@
/**
* Skan Array of filesets for selected resources.
- *
+ *
* @param filesets
* @return
* @throws MojoExecutionException
14 years, 6 months
JBoss Rich Faces SVN: r17654 - root/ui/iteration/trunk/tables/ui/src/main/java/org/richfaces/renderkit.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-06-21 08:36:34 -0400 (Mon, 21 Jun 2010)
New Revision: 17654
Modified:
root/ui/iteration/trunk/tables/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java
root/ui/iteration/trunk/tables/ui/src/main/java/org/richfaces/renderkit/RowHolder.java
Log:
apply checkstyle fixes
Modified: root/ui/iteration/trunk/tables/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java
===================================================================
--- root/ui/iteration/trunk/tables/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java 2010-06-21 12:34:51 UTC (rev 17653)
+++ root/ui/iteration/trunk/tables/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java 2010-06-21 12:36:34 UTC (rev 17654)
@@ -212,7 +212,7 @@
encodeTableBodyEnd(writer);
tbodyStart = false;
if(partialUpdate) {
- partialEnd(facesContext);
+ partialEnd(facesContext);
}
}
}
Modified: root/ui/iteration/trunk/tables/ui/src/main/java/org/richfaces/renderkit/RowHolder.java
===================================================================
--- root/ui/iteration/trunk/tables/ui/src/main/java/org/richfaces/renderkit/RowHolder.java 2010-06-21 12:34:51 UTC (rev 17653)
+++ root/ui/iteration/trunk/tables/ui/src/main/java/org/richfaces/renderkit/RowHolder.java 2010-06-21 12:36:34 UTC (rev 17654)
@@ -42,6 +42,16 @@
private boolean encodeParentTBody;
+
+ public RowHolder(FacesContext context, Row row) {
+ this(context, row, 0, true);
+ }
+
+ public RowHolder(FacesContext context, Row row, int processCell, boolean isRowStart) {
+ super(context);
+ this.row = row;
+ this.parentClientId = row.getClientId(context);
+ }
public boolean isEncodeParentTBody() {
return encodeParentTBody;
@@ -59,16 +69,6 @@
this.updatePartial = updatePartial;
}
- public RowHolder(FacesContext context, Row row) {
- this(context, row, 0, true);
- }
-
- public RowHolder(FacesContext context, Row row, int processCell, boolean isRowStart) {
- super(context);
- this.row = row;
- this.parentClientId = row.getClientId(context);
- }
-
public String getParentClientId() {
return parentClientId;
}
14 years, 6 months
JBoss Rich Faces SVN: r17653 - root/examples/iteration-demo/trunk/src/main/java/org/richfaces/demo.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-06-21 08:34:51 -0400 (Mon, 21 Jun 2010)
New Revision: 17653
Modified:
root/examples/iteration-demo/trunk/src/main/java/org/richfaces/demo/FilteringAndSortingBean.java
Log:
replace swing SortOrder class with our own implementation
Modified: root/examples/iteration-demo/trunk/src/main/java/org/richfaces/demo/FilteringAndSortingBean.java
===================================================================
--- root/examples/iteration-demo/trunk/src/main/java/org/richfaces/demo/FilteringAndSortingBean.java 2010-06-21 11:51:29 UTC (rev 17652)
+++ root/examples/iteration-demo/trunk/src/main/java/org/richfaces/demo/FilteringAndSortingBean.java 2010-06-21 12:34:51 UTC (rev 17653)
@@ -26,8 +26,9 @@
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
-import javax.swing.SortOrder;
+import org.richfaces.component.SortOrder;
+
import org.richfaces.demo.model.Employee;
import org.richfaces.model.Filter;
14 years, 6 months