JBoss Rich Faces SVN: r20923 - in modules/docs/trunk: Component_Reference/src/main/docbook/en-US and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: SeanRogers
Date: 2011-01-10 00:02:39 -0500 (Mon, 10 Jan 2011)
New Revision: 20923
Added:
modules/docs/trunk/Component_Reference/src/main/docbook/en-US/skinning/tabl-richdataTable.xml
Removed:
modules/docs/trunk/Component_Reference/src/main/docbook/en-US/skinning/skin-richdataTable.xml
Modified:
modules/docs/trunk/Component_Reference/Component_Reference_chapters.txt
modules/docs/trunk/Component_Reference/src/main/docbook/en-US/chap-Component_Reference-Tables_and_grids.xml
modules/docs/trunk/Developer_Guide/src/main/docbook/en-US/appe-Developer_Guide-Style_classes_and_skin_parameters.xml
Log:
Changed skinning approach
Modified: modules/docs/trunk/Component_Reference/Component_Reference_chapters.txt
===================================================================
--- modules/docs/trunk/Component_Reference/Component_Reference_chapters.txt 2011-01-08 23:28:47 UTC (rev 20922)
+++ modules/docs/trunk/Component_Reference/Component_Reference_chapters.txt 2011-01-10 05:02:39 UTC (rev 20923)
@@ -12,7 +12,7 @@
x- a4j:htmlCommandLink
-- a4j:jsFunction
-- a4j:poll
--- a4j:push
+x- a4j:push
-- a4j:ajax
- chap-Component_Reference-Resources
@@ -52,20 +52,20 @@
-- rich:inplaceSelect
-- rich:inputNumberSlider
-- rich:inputNumberSpinner
--- rich:selectOne
+-- rich:select
- chap-Component_Reference-Panels_and_containers
-- rich:panel
x- rich:panelBar
--- rich:popupPanel
-- rich:accordion
--- rich:accordionItem
+-- rich:accordionItem
-- rich:collapsiblePanel
--- rich:tab
+-- rich:popupPanel
-- rich:tabPanel
--- rich:toggleControl
+-- rich:tab
-- rich:togglePanel
--- rich:togglePanelItem
+-- rich:toggleControl
+-- rich:togglePanelItem
- chap-Component_Reference-Tables_and_grids
-- a4j:repeat
@@ -80,20 +80,20 @@
-- Table filtering
-- Table sorting
-x chap-Component_Reference-Trees
+- chap-Component_Reference-Trees
xx rich:changeExpandListener
xx rich:nodeSelectListener
-xx rich:recursiveTreeNodesAdapter
-xx rich:tree
-xx rich:treeNode
-xx rich:treeNodesAdapter
+-- rich:tree
+-- rich:treeNode
+xx rich:treeModelRecursiveAdaptor
+xx rich:treeModelAdaptor
-x chap-Component_Reference-Menus_and_toolbars
+- chap-Component_Reference-Menus_and_toolbars
xx rich:contextMenu
-xx rich:dropDownMenu
-xx rich:menuGroup
-xx rich:menuItem
-xx rich:menuSeparator
+-- rich:dropDownMenu
+-- rich:menuGroup
+-- rich:menuItem
+-- rich:menuSeparator
-- rich:panelMenu
-- rich:panelMenuGroup
-- rich:panelMenuItem
@@ -101,13 +101,15 @@
-- rich:toolBarGroup
- chap-Component_Reference-Output_and_messages
-x- rich:message
-x- rich:messages
+-- rich:message
+-- rich:messages
xx rich:paint2D
-- rich:progressBar
-- rich:toolTip
-x chap-Component_Reference-Drag_and_drop
+- chap-Component_Reference-Drag_and_drop
+-- rich:dragBehavior
+-- rich:dropBehavior
xx rich:dragIndicator
xx rich:dragSupport
xx rich:dropSupport
Modified: modules/docs/trunk/Component_Reference/src/main/docbook/en-US/chap-Component_Reference-Tables_and_grids.xml
===================================================================
--- modules/docs/trunk/Component_Reference/src/main/docbook/en-US/chap-Component_Reference-Tables_and_grids.xml 2011-01-08 23:28:47 UTC (rev 20922)
+++ modules/docs/trunk/Component_Reference/src/main/docbook/en-US/chap-Component_Reference-Tables_and_grids.xml 2011-01-10 05:02:39 UTC (rev 20923)
@@ -270,6 +270,13 @@
</listitem>
</itemizedlist>
</section>
+
+ <section id="sect-Component_Reference-richcolumn-Style_classes_and_skin_parameters">
+ <title>Style classes and skin parameters</title>
+ <para>
+ The <sgmltag><rich:column></sgmltag> component uses the same style classes and skin parameters as the <sgmltag><rich:dataTable></sgmltag> component. Refer to <xref linkend="sect-Component_Reference-richdataTable-Style_classes_and_skin_parameters" /> for details.
+ </para>
+ </section>
</section>
<!--<rich:columnGroup>-->
@@ -334,6 +341,13 @@
</listitem>
</itemizedlist>
</section>
+
+ <section id="sect-Component_Reference-richcolumnGroup-Style_classes_and_skin_parameters">
+ <title>Style classes and skin parameters</title>
+ <para>
+ The <sgmltag><rich:columnGroup></sgmltag> component uses the same style classes and skin parameters as the <sgmltag><rich:dataTable></sgmltag> component. Refer to <xref linkend="sect-Component_Reference-richdataTable-Style_classes_and_skin_parameters" /> for details.
+ </para>
+ </section>
</section>
<!-- Removed -->
@@ -391,6 +405,13 @@
</listitem>
</itemizedlist>
</section>
+
+ <section id="sect-Component_Reference-richcolumns-Style_classes_and_skin_parameters">
+ <title>Style classes and skin parameters</title>
+ <para>
+ The <sgmltag><rich:columns></sgmltag> component uses the same style classes and skin parameters as the <sgmltag><rich:dataTable></sgmltag> component. Refer to <xref linkend="sect-Component_Reference-richdataTable-Style_classes_and_skin_parameters" /> for details.
+ </para>
+ </section>
</section>
-->
@@ -563,6 +584,13 @@
</listitem>
</itemizedlist>
</section>
+
+ <section id="sect-Component_Reference-richdataGrid-Style_classes_and_skin_parameters">
+ <title>Style classes and skin parameters</title>
+ <para>
+ The <sgmltag><rich:dataGrid></sgmltag> component uses the same style classes and skin parameters as the <sgmltag><rich:dataTable></sgmltag> component. Refer to <xref linkend="sect-Component_Reference-richdataTable-Style_classes_and_skin_parameters" /> for details.
+ </para>
+ </section>
</section>
<!-- TODO not in M2 -->
@@ -690,8 +718,12 @@
</listitem>
</itemizedlist>
</section>
+
+ <section id="sect-Component_Reference-richdataTable-Style_classes_and_skin_parameters">
+ <title>Style classes and skin parameters</title>
+ <xi:include href="skinning/tabl-richdataTable.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ </section>
- <xi:include href="skinning/skin-richdataTable.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
</section>
<!--<rich:extendedDataTable>-->
@@ -703,16 +735,48 @@
<para>
The <sgmltag><rich:extendedDataTable></sgmltag> component includes the following attributes not included in the <sgmltag><rich:dataTable></sgmltag> component:
</para>
- <simplelist columns="3">
- <member><varname>frozenColumns</varname></member>
- <member><varname>height</varname></member>
- <member><varname>noDataLabel</varname></member>
- <member><varname>onselectionchange</varname></member>
- <member><varname>selectedClass</varname></member>
- <member><varname>selection</varname></member>
- <member><varname>selectionMode</varname></member>
- <member><varname>tableState</varname></member>
- </simplelist>
+ <itemizedlist>
+ <listitem>
+ <para>
+ <varname>frozenColumns</varname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <varname>height</varname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <varname>noDataLabel</varname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <varname>onselectionchange</varname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <varname>selectedClass</varname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <varname>selection</varname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <varname>selectionMode</varname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <varname>tableState</varname>
+ </para>
+ </listitem>
+ </itemizedlist>
<para>
The <sgmltag><rich:extendedDataTable></sgmltag> component does <emphasis>not</emphasis> include the following attributes available with the <sgmltag><rich:dataTable></sgmltag> component:
</para>
Deleted: modules/docs/trunk/Component_Reference/src/main/docbook/en-US/skinning/skin-richdataTable.xml
===================================================================
--- modules/docs/trunk/Component_Reference/src/main/docbook/en-US/skinning/skin-richdataTable.xml 2011-01-08 23:28:47 UTC (rev 20922)
+++ modules/docs/trunk/Component_Reference/src/main/docbook/en-US/skinning/skin-richdataTable.xml 2011-01-10 05:02:39 UTC (rev 20923)
@@ -1,332 +0,0 @@
-<?xml version='1.0' encoding='utf-8' ?>
-<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
-]>
-<section id="skin-richdataTable">
- <title><sgmltag><rich:dataTable></sgmltag> style classes and skin parameters</title>
- <table id="tabl-richdataTable-Style_classes_with_corresponding_skin_parameters">
- <title>Style classes (selectors) with corresponding skin parameters</title>
- <tgroup cols="4">
- <thead>
- <row>
- <entry>Class (selector) name</entry>
- <entry>Skin Parameters</entry>
- <entry><acronym>CSS</acronym> properties mapped</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>
- <variablelist>
- <varlistentry>
- <term><classname>.rich-table</classname></term>
- <listitem>
- <para>
- This class defines the styles for a table.
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
- </entry>
- <entry><literal>tableBackgroundColor</literal></entry>
- <entry><literal>background-color</literal></entry>
- </row>
-
- <row>
- <entry morerows="2">
- <variablelist>
- <varlistentry>
- <term><classname>.rich-table-cell</classname></term>
- <listitem>
- <para>
- This class defines the styles for a table cell.
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
- </entry>
- <entry><literal>generalSizeFont</literal></entry>
- <entry><literal>font-size</literal></entry>
- </row>
- <row>
- <entry><literal>generalTextColor</literal></entry>
- <entry><literal>color</literal></entry>
- </row>
- <row>
- <entry><literal>generalFamilyFont</literal></entry>
- <entry><literal>font-family</literal></entry>
- </row>
-
- <row>
- <entry>
- <variablelist>
- <varlistentry>
- <term><classname>.rich-table-header</classname></term>
- <listitem>
- <para>
- This class defines the styles for a table header row.
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
- </entry>
- <entry><literal>headerBackgroundColor</literal></entry>
- <entry><literal>background-color</literal></entry>
- </row>
-
- <row>
- <entry>
- <variablelist>
- <varlistentry>
- <term><classname>.rich-table-header-continue</classname></term>
- <listitem>
- <para>
- This class defines the styles for all header lines after the first.
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
- </entry>
- <entry><literal>headerBackgroundColor</literal></entry>
- <entry><literal>background-color</literal></entry>
- </row>
-
- <row>
- <entry morerows="4">
- <variablelist>
- <varlistentry>
- <term><classname>.rich-table-headercell</classname></term>
- <listitem>
- <para>
- This class defines the styles for a header cell.
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
- </entry>
- <entry><literal>tableBorderWidth</literal>, <literal>tableBorderColor</literal></entry>
- <entry><literal>border-right, border-bottom</literal></entry>
- </row>
- <row>
- <entry><literal>headerTextColor</literal></entry>
- <entry><literal>color</literal></entry>
- </row>
- <row>
- <entry><literal>headerWeightFont</literal></entry>
- <entry><literal>font-weight</literal></entry>
- </row>
- <row>
- <entry><literal>generalSizeFont</literal></entry>
- <entry><literal>font-size</literal></entry>
- </row>
- <row>
- <entry><literal>generalFamilyFont</literal></entry>
- <entry><literal>font-family</literal></entry>
- </row>
-
- <row>
- <entry>
- <variablelist>
- <varlistentry>
- <term><classname>.rich-table-subheader</classname></term>
- <listitem>
- <para>
- This class defines the styles for a column header.
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
- </entry>
- <entry><literal>additionalBackgroundColor</literal></entry>
- <entry><literal>background-color</literal></entry>
- </row>
-
- <row>
- <entry>
- <variablelist>
- <varlistentry>
- <term><classname>.rich-table-thead</classname></term>
- <listitem>
- <para>
- This class defines the styles for the separator between the header and the rest of the table.
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
- </entry>
- <entry><literal>tableBorderWidth</literal>, <literal>tableBorderColor</literal></entry>
- <entry><literal>border-bottom</literal></entry>
- </row>
-
- <row>
- <entry morerows="3">
- <variablelist>
- <varlistentry>
- <term><classname>.rich-table-subheadercell</classname></term>
- <listitem>
- <para>
- This class defines the styles for a column header cell.
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
- </entry>
- <entry><literal>tableBorderWidth</literal>, <literal>tableBorderColor</literal></entry>
- <entry><literal>border-right</literal></entry>
- </row>
- <row>
- <entry><literal>generalTextColor</literal></entry>
- <entry><literal>color</literal></entry>
- </row>
- <row>
- <entry><literal>generalSizeFont</literal></entry>
- <entry><literal>font-size</literal></entry>
- </row>
- <row>
- <entry><literal>generalFamilyFont</literal></entry>
- <entry><literal>font-family</literal></entry>
- </row>
-
- <row>
- <entry>
- <variablelist>
- <varlistentry>
- <term><classname>.rich-table-footer</classname></term>
- <listitem>
- <para>
- This class defines the styles for a footer row.
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
- </entry>
- <entry><literal>tableFooterBackgroundColor</literal></entry>
- <entry><literal>background-color</literal></entry>
- </row>
-
- <row>
- <entry>
- <variablelist>
- <varlistentry>
- <term><classname>.rich-table-footer-continue</classname></term>
- <listitem>
- <para>
- This class defines the styles for all footer lines after the first.
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
- </entry>
- <entry><literal>tableFooterBackgroundColor</literal></entry>
- <entry><literal>background-color</literal></entry>
- </row>
-
- <row>
- <entry morerows="4">
- <variablelist>
- <varlistentry>
- <term><classname>.rich-table-footercell</classname></term>
- <listitem>
- <para>
- This class defines styles for a footer cell.
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
- </entry>
- <entry><literal>tableBorderWidth, tableBorderColor</literal></entry>
- <entry><literal>border-right, border-bottom</literal></entry>
- </row>
- <row>
- <entry><literal>generalTextColor</literal></entry>
- <entry><literal>color</literal></entry>
- </row>
- <row>
- <entry><literal>headerWeightFont</literal></entry>
- <entry><literal>font-weight</literal></entry>
- </row>
- <row>
- <entry><literal>generalSizeFont</literal></entry>
- <entry><literal>font-size</literal></entry>
- </row>
- <row>
- <entry><literal>generalFamilyFont</literal></entry>
- <entry><literal>font-family</literal></entry>
- </row>
-
- <row>
- <entry>
- <variablelist>
- <varlistentry>
- <term><classname>.rich-table-subfooter</classname></term>
- <listitem>
- <para>
- This class defines the styles for a column footer.
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
- </entry>
- <entry><literal>tableSubfooterBackgroundColor</literal></entry>
- <entry><literal>background-color</literal></entry>
- </row>
-
- <row>
- <entry morerows="3">
- <variablelist>
- <varlistentry>
- <term><classname>.rich-table-subfootercell</classname></term>
- <listitem>
- <para>
- This class defines the styles for a column footer cell.
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
- </entry>
- <entry><literal>tableBorderWidth</literal>, <literal>tableBorderColor</literal></entry>
- <entry><literal>border-right</literal>, <literal>border-bottom</literal></entry>
- </row>
- <row>
- <entry><literal>generalTextColor</literal></entry>
- <entry><literal>color</literal></entry>
- </row>
- <row>
- <entry><literal>generalSizeFont</literal></entry>
- <entry><literal>font-size</literal></entry>
- </row>
- <row>
- <entry><literal>generalFamilyFont</literal></entry>
- <entry><literal>font-family</literal></entry>
- </row>
- </tbody>
- </tgroup>
- </table>
-
- <variablelist>
- <title>Style classes (selectors) without skin parameters</title>
- <varlistentry>
- <term><classname>.rich-table-caption</classname></term>
- <listitem>
- <para>
- This class defines styles for a "caption" facet element.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><classname>.rich-table-row</classname></term>
- <listitem>
- <para>
- This class defines styles for a table row.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><classname>.rich-table-firstrow</classname></term>
- <listitem>
- <para>
- This class defines styles for a table's first row.
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
-</section>
Copied: modules/docs/trunk/Component_Reference/src/main/docbook/en-US/skinning/tabl-richdataTable.xml (from rev 20913, modules/docs/trunk/Component_Reference/src/main/docbook/en-US/skinning/skin-richdataTable.xml)
===================================================================
--- modules/docs/trunk/Component_Reference/src/main/docbook/en-US/skinning/tabl-richdataTable.xml (rev 0)
+++ modules/docs/trunk/Component_Reference/src/main/docbook/en-US/skinning/tabl-richdataTable.xml 2011-01-10 05:02:39 UTC (rev 20923)
@@ -0,0 +1,354 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<!DOCTYPE table PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+]>
+
+<table id="tabl-richdataTable-Style_classes_and_corresponding_skin_parameters">
+ <title>Style classes (selectors) and corresponding skin parameters</title>
+ <tgroup cols="3">
+ <colspec colname="class"/>
+ <colspec colname="skin"/>
+ <colspec colname="css"/>
+ <spanspec spanname="noskin" namest="skin" nameend="css"/>
+ <thead>
+ <row>
+ <entry>Class (selector)</entry>
+ <entry>Skin Parameters</entry>
+ <entry>Mapped <acronym>CSS</acronym> properties</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>
+ <variablelist>
+ <varlistentry>
+ <term><classname>.rich-table</classname></term>
+ <listitem>
+ <para>
+ This class defines the styles for a table.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </entry>
+ <entry><literal>tableBackgroundColor</literal></entry>
+ <entry><literal>background-color</literal></entry>
+ </row>
+
+ <row>
+ <entry morerows="2">
+ <variablelist>
+ <varlistentry>
+ <term><classname>.rich-table-cell</classname></term>
+ <listitem>
+ <para>
+ This class defines the styles for a table cell.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </entry>
+ <entry><literal>generalSizeFont</literal></entry>
+ <entry><literal>font-size</literal></entry>
+ </row>
+ <row>
+ <entry><literal>generalTextColor</literal></entry>
+ <entry><literal>color</literal></entry>
+ </row>
+ <row>
+ <entry><literal>generalFamilyFont</literal></entry>
+ <entry><literal>font-family</literal></entry>
+ </row>
+
+ <row>
+ <entry>
+ <variablelist>
+ <varlistentry>
+ <term><classname>.rich-table-header</classname></term>
+ <listitem>
+ <para>
+ This class defines the styles for a table header row.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </entry>
+ <entry><literal>headerBackgroundColor</literal></entry>
+ <entry><literal>background-color</literal></entry>
+ </row>
+
+ <row>
+ <entry>
+ <variablelist>
+ <varlistentry>
+ <term><classname>.rich-table-header-continue</classname></term>
+ <listitem>
+ <para>
+ This class defines the styles for all header lines after the first.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </entry>
+ <entry><literal>headerBackgroundColor</literal></entry>
+ <entry><literal>background-color</literal></entry>
+ </row>
+
+ <row>
+ <entry morerows="4">
+ <variablelist>
+ <varlistentry>
+ <term><classname>.rich-table-headercell</classname></term>
+ <listitem>
+ <para>
+ This class defines the styles for a header cell.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </entry>
+ <entry><literal>tableBorderWidth</literal>, <literal>tableBorderColor</literal></entry>
+ <entry><literal>border-right, border-bottom</literal></entry>
+ </row>
+ <row>
+ <entry><literal>headerTextColor</literal></entry>
+ <entry><literal>color</literal></entry>
+ </row>
+ <row>
+ <entry><literal>headerWeightFont</literal></entry>
+ <entry><literal>font-weight</literal></entry>
+ </row>
+ <row>
+ <entry><literal>generalSizeFont</literal></entry>
+ <entry><literal>font-size</literal></entry>
+ </row>
+ <row>
+ <entry><literal>generalFamilyFont</literal></entry>
+ <entry><literal>font-family</literal></entry>
+ </row>
+
+ <row>
+ <entry>
+ <variablelist>
+ <varlistentry>
+ <term><classname>.rich-table-subheader</classname></term>
+ <listitem>
+ <para>
+ This class defines the styles for a column header.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </entry>
+ <entry><literal>additionalBackgroundColor</literal></entry>
+ <entry><literal>background-color</literal></entry>
+ </row>
+
+ <row>
+ <entry>
+ <variablelist>
+ <varlistentry>
+ <term><classname>.rich-table-thead</classname></term>
+ <listitem>
+ <para>
+ This class defines the styles for the separator between the header and the rest of the table.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </entry>
+ <entry><literal>tableBorderWidth</literal>, <literal>tableBorderColor</literal></entry>
+ <entry><literal>border-bottom</literal></entry>
+ </row>
+
+ <row>
+ <entry morerows="3">
+ <variablelist>
+ <varlistentry>
+ <term><classname>.rich-table-subheadercell</classname></term>
+ <listitem>
+ <para>
+ This class defines the styles for a column header cell.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </entry>
+ <entry><literal>tableBorderWidth</literal>, <literal>tableBorderColor</literal></entry>
+ <entry><literal>border-right</literal></entry>
+ </row>
+ <row>
+ <entry><literal>generalTextColor</literal></entry>
+ <entry><literal>color</literal></entry>
+ </row>
+ <row>
+ <entry><literal>generalSizeFont</literal></entry>
+ <entry><literal>font-size</literal></entry>
+ </row>
+ <row>
+ <entry><literal>generalFamilyFont</literal></entry>
+ <entry><literal>font-family</literal></entry>
+ </row>
+
+ <row>
+ <entry>
+ <variablelist>
+ <varlistentry>
+ <term><classname>.rich-table-footer</classname></term>
+ <listitem>
+ <para>
+ This class defines the styles for a footer row.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </entry>
+ <entry><literal>tableFooterBackgroundColor</literal></entry>
+ <entry><literal>background-color</literal></entry>
+ </row>
+
+ <row>
+ <entry>
+ <variablelist>
+ <varlistentry>
+ <term><classname>.rich-table-footer-continue</classname></term>
+ <listitem>
+ <para>
+ This class defines the styles for all footer lines after the first.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </entry>
+ <entry><literal>tableFooterBackgroundColor</literal></entry>
+ <entry><literal>background-color</literal></entry>
+ </row>
+
+ <row>
+ <entry morerows="4">
+ <variablelist>
+ <varlistentry>
+ <term><classname>.rich-table-footercell</classname></term>
+ <listitem>
+ <para>
+ This class defines styles for a footer cell.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </entry>
+ <entry><literal>tableBorderWidth, tableBorderColor</literal></entry>
+ <entry><literal>border-right, border-bottom</literal></entry>
+ </row>
+ <row>
+ <entry><literal>generalTextColor</literal></entry>
+ <entry><literal>color</literal></entry>
+ </row>
+ <row>
+ <entry><literal>headerWeightFont</literal></entry>
+ <entry><literal>font-weight</literal></entry>
+ </row>
+ <row>
+ <entry><literal>generalSizeFont</literal></entry>
+ <entry><literal>font-size</literal></entry>
+ </row>
+ <row>
+ <entry><literal>generalFamilyFont</literal></entry>
+ <entry><literal>font-family</literal></entry>
+ </row>
+
+ <row>
+ <entry>
+ <variablelist>
+ <varlistentry>
+ <term><classname>.rich-table-subfooter</classname></term>
+ <listitem>
+ <para>
+ This class defines the styles for a column footer.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </entry>
+ <entry><literal>tableSubfooterBackgroundColor</literal></entry>
+ <entry><literal>background-color</literal></entry>
+ </row>
+
+ <row>
+ <entry morerows="3">
+ <variablelist>
+ <varlistentry>
+ <term><classname>.rich-table-subfootercell</classname></term>
+ <listitem>
+ <para>
+ This class defines the styles for a column footer cell.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </entry>
+ <entry><literal>tableBorderWidth</literal>, <literal>tableBorderColor</literal></entry>
+ <entry><literal>border-right</literal>, <literal>border-bottom</literal></entry>
+ </row>
+ <row>
+ <entry><literal>generalTextColor</literal></entry>
+ <entry><literal>color</literal></entry>
+ </row>
+ <row>
+ <entry><literal>generalSizeFont</literal></entry>
+ <entry><literal>font-size</literal></entry>
+ </row>
+ <row>
+ <entry><literal>generalFamilyFont</literal></entry>
+ <entry><literal>font-family</literal></entry>
+ </row>
+
+ <row>
+ <entry>
+ <variablelist>
+ <varlistentry>
+ <term><classname>.rich-table-row</classname></term>
+ <listitem>
+ <para>
+ This class defines styles for a table row.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </entry>
+ <entry spanname="noskin">No skin parameters.</entry>
+ </row>
+
+ <row>
+ <entry>
+ <variablelist>
+ <varlistentry>
+ <term><classname>.rich-table-firstrow</classname></term>
+ <listitem>
+ <para>
+ This class defines styles for a table's first row.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </entry>
+ <entry spanname="noskin">No skin parameters.</entry>
+ </row>
+
+ <row>
+ <entry>
+ <variablelist>
+ <varlistentry>
+ <term><classname>.rich-table-caption</classname></term>
+ <listitem>
+ <para>
+ This class defines styles for a "caption" facet element.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </entry>
+ <entry spanname="noskin">No skin parameters.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</table>
Modified: modules/docs/trunk/Developer_Guide/src/main/docbook/en-US/appe-Developer_Guide-Style_classes_and_skin_parameters.xml
===================================================================
--- modules/docs/trunk/Developer_Guide/src/main/docbook/en-US/appe-Developer_Guide-Style_classes_and_skin_parameters.xml 2011-01-08 23:28:47 UTC (rev 20922)
+++ modules/docs/trunk/Developer_Guide/src/main/docbook/en-US/appe-Developer_Guide-Style_classes_and_skin_parameters.xml 2011-01-10 05:02:39 UTC (rev 20923)
@@ -6,6 +6,14 @@
<para>
Each of the <productname>RichFaces</productname> components are listed below, along with their style classes and skin parameters. For further details on each component, refer to the relevant section in the <citetitle>RichFaces Component Reference</citetitle>.
</para>
- <xi:include href="http://anonsvn.jboss.org/repos/richfaces/modules/docs/trunk/Component_Ref..." xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <!-- This appendix pulls in the skinning reference tables from the Component Reference -->
+ <section id="sect-Component_Reference-richdataTable-Style_classes_and_skin_parameters">
+ <title><sgmltag><rich:dataTable></sgmltag></title>
+ <xi:include href="skinning/tabl-richdataTable.xml" xmlns:xi="http://www.w3.org/2001/XInclude">
+ <xi:fallback xmlns:xi="http://www.w3.org/2001/XInclude">
+ <xi:include href="http://anonsvn.jboss.org/repos/richfaces/modules/docs/trunk/Component_Ref..." xmlns:xi="http://www.w3.org/2001/XInclude" />
+ </xi:fallback>
+ </xi:include>
+ </section>
</appendix>
13 years, 11 months
JBoss Rich Faces SVN: r20922 - in modules/tests/metamer/trunk: ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richList and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2011-01-08 18:28:47 -0500 (Sat, 08 Jan 2011)
New Revision: 20922
Added:
modules/tests/metamer/trunk/application/src/main/webapp/components/richList/scroller.xhtml
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richList/AbstractListTest.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richList/TestScroller.java
Removed:
modules/tests/metamer/trunk/application/src/main/webapp/components/richList/dataScroller.xhtml
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richList/list.xhtml
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richList/ListModel.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richList/TestSimple.java
Log:
rich:list - added data scroller tests (RFPL-671)
Deleted: modules/tests/metamer/trunk/application/src/main/webapp/components/richList/dataScroller.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richList/dataScroller.xhtml 2011-01-08 22:48:22 UTC (rev 20921)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richList/dataScroller.xhtml 2011-01-08 23:28:47 UTC (rev 20922)
@@ -1,105 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
- xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:metamer="http://java.sun.com/jsf/composite/metamer"
- xmlns:rich="http://richfaces.org/rich">
-
- <!--
-JBoss, Home of Professional Open Source
-Copyright 2010, Red Hat, Inc. and individual contributors
-by the @authors tag. See the copyright.txt in the distribution for a
-full listing of individual contributors.
-
-This is free software; you can redistribute it and/or modify it
-under the terms of the GNU Lesser General Public License as
-published by the Free Software Foundation; either version 2.1 of
-the License, or (at your option) any later version.
-
-This software 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 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.
- -->
-
- <ui:composition template="/templates/template.xhtml">
-
- <ui:define name="head">
- <f:metadata>
- <f:viewParam name="templates" value="#{templateBean.templates}">
- <f:converter converterId="templatesListConverter" />
- </f:viewParam>
- </f:metadata>
- <h:outputStylesheet library="css" name="richList.css" />
-
- </ui:define>
-
- <ui:define name="outOfTemplateBefore">
- </ui:define>
-
- <ui:define name="component">
- <rich:list id="richList"
- dir="#{richListBean.attributes['dir'].value}"
- first="#{richListBean.attributes['first'].value}"
- iterationState="#{richListBean.attributes['iterationState'].value}"
- iterationStatusVar="iterationStatus"
- keepSaved="#{richListBean.attributes['keepSaved'].value}"
- lang="#{richListBean.attributes['lang'].value}"
- onclick="#{richListBean.attributes['onclick'].value}"
- ondblclick="#{richListBean.attributes['ondblclick'].value}"
- onkeydown="#{richListBean.attributes['onkeydown'].value}"
- onkeypress="#{richListBean.attributes['onkeypress'].value}"
- onkeyup="#{richListBean.attributes['onkeyup'].value}"
- onmousedown="#{richListBean.attributes['onmousedown'].value}"
- onmousemove="#{richListBean.attributes['onmousemove'].value}"
- onmouseout="#{richListBean.attributes['onmouseout'].value}"
- onmouseover="#{richListBean.attributes['onmouseover'].value}"
- onmouseup="#{richListBean.attributes['onmouseup'].value}"
- onrowclick="#{richListBean.attributes['onrowclick'].value}"
- onrowdblclick="#{richListBean.attributes['onrowdblclick'].value}"
- onrowkeydown="#{richListBean.attributes['onrowkeydown'].value}"
- onrowkeypress="#{richListBean.attributes['onrowkeypress'].value}"
- onrowkeyup="#{richListBean.attributes['onrowkeyup'].value}"
- onrowmousedown="#{richListBean.attributes['onrowmousedown'].value}"
- onrowmousemove="#{richListBean.attributes['onrowmousemove'].value}"
- onrowmouseout="#{richListBean.attributes['onrowmouseout'].value}"
- onrowmouseover="#{richListBean.attributes['onrowmouseover'].value}"
- onrowmouseup="#{richListBean.attributes['onrowmouseup'].value}"
- relativeRowIndex="#{richListBean.attributes['relativeRowIndex'].value}"
- rendered="#{richListBean.attributes['rendered'].value}"
- rowAvailable="#{richListBean.attributes['rowAvailable'].value}"
- rowClass="#{richListBean.attributes['rowClass'].value}"
- rowClasses="#{richListBean.attributes['rowClasses'].value}"
- rowCount="#{richListBean.attributes['rowCount'].value}"
- rowData="#{richListBean.attributes['rowData'].value}"
- rowIndex="#{richListBean.attributes['rowIndex'].value}"
- rowKey="#{richListBean.attributes['rowKey'].value}"
- rowKeyConverter="#{richListBean.attributes['rowKeyConverter'].value}"
- rows="#{richListBean.attributes['rows'].value}"
- style="#{richListBean.attributes['style'].value}"
- styleClass="#{richListBean.attributes['styleClass'].value}"
- value="#{model.employees}"
- var="item"
- term="#{richListBean.attributes['term'].value}"
- title="#{richListBean.attributes['title'].value}"
- type="#{richListBean.attributes['type'].value}">
- <f:facet name="term">
- <h:outputText id="term" value="#{item.title}" style="font-weight: bold"/>
- </f:facet>
-
- #{item.name}
- </rich:list>
-
- <rich:dataScroller id="dataScroller" for="richList" />
- </ui:define>
-
- <ui:define name="outOfTemplateAfter">
- <metamer:attributes value="#{richListBean.attributes}" id="attributes" />
- </ui:define>
-
- </ui:composition>
-</html>
\ No newline at end of file
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/richList/list.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richList/list.xhtml 2011-01-08 22:48:22 UTC (rev 20921)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richList/list.xhtml 2011-01-08 23:28:47 UTC (rev 20922)
@@ -35,7 +35,7 @@
Simple page that contains <b>rich:list</b> (with model containing capitals) and "term" facet which influences list in definitions mode
</metamer:testPageLink>
- <metamer:testPageLink id="dataScroller" outcome="dataScroller" value="Data Scroller">
+ <metamer:testPageLink id="scroller" outcome="scroller" value="Data Scroller">
Simple page that contains <b>rich:list</b> (with model containing capitals) with bound dataScroller
</metamer:testPageLink>
Copied: modules/tests/metamer/trunk/application/src/main/webapp/components/richList/scroller.xhtml (from rev 20921, modules/tests/metamer/trunk/application/src/main/webapp/components/richList/dataScroller.xhtml)
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richList/scroller.xhtml (rev 0)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richList/scroller.xhtml 2011-01-08 23:28:47 UTC (rev 20922)
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:metamer="http://java.sun.com/jsf/composite/metamer"
+ xmlns:rich="http://richfaces.org/rich">
+
+ <!--
+JBoss, Home of Professional Open Source
+Copyright 2010, Red Hat, Inc. and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+This software 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 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.
+ -->
+
+ <ui:composition template="/templates/template.xhtml">
+ <ui:param name="componentId" value="richList" />
+
+ <ui:define name="head">
+ <f:metadata>
+ <f:viewParam name="templates" value="#{templateBean.templates}">
+ <f:converter converterId="templatesListConverter" />
+ </f:viewParam>
+ </f:metadata>
+ <h:outputStylesheet library="css" name="richList.css" />
+
+ </ui:define>
+
+ <ui:define name="outOfTemplateBefore">
+ <rich:dataScroller id="scroller1" for="richList" maxPages="7" render="#{nestedComponentId}" />
+ </ui:define>
+
+ <ui:define name="component">
+ <rich:list id="richList"
+ dir="#{richListBean.attributes['dir'].value}"
+ first="#{richListBean.attributes['first'].value}"
+ iterationState="#{richListBean.attributes['iterationState'].value}"
+ iterationStatusVar="iterationStatus"
+ keepSaved="#{richListBean.attributes['keepSaved'].value}"
+ lang="#{richListBean.attributes['lang'].value}"
+ onclick="#{richListBean.attributes['onclick'].value}"
+ ondblclick="#{richListBean.attributes['ondblclick'].value}"
+ onkeydown="#{richListBean.attributes['onkeydown'].value}"
+ onkeypress="#{richListBean.attributes['onkeypress'].value}"
+ onkeyup="#{richListBean.attributes['onkeyup'].value}"
+ onmousedown="#{richListBean.attributes['onmousedown'].value}"
+ onmousemove="#{richListBean.attributes['onmousemove'].value}"
+ onmouseout="#{richListBean.attributes['onmouseout'].value}"
+ onmouseover="#{richListBean.attributes['onmouseover'].value}"
+ onmouseup="#{richListBean.attributes['onmouseup'].value}"
+ onrowclick="#{richListBean.attributes['onrowclick'].value}"
+ onrowdblclick="#{richListBean.attributes['onrowdblclick'].value}"
+ onrowkeydown="#{richListBean.attributes['onrowkeydown'].value}"
+ onrowkeypress="#{richListBean.attributes['onrowkeypress'].value}"
+ onrowkeyup="#{richListBean.attributes['onrowkeyup'].value}"
+ onrowmousedown="#{richListBean.attributes['onrowmousedown'].value}"
+ onrowmousemove="#{richListBean.attributes['onrowmousemove'].value}"
+ onrowmouseout="#{richListBean.attributes['onrowmouseout'].value}"
+ onrowmouseover="#{richListBean.attributes['onrowmouseover'].value}"
+ onrowmouseup="#{richListBean.attributes['onrowmouseup'].value}"
+ relativeRowIndex="#{richListBean.attributes['relativeRowIndex'].value}"
+ rendered="#{richListBean.attributes['rendered'].value}"
+ rowAvailable="#{richListBean.attributes['rowAvailable'].value}"
+ rowClass="#{richListBean.attributes['rowClass'].value}"
+ rowClasses="#{richListBean.attributes['rowClasses'].value}"
+ rowCount="#{richListBean.attributes['rowCount'].value}"
+ rowData="#{richListBean.attributes['rowData'].value}"
+ rowIndex="#{richListBean.attributes['rowIndex'].value}"
+ rowKey="#{richListBean.attributes['rowKey'].value}"
+ rowKeyConverter="#{richListBean.attributes['rowKeyConverter'].value}"
+ rows="#{richListBean.attributes['rows'].value}"
+ style="#{richListBean.attributes['style'].value}"
+ styleClass="#{richListBean.attributes['styleClass'].value}"
+ value="#{model.employees}"
+ var="item"
+ term="#{richListBean.attributes['term'].value}"
+ title="#{richListBean.attributes['title'].value}"
+ type="#{richListBean.attributes['type'].value}">
+ <f:facet name="term">
+ <h:outputText id="term" value="#{item.title}" style="font-weight: bold"/>
+ </f:facet>
+
+ #{item.name}
+ </rich:list>
+
+ <rich:dataScroller id="scroller2" for="richList" maxPages="7" render="richList scroller1" />
+ </ui:define>
+
+ <ui:define name="outOfTemplateAfter">
+ <metamer:attributes value="#{richListBean.attributes}" id="attributes" />
+ </ui:define>
+
+ </ui:composition>
+</html>
\ No newline at end of file
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richList/AbstractListTest.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richList/AbstractListTest.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richList/AbstractListTest.java 2011-01-08 23:28:47 UTC (rev 20922)
@@ -0,0 +1,138 @@
+package org.richfaces.tests.metamer.ftest.richList;
+
+import static java.lang.Math.max;
+import static java.lang.Math.min;
+import static org.jboss.test.selenium.dom.Event.CLICK;
+import static org.jboss.test.selenium.dom.Event.DBLCLICK;
+import static org.jboss.test.selenium.dom.Event.KEYDOWN;
+import static org.jboss.test.selenium.dom.Event.KEYPRESS;
+import static org.jboss.test.selenium.dom.Event.KEYUP;
+import static org.jboss.test.selenium.dom.Event.MOUSEDOWN;
+import static org.jboss.test.selenium.dom.Event.MOUSEMOVE;
+import static org.jboss.test.selenium.dom.Event.MOUSEOUT;
+import static org.jboss.test.selenium.dom.Event.MOUSEOVER;
+import static org.jboss.test.selenium.dom.Event.MOUSEUP;
+import static org.jboss.test.selenium.locator.LocatorFactory.jq;
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.richfaces.tests.metamer.ftest.richList.ListAttributes.Type.ORDERED;
+import static org.testng.Assert.assertEquals;
+
+import java.net.URL;
+import java.util.List;
+
+import org.jboss.test.selenium.dom.Event;
+import org.richfaces.tests.metamer.bean.Model;
+import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
+import org.richfaces.tests.metamer.ftest.annotations.Inject;
+import org.richfaces.tests.metamer.ftest.annotations.Use;
+import org.richfaces.tests.metamer.ftest.richList.ListAttributes.Type;
+import org.richfaces.tests.metamer.model.Employee;
+import org.testng.annotations.BeforeMethod;
+
+public abstract class AbstractListTest extends AbstractMetamerTest {
+ protected static List<Employee> EMPLOYESS = Model.unmarshallEmployees();
+ protected static final int ELEMENTS_TOTAL = EMPLOYESS.size();
+ protected static final Event[] events = { CLICK, DBLCLICK, KEYDOWN, KEYPRESS, KEYUP, MOUSEDOWN, MOUSEMOVE,
+ MOUSEOUT, MOUSEOVER, MOUSEUP };
+ protected static final Integer[] ints = { -1, 0, 1, ELEMENTS_TOTAL / 2, ELEMENTS_TOTAL - 1, ELEMENTS_TOTAL,
+ ELEMENTS_TOTAL + 1 };
+
+ ListModel list;
+ ListAttributes attributes = new ListAttributes();
+
+ @Inject
+ @Use(empty = true)
+ Integer first;
+
+ @Inject
+ @Use(empty = true)
+ Integer rows;
+
+ @Inject
+ @Use(empty = true)
+ Event event;
+
+ Type type = ORDERED;
+
+ int expectedBegin;
+ int displayedRows;
+ int expectedEnd;
+ List<Employee> expectedEmployees;
+
+ @BeforeMethod(alwaysRun = true)
+ public void prepareAttributes() {
+ list = new ListModel(jq("*[id$=richList]"));
+ attributes.setType(type);
+ list.setType(type);
+
+ if (rows == null) {
+ rows = 20;
+ }
+
+ if (first != null) {
+ attributes.setFirst(first);
+ }
+ if (rows != null) {
+ attributes.setRows(rows);
+ }
+ }
+
+ protected void verifyList() {
+ countExpectedValues();
+ verifyCounts();
+ verifyRows();
+ }
+
+ private void verifyCounts() {
+ assertEquals(list.getTotalRowCount(), displayedRows);
+ }
+
+ private void verifyRows() {
+ int rowCount = list.getTotalRowCount();
+ for (int position = 1; position <= rowCount; position++) {
+ Employee employee = expectedEmployees.get(position - 1);
+ assertEquals(list.getRowText(position), employee.getName());
+ }
+ }
+
+ private void countExpectedValues() {
+
+ // expected begin
+
+ if (first == null || first < 0) {
+ expectedBegin = 0;
+ } else {
+ expectedBegin = first;
+ }
+
+ expectedBegin = minMax(0, expectedBegin, ELEMENTS_TOTAL);
+
+ // expected displayed rows
+
+ if (rows == null || rows < 1 || rows > ELEMENTS_TOTAL) {
+ displayedRows = ELEMENTS_TOTAL;
+ } else {
+ displayedRows = rows;
+ }
+
+ if (first != null && first < 0) {
+ displayedRows = 0;
+ }
+
+ displayedRows = min(displayedRows, ELEMENTS_TOTAL - expectedBegin);
+
+ // expected end
+
+ if (rows == null || rows < 1) {
+ expectedEnd = ELEMENTS_TOTAL - 1;
+ } else {
+ expectedEnd = rows - 1;
+ }
+
+ expectedEmployees = EMPLOYESS.subList(expectedBegin, expectedBegin + displayedRows);
+ }
+
+ private int minMax(int min, int value, int max) {
+ return max(0, min(max, value));
+ }
+}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richList/ListModel.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richList/ListModel.java 2011-01-08 22:48:22 UTC (rev 20921)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richList/ListModel.java 2011-01-08 23:28:47 UTC (rev 20922)
@@ -23,13 +23,13 @@
import static org.jboss.test.selenium.locator.LocatorFactory.jq;
import static org.jboss.test.selenium.locator.reference.ReferencedLocator.ref;
-import static org.richfaces.tests.metamer.ftest.richList.ListAttributes.Type;
+
import org.jboss.test.selenium.framework.AjaxSelenium;
import org.jboss.test.selenium.framework.AjaxSeleniumProxy;
import org.jboss.test.selenium.locator.JQueryLocator;
-import org.jboss.test.selenium.locator.reference.LocatorReference;
import org.jboss.test.selenium.locator.reference.ReferencedLocator;
import org.richfaces.tests.metamer.ftest.model.AbstractModel;
+import org.richfaces.tests.metamer.ftest.richList.ListAttributes.Type;
/**
* @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richList/TestScroller.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richList/TestScroller.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richList/TestScroller.java 2011-01-08 23:28:47 UTC (rev 20922)
@@ -0,0 +1,54 @@
+package org.richfaces.tests.metamer.ftest.richList;
+
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+
+import java.net.URL;
+
+import org.richfaces.tests.metamer.ftest.annotations.Inject;
+import org.richfaces.tests.metamer.ftest.annotations.Use;
+import org.richfaces.tests.metamer.ftest.model.DataScroller;
+import org.richfaces.tests.metamer.ftest.richDataScroller.PaginationTester;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+public class TestScroller extends AbstractListTest {
+
+ @Inject
+ DataScroller dataScroller;
+ DataScroller dataScroller1 = PaginationTester.DATA_SCROLLER_OUTSIDE_TABLE;
+ DataScroller dataScroller2 = PaginationTester.DATA_SCROLLER_IN_TABLE_FOOTER;
+
+ PaginationTester paginationTester = new PaginationTester() {
+
+ @Override
+ protected void verifyBeforeScrolling() {
+ }
+
+ @Override
+ protected void verifyAfterScrolling() {
+ int currentPage = dataScroller.getCurrentPage();
+ first = rows * (currentPage - 1);
+ verifyList();
+ }
+ };
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/richList/scroller.xhtml");
+ }
+
+ @BeforeMethod
+ public void prepareComponent() {
+ paginationTester.setDataScroller(dataScroller);
+
+ int lastPage = dataScroller.obtainLastPage();
+ dataScroller.setLastPage(lastPage);
+ paginationTester.initializeTestedPages(lastPage);
+ }
+
+ @Test
+ @Use(field = "dataScroller", value = "dataScroller*")
+ public void testScrollerWithRowsAttribute() {
+ paginationTester.testNumberedPages();
+ }
+}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richList/TestSimple.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richList/TestSimple.java 2011-01-08 22:48:22 UTC (rev 20921)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richList/TestSimple.java 2011-01-08 23:28:47 UTC (rev 20922)
@@ -21,94 +21,25 @@
*******************************************************************************/
package org.richfaces.tests.metamer.ftest.richList;
-import static java.lang.Math.max;
-import static java.lang.Math.min;
-import static org.jboss.test.selenium.dom.Event.CLICK;
-import static org.jboss.test.selenium.dom.Event.DBLCLICK;
-import static org.jboss.test.selenium.dom.Event.KEYDOWN;
-import static org.jboss.test.selenium.dom.Event.KEYPRESS;
-import static org.jboss.test.selenium.dom.Event.KEYUP;
-import static org.jboss.test.selenium.dom.Event.MOUSEDOWN;
-import static org.jboss.test.selenium.dom.Event.MOUSEMOVE;
-import static org.jboss.test.selenium.dom.Event.MOUSEOUT;
-import static org.jboss.test.selenium.dom.Event.MOUSEOVER;
-import static org.jboss.test.selenium.dom.Event.MOUSEUP;
-import static org.jboss.test.selenium.locator.LocatorFactory.jq;
import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
import static org.testng.Assert.assertEquals;
-import static org.richfaces.tests.metamer.ftest.richList.ListAttributes.Type;
-import static org.richfaces.tests.metamer.ftest.richList.ListAttributes.Type.*;
import java.net.URL;
-import java.util.List;
-import org.jboss.test.selenium.dom.Event;
-import org.richfaces.tests.metamer.bean.Model;
-import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
-import org.richfaces.tests.metamer.ftest.annotations.Inject;
import org.richfaces.tests.metamer.ftest.annotations.Use;
-import org.richfaces.tests.metamer.model.Employee;
-import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
* @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
* @version $Revision$
*/
-public class TestSimple extends AbstractMetamerTest {
-
- protected static List<Employee> EMPLOYESS = Model.unmarshallEmployees();
- protected static final int ELEMENTS_TOTAL = EMPLOYESS.size();
- protected static final Event[] events = { CLICK, DBLCLICK, KEYDOWN, KEYPRESS, KEYUP, MOUSEDOWN, MOUSEMOVE,
- MOUSEOUT, MOUSEOVER, MOUSEUP };
- protected static final Integer[] ints = { -1, 0, 1, ELEMENTS_TOTAL / 2, ELEMENTS_TOTAL - 1, ELEMENTS_TOTAL,
- ELEMENTS_TOTAL + 1 };
-
- ListModel list;
- ListAttributes attributes = new ListAttributes();
-
- @Inject
- @Use(empty = true)
- Integer first;
-
- @Inject
- @Use(empty = true)
- Integer rows;
-
- @Inject
- @Use(empty = true)
- Event event;
-
- Type type = ORDERED;
-
- int expectedBegin;
- int displayedRows;
- int expectedEnd;
- List<Employee> expectedEmployees;
-
+public class TestSimple extends AbstractListTest {
+
@Override
public URL getTestUrl() {
return buildUrl(contextPath, "faces/components/richList/simple.xhtml");
}
- @BeforeMethod(alwaysRun = true)
- public void prepareAttributes() {
- list = new ListModel(jq("*[id$=richList]"));
- attributes.setType(type);
- list.setType(type);
-
- if (rows == null) {
- rows = 20;
- }
-
- if (first != null) {
- attributes.setFirst(first);
- }
- if (rows != null) {
- attributes.setRows(rows);
- }
- }
-
@Test
public void testRenderedAttribute() {
attributes.setRendered("false");
@@ -162,71 +93,13 @@
@Test
@Use(field = "first", value = "ints")
public void testFirstAttribute() {
- verifyRepeat();
+ verifyList();
}
@Test
@Use(field = "rows", value = "ints")
public void testRowsAttribute() {
- verifyRepeat();
+ verifyList();
}
- private void verifyRepeat() {
- countExpectedValues();
- verifyCounts();
- verifyRows();
- }
-
- private void verifyCounts() {
- assertEquals(list.getTotalRowCount(), displayedRows);
- }
-
- private void verifyRows() {
- int rowCount = list.getTotalRowCount();
- for (int position = 1; position <= rowCount; position++) {
- Employee employee = expectedEmployees.get(position - 1);
- assertEquals(employee.getName(), list.getRowText(position));
- }
- }
-
- private void countExpectedValues() {
-
- // expected begin
-
- if (first == null || first < 0) {
- expectedBegin = 0;
- } else {
- expectedBegin = first;
- }
-
- expectedBegin = minMax(0, expectedBegin, ELEMENTS_TOTAL);
-
- // expected displayed rows
-
- if (rows == null || rows < 1 || rows > ELEMENTS_TOTAL) {
- displayedRows = ELEMENTS_TOTAL;
- } else {
- displayedRows = rows;
- }
-
- if (first != null && first < 0) {
- displayedRows = 0;
- }
-
- displayedRows = min(displayedRows, ELEMENTS_TOTAL - expectedBegin);
-
- // expected end
-
- if (rows == null || rows < 1) {
- expectedEnd = ELEMENTS_TOTAL - 1;
- } else {
- expectedEnd = rows - 1;
- }
-
- expectedEmployees = EMPLOYESS.subList(expectedBegin, expectedBegin + displayedRows);
- }
-
- private int minMax(int min, int value, int max) {
- return max(0, min(max, value));
- }
}
\ No newline at end of file
13 years, 11 months
JBoss Rich Faces SVN: r20921 - in modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest: richList and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2011-01-08 17:48:22 -0500 (Sat, 08 Jan 2011)
New Revision: 20921
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richList/
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richList/ListAttributes.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richList/ListModel.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richList/TestSimple.java
Log:
rich:list - added initial for simple sample (RFPL-671)"
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richList/ListAttributes.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richList/ListAttributes.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richList/ListAttributes.java 2011-01-08 22:48:22 UTC (rev 20921)
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 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.tests.metamer.ftest.richList;
+
+import org.jboss.test.selenium.locator.ExtendedLocator;
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.richfaces.tests.metamer.ftest.AbstractComponentAttributes;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public class ListAttributes extends AbstractComponentAttributes {
+
+ public ListAttributes() {
+ }
+
+ public ListAttributes(ExtendedLocator<JQueryLocator> root) {
+ super(root);
+ }
+
+ public void setFirst(int first) {
+ setProperty("first", first);
+ }
+
+ public void setRendered(String rendered) {
+ setProperty("rendered", rendered);
+ }
+
+ public void setRows(int rows) {
+ setProperty("rows", rows);
+ }
+
+ public void setDir(String dir) {
+ setProperty("dir", dir);
+ }
+
+ public void setFirst(Integer first) {
+ setProperty("first", first);
+ }
+
+ public void setLang(String lang) {
+ setProperty("lang", lang);
+ }
+
+ public void setRowClass(String rowClass) {
+ setProperty("rowClass", rowClass);
+ }
+
+ public void setRows(Integer rows) {
+ setProperty("rows", rows);
+ }
+
+ public void setStyle(String style) {
+ setProperty("style", style);
+ }
+
+ public void setStyleClass(String styleClass) {
+ setProperty("styleClass", styleClass);
+ }
+
+ public void setTitle(String title) {
+ setProperty("title", title);
+ }
+
+ public void setType(Type type) {
+ setProperty("type", type);
+ }
+
+ public enum Type {
+ DEFINITIONS, ORDERED, UNORDERED;
+ }
+
+}
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richList/ListModel.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richList/ListModel.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richList/ListModel.java 2011-01-08 22:48:22 UTC (rev 20921)
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 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.tests.metamer.ftest.richList;
+
+import static org.jboss.test.selenium.locator.LocatorFactory.jq;
+import static org.jboss.test.selenium.locator.reference.ReferencedLocator.ref;
+import static org.richfaces.tests.metamer.ftest.richList.ListAttributes.Type;
+import org.jboss.test.selenium.framework.AjaxSelenium;
+import org.jboss.test.selenium.framework.AjaxSeleniumProxy;
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.jboss.test.selenium.locator.reference.LocatorReference;
+import org.jboss.test.selenium.locator.reference.ReferencedLocator;
+import org.richfaces.tests.metamer.ftest.model.AbstractModel;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public class ListModel extends AbstractModel<JQueryLocator> {
+
+ public ListModel(JQueryLocator root) {
+ super(root);
+ }
+
+ Type type;
+
+ ReferencedLocator<JQueryLocator> rows = ref(root, "li");
+
+ private AjaxSelenium selenium = AjaxSeleniumProxy.getInstance();
+
+ public Type getType() {
+ return type;
+ }
+
+ public void setType(Type type) {
+ this.type = type;
+ }
+
+ public boolean isRendered() {
+ return selenium.isElementPresent(getRoot());
+ }
+
+ public int getTotalRowCount() {
+ return selenium.getCount(getRoot().getChild(getInnerElement()));
+ }
+
+ public JQueryLocator getRow(int position) {
+ return getRoot().getChild(getInnerElement()).getNthChildElement(position);
+ }
+
+ public Iterable<JQueryLocator> getRows() {
+ return getRoot().getChild(getInnerElement()).getAllChildren();
+ }
+
+ public String getRowText(int position) {
+ return selenium.getText(getRow(position));
+ }
+
+ private JQueryLocator getInnerElement() {
+ switch (type) {
+ case ORDERED:
+ return jq("li.rf-olst-itm");
+ case UNORDERED:
+ return jq("li.rf-ulst-itm");
+ case DEFINITIONS:
+ return jq("dd.rf-dlst-dfn");
+ }
+ throw new IllegalStateException();
+ }
+}
\ No newline at end of file
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richList/TestSimple.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richList/TestSimple.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richList/TestSimple.java 2011-01-08 22:48:22 UTC (rev 20921)
@@ -0,0 +1,232 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 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.tests.metamer.ftest.richList;
+
+import static java.lang.Math.max;
+import static java.lang.Math.min;
+import static org.jboss.test.selenium.dom.Event.CLICK;
+import static org.jboss.test.selenium.dom.Event.DBLCLICK;
+import static org.jboss.test.selenium.dom.Event.KEYDOWN;
+import static org.jboss.test.selenium.dom.Event.KEYPRESS;
+import static org.jboss.test.selenium.dom.Event.KEYUP;
+import static org.jboss.test.selenium.dom.Event.MOUSEDOWN;
+import static org.jboss.test.selenium.dom.Event.MOUSEMOVE;
+import static org.jboss.test.selenium.dom.Event.MOUSEOUT;
+import static org.jboss.test.selenium.dom.Event.MOUSEOVER;
+import static org.jboss.test.selenium.dom.Event.MOUSEUP;
+import static org.jboss.test.selenium.locator.LocatorFactory.jq;
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.testng.Assert.assertEquals;
+import static org.richfaces.tests.metamer.ftest.richList.ListAttributes.Type;
+import static org.richfaces.tests.metamer.ftest.richList.ListAttributes.Type.*;
+
+import java.net.URL;
+import java.util.List;
+
+import org.jboss.test.selenium.dom.Event;
+import org.richfaces.tests.metamer.bean.Model;
+import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
+import org.richfaces.tests.metamer.ftest.annotations.Inject;
+import org.richfaces.tests.metamer.ftest.annotations.Use;
+import org.richfaces.tests.metamer.model.Employee;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public class TestSimple extends AbstractMetamerTest {
+
+ protected static List<Employee> EMPLOYESS = Model.unmarshallEmployees();
+ protected static final int ELEMENTS_TOTAL = EMPLOYESS.size();
+ protected static final Event[] events = { CLICK, DBLCLICK, KEYDOWN, KEYPRESS, KEYUP, MOUSEDOWN, MOUSEMOVE,
+ MOUSEOUT, MOUSEOVER, MOUSEUP };
+ protected static final Integer[] ints = { -1, 0, 1, ELEMENTS_TOTAL / 2, ELEMENTS_TOTAL - 1, ELEMENTS_TOTAL,
+ ELEMENTS_TOTAL + 1 };
+
+ ListModel list;
+ ListAttributes attributes = new ListAttributes();
+
+ @Inject
+ @Use(empty = true)
+ Integer first;
+
+ @Inject
+ @Use(empty = true)
+ Integer rows;
+
+ @Inject
+ @Use(empty = true)
+ Event event;
+
+ Type type = ORDERED;
+
+ int expectedBegin;
+ int displayedRows;
+ int expectedEnd;
+ List<Employee> expectedEmployees;
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/richList/simple.xhtml");
+ }
+
+ @BeforeMethod(alwaysRun = true)
+ public void prepareAttributes() {
+ list = new ListModel(jq("*[id$=richList]"));
+ attributes.setType(type);
+ list.setType(type);
+
+ if (rows == null) {
+ rows = 20;
+ }
+
+ if (first != null) {
+ attributes.setFirst(first);
+ }
+ if (rows != null) {
+ attributes.setRows(rows);
+ }
+ }
+
+ @Test
+ public void testRenderedAttribute() {
+ attributes.setRendered("false");
+ assertEquals(list.isRendered(), false);
+ }
+
+ @Test
+ public void testDirAttribute() {
+ testDir(list.getRoot());
+ }
+
+ @Test
+ public void testLangAttribute() {
+ testLang(list.getRoot());
+ }
+
+ @Test
+ public void testStyleClassAttribute() {
+ testStyleClass(list.getRoot(), "styleClass");
+ }
+
+ @Test
+ public void testRowClassesAttribute() {
+ testStyleClass(list.getRow(1), "rowClass");
+ testStyleClass(list.getRow(rows), "rowClass");
+ }
+
+ @Test
+ public void testStyle() {
+ testStyle(list.getRoot(), "style");
+ }
+
+ @Test
+ public void testTitle() {
+ testTitle(list.getRoot());
+ }
+
+ @Test
+ @Use(field = "event", value = "events")
+ public void testEvent() {
+ testFireEvent(event, list.getRoot());
+ }
+
+ @Test
+ @Use(field = "event", value = "events")
+ public void testRowEvent() {
+ testFireEvent(event, list.getRow(1), "row" + event.getEventName());
+ testFireEvent(event, list.getRow(rows), "row" + event.getEventName());
+ }
+
+ @Test
+ @Use(field = "first", value = "ints")
+ public void testFirstAttribute() {
+ verifyRepeat();
+ }
+
+ @Test
+ @Use(field = "rows", value = "ints")
+ public void testRowsAttribute() {
+ verifyRepeat();
+ }
+
+ private void verifyRepeat() {
+ countExpectedValues();
+ verifyCounts();
+ verifyRows();
+ }
+
+ private void verifyCounts() {
+ assertEquals(list.getTotalRowCount(), displayedRows);
+ }
+
+ private void verifyRows() {
+ int rowCount = list.getTotalRowCount();
+ for (int position = 1; position <= rowCount; position++) {
+ Employee employee = expectedEmployees.get(position - 1);
+ assertEquals(employee.getName(), list.getRowText(position));
+ }
+ }
+
+ private void countExpectedValues() {
+
+ // expected begin
+
+ if (first == null || first < 0) {
+ expectedBegin = 0;
+ } else {
+ expectedBegin = first;
+ }
+
+ expectedBegin = minMax(0, expectedBegin, ELEMENTS_TOTAL);
+
+ // expected displayed rows
+
+ if (rows == null || rows < 1 || rows > ELEMENTS_TOTAL) {
+ displayedRows = ELEMENTS_TOTAL;
+ } else {
+ displayedRows = rows;
+ }
+
+ if (first != null && first < 0) {
+ displayedRows = 0;
+ }
+
+ displayedRows = min(displayedRows, ELEMENTS_TOTAL - expectedBegin);
+
+ // expected end
+
+ if (rows == null || rows < 1) {
+ expectedEnd = ELEMENTS_TOTAL - 1;
+ } else {
+ expectedEnd = rows - 1;
+ }
+
+ expectedEmployees = EMPLOYESS.subList(expectedBegin, expectedBegin + displayedRows);
+ }
+
+ private int minMax(int min, int value, int max) {
+ return max(0, min(max, value));
+ }
+}
\ No newline at end of file
13 years, 11 months
JBoss Rich Faces SVN: r20920 - in modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest: annotations and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2011-01-08 17:47:41 -0500 (Sat, 08 Jan 2011)
New Revision: 20920
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/MatrixConfigurator.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/annotations/Use.java
Log:
MatrixConfigurator - added @Use support for enumeration and useNull properties
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/MatrixConfigurator.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/MatrixConfigurator.java 2011-01-08 22:47:08 UTC (rev 20919)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/MatrixConfigurator.java 2011-01-08 22:47:41 UTC (rev 20920)
@@ -301,71 +301,94 @@
}
private List<? extends Object> getUseParameter(Class<?> testClass, Class<?> parameterType, Use useAnnotation) {
+
+ List<Object> result = new LinkedList<Object>();
+
if (useAnnotation.empty()) {
- return Arrays.asList(new Object[] { null });
+ result.addAll(Arrays.asList(new Object[] { null }));
}
if (useAnnotation.ints().length > 0) {
if (parameterType == int.class || parameterType == Integer.class) {
- return Arrays.asList(ArrayUtils.toObject(useAnnotation.ints()));
+ result.addAll(Arrays.asList(ArrayUtils.toObject(useAnnotation.ints())));
}
}
if (useAnnotation.decimals().length > 0) {
if (parameterType == double.class || parameterType == Double.class) {
- return Arrays.asList(ArrayUtils.toObject(useAnnotation.decimals()));
+ result.addAll(Arrays.asList(ArrayUtils.toObject(useAnnotation.decimals())));
}
}
if (useAnnotation.strings().length > 0) {
if (parameterType == String.class) {
- return Arrays.asList(useAnnotation.strings());
+ result.addAll(Arrays.asList(useAnnotation.strings()));
}
}
if (useAnnotation.booleans().length > 0) {
if (parameterType == boolean.class || parameterType == Boolean.class) {
- return Arrays.asList(ArrayUtils.toObject(useAnnotation.booleans()));
+ result.addAll(Arrays.asList(ArrayUtils.toObject(useAnnotation.booleans())));
}
}
+
+ if (useAnnotation.enumeration()) {
+ if (!parameterType.isEnum()) {
+ throw new IllegalArgumentException(parameterType + "have to be enumeration");
+ }
+
+ result.addAll(Arrays.asList((Object) parameterType.getEnumConstants()));
+ }
// tries satisfy parameter from fields
- List<Object> result = new LinkedList<Object>();
- Object testInstance = getTestInstance(testClass);
- for (int i = 0; i < useAnnotation.value().length; i++) {
- boolean satisfied = false;
- String namePattern = useAnnotation.value()[i];
- namePattern = StringUtils.replace(namePattern, "*", ".+");
- namePattern = StringUtils.replace(namePattern, "?", ".");
-
- for (Field field : getAllFields(testClass)) {
- Pattern pattern = Pattern.compile(namePattern);
- if (pattern.matcher(field.getName()).matches()) {
- boolean isArray = field.getType().isArray();
- Class<?> representedType;
- if (isArray) {
- representedType = field.getType().getComponentType();
- } else {
- representedType = field.getType();
- }
- if (parameterType.isAssignableFrom(representedType)) {
- Object[] assignments = getDeclaredFieldValues(testInstance, field);
- for (Object assignment : assignments) {
- result.add(assignment);
+ if (result.isEmpty()) {
+ Object testInstance = getTestInstance(testClass);
+ for (int i = 0; i < useAnnotation.value().length; i++) {
+ boolean satisfied = false;
+ String namePattern = useAnnotation.value()[i];
+ namePattern = StringUtils.replace(namePattern, "*", ".+");
+ namePattern = StringUtils.replace(namePattern, "?", ".");
+
+ for (Field field : getAllFields(testClass)) {
+ Pattern pattern = Pattern.compile(namePattern);
+ if (pattern.matcher(field.getName()).matches()) {
+ boolean isArray = field.getType().isArray();
+ Class<?> representedType;
+ if (isArray) {
+ representedType = field.getType().getComponentType();
+ } else {
+ representedType = field.getType();
}
- satisfied = true;
- } else {
- throw new IllegalStateException("cannot satisfy parameter with declared field"
- + field.getName());
+ if (parameterType.isAssignableFrom(representedType)) {
+ Object[] assignments = getDeclaredFieldValues(testInstance, field);
+ for (Object assignment : assignments) {
+ result.add(assignment);
+ }
+ satisfied = true;
+ } else {
+ throw new IllegalStateException("cannot satisfy parameter with declared field "
+ + field.getName());
+ }
}
}
+ if (satisfied) {
+ continue;
+ }
+ throw new IllegalStateException("cannot find the field satysfying injection point with name pattern: "
+ + useAnnotation.value()[i]);
}
- if (satisfied) {
- continue;
+ }
+
+ if (useAnnotation.useNull()) {
+ if (parameterType.isPrimitive()) {
+ throw new IllegalArgumentException("parameterType is primitive, can't use null value");
}
- throw new IllegalStateException("cannot find the field satysfying injection point with name pattern: "
- + useAnnotation.value()[i]);
+
+ if (result.contains(null)) {
+ result.addAll(null);
+ }
}
+
return result;
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/annotations/Use.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/annotations/Use.java 2011-01-08 22:47:08 UTC (rev 20919)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/annotations/Use.java 2011-01-08 22:47:41 UTC (rev 20920)
@@ -36,14 +36,18 @@
String field() default "";
String[] value() default {};
-
+
String[] strings() default {};
-
+
boolean[] booleans() default {};
int[] ints() default {};
-
+
double[] decimals() default {};
-
- boolean empty() default false;
+
+ boolean enumeration() default false;
+
+ boolean useNull() default false;
+
+ boolean empty() default false;
}
13 years, 11 months
JBoss Rich Faces SVN: r20919 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2011-01-08 17:47:08 -0500 (Sat, 08 Jan 2011)
New Revision: 20919
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractComponentAttributes.java
Log:
fixed AbstractComponentAttributes for checking radio box which is currently checked
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractComponentAttributes.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractComponentAttributes.java 2011-01-08 22:46:38 UTC (rev 20918)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractComponentAttributes.java 2011-01-08 22:47:08 UTC (rev 20919)
@@ -93,7 +93,12 @@
} else if ("radio".equals(inputType)) {
locator = propertyLocator.format(propertyName, "[value="
+ ("".equals(valueAsString) ? "null" : valueAsString) + "]");
- guardHttp(selenium).click(locator);
+
+ if (selenium.isChecked(locator)) {
+ guardHttp(selenium).fireEvent(locator, Event.CHANGE);
+ } else {
+ guardHttp(selenium).click(locator);
+ }
}
}
13 years, 11 months
JBoss Rich Faces SVN: r20918 - in modules/tests/metamer/trunk/application/src/main: webapp/components/richList and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2011-01-08 17:46:38 -0500 (Sat, 08 Jan 2011)
New Revision: 20918
Added:
modules/tests/metamer/trunk/application/src/main/webapp/components/richList/dataScroller.xhtml
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichListBean.java
modules/tests/metamer/trunk/application/src/main/webapp/components/richList/list.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/richList/simple.xhtml
Log:
updated rich:list samples to allow test it (RFPL-671)
Modified: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichListBean.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichListBean.java 2011-01-08 22:45:44 UTC (rev 20917)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichListBean.java 2011-01-08 22:46:38 UTC (rev 20918)
@@ -54,14 +54,15 @@
logger = LoggerFactory.getLogger(getClass());
logger.debug("initializing bean " + getClass().getName());
- attributes = Attributes.getComponentAttributesFromClass(UIList.class, getClass());
+ attributes = Attributes.getComponentAttributesFromFacesConfig(UIList.class, getClass());
attributes.setAttribute("type", "ordered");
attributes.setAttribute("rendered", true);
attributes.setAttribute("rows", 20);
// TODO has to be tested in other way
- attributes.remove("componentState");
+ attributes.remove("keepSaved");
+ attributes.remove("iterationStatusVar");
attributes.remove("rowKeyVar");
attributes.remove("stateVar");
attributes.remove("value");
Copied: modules/tests/metamer/trunk/application/src/main/webapp/components/richList/dataScroller.xhtml (from rev 20917, modules/tests/metamer/trunk/application/src/main/webapp/components/richList/simple.xhtml)
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richList/dataScroller.xhtml (rev 0)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richList/dataScroller.xhtml 2011-01-08 22:46:38 UTC (rev 20918)
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:metamer="http://java.sun.com/jsf/composite/metamer"
+ xmlns:rich="http://richfaces.org/rich">
+
+ <!--
+JBoss, Home of Professional Open Source
+Copyright 2010, Red Hat, Inc. and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+This software 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 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.
+ -->
+
+ <ui:composition template="/templates/template.xhtml">
+
+ <ui:define name="head">
+ <f:metadata>
+ <f:viewParam name="templates" value="#{templateBean.templates}">
+ <f:converter converterId="templatesListConverter" />
+ </f:viewParam>
+ </f:metadata>
+ <h:outputStylesheet library="css" name="richList.css" />
+
+ </ui:define>
+
+ <ui:define name="outOfTemplateBefore">
+ </ui:define>
+
+ <ui:define name="component">
+ <rich:list id="richList"
+ dir="#{richListBean.attributes['dir'].value}"
+ first="#{richListBean.attributes['first'].value}"
+ iterationState="#{richListBean.attributes['iterationState'].value}"
+ iterationStatusVar="iterationStatus"
+ keepSaved="#{richListBean.attributes['keepSaved'].value}"
+ lang="#{richListBean.attributes['lang'].value}"
+ onclick="#{richListBean.attributes['onclick'].value}"
+ ondblclick="#{richListBean.attributes['ondblclick'].value}"
+ onkeydown="#{richListBean.attributes['onkeydown'].value}"
+ onkeypress="#{richListBean.attributes['onkeypress'].value}"
+ onkeyup="#{richListBean.attributes['onkeyup'].value}"
+ onmousedown="#{richListBean.attributes['onmousedown'].value}"
+ onmousemove="#{richListBean.attributes['onmousemove'].value}"
+ onmouseout="#{richListBean.attributes['onmouseout'].value}"
+ onmouseover="#{richListBean.attributes['onmouseover'].value}"
+ onmouseup="#{richListBean.attributes['onmouseup'].value}"
+ onrowclick="#{richListBean.attributes['onrowclick'].value}"
+ onrowdblclick="#{richListBean.attributes['onrowdblclick'].value}"
+ onrowkeydown="#{richListBean.attributes['onrowkeydown'].value}"
+ onrowkeypress="#{richListBean.attributes['onrowkeypress'].value}"
+ onrowkeyup="#{richListBean.attributes['onrowkeyup'].value}"
+ onrowmousedown="#{richListBean.attributes['onrowmousedown'].value}"
+ onrowmousemove="#{richListBean.attributes['onrowmousemove'].value}"
+ onrowmouseout="#{richListBean.attributes['onrowmouseout'].value}"
+ onrowmouseover="#{richListBean.attributes['onrowmouseover'].value}"
+ onrowmouseup="#{richListBean.attributes['onrowmouseup'].value}"
+ relativeRowIndex="#{richListBean.attributes['relativeRowIndex'].value}"
+ rendered="#{richListBean.attributes['rendered'].value}"
+ rowAvailable="#{richListBean.attributes['rowAvailable'].value}"
+ rowClass="#{richListBean.attributes['rowClass'].value}"
+ rowClasses="#{richListBean.attributes['rowClasses'].value}"
+ rowCount="#{richListBean.attributes['rowCount'].value}"
+ rowData="#{richListBean.attributes['rowData'].value}"
+ rowIndex="#{richListBean.attributes['rowIndex'].value}"
+ rowKey="#{richListBean.attributes['rowKey'].value}"
+ rowKeyConverter="#{richListBean.attributes['rowKeyConverter'].value}"
+ rows="#{richListBean.attributes['rows'].value}"
+ style="#{richListBean.attributes['style'].value}"
+ styleClass="#{richListBean.attributes['styleClass'].value}"
+ value="#{model.employees}"
+ var="item"
+ term="#{richListBean.attributes['term'].value}"
+ title="#{richListBean.attributes['title'].value}"
+ type="#{richListBean.attributes['type'].value}">
+ <f:facet name="term">
+ <h:outputText id="term" value="#{item.title}" style="font-weight: bold"/>
+ </f:facet>
+
+ #{item.name}
+ </rich:list>
+
+ <rich:dataScroller id="dataScroller" for="richList" />
+ </ui:define>
+
+ <ui:define name="outOfTemplateAfter">
+ <metamer:attributes value="#{richListBean.attributes}" id="attributes" />
+ </ui:define>
+
+ </ui:composition>
+</html>
\ No newline at end of file
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/richList/list.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richList/list.xhtml 2011-01-08 22:45:44 UTC (rev 20917)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richList/list.xhtml 2011-01-08 22:46:38 UTC (rev 20918)
@@ -32,9 +32,12 @@
<ui:define name="links">
<metamer:testPageLink id="simple" outcome="simple" value="Simple">
- Simple page that contains <b>rich:list</b> (with model containing capitals) and
- input boxes for all its attributes.
+ Simple page that contains <b>rich:list</b> (with model containing capitals) and "term" facet which influences list in definitions mode
</metamer:testPageLink>
+
+ <metamer:testPageLink id="dataScroller" outcome="dataScroller" value="Data Scroller">
+ Simple page that contains <b>rich:list</b> (with model containing capitals) with bound dataScroller
+ </metamer:testPageLink>
</ui:define>
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/richList/simple.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richList/simple.xhtml 2011-01-08 22:45:44 UTC (rev 20917)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richList/simple.xhtml 2011-01-08 22:46:38 UTC (rev 20918)
@@ -46,7 +46,7 @@
dir="#{richListBean.attributes['dir'].value}"
first="#{richListBean.attributes['first'].value}"
iterationState="#{richListBean.attributes['iterationState'].value}"
- iterationStatusVar="#{richListBean.attributes['iterationStatusVar'].value}"
+ iterationStatusVar="iterationStatus"
keepSaved="#{richListBean.attributes['keepSaved'].value}"
lang="#{richListBean.attributes['lang'].value}"
onclick="#{richListBean.attributes['onclick'].value}"
@@ -93,8 +93,6 @@
#{item.name}
</rich:list>
-
- <rich:dataScroller id="dataScroller" for="richList" />
</ui:define>
<ui:define name="outOfTemplateAfter">
13 years, 11 months
JBoss Rich Faces SVN: r20917 - modules/tests/metamer/trunk.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2011-01-08 17:45:44 -0500 (Sat, 08 Jan 2011)
New Revision: 20917
Modified:
modules/tests/metamer/trunk/release.sh
Log:
check for parent version (RFPL-917)
Modified: modules/tests/metamer/trunk/release.sh
===================================================================
--- modules/tests/metamer/trunk/release.sh 2011-01-08 00:55:42 UTC (rev 20916)
+++ modules/tests/metamer/trunk/release.sh 2011-01-08 22:45:44 UTC (rev 20917)
@@ -1,8 +1,9 @@
#!/bin/bash
RICHFACES_VERSION=`grep '<version.richfaces>' pom.xml | sed -r 's#.*>([^<]+)<.*#\1#'`
-echo "Project defines following version of RichFaces ${RICHFACES_VERSION}"
+echo "Project defines following version of RichFaces: ${RICHFACES_VERSION}"
echo $RICHFACES_VERSION | egrep -q '\-SNAPSHOT$' && { echo "The project cannot depend on SNAPSHOT version, correct the version first and try again."; exit 2; }
+perl -e 'open (FILE, "<", "pom.xml"); local $/; $file=<FILE>; close (FILE); if ($file !~ m#\>'$RICHFACES_VERSION'\<\/version\>\s+\<\/parent\>#sg) { exit 1 }' || { echo "The project parent have to be same version like RichFaces version"; exit 3; }
echo "Is this version correct?"
read -p 'Press ENTER to continue or Ctrl+C for exit...'
read -p 'Enter release version: ' RELEASE
13 years, 11 months
JBoss Rich Faces SVN: r20916 - in trunk: cdk/generator/src/main/java/org/richfaces/cdk/apt and 13 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2011-01-07 19:55:42 -0500 (Fri, 07 Jan 2011)
New Revision: 20916
Removed:
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/JsfSubComponent.java
Modified:
trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/Event.java
trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/JsfBehavior.java
trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/JsfComponent.java
trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/JsfConverter.java
trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/JsfRenderer.java
trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/JsfValidator.java
trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/RendererSpecificComponent.java
trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/TagType.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/AptSourceUtils.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/ReflectionUtils.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/SourceUtils.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/AttributesProcessorImpl.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/BehaviorProcessor.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/ConverterProcessor.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/DescriptionProcessor.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/DescriptionProcessorImpl.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/EventProcessor.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/FunctionProcessor.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/ProcessorBase.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/RendererProcessor.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/ValidatorProcessor.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/FreeMarkerWriter.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/LibraryModelWrapper.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/ModelElementBaseTemplateModel.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibGeneratorVisitor.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/DescriptionGroup.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/DescriptionGroupBase.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/EventModel.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/ModelElementBase.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/validator/ValidatorImpl.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java
trunk/cdk/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/DescriptionGroupBean.java
trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/AptSourceUtilsAnnotationsTest.java
trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/processors/BehaviorProcessorTest.java
trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/processors/ComponentProcessorTest.java
trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/processors/DescriptionProcessorTest.java
trunk/cdk/generator/src/test/java/org/richfaces/cdk/templatecompiler/RendererTemplateParserTest.java
trunk/cdk/generator/src/test/java/org/richfaces/cdk/xmlconfig/FacesConfigTest.java
trunk/cdk/generator/src/test/java/org/richfaces/cdk/xmlconfig/FragmentParserTest.java
trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/AbstractTestComponent.java
trunk/ui/core/ui/src/main/java/org/richfaces/component/UIRepeat.java
Log:
RESOLVED - issue RF-10093: https://issues.jboss.org/browse/RF-10093
Modified: trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/Event.java
===================================================================
--- trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/Event.java 2011-01-07 10:58:02 UTC (rev 20915)
+++ trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/Event.java 2011-01-08 00:55:42 UTC (rev 20916)
@@ -23,6 +23,8 @@
package org.richfaces.cdk.annotations;
+import javax.faces.component.UIComponent;
+import javax.faces.event.FacesEvent;
import javax.faces.event.FacesListener;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
@@ -50,13 +52,18 @@
public static final String NAME = "org.richfaces.cdk.annotations.Event";
/**
+ * <p class="changed_added_4_0">Used in the {@link JsfComponent} only, to define event type.</p>
+ * @return
+ */
+ public Class<? extends FacesEvent> value() default DEFAULT.class;
+ /**
* <p class="changed_added_4_0">
- * The listener interface class that process annotated event. This is mandatory parameter.
+ * The listener interface class that process annotated event.
* </p>
*
* @return name of listener interface
*/
- public Class<? extends FacesListener> listener();
+ public Class<? extends FacesListener> listener() default DEFAULT_LISTENER.class;
/**
* <p class="changed_added_4_0">Name for the listener interface method that process annotated event type.</p>
@@ -82,4 +89,24 @@
*/
public Tag[] tag() default {};
+ @SuppressWarnings("serial")
+ static final class DEFAULT extends FacesEvent {
+
+ public DEFAULT(UIComponent component) {
+ super(component);
+ }
+
+ @Override
+ public boolean isAppropriateListener(FacesListener listener) {
+ return false;
+ }
+
+ @Override
+ public void processListener(FacesListener listener) {
+ }
+ }
+
+ static final class DEFAULT_LISTENER implements FacesListener {
+
+ }
}
Modified: trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/JsfBehavior.java
===================================================================
--- trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/JsfBehavior.java 2011-01-07 10:58:02 UTC (rev 20915)
+++ trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/JsfBehavior.java 2011-01-08 00:55:42 UTC (rev 20916)
@@ -52,7 +52,7 @@
public String generate() default "";
- public Tag tag() default @Tag;
+ public Tag[] tag() default {};
public JsfBehaviorRenderer renderer() default @JsfBehaviorRenderer();
/**
@@ -77,4 +77,13 @@
* @return
*/
public String[] attributes() default {};
+
+ /**
+ * <p class="changed_added_4_0">
+ * Interfaces that should be implemented in the generated class. CDK processes all {@link Attribute} annotations in these interfaces
+ * </p>
+ *
+ * @return
+ */
+ public Class<?>[] interfaces() default {};
}
Modified: trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/JsfComponent.java
===================================================================
--- trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/JsfComponent.java 2011-01-07 10:58:02 UTC (rev 20915)
+++ trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/JsfComponent.java 2011-01-08 00:55:42 UTC (rev 20916)
@@ -134,7 +134,7 @@
*
* @return
*/
- public Class<? extends FacesEvent>[] fires() default {};
+ public Event[] fires() default {};
/**
* <p class="changed_added_4_0">
Modified: trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/JsfConverter.java
===================================================================
--- trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/JsfConverter.java 2011-01-07 10:58:02 UTC (rev 20915)
+++ trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/JsfConverter.java 2011-01-08 00:55:42 UTC (rev 20916)
@@ -56,7 +56,7 @@
*/
public Description description() default @Description();
- public Tag tag() default @Tag;
+ public Tag[] tag() default {};
public static final class NONE {}
@@ -72,5 +72,13 @@
* @return
*/
public String[] attributes() default {};
+ /**
+ * <p class="changed_added_4_0">
+ * Interfaces that should be implemented in the generated class. CDK processes all {@link Attribute} annotations in these interfaces
+ * </p>
+ *
+ * @return
+ */
+ public Class<?>[] interfaces() default {};
}
Modified: trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/JsfRenderer.java
===================================================================
--- trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/JsfRenderer.java 2011-01-07 10:58:02 UTC (rev 20915)
+++ trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/JsfRenderer.java 2011-01-08 00:55:42 UTC (rev 20916)
@@ -58,6 +58,13 @@
* @return
*/
public String family() default "";
+
+
+ /**
+ * <p class="changed_added_4_0">Name of generated renderer class.</p>
+ * @return
+ */
+ public String generate() default "";
/**
* <p class="changed_added_4_0">RenderKit for which this renderer is belong to</p>
Modified: trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/JsfValidator.java
===================================================================
--- trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/JsfValidator.java 2011-01-07 10:58:02 UTC (rev 20915)
+++ trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/JsfValidator.java 2011-01-08 00:55:42 UTC (rev 20916)
@@ -19,7 +19,7 @@
public String generate() default "";
- public Tag tag() default @Tag;
+ public Tag[] tag() default {};
/**
* <p class="changed_added_4_0">
* Description used by IDE.
@@ -41,4 +41,13 @@
* @return
*/
public String[] attributes() default {};
+ /**
+ * <p class="changed_added_4_0">
+ * Interfaces that should be implemented in the generated class. CDK processes all {@link Attribute} annotations in these interfaces
+ * </p>
+ *
+ * @return
+ */
+ public Class<?>[] interfaces() default {};
+
}
Modified: trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/RendererSpecificComponent.java
===================================================================
--- trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/RendererSpecificComponent.java 2011-01-07 10:58:02 UTC (rev 20915)
+++ trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/RendererSpecificComponent.java 2011-01-08 00:55:42 UTC (rev 20916)
@@ -129,5 +129,13 @@
* @return
*/
public Class<?>[] interfaces() default {};
+ /**
+ * <p class="changed_added_4_0">
+ * Events fired by the component.
+ * </p>
+ *
+ * @return
+ */
+ public Event[] fires() default {};
}
Modified: trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/TagType.java
===================================================================
--- trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/TagType.java 2011-01-07 10:58:02 UTC (rev 20915)
+++ trunk/cdk/annotations/src/main/java/org/richfaces/cdk/annotations/TagType.java 2011-01-08 00:55:42 UTC (rev 20916)
@@ -28,16 +28,19 @@
*/
public enum TagType {
/**
- * <p class="changed_added_4_0">Do not generate any tags, this is default value for {@link Tag#type()} annotation.</p>
- */
- None, /**
- * <p class="changed_added_4_0">Defines JSP tag.</p>
- */
+ * <p class="changed_added_4_0">
+ * Defines JSP tag.
+ * </p>
+ */
Jsp, /**
- * <p class="changed_added_4_0">Defines Facelets tag.</p>
- */
+ * <p class="changed_added_4_0">
+ * Defines Facelets tag.
+ * </p>
+ */
Facelets, /**
- * <p class="changed_added_4_0">Enforces tag annotation to generate all known tag types</p>
- */
+ * <p class="changed_added_4_0">
+ * Enforces tag annotation to generate all known tag types
+ * </p>
+ */
All
}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/AptSourceUtils.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/AptSourceUtils.java 2011-01-07 10:58:02 UTC (rev 20915)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/AptSourceUtils.java 2011-01-08 00:55:42 UTC (rev 20916)
@@ -25,6 +25,7 @@
import org.richfaces.cdk.CdkException;
import org.richfaces.cdk.Logger;
import org.richfaces.cdk.model.ClassName;
+import org.richfaces.cdk.model.FacesId;
import org.richfaces.cdk.util.PropertyUtils;
import com.google.common.base.Predicate;
@@ -160,7 +161,7 @@
AptBeanProperty beanProperty = result.get(propertyName);
checkPropertyType(type, propertyName, propertyType, beanProperty);
if (null != (setter?beanProperty.setter:beanProperty.getter)) {
- log.warn("Two " + (setter ? "setter" : "getter") + " methods for the same bean property "
+ log.debug("Two " + (setter ? "setter" : "getter") + " methods for the same bean property "
+ propertyName + " in the class " + type.getQualifiedName());
if(!method.getModifiers().contains(Modifier.ABSTRACT)){
beanProperty.setAccessMethod(method, setter);
@@ -278,8 +279,11 @@
VariableElement variable = (VariableElement) annotationValue.getValue();
return (T) Enum.valueOf((Class<? extends Enum>) expectedType, variable.getSimpleName().toString());
} else if (ClassName.class.equals(expectedType)) {
- TypeMirror value = (TypeMirror) annotationValue.getValue();
+ Object value = annotationValue.getValue();
return (T) ClassName.get(value.toString());
+ } else if (FacesId.class.equals(expectedType)) {
+ String value = (String) annotationValue.getValue();
+ return (T) FacesId.parseId(value);
} else if (AnnotationMirror.class.isAssignableFrom(expectedType)) {
AnnotationMirror value = (AnnotationMirror) annotationValue.getValue();
return (T) value;
@@ -290,7 +294,7 @@
@SuppressWarnings("unchecked")
@Override
- public <T> List<T> getAnnotationValues(AnnotationMirror annotation, String propertyName, Class<T> expectedType) {
+ public <T> Iterable<T> getAnnotationValues(AnnotationMirror annotation, String propertyName, Class<T> expectedType) {
Map.Entry<? extends ExecutableElement, ? extends AnnotationValue> attributeEntry =
findAnnotationProperty(annotation, propertyName);
List<? extends AnnotationValue> annotationValues =
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/ReflectionUtils.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/ReflectionUtils.java 2011-01-07 10:58:02 UTC (rev 20915)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/ReflectionUtils.java 2011-01-08 00:55:42 UTC (rev 20916)
@@ -24,7 +24,6 @@
package org.richfaces.cdk.apt;
import java.lang.annotation.Annotation;
-import java.util.List;
import java.util.Set;
import javax.lang.model.element.AnnotationMirror;
@@ -113,7 +112,7 @@
}
@Override
- public <T> List<T> getAnnotationValues(AnnotationMirror annotation, String propertyName, Class<T> expectedType) {
+ public <T> Iterable<T> getAnnotationValues(AnnotationMirror annotation, String propertyName, Class<T> expectedType) {
// TODO Auto-generated method stub
return null;
}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/SourceUtils.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/SourceUtils.java 2011-01-07 10:58:02 UTC (rev 20915)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/SourceUtils.java 2011-01-08 00:55:42 UTC (rev 20916)
@@ -24,7 +24,6 @@
package org.richfaces.cdk.apt;
import java.lang.annotation.Annotation;
-import java.util.List;
import java.util.Set;
import javax.lang.model.element.AnnotationMirror;
@@ -200,7 +199,7 @@
* @param propertyName
* @return
*/
- <T> List<T> getAnnotationValues(AnnotationMirror annotation, String propertyName, Class<T> expectedType);
+ <T> Iterable<T> getAnnotationValues(AnnotationMirror annotation, String propertyName, Class<T> expectedType);
/**
* <p class="changed_added_4_0"></p>
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/AttributesProcessorImpl.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/AttributesProcessorImpl.java 2011-01-07 10:58:02 UTC (rev 20915)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/AttributesProcessorImpl.java 2011-01-08 00:55:42 UTC (rev 20916)
@@ -23,6 +23,7 @@
import org.richfaces.cdk.xmlconfig.CdkEntityResolver;
import org.richfaces.cdk.xmlconfig.FragmentParser;
+import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -83,19 +84,20 @@
}
} else {
SourceUtils utils = utilsProvider.get();
- utils.setModelProperty(attribute, attributeAnnotarion, "hidden");
- utils.setModelProperty(attribute, attributeAnnotarion, "literal");
- utils.setModelProperty(attribute, attributeAnnotarion, "passThrough");
- utils.setModelProperty(attribute, attributeAnnotarion, "required");
- utils.setModelProperty(attribute, attributeAnnotarion, "readOnly");
+ utils.setModelProperty(attribute, attributeAnnotarion, "hidden");
+ utils.setModelProperty(attribute, attributeAnnotarion, "literal");
+ utils.setModelProperty(attribute, attributeAnnotarion, "passThrough");
+ utils.setModelProperty(attribute, attributeAnnotarion, "required");
+ utils.setModelProperty(attribute, attributeAnnotarion, "readOnly");
if (!utils.isDefaultValue(attributeAnnotarion, "generate")) {
attribute.setGenerate(utils.getAnnotationValue(attributeAnnotarion, "generate", boolean.class));
} else {
attribute.setGenerate(!beanProperty.isExists());
}
- descriptionProcessor.processDescription(attribute, beanProperty.getAnnotation(Attribute.class).description(), beanProperty
- .getDocComment());
+ descriptionProcessor.processDescription(attribute,
+ utils.getAnnotationValue(attributeAnnotarion, "description", AnnotationMirror.class),
+ beanProperty.getDocComment());
setDefaultValue(attribute, attributeAnnotarion);
@@ -104,13 +106,13 @@
// MethodExpression call signature.
attribute.setSignature(getSignature(attributeAnnotarion));
- for (AnnotationMirror event : utils.getAnnotationValues(attributeAnnotarion, "events", AnnotationMirror.class)){
+ for (AnnotationMirror event : utils.getAnnotationValues(attributeAnnotarion, "events",
+ AnnotationMirror.class)) {
setBehaviorEvent(attribute, event);
}
}
}
-
private void setDefaultValue(PropertyBase attribute, AnnotationMirror attributeAnnotarion) {
SourceUtils utils = utilsProvider.get();
String defaultValue;
@@ -165,8 +167,8 @@
if (!SIGNATURE_NONE_CLASS_NAME.equals(returnType)) {
MethodSignature methodSignature = new MethodSignature();
- methodSignature.setParameters(utils.getAnnotationValues(signatureAnnotation, "parameters",
- ClassName.class));
+ methodSignature.setParameters(Lists.newArrayList(utils.getAnnotationValues(signatureAnnotation, "parameters",
+ ClassName.class)));
methodSignature.setReturnType(returnType);
return methodSignature;
}
@@ -174,7 +176,6 @@
return null;
}
-
private void setBehaviorEvent(PropertyBase attribute, AnnotationMirror eventMirror) {
if (null != eventMirror) {
SourceUtils utils = utilsProvider.get();
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/BehaviorProcessor.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/BehaviorProcessor.java 2011-01-07 10:58:02 UTC (rev 20915)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/BehaviorProcessor.java 2011-01-08 00:55:42 UTC (rev 20916)
@@ -26,14 +26,15 @@
import java.lang.annotation.Annotation;
import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.Element;
import javax.lang.model.element.TypeElement;
import org.richfaces.cdk.CdkProcessingException;
import org.richfaces.cdk.annotations.JsfBehavior;
+import org.richfaces.cdk.apt.SourceUtils;
import org.richfaces.cdk.model.BehaviorModel;
import org.richfaces.cdk.model.ComponentLibrary;
-import org.richfaces.cdk.model.FacesId;
/**
* <p class="changed_added_4_0"></p>
@@ -45,17 +46,17 @@
@Override
public void process(Element element, ComponentLibrary library) throws CdkProcessingException {
- JsfBehavior behavior = element.getAnnotation(JsfBehavior.class);
+ SourceUtils sourceUtils = getSourceUtils();
+ AnnotationMirror behavior = sourceUtils.getAnnotationMirror(element, JsfBehavior.class);
- BehaviorModel behaviorModel = new BehaviorModel(new FacesId(behavior.id()));
- setClassNames((TypeElement) element, behaviorModel, behavior.generate());
+ BehaviorModel behaviorModel = new BehaviorModel();
+
+ sourceUtils.setModelProperty(behaviorModel, behavior, "id");
+ setClassNames((TypeElement) element, behaviorModel, behavior);
- setTagInfo(behavior.tag(), behaviorModel);
- AttributesProcessor attributesProcessor = getAttributeProcessor();
- attributesProcessor.processXmlFragment(behaviorModel, behavior.attributes());
- attributesProcessor.processType(behaviorModel, (TypeElement) element);
- setDescription(behaviorModel, behavior.description(), getDocComment(element));
-
+ setTagInfo(behavior, behaviorModel);
+ processAttributes((TypeElement) element, behaviorModel, behavior);
+ setDescription(behaviorModel, behavior, getDocComment(element));
library.getBehaviors().add(behaviorModel);
}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java 2011-01-07 10:58:02 UTC (rev 20915)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/ComponentProcessor.java 2011-01-08 00:55:42 UTC (rev 20916)
@@ -24,36 +24,24 @@
package org.richfaces.cdk.apt.processors;
import java.lang.annotation.Annotation;
-import java.util.Collection;
-import java.util.List;
import java.util.Set;
-import javax.faces.event.FacesEvent;
+import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.Element;
import javax.lang.model.element.TypeElement;
-import javax.lang.model.type.MirroredTypeException;
-import javax.lang.model.type.MirroredTypesException;
-import javax.lang.model.type.TypeKind;
-import javax.lang.model.type.TypeMirror;
import org.richfaces.cdk.CdkException;
-import org.richfaces.cdk.Logger;
import org.richfaces.cdk.annotations.Facet;
import org.richfaces.cdk.annotations.JsfComponent;
-import org.richfaces.cdk.annotations.JsfRenderer;
-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;
import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.ComponentModel;
+import org.richfaces.cdk.model.EventModel;
import org.richfaces.cdk.model.FacesId;
import org.richfaces.cdk.model.FacetModel;
-import org.richfaces.cdk.util.Strings;
-import com.google.inject.Inject;
-
/**
* <p class="changed_added_4_0">
* That class process component-related annotations such as {@link org.richfaces.cdk.annotations.JsfComponent} or
@@ -69,32 +57,32 @@
public static final String COMPONENT_TYPE = "COMPONENT_TYPE";
- @Inject
- private Logger log;
-
public void process(Element componentElement, ComponentLibrary library) {
- final JsfComponent annotation = componentElement.getAnnotation(JsfComponent.class);
- if (annotation == null) {
- return;
- }
+ SourceUtils sourceUtils = getSourceUtils();
+ if (sourceUtils.isAnnotationPresent(componentElement, JsfComponent.class)) {
+ AnnotationMirror annotation = sourceUtils.getAnnotationMirror(componentElement, JsfComponent.class);
+ // Process class-level annotations.
+ ComponentModel component = new ComponentModel();
- // Process class-level annotations.
- ComponentModel component = new ComponentModel();
+ // Should that component be generated ?
+ setClassNames((TypeElement) componentElement, component, annotation);
+ setComponentProperties((TypeElement) componentElement, component, annotation);
- // Should that component be generated ?
- setClassNames((TypeElement) componentElement, component, annotation.generate());
- setComponentProperties((TypeElement) componentElement, component, annotation);
- library.getComponents().add(component);
+ library.getComponents().add(component);
- // Process the second level annotations.
- for (final RendererSpecificComponent subcomponent : annotation.components()) {
- JsfComponent subAnnotation = new JsfSubComponent(subcomponent, annotation);
- ComponentModel subcomponentModel = new ComponentModel();
- subcomponentModel.setBaseClass(component.getTargetClass());
- subcomponentModel.setTargetClass(ClassName.parseName(subcomponent.generate()));
- subcomponentModel.setGenerate(!Strings.isEmpty(subcomponent.generate()));
- setComponentProperties(null, subcomponentModel, subAnnotation);
- library.getComponents().add(subcomponentModel);
+ // Process the second level annotations.
+ for (AnnotationMirror subcomponent : sourceUtils.getAnnotationValues(annotation, "components",
+ AnnotationMirror.class)) {
+ ComponentModel subcomponentModel = new ComponentModel();
+ subcomponentModel.setBaseClass(component.getTargetClass());
+ if (!sourceUtils.isDefaultValue(subcomponent, "generate")) {
+ subcomponentModel.setTargetClass(sourceUtils.getAnnotationValue(subcomponent, "generate",
+ ClassName.class));
+ subcomponentModel.setGenerate(true);
+ }
+ setComponentProperties(null, subcomponentModel, subcomponent);
+ library.getComponents().add(subcomponentModel);
+ }
}
}
@@ -108,91 +96,48 @@
* @param annotation
* @throws CdkException
*/
- void setComponentProperties(TypeElement componentElement, ComponentModel component, JsfComponent annotation)
+ void setComponentProperties(TypeElement componentElement, ComponentModel component, AnnotationMirror annotation)
throws CdkException {
+ SourceUtils sourceUtils = getSourceUtils();
- setComponentType(componentElement, component, annotation.type());
- setComponeneFamily(componentElement, component, annotation.family());
- setDescription(component, annotation.description(), getDocComment(componentElement));
- setRendererType(component, annotation.renderer());
-
+ setComponentType(componentElement, component, annotation);
+ setComponeneFamily(componentElement, component, annotation);
+ setDescription(component, annotation, getDocComment(componentElement));
+ if (!sourceUtils.isDefaultValue(annotation, "renderer")) {
+ setRendererType(component, sourceUtils.getAnnotationValue(annotation, "renderer", AnnotationMirror.class));
+ }
processFacets(componentElement, component, annotation);
processAttributes(componentElement, component, annotation);
processEvents(componentElement, component, annotation);
- for (Tag tag : annotation.tag()) {
- setTagInfo(tag, component);
- }
+ setTagInfo(annotation, component);
// TODO - process @Test annotations.
}
- private void setRendererType(ComponentModel component, JsfRenderer jsfRenderer) {
- if(!Strings.isEmpty(jsfRenderer.type())){
- component.setRendererType(FacesId.parseId(jsfRenderer.type()));
+ private void setRendererType(ComponentModel component, AnnotationMirror annotation) {
+ SourceUtils sourceUtils = getSourceUtils();
+ if (!sourceUtils.isDefaultValue(annotation, "type")) {
+ component.setRendererType(sourceUtils.getAnnotationValue(annotation, "type", FacesId.class));
}
- if(!Strings.isEmpty(jsfRenderer.template())){
- component.setRendererTemplate(jsfRenderer.template());
+ if (!sourceUtils.isDefaultValue(annotation, "template")) {
+ component.setRendererTemplate(sourceUtils.getAnnotationValue(annotation, "template", String.class));
}
}
- private void processAttributes(TypeElement componentElement, ComponentModel component, JsfComponent annotation) {
- AttributesProcessor attributesProcessor = getAttributeProcessor();
- attributesProcessor.processXmlFragment(component, annotation.attributes());
-
- if (componentElement != null) {
- attributesProcessor.processType(component, componentElement);
- }
-
- Collection<ClassName> interfaceNames = component.getInterfaces();
- try {
- Class<?>[] interfaces = annotation.interfaces();
- for (Class<?> clazz : interfaces) {
- interfaceNames.add(new ClassName(clazz));
- }
- } catch (MirroredTypesException e) {
- List<? extends TypeMirror> typeMirrors = e.getTypeMirrors();
- for (TypeMirror mirror : typeMirrors) {
- processInterface(component, attributesProcessor, mirror);
- }
- } catch (MirroredTypeException e) {
- processInterface(component, attributesProcessor, e.getTypeMirror());
- }
+ void setComponentType(TypeElement componentElement, ComponentModel component, AnnotationMirror annotation) {
+ component.setId(FacesId.parseId(getAnnotationPropertyOrConstant(componentElement, annotation,"type",COMPONENT_TYPE)));
}
- private void processInterface(ComponentModel component, AttributesProcessor attributesProcessor, TypeMirror mirror) {
- component.getInterfaces().add(ClassName.parseName(mirror.toString()));
- if (TypeKind.DECLARED.equals(mirror.getKind())) {
- attributesProcessor.processType(component, getSourceUtils().asTypeElement(mirror));
- } else {
- // TODO - record warning.
- }
- }
-
- void setComponentType(TypeElement componentElement, ComponentModel component, String type) {
- if (!Strings.isEmpty(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.setId(FacesId.parseId(value.toString()));
- }
- }
- }
-
- final void processFacets(TypeElement componentElement, ComponentModel component, JsfComponent annotation) {
+ final void processFacets(TypeElement componentElement, ComponentModel component, AnnotationMirror annotation) {
+ SourceUtils sourceUtils = getSourceUtils();
if (null != componentElement) {
- SourceUtils sourceUtils = getSourceUtils();
Set<BeanProperty> properties = sourceUtils.getBeanPropertiesAnnotatedWith(Facet.class, componentElement);
// TODO - encapsulate attribute builder into utility class.
for (BeanProperty beanProperty : properties) {
- Facet facet = beanProperty.getAnnotation(Facet.class);
+ AnnotationMirror facet = beanProperty.getAnnotationMirror(Facet.class);
FacetModel facetModel = component.getOrCreateFacet(beanProperty.getName());
-
facetModel.setDescription(beanProperty.getDocComment());
-
processFacet(facet, facetModel, beanProperty.getDocComment());
if (!beanProperty.isExists()) {
facetModel.setGenerate(true);
@@ -200,57 +145,42 @@
}
}
- for (Facet facet : annotation.facets()) {
- String name = facet.name();
- if (!Strings.isEmpty(name)) {
+ for (AnnotationMirror facet : sourceUtils.getAnnotationValues(annotation, "facets", AnnotationMirror.class)) {
+ if (!sourceUtils.isDefaultValue(facet, "name")) {
+ String name = sourceUtils.getAnnotationValue(facet, "name", String.class);
FacetModel facetModel = component.getOrCreateFacet(name);
processFacet(facet, facetModel, null);
} else {
- // TODO - record error.
throw new CdkException("Facet name should be set");
}
}
}
- final void processFacet(Facet facet, FacetModel facetModel, String docComment) {
- setDescription(facetModel, facet.description(), docComment);
- facetModel.setGenerate(facet.generate());
+ final void processFacet(AnnotationMirror facet, FacetModel facetModel, String docComment) {
+ SourceUtils sourceUtils = getSourceUtils();
+ if (!sourceUtils.isDefaultValue(facet, "description")) {
+ setDescription(facetModel, facet, docComment);
+ }
+ if (!sourceUtils.isDefaultValue(facet, "generate")) {
+ facetModel.setGenerate(sourceUtils.getAnnotationValue(facet, "generate", Boolean.class));
+ }
}
- final void setComponeneFamily(TypeElement componentElement, ComponentModel component, String family) {
- if (!Strings.isEmpty(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(FacesId.parseId(value.toString()));
- }
+ final void setComponeneFamily(TypeElement componentElement, ComponentModel component, AnnotationMirror annotation) {
+ if(null != componentElement){
+ component.setFamily(FacesId.parseId(getAnnotationPropertyOrConstant(componentElement, annotation,"family",COMPONENT_FAMILY)));
}
}
- final void processEvents(TypeElement componentElement, ComponentModel component, JsfComponent annotation) {
- try {
- Class<? extends FacesEvent>[] fires = annotation.fires();
-
- for (Class<? extends FacesEvent> event : fires) {
- try {
- component.addEvent(event.getName());
- } catch (MirroredTypesException mirror) {
- for (TypeMirror eventType : mirror.getTypeMirrors()) {
- component.addEvent(eventType.toString());
- }
- } catch (MirroredTypeException mirror) {
- component.addEvent(mirror.getTypeMirror().toString());
- }
-
- }
- } catch (MirroredTypesException mirror) {
- for (TypeMirror eventType : mirror.getTypeMirrors()) {
- component.addEvent(eventType.toString());
- }
- } catch (MirroredTypeException mirror) {
- component.addEvent(mirror.getTypeMirror().toString());
+ final void processEvents(TypeElement componentElement, ComponentModel component, AnnotationMirror annotation) {
+ SourceUtils sourceUtils = getSourceUtils();
+ for (AnnotationMirror event : sourceUtils.getAnnotationValues(annotation, "fires", AnnotationMirror.class)) {
+ EventModel model = new EventModel();
+ sourceUtils.setModelProperty(model, event, "type", "value");
+ sourceUtils.setModelProperty(model, event, "listenerInterface", "listener");
+ sourceUtils.setModelProperty(model, event, "listenerMethod");
+ sourceUtils.setModelProperty(model, event, "sourceInterface", "source");
+ component.getEvents().add(model);
}
}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/ConverterProcessor.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/ConverterProcessor.java 2011-01-07 10:58:02 UTC (rev 20915)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/ConverterProcessor.java 2011-01-08 00:55:42 UTC (rev 20916)
@@ -24,16 +24,14 @@
import java.lang.annotation.Annotation;
import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.Element;
-import javax.lang.model.element.TypeElement;
-import javax.lang.model.type.MirroredTypeException;
import org.richfaces.cdk.CdkProcessingException;
import org.richfaces.cdk.annotations.JsfConverter;
-import org.richfaces.cdk.model.ClassName;
+import org.richfaces.cdk.apt.SourceUtils;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.ConverterModel;
-import org.richfaces.cdk.model.FacesId;
/**
* @author akolonitsky
@@ -44,32 +42,16 @@
@Override
public void process(Element element, ComponentLibrary library) throws CdkProcessingException {
- JsfConverter converter = element.getAnnotation(JsfConverter.class);
+ SourceUtils sourceUtils = getSourceUtils();
+ AnnotationMirror converter = sourceUtils.getAnnotationMirror(element, JsfConverter.class);
ConverterModel converterModel = new ConverterModel();
- converterModel.setId(FacesId.parseId(converter.id()));
+ sourceUtils.setModelProperty(converterModel, converter, "id");
+ sourceUtils.setModelProperty(converterModel, converter, "converterForClass","forClass");
- try {
- Class<?> forClass = converter.forClass();
- if (!JsfConverter.NONE.class.equals(forClass)) {
- converterModel.setConverterForClass(new ClassName(forClass.getName()));
- }
- } catch (MirroredTypeException e) {
- String name = e.getTypeMirror().toString();
- if (!JsfConverter.NONE.class.getName().equals(name)) {
- converterModel.setConverterForClass(new ClassName(name));
- }
- }
-
- setDescription(converterModel, converter.description(), getDocComment(element));
-
- AttributesProcessor attributesProcessor = getAttributeProcessor();
- attributesProcessor.processXmlFragment(converterModel, converter.attributes());
- attributesProcessor.processType(converterModel, (TypeElement) element);
- setClassNames((TypeElement) element, converterModel, converter.generate());
-
- setTagInfo(converter.tag(), converterModel);
-
+ setDescription(converterModel, converter, getDocComment(element));
+ processAttributes(element, converterModel, converter);
+ setTagInfo(converter, converterModel);
library.getConverters().add(converterModel);
}
@@ -77,11 +59,4 @@
public Class<? extends Annotation> getProcessedAnnotation() {
return JsfConverter.class;
}
-
-
- protected String[] getAnnotationAttributes(TypeElement element) {
- JsfConverter converter = element.getAnnotation(JsfConverter.class);
-
- return converter.attributes();
- }
}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/DescriptionProcessor.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/DescriptionProcessor.java 2011-01-07 10:58:02 UTC (rev 20915)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/DescriptionProcessor.java 2011-01-08 00:55:42 UTC (rev 20916)
@@ -23,7 +23,8 @@
package org.richfaces.cdk.apt.processors;
-import org.richfaces.cdk.annotations.Description;
+import javax.lang.model.element.AnnotationMirror;
+
import org.richfaces.cdk.model.DescriptionGroup;
/**
@@ -36,15 +37,15 @@
/**
* <p class="changed_added_4_0">process {@link Description} annotation and set information from it into model. Optional string from the JavaDoc comment has precedence over {@link Desription#value()} attribute.</p>
* @param model
- * @param description
+ * @param annotation
* @param docComment JavaDoc comment associated with described element.
*/
- public void processDescription(DescriptionGroup model, Description description, String docComment);
+ public void processDescription(DescriptionGroup model, AnnotationMirror annotation, String docComment);
/**
* <p class="changed_added_4_0">process {@link Description} annotation and set information from it into model.</p>
* @param model
* @param description
*/
- public void processDescription(DescriptionGroup model, Description description);
+ public void processDescription(DescriptionGroup model, AnnotationMirror description);
}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/DescriptionProcessorImpl.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/DescriptionProcessorImpl.java 2011-01-07 10:58:02 UTC (rev 20915)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/DescriptionProcessorImpl.java 2011-01-08 00:55:42 UTC (rev 20916)
@@ -23,51 +23,56 @@
package org.richfaces.cdk.apt.processors;
-import org.richfaces.cdk.annotations.Description;
+import javax.lang.model.element.AnnotationMirror;
+
+import org.richfaces.cdk.apt.SourceUtils;
import org.richfaces.cdk.model.DescriptionGroup;
import org.richfaces.cdk.util.Strings;
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+
/**
- * <p class="changed_added_4_0"></p>
- *
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @author asmirnov(a)exadel.com
*/
public class DescriptionProcessorImpl implements DescriptionProcessor {
+ private final Provider<SourceUtils> utilsProvider;
+
+ @Inject
+ public DescriptionProcessorImpl(Provider<SourceUtils> utilsProvider) {
+ this.utilsProvider = utilsProvider;
+ }
+
@Override
- public void processDescription(DescriptionGroup model, Description description, String docComment) {
+ public void processDescription(DescriptionGroup model, AnnotationMirror description, String docComment) {
if (!Strings.isEmpty(docComment)) {
model.setDescription(docComment);
}
if (description != null) {
+ SourceUtils utils = utilsProvider.get();
setIcon(model, description);
- if (!Strings.isEmpty(description.displayName())) {
- model.setDisplayname(description.displayName());
- }
- if (!Strings.isEmpty(description.value())) {
- model.setDescription(description.value());
- }
+ utils.setModelProperty(model, description, "displayName");
+ utils.setModelProperty(model, description, "description","value");
}
}
@Override
- public void processDescription(DescriptionGroup model, Description description) {
+ public void processDescription(DescriptionGroup model, AnnotationMirror description) {
processDescription(model, description, null);
}
- protected void setIcon(DescriptionGroup component, Description icon) {
- if (null != icon && (!Strings.isEmpty(icon.smallIcon()) || !Strings.isEmpty(icon.largeIcon()))) {
+ protected void setIcon(DescriptionGroup component, AnnotationMirror description) {
+ SourceUtils utils = utilsProvider.get();
+ if (null != description
+ && (!utils.isDefaultValue(description, "smallIcon") || !utils.isDefaultValue(description, "largeIcon"))) {
DescriptionGroup.Icon iconValue = new DescriptionGroup.Icon();
-
- if (!Strings.isEmpty(icon.smallIcon())) {
- iconValue.setSmallIcon(icon.smallIcon());
- }
-
- if (!Strings.isEmpty(icon.largeIcon())) {
- iconValue.setLargeIcon(icon.largeIcon());
- }
-
+ utils.setModelProperty(iconValue, description, "smallIcon");
+ utils.setModelProperty(iconValue, description, "largeIcon");
component.setIcon(iconValue);
}
}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/EventProcessor.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/EventProcessor.java 2011-01-07 10:58:02 UTC (rev 20915)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/EventProcessor.java 2011-01-08 00:55:42 UTC (rev 20916)
@@ -25,28 +25,31 @@
import java.lang.annotation.Annotation;
+import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.Element;
import javax.lang.model.element.ElementKind;
import javax.lang.model.element.TypeElement;
-import javax.lang.model.type.MirroredTypeException;
import org.richfaces.cdk.CdkProcessingException;
import org.richfaces.cdk.annotations.Event;
-import org.richfaces.cdk.annotations.Tag;
-import org.richfaces.cdk.annotations.TagType;
+import org.richfaces.cdk.apt.SourceUtils;
import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.EventModel;
-import org.richfaces.cdk.util.Strings;
/**
- * <p class="changed_added_4_0">This class processes annotations for FacesEvents.</p>
+ * <p class="changed_added_4_0">
+ * This class processes annotations for FacesEvents.
+ * </p>
+ *
* @author asmirnov(a)exadel.com
- *
+ *
*/
public class EventProcessor extends ProcessorBase implements CdkAnnotationProcessor {
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.richfaces.cdk.apt.processors.CdkAnnotationProcessor#getProcessedAnnotation()
*/
@Override
@@ -54,31 +57,24 @@
return Event.class;
}
- /* (non-Javadoc)
- * @see org.richfaces.cdk.apt.processors.CdkAnnotationProcessor#process(javax.lang.model.element.Element, org.richfaces.cdk.model.ComponentLibrary)
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.richfaces.cdk.apt.processors.CdkAnnotationProcessor#process(javax.lang.model.element.Element,
+ * org.richfaces.cdk.model.ComponentLibrary)
*/
@Override
public void process(Element element, ComponentLibrary library) throws CdkProcessingException {
if (ElementKind.CLASS.equals(element.getKind())) {
+ SourceUtils sourceUtils = getSourceUtils();
TypeElement eventType = (TypeElement) element;
- Event event = eventType.getAnnotation(Event.class);
+ AnnotationMirror event = sourceUtils.getAnnotationMirror(element, Event.class);
EventModel model = new EventModel();
model.setType(ClassName.parseName(eventType.getQualifiedName().toString()));
- try {
- model.setListenerInterface(ClassName.parseName(event.listener().toString()));
- } catch (MirroredTypeException mirror) {
- model.setListenerInterface(ClassName.parseName(mirror.getTypeMirror().toString()));
- }
- String listenerMethod = event.listenerMethod();
- if(!Strings.isEmpty(listenerMethod)){
- model.setListenerMethod(listenerMethod);
- }
- model.setSourceInterface(ClassName.parseName(event.source()));
- for (Tag tag : event.tag()) {
- if(!TagType.None.equals(tag.type())){
- model.getTags().add(processTag(tag));
- }
- }
+ sourceUtils.setModelProperty(model, event, "listenerInterface", "listener");
+ sourceUtils.setModelProperty(model, event, "listenerMethod");
+ sourceUtils.setModelProperty(model, event, "sourceInterface", "source");
+ setTagInfo(event, model);
library.getEvents().add(model);
}
}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/FunctionProcessor.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/FunctionProcessor.java 2011-01-07 10:58:02 UTC (rev 20915)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/FunctionProcessor.java 2011-01-08 00:55:42 UTC (rev 20916)
@@ -26,6 +26,7 @@
import java.lang.annotation.Annotation;
import java.util.Set;
+import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.Element;
import javax.lang.model.element.ElementKind;
import javax.lang.model.element.ExecutableElement;
@@ -35,11 +36,14 @@
import org.richfaces.cdk.CdkProcessingException;
import org.richfaces.cdk.annotations.Function;
+import org.richfaces.cdk.apt.SourceUtils;
import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.FunctionModel;
-import org.richfaces.cdk.util.Strings;
+import com.google.common.base.Joiner;
+import com.google.common.collect.Iterables;
+
/**
* <p class="changed_added_4_0"></p>
* @author asmirnov(a)exadel.com
@@ -47,6 +51,14 @@
*/
public class FunctionProcessor extends ProcessorBase implements CdkAnnotationProcessor {
+ private static final Joiner PARAMETERS_JOINER = Joiner.on(',').skipNulls();
+ private static final com.google.common.base.Function<VariableElement,String> PARAMETER_CONVERTER = new com.google.common.base.Function<VariableElement,String>(){
+
+ @Override
+ public String apply(VariableElement var) {
+ return var.asType().toString();
+ }
+ };
/* (non-Javadoc)
* @see org.richfaces.cdk.apt.processors.CdkAnnotationProcessor#getProcessedAnnotation()
*/
@@ -60,6 +72,7 @@
*/
@Override
public void process(Element element, ComponentLibrary library) throws CdkProcessingException {
+ SourceUtils utils = getSourceUtils();
switch (element.getKind()) {
case METHOD:
ExecutableElement methodElement = (ExecutableElement) element;
@@ -72,27 +85,20 @@
if(!modifiers.contains(Modifier.STATIC)){
throw new CdkProcessingException("Only static method can be registered as EL function "+methodElement.getSimpleName());
}
- Function function = methodElement.getAnnotation(Function.class);
+ AnnotationMirror function = utils.getAnnotationMirror(methodElement, Function.class);
FunctionModel model = new FunctionModel();
- if(!Strings.isEmpty(function.name())){
- model.setName(function.name());
+ if(!utils.isDefaultValue(function, "name")){
+ utils.setModelProperty(model, function, "name");
} else {
model.setName(methodElement.getSimpleName().toString());
}
- model.setType(function.type());
- setDescription(model, function.description(), getDocComment(methodElement));
+ utils.setModelProperty(model, function, "type");
+ setDescription(model, function, getDocComment(methodElement));
// Calculate method signature
StringBuilder signature = new StringBuilder();
signature.append(methodElement.getReturnType()).append(" ");
signature.append(methodElement.getSimpleName()).append("(");
- boolean first = true;
- for(VariableElement parameter :methodElement.getParameters()){
- if(!first){
- signature.append(",");
- }
- signature.append(parameter.asType());
- first = false;
- }
+ PARAMETERS_JOINER.appendTo(signature, Iterables.transform(methodElement.getParameters(), PARAMETER_CONVERTER));
signature.append(")");
model.setSignature(signature.toString());
Element declaringClass = methodElement.getEnclosingElement();
Deleted: trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/JsfSubComponent.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/JsfSubComponent.java 2011-01-07 10:58:02 UTC (rev 20915)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/JsfSubComponent.java 2011-01-08 00:55:42 UTC (rev 20916)
@@ -1,120 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright , Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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 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.apt.processors;
-
-import java.lang.annotation.Annotation;
-
-import javax.faces.event.FacesEvent;
-
-import org.richfaces.cdk.annotations.Description;
-import org.richfaces.cdk.annotations.Facet;
-import org.richfaces.cdk.annotations.JsfComponent;
-import org.richfaces.cdk.annotations.JsfRenderer;
-import org.richfaces.cdk.annotations.RendererSpecificComponent;
-import org.richfaces.cdk.annotations.Tag;
-import org.richfaces.cdk.annotations.Test;
-
-/**
- * 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
- * @since Mar 31, 2010
- */
-public class JsfSubComponent implements JsfComponent {
-
- private final RendererSpecificComponent subcomponent;
-
- private final JsfComponent parent;
-
- public JsfSubComponent(RendererSpecificComponent subcomponent, JsfComponent parent) {
- this.subcomponent = subcomponent;
- this.parent = parent;
- }
-
- @Override
- public Class<? extends Annotation> annotationType() {
- return JsfComponent.class;
- }
-
- @Override
- public String type() {
- return this.subcomponent.type();
- }
-
- @Override
- public Test test() {
- return this.subcomponent.test();
- }
-
- @Override
- public Tag[] tag() {
- return this.subcomponent.tag();
- }
-
- @Override
- public JsfRenderer renderer() {
- return this.subcomponent.renderer();
- }
-
- @Override
- public Class<?>[] interfaces() {
- return this.subcomponent.interfaces();
- }
-
- @Override
- public String generate() {
- return this.subcomponent.generate();
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Class<? extends FacesEvent>[] fires() {
- return new Class[0];
- }
-
- @Override
- public String family() {
- return this.parent.family();
- }
-
- @Override
- public Facet[] facets() {
- return this.subcomponent.facets();
- }
-
- @Override
- public Description description() {
- return this.subcomponent.description();
- }
-
- @Override
- public RendererSpecificComponent[] components() {
- return new RendererSpecificComponent[0];
- }
-
- @Override
- public String[] attributes() {
- return this.subcomponent.attributes();
- }
-}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/ProcessorBase.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/ProcessorBase.java 2011-01-07 10:58:02 UTC (rev 20915)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/ProcessorBase.java 2011-01-08 00:55:42 UTC (rev 20916)
@@ -1,27 +1,33 @@
package org.richfaces.cdk.apt.processors;
+import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.Element;
+import javax.lang.model.element.ElementKind;
import javax.lang.model.element.Modifier;
import javax.lang.model.element.TypeElement;
+import javax.lang.model.type.TypeKind;
+import javax.lang.model.type.TypeMirror;
+import org.richfaces.cdk.Logger;
import org.richfaces.cdk.NamingConventions;
-import org.richfaces.cdk.annotations.Description;
-import org.richfaces.cdk.annotations.Tag;
import org.richfaces.cdk.annotations.TagType;
import org.richfaces.cdk.apt.SourceUtils;
import org.richfaces.cdk.model.ClassName;
import org.richfaces.cdk.model.DescriptionGroup;
+import org.richfaces.cdk.model.ModelCollection;
import org.richfaces.cdk.model.ModelElementBase;
import org.richfaces.cdk.model.TagModel;
-import org.richfaces.cdk.util.Strings;
+import org.richfaces.cdk.model.ViewElement;
import com.google.inject.Inject;
import com.google.inject.Provider;
-public abstract class ProcessorBase {
+public abstract class ProcessorBase {
-
@Inject
+ protected Logger log;
+
+ @Inject
private Provider<SourceUtils> sourceUtils;
@Inject
@@ -29,7 +35,7 @@
@Inject
private NamingConventions namingConventions;
-
+
@Inject
private DescriptionProcessor descriptionProcessor;
@@ -37,46 +43,47 @@
return this.sourceUtils.get();
}
- protected void setTagInfo(Tag tag, ModelElementBase model) {
-
- if (!TagType.None.equals(tag.type())) {
+ protected void setTagInfo(AnnotationMirror annotation, ViewElement model) {
+ SourceUtils sourceUtils = getSourceUtils();
+ ModelCollection<TagModel> tags = model.getTags();
+ for (AnnotationMirror tag : sourceUtils.getAnnotationValues(annotation, "tag", AnnotationMirror.class)) {
TagModel tagModel = processTag(tag);
-
- model.getTags().add(tagModel);
-
+ tags.add(tagModel);
}
}
- protected TagModel processTag(Tag tag) {
+ protected TagModel processTag(AnnotationMirror tag) {
TagModel tagModel = new TagModel();
- String name = tag.name();
- tagModel.setName(name);
- tagModel.setType(tag.type());
- tagModel.setTargetClass(ClassName.parseName(tag.handler()));
- tagModel.setBaseClass(ClassName.parseName(tag.baseClass()));
- tagModel.setGenerate(tag.generate());
+ SourceUtils sourceUtils = getSourceUtils();
+ sourceUtils.setModelProperty(tagModel, tag, "name");
+ tagModel.setType(sourceUtils.getAnnotationValue(tag, "type", TagType.class));
+ sourceUtils.setModelProperty(tagModel, tag, "targetClass", "handler");
+ sourceUtils.setModelProperty(tagModel, tag, "baseClass");
+ sourceUtils.setModelProperty(tagModel, tag, "generate");
return tagModel;
}
- protected void setClassNames(TypeElement componentElement, ModelElementBase modelElement,
- String generatedClass) {
-
- if (componentElement.getModifiers().contains(Modifier.ABSTRACT) || !Strings.isEmpty(generatedClass)) {
+ protected void setClassNames(TypeElement componentElement, ModelElementBase modelElement, AnnotationMirror behavior) {
+ SourceUtils sourceUtils = getSourceUtils();
+ if (componentElement.getModifiers().contains(Modifier.ABSTRACT)
+ || !sourceUtils.isDefaultValue(behavior, "generate")) {
modelElement.setGenerate(true);
- modelElement.setTargetClass(ClassName.parseName(generatedClass));
+ sourceUtils.setModelProperty(modelElement, behavior, "targetClass", "generate");
} else {
modelElement.setGenerate(false);
+ modelElement.setTargetClass(ClassName.parseName(componentElement.getQualifiedName().toString()));
}
modelElement.setBaseClass(ClassName.parseName(componentElement.getQualifiedName().toString()));
}
-
protected String getDocComment(Element element) {
return null != element ? getSourceUtils().getDocComment(element) : null;
}
/**
- * <p class="changed_added_4_0"></p>
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @return the attributeProcessor
*/
protected AttributesProcessor getAttributeProcessor() {
@@ -91,7 +98,44 @@
this.namingConventions = namingConventions;
}
- protected void setDescription(DescriptionGroup model, Description description, String docComment) {
- descriptionProcessor.processDescription(model, description, docComment);
+ protected void setDescription(DescriptionGroup model, AnnotationMirror annotation, String docComment) {
+ descriptionProcessor.processDescription(model,
+ getSourceUtils().getAnnotationValue(annotation, "description", AnnotationMirror.class), docComment);
}
+
+ protected void processAttributes(Element element, ModelElementBase component, AnnotationMirror annotation) {
+ AttributesProcessor attributesProcessor = getAttributeProcessor();
+ SourceUtils sourceUtils = getSourceUtils();
+ for (String atributesFragment : sourceUtils.getAnnotationValues(annotation, "attributes", String.class)) {
+ attributesProcessor.processXmlFragment(component, atributesFragment);
+ }
+ if (element != null && ElementKind.CLASS.equals(element.getKind())) {
+ attributesProcessor.processType(component, (TypeElement) element);
+ }
+ for (TypeMirror atributesInterface : sourceUtils
+ .getAnnotationValues(annotation, "interfaces", TypeMirror.class)) {
+ processInterface(component, attributesProcessor, atributesInterface);
+ }
+ }
+
+ private void processInterface(ModelElementBase component, AttributesProcessor attributesProcessor, TypeMirror mirror) {
+ component.getInterfaces().add(ClassName.parseName(mirror.toString()));
+ if (TypeKind.DECLARED.equals(mirror.getKind())) {
+ attributesProcessor.processType(component, getSourceUtils().asTypeElement(mirror));
+ } else {
+ // TODO - record warning.
+ }
+ }
+
+ protected String getAnnotationPropertyOrConstant(TypeElement element, AnnotationMirror annotation, String annotationAttribute, String fieldName) {
+ SourceUtils utils = getSourceUtils();
+ if (!utils.isDefaultValue(annotation, annotationAttribute)) {
+ return utils.getAnnotationValue(annotation, annotationAttribute,String.class);
+ }
+ Object value = utils.getConstant((TypeElement) element, fieldName);
+ if (value != null) {
+ return value.toString();
+ }
+ return null;
+ }
}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/RendererProcessor.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/RendererProcessor.java 2011-01-07 10:58:02 UTC (rev 20915)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/RendererProcessor.java 2011-01-08 00:55:42 UTC (rev 20916)
@@ -24,23 +24,18 @@
import java.lang.annotation.Annotation;
import javax.annotation.processing.SupportedAnnotationTypes;
-import javax.faces.render.RenderKitFactory;
+import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.Element;
-import javax.lang.model.element.Modifier;
import javax.lang.model.element.TypeElement;
-import javax.lang.model.type.TypeKind;
-import javax.lang.model.type.TypeMirror;
-import org.richfaces.cdk.Logger;
import org.richfaces.cdk.annotations.JsfComponent;
import org.richfaces.cdk.annotations.JsfRenderer;
-import org.richfaces.cdk.model.ClassName;
+import org.richfaces.cdk.apt.SourceUtils;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.FacesId;
import org.richfaces.cdk.model.RendererModel;
import org.richfaces.cdk.util.Strings;
-import com.google.inject.Inject;
/**
* @author akolonitsky
@@ -53,61 +48,29 @@
private static final String RENDERER_TYPE = "RENDERER_TYPE";
- @Inject
- private Logger log;
-
-
public void process(Element rendererElement, ComponentLibrary library) {
- JsfRenderer annotation = rendererElement.getAnnotation(JsfRenderer.class);
+ SourceUtils sourceUtils = getSourceUtils();
+ AnnotationMirror annotation = sourceUtils.getAnnotationMirror(rendererElement, JsfRenderer.class);
- RendererModel rendererModel = process((TypeElement) rendererElement, annotation, library);
-
- addToRenderKit(annotation, library, rendererModel);
-
- }
-
- public RendererModel process(TypeElement rendererElement, JsfRenderer annotation, ComponentLibrary library) {
RendererModel rendererModel = new RendererModel();
- setClassNames(rendererElement, rendererModel, null);
+ TypeElement rendererTypeElement = (TypeElement) rendererElement;
+ setClassNames(rendererTypeElement, rendererModel, annotation);
- setRendererType(rendererElement, rendererModel, annotation);
- setComponentFamily(rendererElement, rendererModel, annotation);
- setDescription(rendererModel, annotation.description(), getDocComment(rendererElement));
+ setRendererType(rendererTypeElement, rendererModel, annotation);
+
+ setComponentFamily(rendererTypeElement, rendererModel, annotation);
+ setDescription(rendererModel, annotation, getDocComment(rendererElement));
- setTemplate(rendererModel, annotation);
+ sourceUtils.setModelProperty(rendererModel, annotation, "templatePath","template");
- // TODO - process @Test annotations.
- return rendererModel;
- }
+ String renderKitId = sourceUtils.getAnnotationValue(annotation, "renderKitId", String.class);
+ library.addRenderer(renderKitId, rendererModel);
- protected void setClassNames(TypeElement componentElement, RendererModel modelElement, String generatedClass) {
-
- if (componentElement.getModifiers().contains(Modifier.ABSTRACT) || !Strings.isEmpty(generatedClass)) {
- modelElement.setGenerate(true);
- modelElement.setRendererClass(ClassName.parseName(generatedClass));
- modelElement.setBaseClass(ClassName.parseName(componentElement.getQualifiedName().toString()));
- } else {
- modelElement.setGenerate(false);
- modelElement.setRendererClass(ClassName.parseName(componentElement.getQualifiedName().toString()));
-
- TypeMirror superclass = componentElement.getSuperclass();
- if (superclass.getKind() == TypeKind.DECLARED) {
- TypeElement typeElement = getSourceUtils().asTypeElement(superclass);
- modelElement.setBaseClass(ClassName.parseName(typeElement.getQualifiedName().toString()));
- }
- }
-
}
- private void addToRenderKit(JsfRenderer annotation, ComponentLibrary library, RendererModel rendererModel) {
- String renderKitId = annotation.renderKitId();
- if (Strings.isEmpty(renderKitId)) {
- renderKitId = RenderKitFactory.HTML_BASIC_RENDER_KIT; // TODO ???
- }
- library.addRenderer(renderKitId, rendererModel);
- }
+
private void setTemplate(RendererModel rendererModel, JsfRenderer annotation) {
String template = annotation.template();
if (!Strings.isEmpty(template)) {
@@ -116,39 +79,14 @@
}
- private void setComponentFamily(TypeElement rendererElement, RendererModel rendererModel, JsfRenderer annotation) {
- String family = annotation.family();
- if (!Strings.isEmpty(family)) {
- rendererModel.setFamily(FacesId.parseId(family));
- return;
- } else {
-
- Object value = getSourceUtils().getConstant(rendererElement, COMPONENT_FAMILY);
- if (value != null) {
- rendererModel.setFamily(FacesId.parseId(value.toString()));
- return;
- }
- }
+ private void setComponentFamily(TypeElement rendererElement, RendererModel rendererModel, AnnotationMirror annotation) {
+ rendererModel.setFamily(FacesId.parseId(getAnnotationPropertyOrConstant(rendererElement, annotation,"family",COMPONENT_FAMILY)));
}
- private String getRendererType(TypeElement rendererElement, JsfRenderer annotation) {
- String type = annotation.type();
- if (!Strings.isEmpty(type)) {
- return type;
- }
-
- Object value = getSourceUtils().getConstant(rendererElement, RENDERER_TYPE);
- if (value != null) {
- return value.toString();
- }
-
- return null;
+ private void setRendererType(TypeElement rendererElement, RendererModel rendererModel, AnnotationMirror annotation) {
+ rendererModel.setId(FacesId.parseId(getAnnotationPropertyOrConstant(rendererElement, annotation,"type",RENDERER_TYPE)));
}
- private void setRendererType(TypeElement rendererElement, RendererModel rendererModel, JsfRenderer annotation) {
- rendererModel.setId(FacesId.parseId(getRendererType(rendererElement, annotation)));
- }
-
protected String getComponentType(TypeElement componentElement) {
JsfComponent annotation = componentElement.getAnnotation(JsfComponent.class);
if (annotation != null) {
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/ValidatorProcessor.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/ValidatorProcessor.java 2011-01-07 10:58:02 UTC (rev 20915)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/apt/processors/ValidatorProcessor.java 2011-01-08 00:55:42 UTC (rev 20916)
@@ -24,13 +24,14 @@
import java.lang.annotation.Annotation;
import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.Element;
import javax.lang.model.element.TypeElement;
import org.richfaces.cdk.CdkProcessingException;
import org.richfaces.cdk.annotations.JsfValidator;
+import org.richfaces.cdk.apt.SourceUtils;
import org.richfaces.cdk.model.ComponentLibrary;
-import org.richfaces.cdk.model.FacesId;
import org.richfaces.cdk.model.ValidatorModel;
/**
@@ -42,13 +43,15 @@
@Override
public void process(Element element, ComponentLibrary library) throws CdkProcessingException {
- JsfValidator validator = element.getAnnotation(JsfValidator.class);
+ SourceUtils utils = getSourceUtils();
+ AnnotationMirror validator = utils.getAnnotationMirror(element,JsfValidator.class);
- ValidatorModel validatorModel = new ValidatorModel(FacesId.parseId(validator.id()));
- setClassNames((TypeElement) element, validatorModel, validator.generate());
- setDescription(validatorModel, validator.description(), getDocComment(element));
+ ValidatorModel validatorModel = new ValidatorModel();
+ utils.setModelProperty(validatorModel, validator, "id");
+ setClassNames((TypeElement) element, validatorModel, validator);
+ setDescription(validatorModel, validator, getDocComment(element));
- setTagInfo(validator.tag(), validatorModel);
+ setTagInfo(validator, validatorModel);
library.getValidators().add(validatorModel);
}
@@ -57,10 +60,4 @@
public Class<? extends Annotation> getProcessedAnnotation() {
return JsfValidator.class;
}
-
-
- protected String[] getAnnotationAttributes(TypeElement element) {
- JsfValidator validator = element.getAnnotation(JsfValidator.class);
- return validator.attributes();
- }
}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/FreeMarkerWriter.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/FreeMarkerWriter.java 2011-01-07 10:58:02 UTC (rev 20915)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/FreeMarkerWriter.java 2011-01-08 00:55:42 UTC (rev 20916)
@@ -36,6 +36,7 @@
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.ModelElementBase;
import org.richfaces.cdk.model.Trackable;
+import org.richfaces.cdk.model.ViewElement;
import freemarker.template.TemplateException;
@@ -86,7 +87,7 @@
}
protected String getOutputFileName(C c) throws CdkException {
- if (c instanceof ModelElementBase) {
+ if (c instanceof ViewElement) {
ModelElementBase modelElement = (ModelElementBase) c;
return modelElement.getTargetClass().getName().replace('.', File.separatorChar) + ".java";
} else {
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/LibraryModelWrapper.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/LibraryModelWrapper.java 2011-01-07 10:58:02 UTC (rev 20915)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/LibraryModelWrapper.java 2011-01-08 00:55:42 UTC (rev 20916)
@@ -26,9 +26,9 @@
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 org.richfaces.cdk.model.ViewElement;
import freemarker.ext.beans.BeansWrapper;
import freemarker.ext.beans.StringModel;
@@ -72,7 +72,7 @@
return create(obj, EventTemplateModel.FACTORY);
} else if (obj instanceof TagModel) {
return create(obj, TagTemplateModel.FACTORY);
- } else if (obj instanceof ModelElementBase) {
+ } else if (obj instanceof ViewElement) {
return create(obj, ModelElementBaseTemplateModel.FACTORY);
} else {
return super.wrap(obj);
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/ModelElementBaseTemplateModel.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/ModelElementBaseTemplateModel.java 2011-01-07 10:58:02 UTC (rev 20915)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/freemarker/ModelElementBaseTemplateModel.java 2011-01-08 00:55:42 UTC (rev 20916)
@@ -122,39 +122,46 @@
public TemplateModel getImportClasses() throws TemplateModelException {
Set<ClassName> result = Sets.newTreeSet();
-
+ String targetPackage = model.getTargetClass().getPackage();
for (PropertyBase entry : model.getAttributes()) {
- if (entry.getGenerate() && !isPredefined(entry)) {
- result.add(entry.getType());
+ if (entry.getGenerate()) {
+ addIfNecessary(targetPackage, result, entry.getType());
}
}
// Import all interfaces implemented by the generated class.
result.addAll(model.getInterfaces());
if (model instanceof ComponentModel) {
ComponentModel component = (ComponentModel) model;
- for(EventModel event :component.getEvents()){
- result.add(event.getSourceInterface());
- result.add(event.getListenerInterface());
+ for (EventModel event : component.getEvents()) {
+ addIfNecessary(targetPackage, result, event.getSourceInterface());
+ addIfNecessary(targetPackage, result, event.getListenerInterface());
}
}
// Collection<String> list = new ArrayList<String>(result);
return this.wrapper.wrap(result);
}
+
+ private void addIfNecessary(String pkg, Set<ClassName> classNames, ClassName toadd) {
+ if (null != toadd && !isPredefined(toadd) && !pkg.equals(toadd.getPackage())) {
+ classNames.add(toadd);
+ }
+ }
+
public TemplateModel getTagImports() throws TemplateModelException {
Set<ClassName> result = Sets.newTreeSet();
for (PropertyBase entry : model.getAttributes()) {
- if (!(entry.isHidden()||entry.isReadOnly()||null == entry.getSignature())) {
+ if (!(entry.isHidden() || entry.isReadOnly() || null == entry.getSignature())) {
MethodSignature methodSignature = entry.getSignature();
- if(!isPredefined(methodSignature.getReturnType())){
+ if (!isPredefined(methodSignature.getReturnType())) {
result.add(methodSignature.getReturnType());
}
for (ClassName className : methodSignature.getParameters()) {
- if(!isPredefined(className)){
+ if (!isPredefined(className)) {
result.add(className);
}
-
+
}
}
}
@@ -173,15 +180,18 @@
public TemplateModel getImplementedInterfaces() throws TemplateModelException {
Set<ClassName> result = Sets.newTreeSet();
- if(getEventNames().size()>0){
+ if (getEventNames().size() > 0) {
result.add(ClassName.parseName("javax.faces.component.behavior.ClientBehaviorHolder"));
}
// Import all interfaces implemented by the generated class.
result.addAll(model.getInterfaces());
if (model instanceof ComponentModel) {
ComponentModel component = (ComponentModel) model;
- for(EventModel event :component.getEvents()){
- result.add(event.getSourceInterface());
+ for (EventModel event : component.getEvents()) {
+ ClassName sourceInterface = event.getSourceInterface();
+ if (null != sourceInterface) {
+ result.add(sourceInterface);
+ }
}
}
// Collection<String> list = new ArrayList<String>(result);
@@ -193,7 +203,7 @@
}
public boolean isPredefined(ClassName type) {
- return type.isPrimitive() ||"java.lang".equals(type.getPackage());
+ return type.isPrimitive() || "java.lang".equals(type.getPackage());
}
private TemplateModel eventNames() throws TemplateModelException {
@@ -254,7 +264,7 @@
@Override
public boolean apply(PropertyBase input) {
- return !(input.isHidden()||input.isReadOnly());
+ return !(input.isHidden() || input.isReadOnly());
}
}));
}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibGeneratorVisitor.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibGeneratorVisitor.java 2011-01-07 10:58:02 UTC (rev 20915)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/generate/taglib/TaglibGeneratorVisitor.java 2011-01-08 00:55:42 UTC (rev 20916)
@@ -288,8 +288,8 @@
if (!Strings.isEmpty(model.getDescription())) {
parent.addElement("description").addText(model.getDescription());
}
- if (!Strings.isEmpty(model.getDisplayname())) {
- parent.addElement("display-name").addText(model.getDisplayname());
+ if (!Strings.isEmpty(model.getDisplayName())) {
+ parent.addElement("display-name").addText(model.getDisplayName());
}
if (null != model.getIcon()) {
Element iconElement = parent.addElement("icon");
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java 2011-01-07 10:58:02 UTC (rev 20915)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java 2011-01-08 00:55:42 UTC (rev 20916)
@@ -159,15 +159,18 @@
return events;
}
- public EventModel addEvent(String className) {
+ public EventModel addEvent(ClassName className) {
- // TODO - use a single events collection from library.
EventModel event = new EventModel();
- event.setType(new ClassName(className));
+ event.setType(className);
events.add(event);
return event;
}
+ public EventModel addEvent(String className) {
+ return addEvent(ClassName.get(className));
+ }
+
@Override
public String toString() {
return "Component {type: " + getId() + ", family: " + getFamily() + "}";
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/DescriptionGroup.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/DescriptionGroup.java 2011-01-07 10:58:02 UTC (rev 20915)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/DescriptionGroup.java 2011-01-08 00:55:42 UTC (rev 20916)
@@ -36,7 +36,7 @@
*/
@XmlElement(name = "display-name")
@Merge
- public String getDisplayname();
+ public String getDisplayName();
/**
* <p class="changed_added_4_0">
@@ -44,7 +44,7 @@
*
* @param displayname the displayname to set
*/
- public void setDisplayname(String displayname);
+ public void setDisplayName(String displayname);
/**
* <p class="changed_added_4_0">
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/DescriptionGroupBase.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/DescriptionGroupBase.java 2011-01-07 10:58:02 UTC (rev 20915)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/DescriptionGroupBase.java 2011-01-08 00:55:42 UTC (rev 20916)
@@ -65,11 +65,11 @@
}
@Merge
- public final String getDisplayname() {
+ public final String getDisplayName() {
return displayname;
}
- public final void setDisplayname(String displayname) {
+ public final void setDisplayName(String displayname) {
this.displayname = displayname;
}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/EventModel.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/EventModel.java 2011-01-07 10:58:02 UTC (rev 20915)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/EventModel.java 2011-01-08 00:55:42 UTC (rev 20916)
@@ -41,7 +41,7 @@
@SuppressWarnings("serial")
@XmlType(name = "event-configType", namespace = ComponentLibrary.CDK_EXTENSIONS_NAMESPACE)
@XmlAccessorType(XmlAccessType.PUBLIC_MEMBER)
-public class EventModel implements ModelElement<EventModel> {
+public class EventModel implements ModelElement<EventModel>, ViewElement {
private String description;
private ClassName listenerInterface;
private String listenerMethod;
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/ModelElementBase.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/ModelElementBase.java 2011-01-07 10:58:02 UTC (rev 20915)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/ModelElementBase.java 2011-01-08 00:55:42 UTC (rev 20916)
@@ -10,7 +10,7 @@
* @author asmirnov(a)exadel.com
*
*/
-public class ModelElementBase extends BeanModelBase implements FacesComponent {
+public class ModelElementBase extends BeanModelBase implements FacesComponent, ViewElement {
private FacesId id;
@@ -23,10 +23,10 @@
private final Collection<ClassName> interfaces = Lists.newArrayList();
- /**
- * <p class="changed_added_4_0"></p>
- * @return the tags
+ /* (non-Javadoc)
+ * @see org.richfaces.cdk.model.ViewElement#getTags()
*/
+ @Override
public ModelCollection<TagModel> getTags() {
return this.tags;
}
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/validator/ValidatorImpl.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/validator/ValidatorImpl.java 2011-01-07 10:58:02 UTC (rev 20915)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/model/validator/ValidatorImpl.java 2011-01-08 00:55:42 UTC (rev 20916)
@@ -319,22 +319,19 @@
protected void verifyEvents(ComponentLibrary library) {
for (EventModel event : library.getEvents()) {
ClassName listenerInterface = event.getListenerInterface();
- if (null == listenerInterface) {
- // TODO - infer listener interface name.
- }
SourceUtils sourceUtils = sourceUtilsProvider.get();
- event.setGenerateListener(!sourceUtils.isClassExists(listenerInterface));
+ if (null != listenerInterface) {
+ event.setGenerateListener(!sourceUtils.isClassExists(listenerInterface));
+ }
String methodName = event.getListenerMethod();
if (null == methodName) {
- // TODO infer listener method name.
methodName = "process";
event.setListenerMethod(methodName);
}
ClassName sourceInterface = event.getSourceInterface();
- if (null == sourceInterface) {
- // TODO - infer source interface.
+ if (null != sourceInterface) {
+ event.setGenerateSource(!sourceUtils.isClassExists(sourceInterface));
}
- event.setGenerateSource(!sourceUtils.isClassExists(sourceInterface));
// Propagate event to corresponding components.
for (ComponentModel component : library.getComponents()) {
for (EventModel componentEvent : component.getEvents()) {
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java 2011-01-07 10:58:02 UTC (rev 20915)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java 2011-01-08 00:55:42 UTC (rev 20916)
@@ -246,7 +246,7 @@
// TODO is it the right one?
rendererProperty.setDescription(templateAttribute.getShortDescription());
- rendererProperty.setDisplayname(templateAttribute.getDisplayName());
+ rendererProperty.setDisplayName(templateAttribute.getDisplayName());
Set<EventName> eventNamesSet = convert(templateAttribute.getClientBehaviors());
if (eventNamesSet != null) {
Modified: trunk/cdk/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/DescriptionGroupBean.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/DescriptionGroupBean.java 2011-01-07 10:58:02 UTC (rev 20915)
+++ trunk/cdk/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/DescriptionGroupBean.java 2011-01-08 00:55:42 UTC (rev 20916)
@@ -7,7 +7,7 @@
import org.richfaces.cdk.model.DescriptionGroup;
@XmlType(name = "descriptionType", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE,
- propOrder = {"description", "displayname", "icon"})
+ propOrder = {"description", "displayName", "icon"})
public class DescriptionGroupBean implements DescriptionGroup {
private String description;
private String displayname;
@@ -61,7 +61,7 @@
* @return the displayname
*/
@XmlElement(name = "display-name", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE)
- public final String getDisplayname() {
+ public final String getDisplayName() {
return displayname;
}
@@ -70,7 +70,7 @@
*
* @param displayname the displayname to set
*/
- public final void setDisplayname(String displayname) {
+ public final void setDisplayName(String displayname) {
this.displayname = displayname;
}
}
Modified: trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/AptSourceUtilsAnnotationsTest.java
===================================================================
--- trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/AptSourceUtilsAnnotationsTest.java 2011-01-07 10:58:02 UTC (rev 20915)
+++ trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/AptSourceUtilsAnnotationsTest.java 2011-01-08 00:55:42 UTC (rev 20916)
@@ -13,6 +13,7 @@
import org.richfaces.cdk.model.ClassName;
import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Iterables;
public class AptSourceUtilsAnnotationsTest extends SourceUtilsTestBase {
@@ -136,11 +137,11 @@
public void process(SourceUtils utils, RoundEnvironment roundEnv) {
Element element = findElement(roundEnv, ANNOTATIONS_TEST_CLASS);
AnnotationMirror annotationMirror = utils.getAnnotationMirror(element, TestAnnotation.class);
- List<T> annotationValues = utils.getAnnotationValues(annotationMirror, propertyName, type);
- assertEquals("Annotation values size is different from expected",expected.length, annotationValues.size());
+ Iterable<T> annotationValues = utils.getAnnotationValues(annotationMirror, propertyName, type);
+ assertEquals("Annotation values size is different from expected",expected.length, Iterables.size(annotationValues));
for (int i = 0; i < expected.length; i++) {
Object expectedValue = expected[i];
- assertEquals("Annotation value at position "+i+" is different from expected",expectedValue, annotationValues.get(i));
+ assertEquals("Annotation value at position "+i+" is different from expected",expectedValue, Iterables.get(annotationValues, i));
}
}
});
Modified: trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/processors/BehaviorProcessorTest.java
===================================================================
--- trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/processors/BehaviorProcessorTest.java 2011-01-07 10:58:02 UTC (rev 20915)
+++ trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/processors/BehaviorProcessorTest.java 2011-01-08 00:55:42 UTC (rev 20916)
@@ -104,7 +104,7 @@
expect(componentElement.getModifiers()).andReturn(Collections.singleton(Modifier.ABSTRACT));
expect(componentElement.getQualifiedName()).andReturn(name).atLeastOnce();
expect(behaviorAnnotation.generate()).andReturn("foo.Bar");
- expect(behaviorAnnotation.tag()).andReturn(tag);
+ expect(behaviorAnnotation.tag()).andReturn(new Tag[]{tag});
expect(behaviorAnnotation.attributes()).andReturn(new String[] {});
expect(behaviorAnnotation.description()).andReturn(this.description);
expect(tag.handler()).andStubReturn("");
Modified: trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/processors/ComponentProcessorTest.java
===================================================================
--- trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/processors/ComponentProcessorTest.java 2011-01-07 10:58:02 UTC (rev 20915)
+++ trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/processors/ComponentProcessorTest.java 2011-01-08 00:55:42 UTC (rev 20916)
@@ -28,6 +28,7 @@
import java.util.Collections;
+import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.Modifier;
import javax.lang.model.element.TypeElement;
@@ -71,7 +72,7 @@
private static final String FOO_HTML_BAR = "foo.HtmlBar";
@Mock
- private JsfComponent annotation;
+ private AnnotationMirror annotation;
@Mock
private AttributesProcessor attributesProcessor;
@@ -112,13 +113,19 @@
@Test
public void testProcessFacetsFromAnnotation() throws Exception {
- Facet facet = createMock(Facet.class);
+ AnnotationMirror facet = createMock(AnnotationMirror.class);
expect(utils.getBeanPropertiesAnnotatedWith(eq(Facet.class), same(componentElement))).andReturn(
Collections.<BeanProperty> emptySet());
- expect(annotation.facets()).andReturn(new Facet[] { facet });
- expect(facet.name()).andReturn("foo");
- expect(facet.description()).andReturn(this.description);
- expect(facet.generate()).andReturn(true);
+// expect(annotation.facets()).andReturn(new Facet[] { facet });
+ expect(utils.getAnnotationValues(annotation, "facets",AnnotationMirror.class)).andReturn(Collections.singleton(facet));
+ expect(utils.isDefaultValue(same(facet), eq("name"))).andReturn(false);
+ expect(utils.getAnnotationValue(facet, "name",String.class)).andReturn("foo");
+ expect(utils.isDefaultValue(same(facet), eq("description"))).andReturn(true);
+ expect(utils.isDefaultValue(same(facet), eq("generate"))).andReturn(false);
+ expect(utils.getAnnotationValue(facet, "generate",Boolean.class)).andReturn(true);
+// expect(facet.name()).andReturn("foo");
+// expect(facet.description()).andReturn(this.description);
+// expect(facet.generate()).andReturn(true);
// expect(this.description.smallIcon()).andReturn("");
// expect(this.description.largeIcon()).andReturn("");
// expect(this.description.displayName()).andReturn("fooFacet").times(2);
@@ -139,20 +146,17 @@
@Test
public void testProcessFacetsFromProperty() throws Exception {
- Facet facet = createMock(Facet.class);
+ AnnotationMirror facet = createMock(AnnotationMirror.class);
expect(utils.getBeanPropertiesAnnotatedWith(eq(Facet.class), same(componentElement))).andReturn(
Collections.singleton(property));
- expect(annotation.facets()).andReturn(new Facet[0]);
- expect(property.getAnnotation(Facet.class)).andReturn(facet);
+ expect(property.getAnnotationMirror(Facet.class)).andReturn(facet);
expect(property.getName()).andReturn("foo");
expect(property.getDocComment()).andReturn("my comment").times(2);
expect(property.isExists()).andReturn(true);
- expect(facet.description()).andReturn(description);
- expect(facet.generate()).andReturn(true);
- // expect(this.description.smallIcon()).andReturn("");
- // expect(this.description.largeIcon()).andReturn("");
- // expect(this.description.displayName()).andReturn("fooFacet").times(2);
- // expect(this.description.value()).andReturn("");
+ expect(utils.isDefaultValue(same(facet), eq("description"))).andReturn(true);
+ expect(utils.isDefaultValue(same(facet), eq("generate"))).andReturn(false);
+ expect(utils.getAnnotationValue(facet, "generate",Boolean.class)).andReturn(true);
+ expect(utils.getAnnotationValues(annotation, "facets",AnnotationMirror.class)).andReturn(Collections.<AnnotationMirror>emptySet());
replay(utils, componentElement, jaxb, annotation, property, facet, description);
processor.processFacets(componentElement, model, annotation);
@@ -162,9 +166,6 @@
FacetModel facetModel = Iterables.getOnlyElement(model.getFacets());
assertTrue(facetModel.getGenerate());
assertEquals("foo", facetModel.getName());
- // assertEquals("my comment", facetModel.getDescription());
- // assertEquals("fooFacet", facetModel.getDisplayname());
- // assertNull(facetModel.getIcon());
}
/**
@@ -177,12 +178,14 @@
public void testSetClassNames() throws Exception {
expect(componentElement.getModifiers()).andReturn(Collections.<Modifier> emptySet());
expect(componentElement.getQualifiedName()).andReturn(new TestName(FOO_BAR));
+ expect(utils.isDefaultValue(annotation, "generate")).andReturn(true);
+ expect(componentElement.getQualifiedName()).andReturn(new TestName(FOO_BAR));
replay(utils, componentElement, jaxb, annotation);
- processor.setClassNames(componentElement, model, "");
+ processor.setClassNames(componentElement, model, annotation);
verify(utils, componentElement, jaxb, annotation);
assertFalse(model.getGenerate());
assertEquals(FOO_BAR, model.getBaseClass().toString());
- assertNull(model.getTargetClass());
+ assertEquals(FOO_BAR, model.getTargetClass().toString());
}
/**
@@ -194,10 +197,11 @@
@Test
public void testSetClassNames1() throws Exception {
expect(componentElement.getModifiers()).andReturn(Collections.<Modifier> singleton(Modifier.ABSTRACT));
+ utils.setModelProperty(model, annotation, "targetClass","generate");expectLastCall();
expect(componentElement.getQualifiedName()).andReturn(new TestName(FOO_BAR));
replay(utils, componentElement, jaxb, annotation);
- processor.setClassNames(componentElement, model, "");
+ processor.setClassNames(componentElement, model, annotation);
verify(utils, componentElement, jaxb, annotation);
assertTrue(model.getGenerate());
@@ -214,50 +218,18 @@
@Test
public void testSetClassNames2() throws Exception {
expect(componentElement.getModifiers()).andReturn(Collections.<Modifier> emptySet());
+ expect(utils.isDefaultValue(annotation, "generate")).andReturn(false);
+ utils.setModelProperty(model, annotation, "targetClass","generate");expectLastCall();
expect(componentElement.getQualifiedName()).andReturn(new TestName(FOO_BAR));
replay(utils, componentElement, jaxb, annotation);
- processor.setClassNames(componentElement, model, FOO_HTML_BAR);
+ processor.setClassNames(componentElement, model, annotation);
verify(utils, componentElement, jaxb, annotation);
assertTrue(model.getGenerate());
assertEquals(FOO_BAR, model.getBaseClass().toString());
- assertEquals(FOO_HTML_BAR, model.getTargetClass().toString());
}
- @Test
- public void testSetFamily() throws Exception {
- replay(utils, componentElement, jaxb, annotation);
-
- processor.setComponeneFamily(componentElement, model, FOO_HTML_BAR);
-
- verify(utils, componentElement, jaxb, annotation);
- assertEquals(FacesId.parseId(FOO_HTML_BAR), model.getFamily());
- }
-
- @Test
- public void testSetFamily1() throws Exception {
- expect(utils.getConstant(same(componentElement), eq(ComponentProcessor.COMPONENT_FAMILY))).andReturn(
- FOO_HTML_BAR);
- replay(utils, componentElement, jaxb, annotation);
-
- processor.setComponeneFamily(componentElement, model, "");
-
- verify(utils, componentElement, jaxb, annotation);
- assertEquals(FacesId.parseId(FOO_HTML_BAR), model.getFamily());
- }
-
- @Test
- public void testSetFamily2() throws Exception {
- expect(utils.getConstant(same(componentElement), eq(ComponentProcessor.COMPONENT_FAMILY))).andReturn(null);
- replay(utils, componentElement, jaxb, annotation);
-
- processor.setComponeneFamily(componentElement, model, "");
-
- verify(utils, componentElement, jaxb, annotation);
- assertNull(model.getFamily());
- }
-
@Override
protected Iterable<String> sources() {
return Collections.singleton(COMPONENT_CLASS_JAVA);
Modified: trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/processors/DescriptionProcessorTest.java
===================================================================
--- trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/processors/DescriptionProcessorTest.java 2011-01-07 10:58:02 UTC (rev 20915)
+++ trunk/cdk/generator/src/test/java/org/richfaces/cdk/apt/processors/DescriptionProcessorTest.java 2011-01-08 00:55:42 UTC (rev 20916)
@@ -27,12 +27,15 @@
import java.util.Collections;
+import javax.lang.model.element.AnnotationMirror;
+
import org.junit.Test;
import org.junit.runner.RunWith;
import org.richfaces.cdk.CdkTestRunner;
import org.richfaces.cdk.Mock;
import org.richfaces.cdk.annotations.Description;
import org.richfaces.cdk.apt.AnnotationProcessorTestBase;
+import org.richfaces.cdk.apt.SourceUtils;
import org.richfaces.cdk.model.DescriptionGroup;
import com.google.inject.Inject;
@@ -55,12 +58,14 @@
private DescriptionGroup bean;
@Mock
- private Description description;
+ private AnnotationMirror description;
@Inject
private DescriptionProcessorImpl descriptionProcessor;
- /**
+ @Mock
+ private SourceUtils utils;
+ /**
* Test method for
* {@link org.richfaces.cdk.apt.processors.DescriptionProcessorImpl#processDescription(org.richfaces.cdk.model.DescriptionGroup, org.richfaces.cdk.annotations.Description, java.lang.String)}
* .
@@ -69,12 +74,14 @@
public void testProcessDescription() {
bean.setDescription(FOO_BAR_ELEMENT);
expectLastCall();
- bean.setDisplayname(FOO_FACET);
- expectLastCall();
- expect(this.description.smallIcon()).andReturn("");
- expect(this.description.largeIcon()).andReturn("");
- expect(this.description.displayName()).andReturn(FOO_FACET).times(2);
- expect(this.description.value()).andReturn("");
+ expect(utils.isDefaultValue(description, "smallIcon")).andStubReturn(true);
+ expect(utils.isDefaultValue(description, "largeIcon")).andStubReturn(true);
+ utils.setModelProperty(bean, description, "displayName");expectLastCall();
+ utils.setModelProperty(bean, description, "description","value");expectLastCall();
+// expect(this.description.smallIcon()).andReturn("");
+// expect(this.description.largeIcon()).andReturn("");
+// expect(this.description.displayName()).andReturn(FOO_FACET).times(2);
+// expect(this.description.value()).andReturn("");
mockController.replay();
descriptionProcessor.processDescription(bean, description, FOO_BAR_ELEMENT);
mockController.verify();
Modified: trunk/cdk/generator/src/test/java/org/richfaces/cdk/templatecompiler/RendererTemplateParserTest.java
===================================================================
--- trunk/cdk/generator/src/test/java/org/richfaces/cdk/templatecompiler/RendererTemplateParserTest.java 2011-01-07 10:58:02 UTC (rev 20915)
+++ trunk/cdk/generator/src/test/java/org/richfaces/cdk/templatecompiler/RendererTemplateParserTest.java 2011-01-08 00:55:42 UTC (rev 20916)
@@ -252,7 +252,7 @@
assertTrue(requiredAttribute.isRequired());
assertEquals("That's a required attribute", requiredAttribute.getDescription());
- assertEquals("Required Attribute", requiredAttribute.getDisplayname());
+ assertEquals("Required Attribute", requiredAttribute.getDisplayName());
}
@Test
Modified: trunk/cdk/generator/src/test/java/org/richfaces/cdk/xmlconfig/FacesConfigTest.java
===================================================================
--- trunk/cdk/generator/src/test/java/org/richfaces/cdk/xmlconfig/FacesConfigTest.java 2011-01-07 10:58:02 UTC (rev 20915)
+++ trunk/cdk/generator/src/test/java/org/richfaces/cdk/xmlconfig/FacesConfigTest.java 2011-01-08 00:55:42 UTC (rev 20916)
@@ -103,7 +103,7 @@
assertEquals("panel.gif", component.getIcon().getSmallIcon());
assertEquals("panel-large.gif", component.getIcon().getLargeIcon());
assertEquals("Panel component", component.getDescription());
- assertEquals("Panel", component.getDisplayname());
+ assertEquals("Panel", component.getDisplayName());
assertTrue(component.getGenerate());
FacetModel facet = Iterables.getOnlyElement(component.getFacets());
Modified: trunk/cdk/generator/src/test/java/org/richfaces/cdk/xmlconfig/FragmentParserTest.java
===================================================================
--- trunk/cdk/generator/src/test/java/org/richfaces/cdk/xmlconfig/FragmentParserTest.java 2011-01-07 10:58:02 UTC (rev 20915)
+++ trunk/cdk/generator/src/test/java/org/richfaces/cdk/xmlconfig/FragmentParserTest.java 2011-01-08 00:55:42 UTC (rev 20916)
@@ -113,7 +113,7 @@
assertEquals("int", property.getType().getName());
assertEquals("test2 property", property.getDescription());
assertEquals("ontest2.png", property.getIcon().getSmallIcon());
- assertEquals("test2 event property", property.getDisplayname());
+ assertEquals("test2 event property", property.getDisplayName());
assertEquals("3", property.getDefaultValue());
assertEquals("15", property.getSuggestedValue());
Modified: trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/AbstractTestComponent.java
===================================================================
--- trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/AbstractTestComponent.java 2011-01-07 10:58:02 UTC (rev 20915)
+++ trunk/cdk/maven-cdk-plugin/src/it/annotated-component/src/main/java/org/richfaces/cdk/test/component/AbstractTestComponent.java 2011-01-08 00:55:42 UTC (rev 20916)
@@ -31,9 +31,12 @@
import javax.faces.component.ValueHolder;
import javax.faces.el.MethodBinding;
import javax.faces.el.ValueBinding;
+import javax.faces.event.ValueChangeEvent;
+import javax.faces.event.ValueChangeListener;
import org.richfaces.cdk.annotations.Attribute;
import org.richfaces.cdk.annotations.Description;
+import org.richfaces.cdk.annotations.Event;
import org.richfaces.cdk.annotations.Facet;
import org.richfaces.cdk.annotations.JsfComponent;
import org.richfaces.cdk.annotations.JsfRenderer;
@@ -56,7 +59,7 @@
description=@Description(displayName="Test Component",largeIcon="large.gif",smallIcon="spall.png"),
generate="org.richfaces.cdk.test.component.UITestComponent",
facets=@Facet(name="caption",generate=true,description=@Description("Caption Facet")),
- fires=TestEvent.class,
+ fires={@Event(TestEvent.class),(a)Event(value=ValueChangeEvent.class,listener=ValueChangeListener.class)},
interfaces=ValueHolder.class,
components={
@RendererSpecificComponent(type = "org.richfaces.cdk.test.TestHtmlAbbr",
Modified: trunk/ui/core/ui/src/main/java/org/richfaces/component/UIRepeat.java
===================================================================
--- trunk/ui/core/ui/src/main/java/org/richfaces/component/UIRepeat.java 2011-01-07 10:58:02 UTC (rev 20915)
+++ trunk/ui/core/ui/src/main/java/org/richfaces/component/UIRepeat.java 2011-01-08 00:55:42 UTC (rev 20916)
@@ -30,7 +30,7 @@
* @author Nick Belaevski
*
*/
-@JsfComponent(generate = "", tag = @Tag(name = "repeat", type = TagType.Facelets), renderer = @JsfRenderer(type = "org.richfaces.RepeatRenderer"))
+@JsfComponent(tag = @Tag(name = "repeat", type = TagType.Facelets), renderer = @JsfRenderer(type = "org.richfaces.RepeatRenderer"))
public class UIRepeat extends UISequence {
public static final String COMPONENT_TYPE = "org.richfaces.Repeat";
13 years, 11 months
JBoss Rich Faces SVN: r20915 - in modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest: richMenuSeparator and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2011-01-07 05:58:02 -0500 (Fri, 07 Jan 2011)
New Revision: 20915
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMenuSeparator/
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMenuSeparator/TestRichMenuSeparator.java
Log:
https://issues.jboss.org/browse/RFPL-960
* adde one test for rich:menuSeparator
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMenuSeparator/TestRichMenuSeparator.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMenuSeparator/TestRichMenuSeparator.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMenuSeparator/TestRichMenuSeparator.java 2011-01-07 10:58:02 UTC (rev 20915)
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 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.tests.metamer.ftest.richMenuSeparator;
+
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.testng.Assert.assertEquals;
+import java.net.URL;
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
+import org.testng.annotations.Test;
+
+/**
+ * Test case for page faces/components/richMenuSeparator/simple.xhtml.
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public class TestRichMenuSeparator extends AbstractMetamerTest {
+
+ private JQueryLocator separators = pjq("div.rf-ddm-sep");
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/richMenuSeparator/simple.xhtml");
+ }
+
+ @Test
+ public void testRendered() {
+ int count = selenium.getCount(separators);
+ assertEquals(count, 2, "There should be two separators on the page - after 'Open Recent' and after 'Close'.");
+
+ selenium.click(pjq("input[type=radio][name$=renderedInput][value=false]"));
+ selenium.waitForPageToLoad();
+ count = selenium.getCount(separators);
+ assertEquals(count, 1, "There should be only one separator on the page - after 'Close'.");
+
+ selenium.click(pjq("input[type=radio][name$=renderedInput][value=true]"));
+ selenium.waitForPageToLoad();
+ count = selenium.getCount(separators);
+ assertEquals(count, 2, "There should be two separators on the page - after 'Open Recent' and after 'Close'.");
+ }
+}
Property changes on: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMenuSeparator/TestRichMenuSeparator.java
___________________________________________________________________
Name: svn:keywords
+ Revision
13 years, 11 months
JBoss Rich Faces SVN: r20914 - in modules/tests/metamer/trunk: ftest-source/src/main/java/org/richfaces/tests/metamer/ftest and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2011-01-07 05:45:36 -0500 (Fri, 07 Jan 2011)
New Revision: 20914
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richFunctions/
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richFunctions/TestClientFunctions.java
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richFunctions/all.xhtml
Log:
https://issues.jboss.org/browse/RFPL-718
* added two tests for client functions
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/richFunctions/all.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richFunctions/all.xhtml 2011-01-06 17:50:51 UTC (rev 20913)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richFunctions/all.xhtml 2011-01-07 10:45:36 UTC (rev 20914)
@@ -50,16 +50,16 @@
<h:panelGrid columns="2">
rich:clientId('input')
- <h:outputText value="#{rich:clientId('input')}" style="font-weight: bold;" />
+ <h:outputText id="clientIdOutput" value="#{rich:clientId('input')}" style="font-weight: bold;" />
rich:element('input')
- <h:outputText value="#{rich:element('input')}" style="font-weight: bold;" />
+ <h:outputText id="elementOutput" value="#{rich:element('input')}" style="font-weight: bold;" />
rich:component('input')
- <h:outputText value="#{rich:component('input')}" style="font-weight: bold;" />
+ <h:outputText id="componentOutput" value="#{rich:component('input')}" style="font-weight: bold;" />
rich:findComponent('input').value
- <h:outputText value="#{rich:findComponent('input').value}" style="font-weight: bold;" />
+ <h:outputText id="findComponentOutput" value="#{rich:findComponent('input').value}" style="font-weight: bold;" />
</h:panelGrid>
<hr/>
@@ -67,7 +67,7 @@
<h:outputLabel value="Role name: " for="roleName" />
<h:inputText value="#{userBean.rolename}" id="roleName" />
<br />
- <h:commandLink value="Apply role name" />
+ <h:commandLink id="applyLink" value="Apply role name" />
<hr/>
<h:panelGrid columns="2">
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richFunctions/TestClientFunctions.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richFunctions/TestClientFunctions.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richFunctions/TestClientFunctions.java 2011-01-07 10:45:36 UTC (rev 20914)
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 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.tests.metamer.ftest.richFunctions;
+
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertNotSame;
+import java.net.URL;
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
+import org.testng.annotations.Test;
+
+/**
+ * Test case for page faces/components/richFunctions/all.xhtml.
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public class TestClientFunctions extends AbstractMetamerTest {
+
+ private JQueryLocator clientIdOutput = pjq("span[id$=clientIdOutput]");
+ private JQueryLocator elementOutput = pjq("span[id$=elementOutput]");
+ private JQueryLocator componentOutput = pjq("span[id$=componentOutput]");
+ private JQueryLocator findComponentOutput = pjq("span[id$=findComponentOutput]");
+ private JQueryLocator roleNameInput = pjq("input[id$=roleName]");
+ private JQueryLocator applyLink = pjq("a[id$=applyLink]");
+ private JQueryLocator userInRoleAUOutput = pjq("span[id$=outputUserInRoleAU]");
+ private JQueryLocator userInRoleAOutput = pjq("span[id$=outputUserInRoleA]");
+ private JQueryLocator userInRoleUOutput = pjq("span[id$=outputUserInRoleU]");
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/richFunctions/all.xhtml");
+ }
+
+ @Test
+ public void testFunctions() {
+ String clientId = selenium.getText(clientIdOutput);
+ assertNotNull(clientId, "Function clientId() doesn't work.");
+ assertNotSame(clientId, "", "Function clientId() doesn't work.");
+
+ String output = selenium.getText(elementOutput);
+ assertEquals(output, "document.getElementById('" + clientId + "')", "Function element() doesn't work.");
+
+ output = selenium.getText(componentOutput);
+ assertEquals(output, "RichFaces.$('" + clientId + "')", "Function component() doesn't work.");
+
+ output = selenium.getText(findComponentOutput);
+ assertEquals(output, "abc", "Function findComponent() doesn't work.");
+ }
+
+ @Test
+ public void testRoles() {
+ String outputAU = selenium.getText(userInRoleAUOutput);
+ String outputA = selenium.getText(userInRoleAOutput);
+ String outputU = selenium.getText(userInRoleUOutput);
+ assertEquals(outputAU, "false", "User is not in role 'admin' nor 'user'.");
+ assertEquals(outputA, "false", "User is not in role 'admin'.");
+ assertEquals(outputU, "false", "User is not in role 'user'.");
+
+ selenium.type(roleNameInput, "user");
+ selenium.click(applyLink);
+ selenium.waitForPageToLoad();
+ outputAU = selenium.getText(userInRoleAUOutput);
+ outputA = selenium.getText(userInRoleAOutput);
+ outputU = selenium.getText(userInRoleUOutput);
+ assertEquals(outputAU, "true", "User is in role 'admin' or 'user'.");
+ assertEquals(outputA, "false", "User is not in role 'admin'.");
+ assertEquals(outputU, "true", "User is in role 'user'.");
+
+ selenium.type(roleNameInput, "admin");
+ selenium.click(applyLink);
+ selenium.waitForPageToLoad();
+ outputAU = selenium.getText(userInRoleAUOutput);
+ outputA = selenium.getText(userInRoleAOutput);
+ outputU = selenium.getText(userInRoleUOutput);
+ assertEquals(outputAU, "true", "User is in role 'admin' or 'user'.");
+ assertEquals(outputA, "true", "User is in role 'admin'.");
+ assertEquals(outputU, "false", "User is not in role 'user'.");
+
+ selenium.type(roleNameInput, "superhero");
+ selenium.click(applyLink);
+ selenium.waitForPageToLoad();
+ outputAU = selenium.getText(userInRoleAUOutput);
+ outputA = selenium.getText(userInRoleAOutput);
+ outputU = selenium.getText(userInRoleUOutput);
+ assertEquals(outputAU, "false", "User is not in role 'admin' nor 'user'.");
+ assertEquals(outputA, "false", "User is not in role 'admin'.");
+ assertEquals(outputU, "false", "User is not in role 'user'.");
+ }
+}
Property changes on: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richFunctions/TestClientFunctions.java
___________________________________________________________________
Name: svn:keywords
+ Revision
13 years, 11 months