JBoss Rich Faces SVN: r19515 - in modules/tests/metamer/trunk/application/src/main: webapp/components/richInputNumberSpinner and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2010-10-11 05:46:58 -0400 (Mon, 11 Oct 2010)
New Revision: 19515
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichInputNumberSpinnerBean.java
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichTogglePanelBean.java
modules/tests/metamer/trunk/application/src/main/webapp/components/richInputNumberSpinner/simple.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/richTogglePanel/simple.xhtml
Log:
* listeners removed from attribute list
Modified: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichInputNumberSpinnerBean.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichInputNumberSpinnerBean.java 2010-10-11 09:31:55 UTC (rev 19514)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichInputNumberSpinnerBean.java 2010-10-11 09:46:58 UTC (rev 19515)
@@ -64,6 +64,7 @@
// TODO has to be tested in another way
attributes.remove("validator");
+ attributes.remove("valueChangeListener");
}
public Attributes getAttributes() {
Modified: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichTogglePanelBean.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichTogglePanelBean.java 2010-10-11 09:31:55 UTC (rev 19514)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichTogglePanelBean.java 2010-10-11 09:46:58 UTC (rev 19515)
@@ -58,6 +58,10 @@
attributes.setAttribute("activeItem", "item1");
attributes.setAttribute("rendered", true);
+
+ // TODO has to be tested in another way
+ attributes.remove("itemChangeListener");
+ attributes.remove("itemChangeListeners");
}
public Attributes getAttributes() {
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/richInputNumberSpinner/simple.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richInputNumberSpinner/simple.xhtml 2010-10-11 09:31:55 UTC (rev 19514)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richInputNumberSpinner/simple.xhtml 2010-10-11 09:46:58 UTC (rev 19515)
@@ -89,7 +89,6 @@
validatorMessage="#{richInputNumberSpinnerBean.attributes['validatorMessage'].value}"
validators="#{richInputNumberSpinnerBean.attributes['validators'].value}"
value="#{richInputNumberSpinnerBean.attributes['value'].value}"
- valueChangeListener="#{richInputNumberSpinnerBean.attributes['valueChangeListener'].value}"
valueChangeListeners="#{richInputNumberSpinnerBean.attributes['valueChangeListeners'].value}">
<a4j:ajax render="output"/>
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/richTogglePanel/simple.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richTogglePanel/simple.xhtml 2010-10-11 09:31:55 UTC (rev 19514)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richTogglePanel/simple.xhtml 2010-10-11 09:46:58 UTC (rev 19515)
@@ -65,8 +65,6 @@
firstItem="#{richTogglePanelBean.attributes['firstItem'].value}"
immediate="#{richTogglePanelBean.attributes['immediate'].value}"
itemByIndex="#{richTogglePanelBean.attributes['itemByIndex'].value}"
- itemChangeListener="#{richTogglePanelBean.attributes['itemChangeListener'].value}"
- itemChangeListeners="#{richTogglePanelBean.attributes['itemChangeListeners'].value}"
lang="#{richTogglePanelBean.attributes['lang'].value}"
lastItem="#{richTogglePanelBean.attributes['lastItem'].value}"
limitToList="#{richTogglePanelBean.attributes['limitToList'].value}"
13 years, 11 months
JBoss Rich Faces SVN: r19514 - modules/tests/metamer/trunk/application/src/main/webapp/components/richColumnGroup.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2010-10-11 05:31:55 -0400 (Mon, 11 Oct 2010)
New Revision: 19514
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richColumnGroup/header.xhtml
Log:
* added spinner to last column and a4j:ajax to checkbox
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/richColumnGroup/header.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richColumnGroup/header.xhtml 2010-10-11 09:27:10 UTC (rev 19513)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richColumnGroup/header.xhtml 2010-10-11 09:31:55 UTC (rev 19514)
@@ -77,7 +77,7 @@
</rich:column>
<rich:column id="columnSmoker">
- <h:selectBooleanCheckbox value="#{record.smoker}">
+ <h:selectBooleanCheckbox id="smokerCheckbox" value="#{record.smoker}">
<a4j:ajax/>
</h:selectBooleanCheckbox>
</rich:column>
@@ -87,7 +87,9 @@
</rich:column>
<rich:column id="columnNumberOfKids">
- <h:outputText value="#{record.numberOfKids}" />
+ <rich:inputNumberSpinner id="numberOfKidsSpinner" value="#{record.numberOfKids}">
+ <a4j:ajax/>
+ </rich:inputNumberSpinner>
</rich:column>
<f:facet name="footer">
13 years, 11 months
JBoss Rich Faces SVN: r19512 - in modules/docs/trunk/Component_Reference/src/main/docbook/en-US: extras and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: SeanRogers
Date: 2010-10-11 02:12:42 -0400 (Mon, 11 Oct 2010)
New Revision: 19512
Added:
modules/docs/trunk/Component_Reference/src/main/docbook/en-US/images/Component_Reference-richjQuery-richjQuery_example.png
Modified:
modules/docs/trunk/Component_Reference/src/main/docbook/en-US/chap-Component_Reference-Layout_and_appearance.xml
modules/docs/trunk/Component_Reference/src/main/docbook/en-US/extras/exam-Component_Reference-richjQuery-Calling_a_richjQuery_component_as_a_function.xml_sample
modules/docs/trunk/Component_Reference/src/main/docbook/en-US/extras/exam-Component_Reference-richjQuery-richjQuery_example.xml_sample
Log:
Revised rich:jQuery based on tech review RFPL-834
Modified: modules/docs/trunk/Component_Reference/src/main/docbook/en-US/chap-Component_Reference-Layout_and_appearance.xml
===================================================================
--- modules/docs/trunk/Component_Reference/src/main/docbook/en-US/chap-Component_Reference-Layout_and_appearance.xml 2010-10-11 00:37:43 UTC (rev 19511)
+++ modules/docs/trunk/Component_Reference/src/main/docbook/en-US/chap-Component_Reference-Layout_and_appearance.xml 2010-10-11 06:12:42 UTC (rev 19512)
@@ -27,65 +27,35 @@
<section id="sect-Component_Reference-Layout_and_appearance-richjQuery">
<title><sgmltag><rich:jQuery></sgmltag></title>
<para>
- The <sgmltag><rich:jQuery></sgmltag> component applies styles and custom behavior to both <acronym>JSF</acronym> (JavaServer Faces) objects and regular <acronym>DOM</acronym> (Document Object Model) objects. It uses the <phrase>jQuery</phrase> JavaScript framework to add functionality without conflicting with the <filename>prototype.js</filename> library.
+ The <sgmltag><rich:jQuery></sgmltag> component applies styles and custom behavior to both <acronym>JSF</acronym> (JavaServer Faces) objects and regular <acronym>DOM</acronym> (Document Object Model) objects. It uses the <phrase>jQuery</phrase> JavaScript framework to add functionality to web applications.
</para>
+
<section id="sect-Component_Reference-richjQuery-Basic_usage">
<title>Basic usage</title>
<para>
The query triggered by the <sgmltag><rich:jQuery></sgmltag> component is specified using the <varname>query</varname> attribute.
</para>
<para>
- The query can be triggered in three different ways. Use the <varname>timing</varname> attribute to specify the point at which the query is triggered:
+ With the query defined, the component is used to trigger the query as either a <firstterm>timed query</firstterm> or a <firstterm>named query</firstterm>. The query can be bound to an event to act as an <firstterm>event handler</firstterm>. These different approaches are covered in the following sections.
</para>
- <variablelist>
- <varlistentry>
- <term><literal>immediate</literal></term>
- <listitem>
- <para>
- The query is triggered immediately.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><literal>onload</literal></term>
- <listitem>
- <para>
- The query is triggered when the document is loaded.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><literal>onJScall</literal></term>
- <listitem>
- <para>
- The query is triggered when a JavaScript function is invoked. The JavaScript function is specified using the <varname>name</varname> attribute.
- </para>
- <para>
- If the <varname>name</varname> attribute is included when the <varname>timing</varname> attribute is set to either <literal>immediate</literal> or <literal>onload</literal>, the query can be triggered using the JavaScript function <emphasis>in addition</emphasis> to the specified trigger timing.
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
- <example id="exam-Component_Reference-richjQuery-richjQuery_example">
- <title><sgmltag><rich:jQuery></sgmltag> example</title>
- <programlisting language="XML" role="XML"><xi:include parse="text" href="extras/exam-Component_Reference-richjQuery-richjQuery_example.xml_sample" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
- <para>
- In the example, the selector picks out the odd <sgmltag><tr></sgmltag> elements that are children of the element with an <code><varname>id</varname>="customlist"</code> attribute. The query <code>addClass(odd)</code> is then performed on the selection during page loading (<literal>onload</literal>) such that the <literal>odd</literal> CSS class is added to the selected elements.
- </para>
- </example>
+ </section>
+
+ <section id="sect-Component_Reference-richjQuery-Defining_a_selector">
+ <title>Defining a selector</title>
<para>
Any objects or lists of objects used in the query are specified using the <varname>selector</varname> attribute. The <varname>selector</varname> attribute references objects using the following method:
</para>
<itemizedlist>
<listitem>
<para>
- The <varname>selector</varname> attribute can refer to the <varname>id</varname> attribute of any JSF component or client.
+ The <varname>selector</varname> attribute can refer to the <varname>id</varname> identifier of any JSF component or client.
</para>
</listitem>
<listitem>
<para>
- If the <varname>selector</varname> attribute does not match the <varname>id</varname> identifier attribute of any JSF components or clients on the page, it instead uses syntax defined by the <orgname>World Wide Web Consortium (<acronym>W3C</acronym>)</orgname> for the <acronym>CSS</acronym> rule selector. <xref linkend="exam-Component_Reference-richjQuery-Example_selector_values" /> shows a list of examples of the selector syntax. Refer to the syntax specification at <ulink url="http://www.w3.org/TR/CSS2/selector.html">http://www.w3.org/TR/CSS2/selector.html</ulink> for full details.
+ If the <varname>selector</varname> attribute does not match the <varname>id</varname> identifier attribute of any JSF components or clients on the page, it instead uses syntax defined by the <orgname>World Wide Web Consortium (<acronym>W3C</acronym>)</orgname> for the <acronym>CSS</acronym> rule selector. <!--<xref linkend="exam-Component_Reference-richjQuery-Example_selector_values" /> shows a list of examples of the selector syntax.--> Refer to the syntax specification at <ulink url="http://api.jquery.com/category/selectors/">http://api.jquery.com/category/selectors/</ulink> for full details.
</para>
+ <!--
<example id="exam-Component_Reference-richjQuery-Example_selector_values">
<title>Example selector values</title>
<variablelist>
@@ -153,25 +123,7 @@
</para>
</listitem>
</varlistentry>
- <!--
<varlistentry>
- <term><code>p//span</code></term>
- <listitem>
- <para>
- All <sgmltag><span></sgmltag> elements that are direct or indirect children of <sgmltag><p></sgmltag> elements are selected.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><code>p/../span</code></term>
- <listitem>
- <para>
- All <sgmltag><span></sgmltag> elements that are grandchildren of <sgmltag><p></sgmltag> elements are selected.
- </para>
- </listitem>
- </varlistentry>
- -->
- <varlistentry>
<term><code>p[foo^=bar]</code></term>
<listitem>
<para>
@@ -197,6 +149,7 @@
</varlistentry>
</variablelist>
</example>
+ -->
</listitem>
</itemizedlist>
<para>
@@ -211,15 +164,96 @@
<programlisting language="XML" role="XML"><xi:include parse="text" href="extras/exam-Component_Reference-richjQuery-Avoiding_syntax_confusion_1.xml_sample" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
</example>
</section>
+
+ <section id="sect-Component_Reference-richjQuery-Event_handlers">
+ <title>Event handlers</title>
+ <para>
+ Queries set as event handlers are triggered when the component specified in the <varname>selector</varname> attribute raises an event. The query is bound to the event defined using the <varname>event</varname> attribute.
+ </para>
+ <para>
+ Use the <varname>attachType</varname> attribute to specify how the event-handling queries are attached to the events:
+ </para>
+ <variablelist>
+ <varlistentry>
+ <term><literal>bind</literal></term>
+ <listitem>
+ <para>
+ This is the default for attaching queries to events. The event handler is bound to all elements currently defined by the <varname>selector</varname> attribute.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><literal>live</literal></term>
+ <listitem>
+ <para>
+ The event handler is bound to all current and future elements defined by the <varname>selector</varname> attribute.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><literal>one</literal></term>
+ <listitem>
+ <para>
+ The event handler is bound to all elements currently defined by the <varname>selector</varname> attribute. After the first invocation of the event, the event handler is unbound such that it no longer fires when the event is raised.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </section>
- <section id="sect-Component_Reference-richjQuery-Calling_a_richjQuery_as_a_JavaScript_function">
- <title>Calling a <sgmltag><richjQuery></sgmltag> as a JavaScript function</title>
+ <section id="sect-Component_Reference-richjQuery-Timed_queries">
+ <title>Timed queries</title>
<para>
- If the <varname>name</varname> attribute is specified, the <sgmltag><rich:jQuery></sgmltag> component generates a JavaScript function that can be called by any other JavaScript on the page.
+ Timed queries are triggered at specified times. This can be useful for calling simple methods when a page is rendered, or for adding specific functionality to an element. Use the <varname>timing</varname> attribute to specify the point at which the timed query is triggered:
</para>
+ <variablelist>
+ <varlistentry>
+ <term><literal>ondomready</literal></term>
+ <listitem>
+ <para>
+ This is the default behavior. The query is triggered when the document is loaded and the DOM is ready. The query is called as a <methodname>jQuery()</methodname> function.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><literal>immediate</literal></term>
+ <listitem>
+ <para>
+ The query is triggered immediately. The query is called as an in-line script.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ <example id="exam-Component_Reference-richjQuery-richjQuery_example">
+ <title><sgmltag><rich:jQuery></sgmltag> example</title>
+ <programlisting language="XML" role="XML"><xi:include parse="text" href="extras/exam-Component_Reference-richjQuery-richjQuery_example.xml_sample" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
+ <para>
+ In the example, the selector picks out the odd <sgmltag><tr></sgmltag> elements that are children of the element with an <code><varname>id</varname>="customlist"</code> attribute. The query <code>addClass(odd)</code> is then performed on the selection during page loading (<literal>onload</literal>) such that the <literal>odd</literal> CSS class is added to the selected elements.
+ </para>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/Component_Reference-richjQuery-richjQuery_example.png" format="PNG" />
+ </imageobject>
+ <textobject>
+ <para>
+ A table highlighted in a "zebra" fashion, with every odd row colored.
+ </para>
+ </textobject>
+ </mediaobject>
+ </example>
+ </section>
+
+ <section id="sect-Component_Reference-richjQuery-Named_queries">
+ <title>Named queries</title>
<para>
- Calls to the function must pass a direct reference (<literal>this</literal>) to the calling object as a parameter. If the function requires extra parameters itself, these are provided in JavaScript Object Notation (JSON) syntax as a second parameter in the JavaScript call. The <literal>param</literal> namespace is then used in the <sgmltag><rich:jQuery></sgmltag> query to access the passed function parameters. <xref linkend="exam-Component_Reference-richjQuery-Calling_a_richjQuery_component_as_a_function" /> demonstrates the use of the <varname>name</varname> attribute and how to pass function parameters through the JavaScript calls.
+ Named queries are given a name such that they can be triggered by other functions or handlers. Use the <varname>name</varname> attribute to name the query. The query can then be accessed as though it were a JavaScript function using the specified <varname>name</varname> attribute as the function name.
</para>
+ <para>
+ Calls to the function must pass a direct reference (<literal>this</literal>) to the calling object as a parameter. This is treated the same as an item defined through the <varname>selector</varname> attribute.
+ </para>
+ <para>
+ If the function requires extra parameters itself, these are provided in JavaScript Object Notation (JSON) syntax as a second parameter in the JavaScript call. The <literal>options</literal> namespace is then used in the <sgmltag><rich:jQuery></sgmltag> query to access the passed function parameters. <xref linkend="exam-Component_Reference-richjQuery-Calling_a_richjQuery_component_as_a_function" /> demonstrates the use of the <varname>name</varname> attribute and how to pass function parameters through the JavaScript calls.
+ </para>
<example id="exam-Component_Reference-richjQuery-Calling_a_richjQuery_component_as_a_function">
<title>Calling a <sgmltag><rich:jQuery></sgmltag> component as a function</title>
<programlisting language="XML" role="XML"><xi:include parse="text" href="extras/exam-Component_Reference-richjQuery-Calling_a_richjQuery_component_as_a_function.xml_sample" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
@@ -235,21 +269,10 @@
The <sgmltag><rich:jQuery></sgmltag> component applies style and behavioral changes to DOM objects dynamically. As such, changes applied during an Ajax response are overwritten, and will need to be re-applied once the Ajax response is complete.
</para>
<para>
- Any queries with the <varname>timing</varname> attribute set to <literal>onload</literal> may not update during an Ajax response, as the DOM document is not completely reloaded. To ensure the query is re-applied after an Ajax response, include the <varname>name</varname> attribute in the <sgmltag><rich:jQuery></sgmltag> component and invoke it using JavaScript from the <varname>oncomplete</varname> event attribute of the component that triggered the Ajax interaction.
+ Any timed queries with the <varname>timing</varname> attribute set to <literal>ondomready</literal> may not update during an Ajax response, as the DOM document is not completely reloaded. To ensure the query is re-applied after an Ajax response, include the <varname>name</varname> attribute in the <sgmltag><rich:jQuery></sgmltag> component and invoke it using JavaScript from the <varname>oncomplete</varname> event attribute of the component that triggered the Ajax interaction.
</para>
</section>
- <section id="sect-Component_Reference-richjQuery-Using_the_jQuery_JavaScript_framework">
- <title>Using the jQuery JavaScript framework</title>
- <para>
- RichFaces includes the jQuery JavaScript framework. The features of the framework can be accessed directly without using a <sgmltag><rich:jQuery></sgmltag> component by including the library on the page using the <sgmltag><a4j:loadScript></sgmltag> component:
- </para>
- <programlisting language="XML" role="XML"><xi:include parse="text" href="extras/exam-Component_Reference-richjQuery-Using_the_jQuery_JavaScript_framework.xml_sample" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
- <para>
- Refer to the <citetitle>jQuery documentation</citetitle> at <ulink url="http://docs.jquery.com">http://docs.jquery.com</ulink> for full details on jQuery syntax and usage.
- </para>
- </section>
-
<section id="sect-Component_Reference-richjQuery-Reference_data">
<title>Reference data</title>
<itemizedlist>
Modified: modules/docs/trunk/Component_Reference/src/main/docbook/en-US/extras/exam-Component_Reference-richjQuery-Calling_a_richjQuery_component_as_a_function.xml_sample
===================================================================
--- modules/docs/trunk/Component_Reference/src/main/docbook/en-US/extras/exam-Component_Reference-richjQuery-Calling_a_richjQuery_component_as_a_function.xml_sample 2010-10-11 00:37:43 UTC (rev 19511)
+++ modules/docs/trunk/Component_Reference/src/main/docbook/en-US/extras/exam-Component_Reference-richjQuery-Calling_a_richjQuery_component_as_a_function.xml_sample 2010-10-11 06:12:42 UTC (rev 19512)
@@ -1,5 +1,5 @@
<h:graphicImage width="50" value="/images/price.png" onmouseover="enlargePic(this, {pwidth:'60px'})" onmouseout="releasePic(this)" />
<h:graphicImage width="50" value="/images/discount.png" onmouseover="enlargePic(this, {pwidth:'100px'})" onmouseout="releasePic(this)" />
...
-<rich:jQuery name="enlargePic" timing="onJScall" query="animate({width:param.pwidth})" />
-<rich:jQuery name="releasePic" timing="onJScall" query="animate({width:'50px'})"/>
+<rich:jQuery name="enlargePic" query="animate({width:options.pwidth})" />
+<rich:jQuery name="releasePic" query="animate({width:'50px'})"/>
Modified: modules/docs/trunk/Component_Reference/src/main/docbook/en-US/extras/exam-Component_Reference-richjQuery-richjQuery_example.xml_sample
===================================================================
--- modules/docs/trunk/Component_Reference/src/main/docbook/en-US/extras/exam-Component_Reference-richjQuery-richjQuery_example.xml_sample 2010-10-11 00:37:43 UTC (rev 19511)
+++ modules/docs/trunk/Component_Reference/src/main/docbook/en-US/extras/exam-Component_Reference-richjQuery-richjQuery_example.xml_sample 2010-10-11 06:12:42 UTC (rev 19512)
@@ -2,4 +2,4 @@
...
</rich:dataTable>
-<rich:jQuery selector="#customList tr:odd" timing="onload" query="addClass(odd)" />
+<rich:jQuery selector="#customList tr:odd" timing="ondomready" query="addClass(odd)" />
Added: modules/docs/trunk/Component_Reference/src/main/docbook/en-US/images/Component_Reference-richjQuery-richjQuery_example.png
===================================================================
(Binary files differ)
Property changes on: modules/docs/trunk/Component_Reference/src/main/docbook/en-US/images/Component_Reference-richjQuery-richjQuery_example.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
13 years, 11 months
JBoss Rich Faces SVN: r19511 - modules/docs/trunk/Component_Reference/src/main/docbook/en-US.
by richfaces-svn-commits@lists.jboss.org
Author: SeanRogers
Date: 2010-10-10 20:37:43 -0400 (Sun, 10 Oct 2010)
New Revision: 19511
Modified:
modules/docs/trunk/Component_Reference/src/main/docbook/en-US/chap-Component_Reference-Output_and_messages.xml
Log:
Updated progressBar following tech review RFPL-829
Modified: modules/docs/trunk/Component_Reference/src/main/docbook/en-US/chap-Component_Reference-Output_and_messages.xml
===================================================================
--- modules/docs/trunk/Component_Reference/src/main/docbook/en-US/chap-Component_Reference-Output_and_messages.xml 2010-10-08 22:22:19 UTC (rev 19510)
+++ modules/docs/trunk/Component_Reference/src/main/docbook/en-US/chap-Component_Reference-Output_and_messages.xml 2010-10-11 00:37:43 UTC (rev 19511)
@@ -303,6 +303,12 @@
</listitem>
</varlistentry>
</variablelist>
+ <note>
+ <title>Macro-substitution</title>
+ <para>
+ The following section details the use of macro-substitution paramaters in labeling. Macro-substitution may be revised and altered in future versions of RichFaces. Be aware of this when using macro-substitution in your applications.
+ </para>
+ </note>
<para>
For labeling, the <sgmltag><rich:progressBar></sgmltag> component recognizes three macro-substitution parameters:
</para>
13 years, 11 months
JBoss Rich Faces SVN: r19510 - in branches/RF-8742/ui/validator/impl/src: main/resources/META-INF/resources and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-10-08 18:22:19 -0400 (Fri, 08 Oct 2010)
New Revision: 19510
Added:
branches/RF-8742/ui/validator/impl/src/main/resources/META-INF/resources/
branches/RF-8742/ui/validator/impl/src/main/resources/META-INF/resources/org.richfaces/
branches/RF-8742/ui/validator/impl/src/main/resources/META-INF/resources/org.richfaces/length.js
branches/RF-8742/ui/validator/impl/src/main/resources/META-INF/resources/org.richfaces/richfaces.js
branches/RF-8742/ui/validator/impl/src/test/resources/test.html
Log:
https://jira.jboss.org/browse/RF-9215 - copy JavaScript prototype to branch
Copied: branches/RF-8742/ui/validator/impl/src/main/resources/META-INF/resources/org.richfaces/length.js (from rev 19508, sandbox/trunk/prototypes/csv/validator/length.js)
===================================================================
--- branches/RF-8742/ui/validator/impl/src/main/resources/META-INF/resources/org.richfaces/length.js (rev 0)
+++ branches/RF-8742/ui/validator/impl/src/main/resources/META-INF/resources/org.richfaces/length.js 2010-10-08 22:22:19 UTC (rev 19510)
@@ -0,0 +1,78 @@
+(function($, rf) {
+
+ rf.csv = rf.csv || {};
+
+ var _messages = {};
+ var _validators = {};
+ var _converters = {};
+
+ var RE_MESSAGE_PATTERN = /\{(\d+)\}/g;
+
+ $.extend(rf.csv, {
+ // Messages API
+ addMessage: function (messagesObject) {
+ $.extend(_messages, messagesObject);
+ },
+ getMessage: function(customMessages, id, values) {
+ var message = (customMessages && customMessages[id]) || _messages[id] || "";
+ if (message) {
+ var msgObject = message.replace(RE_MESSAGE_PATTERN,"\n$1\n").split("\n");
+ var value;
+ for (var i=1; i<msgObject.length; i+=2) {
+ value = values[msgObject[i]];
+ msgObject[i] = typeof value == "undefined" ? "" : value;
+ }
+ message = msgObject.join('');
+ }
+ return message;
+ },
+ // Validators API
+ addValidator: function (validatorFunctions) {
+ $.extend(_validators, validatorFunctions);
+ },
+ validate: function (event, id, validatorList, messageComponentList, options) {
+ var value;
+ var element = rf.getDomElement(id);
+ if (element.value) {
+ value = element.value;
+ } else {
+ var component = rf.$(element);
+ value = component && typeof component["getValue"] == "function" ? component.getValue() : "";
+ }
+ var result;
+ var messageComponentsUpdated = false;
+ var validatorFunction;
+ for (var validator in validatorList) {
+ validatorFunction = _validators[validator];
+ if (validatorFunction) {
+ result = validatorFunction(value, validatorList[validator]);
+ }
+ if (result && result.length>0) {
+ messageComponentsUpdated = true;
+ //updateMessageComponents(messageElementIds, result);
+ alert(result);
+ break;
+ }
+ }
+ !messageComponentsUpdated && alert("no message from validators");//updateMessageComponents(messageElementIds, "");
+ },
+ addFormValidators: function (formId, callValidatorFunctions) {
+
+ }
+ });
+})(jQuery, window.RichFaces || (window.RichFaces={}));
+
+
+RichFaces.csv.addValidator({"length":
+(function(rf) {
+ return function (value, params) {
+ var result = "";
+ if (value.length<params.min) {
+ result = rf.csv.getMessage(params.customMessages, 'LengthValidator.MINIMUM', [params.min,value]);
+ } else if (value.length>params.max){
+ result = rf.csv.getMessage(params.customMessages, 'LengthValidator.MAXIMUM', [params.max,value]);
+ }
+ return result;
+ }
+})(window.RichFaces || (window.RichFaces={}))
+});
\ No newline at end of file
Copied: branches/RF-8742/ui/validator/impl/src/main/resources/META-INF/resources/org.richfaces/richfaces.js (from rev 19508, sandbox/trunk/prototypes/csv/validator/richfaces.js)
===================================================================
--- branches/RF-8742/ui/validator/impl/src/main/resources/META-INF/resources/org.richfaces/richfaces.js (rev 0)
+++ branches/RF-8742/ui/validator/impl/src/main/resources/META-INF/resources/org.richfaces/richfaces.js 2010-10-08 22:22:19 UTC (rev 19510)
@@ -0,0 +1,749 @@
+
+if (!window.RichFaces) {
+ /**
+ * Global object container for RichFaces API.
+ * All classes should be defined here.
+ * @class
+ * @name RichFaces
+ * @static
+ *
+ * */
+ window.RichFaces = {};
+}
+
+(function(jQuery, richfaces) {
+
+ // get DOM element by id or DOM element or jQuery object
+ richfaces.getDomElement = function (source) {
+ var type = typeof source;
+ var element;
+ if (type == "string") {
+ // id
+ element = document.getElementById(source);
+ } else if (type == "object") {
+ if (source.nodeType) {
+ // DOM element
+ element = source;
+ } else
+ if (source instanceof jQuery) {
+ // jQuery object
+ element = source.get(0);
+ }
+ }
+ return element;
+ }
+
+ // get RichFaces component object by component id or DOM element or jQuery object
+ richfaces.$ = function (source) {
+ var element = richfaces.getDomElement(source);
+
+ if (element) {
+ return (element["richfaces"] || {})["component"];
+ }
+ }
+
+ // find component and call his method
+ richfaces.invokeMethod = function(source, method) {
+ var c = richfaces.$(source);
+ if (c) {
+ var f = c[method];
+ if (typeof f == "function") {
+ return f.apply(c, Array.prototype.slice.call(arguments, 2));
+ }
+ }
+ }
+
+ //dom cleaner
+ richfaces.cleanDom = function(source) {
+ var e = (typeof source == "string") ? document.getElementById(source) : jQuery('body').get(0);
+ if (e) {
+ var elements = e.getElementsByTagName("*");
+ if (elements.length) {
+ jQuery.cleanData(elements);
+ jQuery.cleanData([e]);
+ jQuery.each(elements, function(index) {
+ richfaces.invokeMethod(this, "destroy");
+ });
+ richfaces.invokeMethod(e, "destroy");
+ }
+ }
+ }
+
+ //form.js
+ richfaces.submitForm = function(form, parameters, target) {
+ if (typeof form === "string") { form = jQuery(form) };
+ var initialTarget = form.attr("target");
+ var parameterInputs = new Array();
+ try {
+ form.attr("target", target);
+
+ if (parameters) {
+ for (var parameterName in parameters) {
+ var parameterValue = parameters[parameterName];
+
+ var input = jQuery("input[name='" + parameterName + "']", form);
+ if (input.length == 0) {
+ var newInput = jQuery("<input />").attr({type: 'hidden', name: parameterName, value: parameterValue});
+ if (parameterName === 'javax.faces.portletbridge.STATE_ID' /* fix for fileUpload in portlets */) {
+ input = newInput.prependTo(form);
+ } else {
+ input = newInput.appendTo(form);
+ }
+ } else {
+ input.val(parameterValue);
+ }
+
+ input.each(function() {parameterInputs.push(this)});
+ }
+ }
+
+ //TODO: inline onsubmit handler is not triggered - http://dev.jquery.com/ticket/4930
+ form.trigger("submit");
+ } finally {
+ form.attr("target", initialTarget);
+ jQuery(parameterInputs).remove();
+ }
+ };
+ //
+
+ //utils.js
+ jQuery.fn.toXML = function () {
+ var out = '';
+
+ if (this.length > 0) {
+ if (typeof XMLSerializer == 'function' ||
+ typeof XMLSerializer == 'object') {
+
+ var xs = new XMLSerializer();
+ this.each(function() { out += xs.serializeToString(this); });
+ } else if (this[0].xml !== undefined) {
+ this.each(function() { out += this.xml; });
+ } else {
+ this.each( function() { out += this; } );
+ }
+ }
+
+ return out;
+ };
+
+ //there is the same pattern in server-side code:
+ //org.ajax4jsf.javascript.ScriptUtils.escapeCSSMetachars(String)
+ var CSS_METACHARS_PATTERN = /([#;&,.+*~':"!^$\[\]()=>|\/])/g;
+
+ /**
+ * Escapes CSS meta-characters in string according to
+ * <a href="http://api.jquery.com/category/selectors/">jQuery selectors</a> document.
+ *
+ * @param s - string to escape meta-characters in
+ * @return string with meta-characters escaped
+ */
+ richfaces.escapeCSSMetachars = function(s) {
+ //TODO nick - cache results
+
+ return s.replace(CSS_METACHARS_PATTERN, "\\$1");
+ };
+
+ var logImpl;
+
+ richfaces.setLog = function(newLogImpl) {
+ logImpl = newLogImpl;
+ };
+
+ richfaces.log = {
+ debug: function(text) {
+ if (logImpl) {
+ logImpl.debug(text);
+ }
+ },
+
+ info: function(text) {
+ if (logImpl) {
+ logImpl.info(text);
+ }
+ },
+
+ warn: function(text) {
+ if (logImpl) {
+ logImpl.warn(text);
+ }
+ },
+
+ error: function(text) {
+ if (logImpl) {
+ logImpl.error(text);
+ }
+ },
+
+ setLevel: function(level) {
+ if (logImpl) {
+ logImpl.setLevel(level);
+ }
+ },
+
+ getLevel: function() {
+ if (logImpl) {
+ return logImpl.getLevel();
+ }
+ return 'info';
+ },
+
+ clear: function() {
+ if (logImpl) {
+ logImpl.clear();
+ }
+ }
+ };
+
+ /**
+ * Evaluates chained properties for the "base" object.
+ * For example, window.document.location is equivalent to
+ * "propertyNamesString" = "document.location" and "base" = window
+ * Evaluation is safe, so it stops on the first null or undefined object
+ *
+ * @param propertyNamesArray - array of strings that contains names of the properties to evaluate
+ * @param base - base object to evaluate properties on
+ * @return returns result of evaluation or empty string
+ */
+ richfaces.getValue = function(propertyNamesArray, base) {
+ var result = base;
+ var c = 0;
+ do {
+ result = result[propertyNamesArray[c++]];
+ } while (result && c != propertyNamesArray.length);
+
+ return result;
+ };
+
+ var VARIABLE_NAME_PATTERN_STRING = "[_A-Z,a-z]\\w*";
+ var VARIABLES_CHAIN = new RegExp("^\\s*"+VARIABLE_NAME_PATTERN_STRING+"(?:\\s*\\.\\s*"+VARIABLE_NAME_PATTERN_STRING+")*\\s*$");
+ var DOT_SEPARATOR = /\s*\.\s*/;
+
+ richfaces.evalMacro = function(macro, base) {
+ var value = "";
+ // variable evaluation
+ if (VARIABLES_CHAIN.test(macro)) {
+ // object's variable evaluation
+ var propertyNamesArray = jQuery.trim(macro).split(DOT_SEPARATOR);
+ value = richfaces.getValue(propertyNamesArray, base);
+ if (!value) {
+ value = richfaces.getValue(propertyNamesArray, window);
+ }
+ } else {
+ //js string evaluation
+ try {
+ if (base.eval) {
+ value = base.eval(macro);
+ } else with (base) {
+ value = eval(macro) ;
+ }
+ } catch (e) {
+ richfaces.log.warn("Exception: " + e.message + "\n[" + macro + "]");
+ }
+ }
+
+ if (typeof value == 'function') {
+ value = value(base);
+ }
+ //TODO 0 and false are also treated as null values
+ return value || "";
+ };
+
+ var ALPHA_NUMERIC_MULTI_CHAR_REGEXP = /^\w+$/;
+
+ richfaces.interpolate = function (placeholders, context) {
+ var contextVarsArray = new Array();
+ for (var contextVar in context) {
+ if (ALPHA_NUMERIC_MULTI_CHAR_REGEXP.test(contextVar)) {
+ //guarantees that no escaping for the below RegExp is necessary
+ contextVarsArray.push(contextVar);
+ }
+ }
+
+ var regexp = new RegExp("\\{(" + contextVarsArray.join("|") + ")\\}", "g");
+ return placeholders.replace(regexp, function(str, contextVar) {return context[contextVar];});
+ };
+
+ richfaces.clonePosition = function(element, baseElement, positioning, offset) {
+
+ };
+ //
+
+ var pollTracker = {};
+ richfaces.startPoll = function(options) {
+ var pollId = options.pollId;
+ var interval = options.pollinterval;
+ var ontimer = options.ontimer;
+ richfaces.stopPoll(pollId);
+
+ richfaces.setZeroRequestDelay(options);
+
+ pollTracker[pollId] = window.setTimeout(function(){
+ var pollElement = document.getElementById(pollId);
+ try {
+ ontimer.call(pollElement || window);
+ richfaces.startPoll(options);
+ } catch (e) {
+ // TODO: handle exception
+ }
+ },interval);
+ };
+
+ richfaces.stopPoll = function(id) {
+ if(pollTracker[id]){
+ window.clearTimeout(pollTracker[id]);
+ delete pollTracker[id];
+ }
+ };
+
+ var pushTracker = {};
+
+ richfaces.startPush = function(options) {
+ var clientId = options.clientId;
+ var pushResourceUrl = options.pushResourceUrl;
+ var pushId = options.pushId;
+ var interval = options.interval;
+ var ondataavailable = options.ondataavailable;
+ richfaces.setZeroRequestDelay(options);
+
+ richfaces.stopPush(pushId);
+
+ pushTracker[pushId] = setTimeout(function() { // TODO: define this function in richfaces object to avoid definition every time when call startPush
+ var ajaxOptions = {
+ type: "HEAD",
+ //TODO - encodeURIComponent; URL sessionId handling check
+ //TODO - add pushUri supports
+ url: pushResourceUrl + "?id=" + pushId,
+ dataType: "text",
+ complete: function(xhr) {
+ var isPushActive = !!pushTracker[pushId];
+
+ //TODO may someone wish to stop push from dataavailable handler?
+ delete pushTracker[pushId];
+
+ if (xhr.status == 200 && xhr.getResponseHeader("Ajax-Push-Status") == "READY") {
+ var pushElement = document.getElementById(clientId);
+ try {
+ ondataavailable.call(pushElement || window);
+ } catch (e) {
+ // TODO: handle exception
+ }
+ }
+
+ if (isPushActive) {
+ richfaces.startPush(options);
+ }
+ }
+ };
+
+ if (options.timeout) {
+ ajaxOptions.timeout = options.timeout;
+ }
+
+ jQuery.ajax(ajaxOptions);
+ }, interval);
+ };
+
+ richfaces.stopPush = function(id) {
+ if (pushTracker[id]){
+ window.clearTimeout(pushTracker[id]);
+ delete pushTracker[id];
+ }
+ };
+
+ var jsfEventsAdapterEventNames = {
+ event: {
+ 'begin': ['begin'],
+ 'complete': ['beforedomupdate'],
+ 'success': ['success', 'complete']
+ },
+ error: ['error', 'complete']
+ };
+
+ var getExtensionResponseElement = function(responseXML) {
+ return jQuery("partial-response > extension#org\\.richfaces\\.extension", responseXML);
+ };
+
+ var JSON_STRING_START = /^\s*(\[|\{)/;
+
+ var getJSONData = function(extensionElement, elementName) {
+ var dataString = jQuery.trim(extensionElement.children(elementName).text());
+ extensionElement.end();
+ try {
+ if (dataString) {
+ if (JSON_STRING_START.test(dataString)) {
+ return jQuery.parseJSON(dataString);
+ } else {
+ var parsedData = jQuery.parseJSON("{\"root\": " + dataString + "}");
+ return parsedData.root;
+ }
+ }
+ } catch (e) {
+ richfaces.log.warn("Error evaluating JSON data from element <" + elementName + ">: " + e.message);
+ }
+ return null;
+ };
+
+ richfaces.createJSFEventsAdapter = function(handlers) {
+ //hash of handlers
+ //supported are:
+ // - begin
+ // - beforedomupdate
+ // - success
+ // - error
+ // - complete
+ handlers = handlers || {};
+
+ return function(eventData) {
+ var source = eventData.source;
+ //that's request status, not status control data
+ var status = eventData.status;
+ var type = eventData.type;
+
+ var typeHandlers = jsfEventsAdapterEventNames[type];
+ var handlerNames = (typeHandlers || {})[status] || typeHandlers;
+
+ if (handlerNames) {
+ for (var i = 0; i < handlerNames.length; i++) {
+ var eventType = handlerNames[i];
+ var handler = handlers[eventType];
+ if (handler) {
+ var event = {};
+ jQuery.extend(event, eventData);
+ event.type = eventType;
+ if (type != 'error') {
+ delete event.status;
+
+ if (event.responseXML) {
+ var xml = getExtensionResponseElement(event.responseXML);
+ var data = getJSONData(xml, "data");
+ var componentData = getJSONData(xml, "componentData");
+
+ event.data = data;
+ event.componentData = componentData || {};
+ }
+ }
+
+ handler.call(source, event);
+ }
+ }
+ }
+ };
+ };
+
+ var setGlobalStatusNameVariable = function(statusName) {
+ //TODO: parallel requests
+ if (statusName) {
+ richfaces['statusName'] = statusName;
+ } else {
+ delete richfaces['statusName'];
+ }
+ }
+
+ richfaces.setZeroRequestDelay = function(options) {
+ if (typeof options.requestDelay == "undefined") {
+ options.requestDelay = 0;
+ }
+ };
+
+ var getGlobalStatusNameVariable = function() {
+ return richfaces.statusName;
+ }
+
+ var chain = function() {
+ var functions = arguments;
+ if (functions.length == 1) {
+ return functions[0];
+ } else {
+ return function() {
+ var callResult;
+ for (var i = 0; i < functions.length; i++) {
+ var f = functions[i];
+ callResult = f.apply(this, arguments);
+ }
+
+ return callResult;
+ };
+ }
+ };
+
+ /**
+ * curry (g, a) (b) -> g(a, b)
+ */
+ var curry = function(g, a) {
+ var _g = g;
+ var _a = a;
+
+ return function(b) {
+ _g(_a, b);
+ };
+ };
+
+ var createEventHandler = function(handlerCode) {
+ if (handlerCode) {
+ return new Function("event", handlerCode);
+ }
+
+ return null;
+ };
+
+ //TODO take events just from .java code using EL-expression
+ var AJAX_EVENTS = (function() {
+ var serverEventHandler = function(clientHandler, event) {
+ var xml = getExtensionResponseElement(event.responseXML);
+
+ var serverHandler = createEventHandler(xml.children(event.type).text());
+ xml.end();
+
+ if (clientHandler) {
+ clientHandler.call(window, event);
+ }
+
+ if (serverHandler) {
+ serverHandler.call(window, event);
+ }
+ };
+
+ return {
+ 'begin': null,
+ 'complete': serverEventHandler,
+ 'beforedomupdate': serverEventHandler
+ }
+ }());
+
+ richfaces.ajax = function(source, event, options) {
+ var sourceId = (typeof source == 'object' && source.id) ? source.id : source;
+
+ options = options || {};
+
+ parameters = options.parameters || {}; // TODO: change "parameters" to "richfaces.ajax.params"
+ parameters.execute = "@component";
+ parameters.render = "@component";
+
+ if (!parameters["org.richfaces.ajax.component"]) {
+ parameters["org.richfaces.ajax.component"] = sourceId;
+ }
+
+ var eventHandlers;
+
+ for (var eventName in AJAX_EVENTS) {
+ var handlerCode = options[eventName];
+ var handler = typeof handlerCode == "function" ? handlerCode : createEventHandler(handlerCode);
+
+ var serverHandler = AJAX_EVENTS[eventName];
+ if (serverHandler) {
+ handler = curry(serverHandler, handler);
+ }
+
+ if (handler) {
+ eventHandlers = eventHandlers || {};
+ eventHandlers[eventName] = handler;
+ }
+ }
+
+ if (options.status) {
+ var namedStatusEventHandler = function() { setGlobalStatusNameVariable(options.status); };
+
+ //TODO add support for options.submit
+ eventHandlers = eventHandlers || {};
+ if (eventHandlers.begin) {
+ eventHandlers.begin = chain(namedStatusEventHandler, eventHandlers.begin);
+ } else {
+ eventHandlers.begin = namedStatusEventHandler;
+ }
+ }
+
+ if (options.incId) {
+ parameters[sourceId] = sourceId;
+ }
+
+ if (eventHandlers) {
+ var eventsAdapter = richfaces.createJSFEventsAdapter(eventHandlers);
+ parameters['onevent'] = eventsAdapter;
+ parameters['onerror'] = eventsAdapter;
+ }
+
+ if (richfaces.queue) {
+ parameters.queueId = options.queueId;
+ }
+
+ jsf.ajax.request(source, event, parameters);
+ };
+
+ var RICHFACES_AJAX_STATUS = "richfaces:ajaxStatus";
+
+ var getStatusDataAttributeName = function(statusName) {
+ return statusName ? (RICHFACES_AJAX_STATUS + "@" + statusName) : RICHFACES_AJAX_STATUS;
+ };
+
+ var statusAjaxEventHandler = function(data, methodName) {
+ if (methodName) {
+ //global status name
+ var statusName = getGlobalStatusNameVariable();
+ var source = data.source;
+
+ var statusApplied = false;
+ var statusDataAttribute = getStatusDataAttributeName(statusName);
+
+ var statusContainers;
+ if (statusName) {
+ statusContainers = [jQuery(document)];
+ } else {
+ statusContainers = [jQuery(source).parents('form'), jQuery(document)];
+ }
+
+ for (var containerIdx = 0; containerIdx < statusContainers.length && !statusApplied;
+ containerIdx++) {
+
+ var statusContainer = statusContainers[containerIdx];
+ var statuses = statusContainer.data(statusDataAttribute);
+ if (statuses) {
+ for (var statusId in statuses) {
+ var status = statuses[statusId];
+ var result = status[methodName].apply(status, arguments);
+ if (result) {
+ statusApplied = true;
+ } else {
+ delete statuses[statusId];
+ }
+ }
+
+ if (!statusApplied) {
+ statusContainer.removeData(statusDataAttribute);
+ }
+ }
+ }
+ }
+ };
+
+ var initializeStatuses = function() {
+ var thisFunction = arguments.callee;
+ if (!thisFunction.initialized) {
+ thisFunction.initialized = true;
+
+ var jsfEventsListener = richfaces.createJSFEventsAdapter({
+ begin: function(event) { statusAjaxEventHandler(event, 'start'); },
+ error: function(event) { statusAjaxEventHandler(event, 'error'); },
+ success: function(event) { statusAjaxEventHandler(event, 'success'); },
+ complete: function() { setGlobalStatusNameVariable(null); }
+ });
+
+ jsf.ajax.addOnEvent(jsfEventsListener);
+ //TODO blocks default alert error handler
+ jsf.ajax.addOnError(jsfEventsListener);
+ }
+ };
+
+ richfaces.status = function(statusId, options) {
+ this.statusId = statusId;
+ this.options = options || {};
+ this.register();
+ };
+
+ jQuery.extend(richfaces.status.prototype, (function() {
+ //TODO - support for parallel requests
+
+ var getElement = function() {
+ var elt = document.getElementById(this.statusId);
+ return elt ? jQuery(elt) : null;
+ };
+
+ var showHide = function(selector) {
+ var element = getElement.call(this);
+ if (element) {
+ var statusElts = element.children();
+ statusElts.each(function() {
+ var t = jQuery(this);
+ t.css('display', t.is(selector) ? '': 'none');
+ });
+
+ return true;
+ }
+
+ return false;
+ };
+
+ return {
+ register: function() {
+ initializeStatuses();
+
+ var statusName = this.options.statusName;
+ var dataStatusAttribute = getStatusDataAttributeName(statusName);
+
+ var container;
+ if (statusName) {
+ container = jQuery(document);
+ } else {
+ container = getElement.call(this).parents('form');
+ if (container.length == 0) {
+ container = jQuery(document);
+ };
+ }
+
+ var statuses = container.data(dataStatusAttribute);
+ if (!statuses) {
+ statuses = {};
+ container.data(dataStatusAttribute, statuses);
+ }
+
+ statuses[this.statusId] = this;
+ },
+
+ start: function() {
+ if (this.options.onstart) {
+ this.options.onstart.apply(this, arguments);
+ }
+
+ return showHide.call(this, '.rich-status-start');
+ },
+
+ stop: function() {
+ if (this.options.onstop) {
+ this.options.onstop.apply(this, arguments);
+ }
+ },
+
+ success: function() {
+ if (this.options.onsuccess) {
+ this.options.onsuccess.apply(this, arguments);
+ }
+ this.stop();
+
+ return showHide.call(this, '.rich-status-stop');
+ },
+
+ error: function() {
+ if (this.options.onerror) {
+ this.options.onerror.apply(this, arguments);
+ }
+ this.stop();
+
+ return showHide.call(this, ':not(.rich-status-error) + .rich-status-stop, .rich-status-error');
+ }
+ };
+ }()));
+
+ var ajaxOnComplete = function (data) {
+ var type = data.type;
+ var responseXML = data.responseXML;
+
+ if (data.type == 'event' && data.status == 'complete' && responseXML) {
+ var partialResponse = jQuery(responseXML).children("partial-response");
+ if (partialResponse && partialResponse.length) {
+ var elements = partialResponse.children('changes').children('update, delete');
+ jQuery.each(elements, function () {
+ richfaces.cleanDom(jQuery(this).attr('id'));
+ });
+ }
+ }
+ };
+ // move this code to somewhere
+ if (typeof jsf != 'undefined') {
+ jsf.ajax.addOnEvent(ajaxOnComplete);
+ }
+ if (window.addEventListener) {
+ window.addEventListener("unload", richfaces.cleanDom, false);
+ } else {
+ window.attachEvent("onunload", richfaces.cleanDom);
+ }
+}(jQuery, RichFaces));
+
Copied: branches/RF-8742/ui/validator/impl/src/test/resources/test.html (from rev 19508, sandbox/trunk/prototypes/csv/validator/test.html)
===================================================================
--- branches/RF-8742/ui/validator/impl/src/test/resources/test.html (rev 0)
+++ branches/RF-8742/ui/validator/impl/src/test/resources/test.html 2010-10-08 22:22:19 UTC (rev 19510)
@@ -0,0 +1,27 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
+
+<html>
+<head>
+ <title>Untitled</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <title>Test Page</title>
+ <script type="text/javascript" src="jquery.js"></script>
+ <script type="text/javascript" src="richfaces.js"></script>
+ <script type="text/javascript" src="length.js"></script>
+
+</head>
+
+<body style="margin : 30px">
+<form id="myForm">
+<input id="myInput" type="text" value="aaa"/>
+<input type="button" onclick="v();" value="validate length"/>
+<input type="button" onclick="v({'LengthValidator.MINIMUM':'CustomMessage: length of the {1} is smaller then {0} chars', 'LengthValidator.MAXIMUM':'CustomMessage: length of the {1} is bigger then {0} chars'});" value="validate length (custom message)"/>
+</form>
+<script>
+RichFaces.csv.addMessage({'LengthValidator.MINIMUM':'Hello, length of the "{1}" is smaller then {0} chars', 'LengthValidator.MAXIMUM':'Hello, length of the "{1}" is bigger then {0} chars'});
+var v = function (customMessages) {
+ RichFaces.csv.validate(null, 'myInput', {'length':{min:1, max:5, customMessages:customMessages}}, null, null);
+};
+</script>
+</body>
+<html>
\ No newline at end of file
13 years, 11 months
JBoss Rich Faces SVN: r19509 - in branches/RF-8742: examples/input-demo/src/main/java/org/richfaces/demo and 10 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-10-08 13:57:34 -0400 (Fri, 08 Oct 2010)
New Revision: 19509
Added:
branches/RF-8742/examples/input-demo/src/main/java/org/richfaces/demo/InputBean.java
branches/RF-8742/examples/input-demo/src/main/webapp/examples/inplaceSelect.xhtml
branches/RF-8742/ui/input/api/src/main/java/org/richfaces/component/InplaceComponent.java
branches/RF-8742/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceSelect.java
branches/RF-8742/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java
branches/RF-8742/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceBase.js
branches/RF-8742/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.ecss
branches/RF-8742/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js
branches/RF-8742/ui/input/ui/src/main/templates/inplaceSelect.template.xml
Modified:
branches/RF-8742/
branches/RF-8742/examples/input-demo/src/main/webapp/WEB-INF/faces-config.xml
branches/RF-8742/examples/input-demo/src/main/webapp/examples/inplaceInput.xhtml
branches/RF-8742/examples/input-demo/src/main/webapp/templates/template.xhtml
branches/RF-8742/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceInput.java
branches/RF-8742/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java
branches/RF-8742/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.ecss
branches/RF-8742/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.js
branches/RF-8742/ui/input/ui/src/main/templates/inplaceInput.template.xml
branches/RF-8742/ui/input/ui/src/test/java/org/richfaces/renderkit/InplaceInputRendererTest.java
branches/RF-8742/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanel.ecss
branches/RF-8742/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/progressBar.js
Log:
Merged revisions 19498-19499,19501,19504,19506-19507 via svnmerge from
https://svn.jboss.org/repos/richfaces/trunk
.......
r19498 | amarkhel | 2010-10-08 02:37:19 -0700 (Fri, 08 Oct 2010) | 1 line
RF-9436
.......
r19499 | amarkhel | 2010-10-08 02:38:48 -0700 (Fri, 08 Oct 2010) | 1 line
RF-9437
.......
r19501 | abelevich | 2010-10-08 06:08:18 -0700 (Fri, 08 Oct 2010) | 1 line
inplaceSelect developer sample
.......
r19504 | abelevich | 2010-10-08 06:41:56 -0700 (Fri, 08 Oct 2010) | 1 line
move inplaceSelect component to the trunk, refactoring, bugfixing (https://jira.jboss.org/browse/RF-9347, https://jira.jboss.org/browse/RF-2816, https://jira.jboss.org/browse/RF-9056)
.......
r19506 | abelevich | 2010-10-08 08:03:43 -0700 (Fri, 08 Oct 2010) | 1 line
rename css according richfaces css names convention
.......
r19507 | abelevich | 2010-10-08 08:21:01 -0700 (Fri, 08 Oct 2010) | 1 line
fix button background gradients
.......
Property changes on: branches/RF-8742
___________________________________________________________________
Name: svnmerge-integrated
- /trunk:1-19495
+ /trunk:1-19508
Copied: branches/RF-8742/examples/input-demo/src/main/java/org/richfaces/demo/InputBean.java (from rev 19507, trunk/examples/input-demo/src/main/java/org/richfaces/demo/InputBean.java)
===================================================================
--- branches/RF-8742/examples/input-demo/src/main/java/org/richfaces/demo/InputBean.java (rev 0)
+++ branches/RF-8742/examples/input-demo/src/main/java/org/richfaces/demo/InputBean.java 2010-10-08 17:57:34 UTC (rev 19509)
@@ -0,0 +1,20 @@
+package org.richfaces.demo;
+
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.SessionScoped;
+
+
+@SessionScoped
+@ManagedBean(name = "inputBean")
+public class InputBean {
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+}
Modified: branches/RF-8742/examples/input-demo/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- branches/RF-8742/examples/input-demo/src/main/webapp/WEB-INF/faces-config.xml 2010-10-08 15:48:10 UTC (rev 19508)
+++ branches/RF-8742/examples/input-demo/src/main/webapp/WEB-INF/faces-config.xml 2010-10-08 17:57:34 UTC (rev 19509)
@@ -12,6 +12,10 @@
<to-view-id>/examples/inplaceInput.xhtml</to-view-id>
</navigation-case>
<navigation-case>
+ <from-outcome>inplaceSelect</from-outcome>
+ <to-view-id>/examples/inplaceSelect.xhtml</to-view-id>
+ </navigation-case>
+ <navigation-case>
<from-outcome>inputNumberSlider</from-outcome>
<to-view-id>/examples/inputNumberSlider.xhtml</to-view-id>
</navigation-case>
Modified: branches/RF-8742/examples/input-demo/src/main/webapp/examples/inplaceInput.xhtml
===================================================================
--- branches/RF-8742/examples/input-demo/src/main/webapp/examples/inplaceInput.xhtml 2010-10-08 15:48:10 UTC (rev 19508)
+++ branches/RF-8742/examples/input-demo/src/main/webapp/examples/inplaceInput.xhtml 2010-10-08 17:57:34 UTC (rev 19509)
@@ -12,7 +12,7 @@
<h:body>
<h:form id="form">
- <in:inplaceInput showControls="false" value="New York"/>
+ <in:inplaceInput showControls="true" value="New York"/>
<h:commandButton value="submit"/>
</h:form>
</h:body>
Copied: branches/RF-8742/examples/input-demo/src/main/webapp/examples/inplaceSelect.xhtml (from rev 19507, trunk/examples/input-demo/src/main/webapp/examples/inplaceSelect.xhtml)
===================================================================
--- branches/RF-8742/examples/input-demo/src/main/webapp/examples/inplaceSelect.xhtml (rev 0)
+++ branches/RF-8742/examples/input-demo/src/main/webapp/examples/inplaceSelect.xhtml 2010-10-08 17:57:34 UTC (rev 19509)
@@ -0,0 +1,35 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:in="http://richfaces.org/input">
+<f:view contentType="text/html" />
+
+<h:head>
+ <title>InplaceInput</title>
+</h:head>
+
+
+<h:body>
+ <h:form id="form">
+ <div id="scroll" style="width: 400px; height:400px; overflow:auto;" >
+ <fieldset>
+ <legend>Test App</legend>
+ Fresh off his victory in the Florida primary, Sen. John McCain is poised to take another big prize. Former
+ <in:inplaceSelect defaultLabel="Edit Text" value="#{inputBean.value}">
+ <f:selectItem itemLabel="1#OptionLabel" itemValue="1#OptionValue"/>
+ <f:selectItem itemLabel="2#OptionLabel" itemValue="2#OptionValue"/>
+ <f:selectItem itemLabel="3#OptionLabel" itemValue="3#OptionValue"/>
+ <f:selectItem itemLabel="4#OptionLabel" itemValue="4#OptionValue"/>
+ </in:inplaceSelect>
+ Mayor Rudy Giuliani plans to drop out and endorse McCain, two GOP sources said. That would give McCain added momentum heading into a debate Wednesday and next week's Super Tuesday contests
+ </fieldset>
+ <h:commandButton value="submit"></h:commandButton>
+ </div>
+ <h:panelGroup id="out">
+ <h:outputText value="Entered Value: #{inputBean.value}"/>
+ </h:panelGroup>
+ </h:form>
+</h:body>
+</html>
Modified: branches/RF-8742/examples/input-demo/src/main/webapp/templates/template.xhtml
===================================================================
--- branches/RF-8742/examples/input-demo/src/main/webapp/templates/template.xhtml 2010-10-08 15:48:10 UTC (rev 19508)
+++ branches/RF-8742/examples/input-demo/src/main/webapp/templates/template.xhtml 2010-10-08 17:57:34 UTC (rev 19509)
@@ -32,6 +32,7 @@
<p>Input Component's Examples</p>
<ul>
<li><h:commandLink value="rich:inplaceInput" action="inplaceInput" /></li>
+ <li><h:commandLink value="rich:inplaceSelect" action="inplaceSelect" /></li>
<li><h:commandLink value="rich:inputNumberSlider" action="inputNumberSlider" /></li>
<li><h:commandLink value="rich:inputNumberSpinner" action="inputNumberSpinner" /></li>
<li><h:commandLink value="rich:autocomplete" action="autocomplete" /></li>
Copied: branches/RF-8742/ui/input/api/src/main/java/org/richfaces/component/InplaceComponent.java (from rev 19507, trunk/ui/input/api/src/main/java/org/richfaces/component/InplaceComponent.java)
===================================================================
--- branches/RF-8742/ui/input/api/src/main/java/org/richfaces/component/InplaceComponent.java (rev 0)
+++ branches/RF-8742/ui/input/api/src/main/java/org/richfaces/component/InplaceComponent.java 2010-10-08 17:57:34 UTC (rev 19509)
@@ -0,0 +1,16 @@
+package org.richfaces.component;
+
+
+public interface InplaceComponent {
+
+ public String getDefaultLabel();
+
+ public String getEditEvent();
+
+ public boolean isShowControls();
+
+ public boolean isSaveOnBlur();
+
+ public InplaceState getState();
+
+}
Modified: branches/RF-8742/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceInput.java
===================================================================
--- branches/RF-8742/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceInput.java 2010-10-08 15:48:10 UTC (rev 19508)
+++ branches/RF-8742/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceInput.java 2010-10-08 17:57:34 UTC (rev 19509)
@@ -40,7 +40,7 @@
renderer = @JsfRenderer(type = "org.richfaces.InplaceInputRenderer"),
tag = @Tag(name="inplaceInput")
)
-public abstract class AbstractInplaceInput extends UIInput {
+public abstract class AbstractInplaceInput extends UIInput implements InplaceComponent {
public static final String COMPONENT_TYPE = "org.richfaces.InplaceInput";
@@ -49,6 +49,9 @@
@Attribute
public abstract String getDefaultLabel();
+ @Attribute(defaultValue="true")
+ public abstract boolean isSaveOnBlur();
+
@Attribute(defaultValue="InplaceState.ready")
public abstract InplaceState getState();
Copied: branches/RF-8742/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceSelect.java (from rev 19507, trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceSelect.java)
===================================================================
--- branches/RF-8742/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceSelect.java (rev 0)
+++ branches/RF-8742/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceSelect.java 2010-10-08 17:57:34 UTC (rev 19509)
@@ -0,0 +1,49 @@
+package org.richfaces.component;
+
+import javax.faces.component.UISelectOne;
+
+import org.richfaces.cdk.annotations.Attribute;
+import org.richfaces.cdk.annotations.JsfComponent;
+import org.richfaces.cdk.annotations.JsfRenderer;
+import org.richfaces.cdk.annotations.Tag;
+
+
+/**
+ * @author Anton Belevich
+ *
+ */
+
+@JsfComponent(
+ type = AbstractInplaceSelect.COMPONENT_TYPE,
+ family = AbstractInplaceSelect.COMPONENT_FAMILY,
+ generate = "org.richfaces.component.UIInplaceSelect",
+ renderer = @JsfRenderer(type = "org.richfaces.InplaceSelectRenderer"),
+ tag = @Tag(name="inplaceSelect")
+)
+public abstract class AbstractInplaceSelect extends UISelectOne implements InplaceComponent {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.InplaceSelect";
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.InplaceSelect";
+
+ @Attribute(defaultValue="250px")
+ public abstract String getListWidth();
+
+ @Attribute(defaultValue="100px")
+ public abstract String getListHeight();
+
+ @Attribute(defaultValue="InplaceState.ready")
+ public abstract InplaceState getState();
+
+ @Attribute
+ public abstract String getDefaultLabel();
+
+ @Attribute(defaultValue="true")
+ public abstract boolean isSaveOnBlur();
+
+ @Attribute(defaultValue="false")
+ public abstract boolean isShowControls();
+
+ @Attribute(defaultValue="click")
+ public abstract String getEditEvent();
+}
Modified: branches/RF-8742/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java
===================================================================
--- branches/RF-8742/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java 2010-10-08 15:48:10 UTC (rev 19508)
+++ branches/RF-8742/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java 2010-10-08 17:57:34 UTC (rev 19509)
@@ -35,7 +35,7 @@
import javax.faces.context.ResponseWriter;
import org.ajax4jsf.javascript.JSFunction;
-import org.richfaces.component.AbstractInplaceInput;
+import org.richfaces.component.InplaceComponent;
import org.richfaces.component.InplaceState;
import org.richfaces.component.util.HtmlUtil;
@@ -43,10 +43,11 @@
* @author Anton Belevich
*
*/
-@ResourceDependencies({
- @ResourceDependency(library = "javax.faces", name = "jsf.js"),
- @ResourceDependency(library = "org.richfaces", name = "base-component.reslib"),
+@ResourceDependencies({ @ResourceDependency(library = "javax.faces", name = "jsf.js"),
+ @ResourceDependency(name = "jquery.js"), @ResourceDependency(name = "richfaces.js"),
@ResourceDependency(name = "richfaces-event.js"),
+ @ResourceDependency(name = "richfaces-base-component.js"),
+ @ResourceDependency(library="org.richfaces", name = "inplaceBase.js"),
@ResourceDependency(library="org.richfaces", name = "inplaceInput.js"),
@ResourceDependency(library="org.richfaces", name = "inplaceInput.ecss") })
public class InplaceInputBaseRenderer extends InputRendererBase {
@@ -75,14 +76,9 @@
public static final String OPTIONS_INITIAL_VALUE = "initialValue";
- private static final String READY_STATE_CSS = "rf-ii-ready-st";
+ public static final String OPTIONS_SAVE_ON_BLUR = "saveOnBlur";
+
- private static final String EDIT_STATE_CSS = "rf-ii-edt-st";
-
- private static final String CHANGED_STATE_CSS = "rf-ii-chd-st";
-
- private static final String NONE_CSS = "rf-ii-none";
-
private static final Map<String, ComponentAttribute> INPLACEINPUT_HANDLER_ATTRIBUTES = Collections
.unmodifiableMap(ComponentAttribute.createMap(
new ComponentAttribute(HtmlConstants.ONCLICK_ATTRIBUTE).setEventNames("inputClick").
@@ -120,14 +116,13 @@
}
public InplaceState getInplaceState(UIComponent component) {
- return ((AbstractInplaceInput) component).getState();
+ return ((InplaceComponent) component).getState();
}
public String getValue(FacesContext facesContext, UIComponent component) throws IOException {
- AbstractInplaceInput inplaceInput = (AbstractInplaceInput)component;
- String value = getInputValue(facesContext, inplaceInput);
+ String value = getInputValue(facesContext, component);
if(value == null || "".equals(value)) {
- value = inplaceInput.getDefaultLabel();
+ value = ((InplaceComponent)component).getDefaultLabel();
}
return value;
}
@@ -142,11 +137,11 @@
}
public String getReadyStyleClass(UIComponent component, InplaceState inplaceState) {
- return (InplaceState.changed != inplaceState) ? READY_STATE_CSS : HtmlUtil.concatClasses(READY_STATE_CSS, CHANGED_STATE_CSS);
+ return (InplaceState.changed != inplaceState) ? getReadyStateCss() : HtmlUtil.concatClasses(getReadyStateCss(), getChangedStateCss());
}
public String getEditStyleClass(UIComponent component, InplaceState inplaceState) {
- return (InplaceState.edit != inplaceState)? HtmlUtil.concatClasses(EDIT_STATE_CSS, NONE_CSS) : EDIT_STATE_CSS;
+ return (InplaceState.edit != inplaceState)? HtmlUtil.concatClasses(getEditStateCss(), getNoneCss()) : getEditStateCss();
}
public String getReadyClientId(FacesContext facesContext, UIComponent component, InplaceState inplaceState) {
String clientId = component.getClientId(facesContext);
@@ -166,30 +161,64 @@
return result;
}
- public void buildScript(ResponseWriter writer, FacesContext facesContext, UIComponent component) throws IOException {
- AbstractInplaceInput inplaceInput = (AbstractInplaceInput)component;
- JSFunction function = new JSFunction("new RichFaces.ui.InplaceInput");
- function.addParameter(inplaceInput.getClientId(facesContext));
-
- String clientId = inplaceInput.getClientId(facesContext);
+ public void buildScript(ResponseWriter writer, FacesContext facesContext, UIComponent component, Object additional) throws IOException {
+ if(!(component instanceof InplaceComponent)) {
+ return;
+ }
+
+ String scriptName = getScriptName();
+ JSFunction function = new JSFunction(scriptName);
+ String clientId = component.getClientId(facesContext);
+ Map<String, Object> options = createInplaceComponentOptions(clientId, (InplaceComponent)component);
+ addToOptions(facesContext, component, options, additional);
+ function.addParameter(clientId);
+ function.addParameter(options);
+ writer.write(function.toString());
+ }
+
+ protected String getScriptName() {
+ return "new RichFaces.ui.InplaceInput";
+ }
+
+ private Map<String, Object> createInplaceComponentOptions(String clientId, InplaceComponent inplaceComponent) {
Map<String, Object> options = new HashMap<String, Object>();
- options.put(OPTIONS_EDIT_EVENT, inplaceInput.getEditEvent());
- options.put(OPTIONS_NONE_CSS, NONE_CSS);
- options.put(OPTIONS_CHANGED_CSS, CHANGED_STATE_CSS);
+ options.put(OPTIONS_EDIT_EVENT, inplaceComponent.getEditEvent());
+ options.put(OPTIONS_NONE_CSS, getNoneCss());
+ options.put(OPTIONS_CHANGED_CSS, getChangedStateCss());
options.put(OPTIONS_EDIT_CONTAINER, clientId + ":edit");
options.put(OPTIONS_INPUT, clientId + ":input");
options.put(OPTIONS_LABEL, clientId + ":label");
options.put(OPTIONS_FOCUS, clientId + ":focus");
- options.put(OPTIONS_DEFAULT_LABEL, inplaceInput.getDefaultLabel());
+ options.put(OPTIONS_DEFAULT_LABEL, inplaceComponent.getDefaultLabel());
+ options.put(OPTIONS_SAVE_ON_BLUR, inplaceComponent.isSaveOnBlur());
+
+ boolean showControls = inplaceComponent.isShowControls();
- boolean showControls = inplaceInput.isShowControls();
options.put(OPTIONS_SHOWCONTROLS, showControls);
if(showControls) {
options.put(OPTIONS_BUTTON_OK, clientId + ":okbtn");
options.put(OPTIONS_BUTTON_CANCEL, clientId + ":cancelbtn");
- }
- function.addParameter(options);
-
- writer.write(function.toString());
+ }
+ return options;
}
+
+ public void addToOptions(FacesContext facesContext, UIComponent component, Map<String, Object> options, Object additional) {
+ //override this method if you need additional options
+ }
+
+ public String getReadyStateCss() {
+ return "rf-ii-d-s";
+ }
+
+ public String getEditStateCss() {
+ return "rf-ii-e-s";
+ }
+
+ public String getChangedStateCss() {
+ return "rf-ii-c-s";
+ }
+
+ public String getNoneCss() {
+ return "rf-ii-none";
+ }
}
Copied: branches/RF-8742/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java (from rev 19507, trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java)
===================================================================
--- branches/RF-8742/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java (rev 0)
+++ branches/RF-8742/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java 2010-10-08 17:57:34 UTC (rev 19509)
@@ -0,0 +1,214 @@
+package org.richfaces.renderkit;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import javax.faces.application.ResourceDependencies;
+import javax.faces.application.ResourceDependency;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import javax.faces.model.SelectItem;
+
+import org.ajax4jsf.javascript.ScriptString;
+import org.ajax4jsf.javascript.ScriptUtils;
+import org.richfaces.component.AbstractInplaceSelect;
+import org.richfaces.component.util.InputUtils;
+import org.richfaces.component.util.SelectUtils;
+
+/**
+ * @author Anton Belevich
+ *
+ */
+
+@ResourceDependencies({
+ @ResourceDependency(library = "javax.faces", name = "jsf.js"),
+ @ResourceDependency(name = "jquery.js"),
+ @ResourceDependency(name = "jquery.position.js"),
+ @ResourceDependency(name = "richfaces.js"),
+ @ResourceDependency(name = "richfaces-event.js"),
+ @ResourceDependency(name = "richfaces-base-component.js"),
+ @ResourceDependency(name = "richfaces-selection.js"),
+ @ResourceDependency(library = "org.richfaces", name = "inplaceBase.js"),
+ @ResourceDependency(library = "org.richfaces", name = "select.js"),
+ @ResourceDependency(library = "org.richfaces", name = "inplaceInput.js"),
+ @ResourceDependency(library = "org.richfaces", name = "inplaceSelect.js"),
+ @ResourceDependency(library = "org.richfaces", name = "inplaceSelect.ecss") })
+public class InplaceSelectBaseRenderer extends InplaceInputBaseRenderer {
+
+ public static final String OPTIONS_ITEM_CLASS = "itemCss";
+
+ public static final String OPTIONS_SELECT_ITEM_CLASS = "selectItemCss";
+
+ public static final String OPTIONS_LIST_CORD = "listCord";
+
+ public static final String OPTIONS_ITEMS_CORD = "itemsCord";
+
+ public static final String OPTIONS_SELECT_ITEMS = "selectItems";
+
+ public static final String OPTIONS_SELECT_ITEM_VALUE_INPUT = "selValueInput";
+
+ protected static final class ClientSelectItem implements ScriptString {
+
+ private String clientId;
+ private String label;
+ private String convertedValue;
+
+ public ClientSelectItem(String convertedValue, String label) {
+ this(convertedValue, label, null);
+ }
+
+ public ClientSelectItem(String convertedValue, String label,
+ String clientId) {
+ super();
+ this.convertedValue = convertedValue;
+ this.label = label;
+ this.clientId = clientId;
+ }
+
+ public String getClientId() {
+ return clientId;
+ }
+
+ public void setClientId(String clientId) {
+ this.clientId = clientId;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public String getConvertedValue() {
+ return convertedValue;
+ }
+
+ public void appendScript(StringBuffer functionString) {
+ functionString.append(this.toScript());
+ }
+
+ public String toScript() {
+ return "{ 'id' : " + ScriptUtils.toScript(clientId)
+ + " , 'label' : " + ScriptUtils.toScript(label)
+ + ", 'value' : " + ScriptUtils.toScript(convertedValue)
+ + "}";
+ }
+ }
+
+ @Override
+ protected String getScriptName() {
+ return "new RichFaces.ui.InplaceSelect";
+ }
+
+ public List<ClientSelectItem> getConvertedSelectItems(
+ FacesContext facesContext, UIComponent component) {
+ AbstractInplaceSelect inplaceSelect = (AbstractInplaceSelect) component;
+ List<SelectItem> selectItems = SelectUtils.getSelectItems(facesContext,
+ inplaceSelect);
+ List<ClientSelectItem> clientSelectItems = new ArrayList<InplaceSelectBaseRenderer.ClientSelectItem>();
+ for (SelectItem selectItem : selectItems) {
+ String convertedStringValue = InputUtils.getConvertedStringValue(
+ facesContext, inplaceSelect, selectItem.getValue());
+ String label = selectItem.getLabel();
+ clientSelectItems.add(new ClientSelectItem(convertedStringValue,
+ label));
+ }
+ return clientSelectItems;
+ }
+
+ @Override
+ public void addToOptions(FacesContext facesContext, UIComponent component,
+ Map<String, Object> options, Object additional) {
+ options.put(OPTIONS_ITEM_CLASS, "rf-is-opt");
+ options.put(OPTIONS_SELECT_ITEM_CLASS, "rf-is-sel");
+ String clientId = component.getClientId(facesContext);
+ options.put(OPTIONS_LIST_CORD, clientId + "List");
+ options.put(OPTIONS_ITEMS_CORD, clientId + "Items");
+ options.put(OPTIONS_SELECT_ITEMS, additional);
+ options.put(OPTIONS_SELECT_ITEM_VALUE_INPUT, clientId + "selValue");
+ }
+
+ public void encodeOptions(FacesContext facesContext, UIComponent component,
+ List<ClientSelectItem> clientSelectItems) throws IOException {
+ AbstractInplaceSelect inplaceSelect = (AbstractInplaceSelect) component;
+ if (clientSelectItems != null && !clientSelectItems.isEmpty()) {
+ ResponseWriter writer = facesContext.getResponseWriter();
+ String clientId = component.getClientId(facesContext);
+ int i = 0;
+ for (ClientSelectItem clientSelectItem : clientSelectItems) {
+ String itemClientId = clientId + "Item" + (i++);
+ clientSelectItem.setClientId(itemClientId);
+
+ writer.startElement(HtmlConstants.SPAN_ELEM, inplaceSelect);
+ writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, itemClientId,
+ null);
+ writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE,
+ getOptionCss(), null);
+
+ String label = clientSelectItem.getLabel();
+ if (label != null && label.trim().length() > 0) {
+ writer.writeText(label, null);
+ } else {
+ writer.write("\u00a0");
+ }
+ writer.endElement(HtmlConstants.SPAN_ELEM);
+ }
+ }
+ }
+
+ public String getSelectLabel(FacesContext facesContext,
+ UIComponent component) {
+ AbstractInplaceSelect select = (AbstractInplaceSelect) component;
+ String label = getSelectInputLabel(facesContext, select);
+ if (label == null) {
+ label = select.getDefaultLabel();
+ }
+ return label;
+ }
+
+ public String getSelectInputLabel(FacesContext facesContext,
+ UIComponent component) {
+ AbstractInplaceSelect select = (AbstractInplaceSelect) component;
+ Object value = select.getSubmittedValue();
+ if (value == null) {
+ value = select.getValue();
+ if (value != null) {
+ List<SelectItem> items = SelectUtils.getSelectItems(
+ facesContext, component);
+ for (SelectItem item : items) {
+ if (value.equals(item.getValue())) {
+ value = item.getLabel();
+ }
+ }
+ }
+ }
+
+ return (String) value;
+ }
+
+ public String getListStyles(FacesContext facesContext, UIComponent component) {
+ return "";
+ }
+
+ public String getReadyStateCss() {
+ return "rf-is-d-s";
+ }
+
+ public String getEditStateCss() {
+ return "rf-is-e-s";
+ }
+
+ public String getChangedStateCss() {
+ return "rf-is-c-s";
+ }
+
+ public String getNoneCss() {
+ return "rf-is-none";
+ }
+
+ public String getOptionCss() {
+ return "rf-is-opt rf-is-fnt";
+ }
+
+}
Copied: branches/RF-8742/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceBase.js (from rev 19507, trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceBase.js)
===================================================================
--- branches/RF-8742/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceBase.js (rev 0)
+++ branches/RF-8742/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceBase.js 2010-10-08 17:57:34 UTC (rev 19509)
@@ -0,0 +1,169 @@
+// TODO: remove when these functions will be moved to the RichFaces.Event <!--
+$.extend(RichFaces.Event, {
+ bindScrollEventHandlers: function(element, handler, component) {
+ var elements = [];
+ element = RichFaces.getDomElement(element).parentNode;
+ while (element && element!=window.document.body)
+ {
+ if (element.offsetWidth!=element.scrollWidth || element.offsetHeight!=element.scrollHeight)
+ {
+ elements.push(element);
+ RichFaces.Event.bind(element, "scroll"+component.getNamespace(), handler, component);
+ }
+ element = element.parentNode;
+ }
+ return elements;
+ },
+ unbindScrollEventHandlers: function(elements, component) {
+ RichFaces.Event.unbind(elements, "scroll"+component.getNamespace());
+ }
+});
+// -->
+
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ rf.ui.InplaceBase = function(id, options) {
+ $super.constructor.call(this, id);
+ this.attachToDom(id);
+ this.namespace = this.getNamespace() || "." + rf.Event.createNamespace(this.getName(), this.id);
+
+ this.editEvent = options.editEvent;
+ this.noneCss = options.noneCss;
+ this.changedCss = options.changedCss;
+ this.showControls = options.showControls;
+ this.defaultLabel = options.defaultLabel;
+
+ this.element = $(document.getElementById(id));
+ this.editContainer = $(document.getElementById(options.editContainer));
+
+ this.element.bind(this.editEvent, $.proxy(this.__editHandler, this));
+
+ this.isSaved = false;
+ this.useDefaultLabel = false;
+
+ if(this.showControls) {
+ this.okbtn = $(document.getElementById(options.okbtn));
+ this.cancelbtn = $(document.getElementById(options.cancelbtn));
+ this.okbtn.bind("mousedown", $.proxy(this.__saveBtnHandler, this));
+ this.cancelbtn.bind("mousedown", $.proxy(this.__cancelBtnHandler, this));
+ }
+ };
+
+ rf.BaseComponent.extend(rf.ui.InplaceBase);
+ var $super = rf.ui.InplaceBase.$super;
+
+ $.extend(rf.ui.InplaceBase.prototype, ( function () {
+
+ return {
+ getName: function() {
+ },
+
+ getNamespace: function() {
+ },
+
+ getValue: function() {
+ },
+
+ setValue: function(value){
+ },
+
+ getLabel: function() {
+ },
+
+ setLabel: function(value) {
+ },
+
+ onshow: function(){
+ },
+
+ onhide: function() {
+ },
+
+ getNamespace: function() {
+ },
+
+ save: function() {
+ var value = this.getValue()
+ if(value.length > 0) {
+ this.setLabel(value);
+ } else {
+ this.setLabel(this.defaultLabel);
+ this.useDefaultLabel = true;
+ }
+
+ this.isSaved = true;
+
+ this.__applyChangedStyles();
+ this.__hide();
+ },
+
+ __applyChangedStyles: function() {
+ if(this.isValueChanged()) {
+ this.element.addClass(this.changedCss);
+ } else {
+ this.element.removeClass(this.changedCss);
+ }
+ },
+
+ cancel: function(){
+ var text = "";
+ if(!this.useDefaultLabel) {
+ text = this.getLabel()
+ }
+ this.setValue(text);
+ this.isSaved = true;
+ this.__hide();
+ },
+
+ isValueSaved: function() {
+ return this.isSaved;
+ },
+
+ __saveValue: function(value) {
+
+ },
+
+ __show: function() {
+ this.scrollElements = rf.Event.bindScrollEventHandlers(this.id, this.__scrollHandler, this);
+ this.onshow();
+ },
+
+ __hide: function() {
+ if(this.scrollElements) {
+ rf.Event.unbindScrollEventHandlers(this.scrollElements, this);
+ this.scrollElements = null;
+ }
+ this.onhide();
+ this.editContainer.addClass(this.noneCss);
+ },
+
+ __editHandler: function(e) {
+ this.isSaved = false;
+ this.editContainer.removeClass(this.noneCss);
+ this.__show();
+ },
+
+ __saveBtnHandler: function(e) {
+ this.save();
+ return false;
+ },
+
+ __cancelBtnHandler: function(e) {
+ this.cancel();
+ return false;
+ },
+
+ __scrollHandler: function(e) {
+ this.cancel();
+ },
+
+ destroy: function () {
+ $super.destroy.call(this);
+ }
+ }
+
+ })());
+
+})(jQuery, window.RichFaces);
Modified: branches/RF-8742/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.ecss
===================================================================
--- branches/RF-8742/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.ecss 2010-10-08 15:48:10 UTC (rev 19508)
+++ branches/RF-8742/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.ecss 2010-10-08 17:57:34 UTC (rev 19509)
@@ -1,6 +1,7 @@
input.rf-ii-fld {
background-image: none;
background-color : '#{richSkin.editBackgroundColor}';
+ /*TODO: seems these styles are incorrect*/
border-bottom-width : 10px;
border-bottom-style: solid;
border-bottom-color: '#{richSkin.editBackgroundColor}';
@@ -17,7 +18,7 @@
white-space : nowrap;
}
-.rf-ii-ready-st {
+.rf-ii-d-s {
display : inline-block;
white-space : nowrap;
background-color : '#{richSkin.editorBackgroundColor}';
@@ -30,14 +31,14 @@
position : relative;
}
-.rf-ii-chd-st {
+.rf-ii-c-s {
display : inline-block;
background-image : url("#{resource['org.richfaces:mark_changed.gif']}");
background-position : top left;
background-repeat : no-repeat;
}
-.rf-ii-edt-st {
+.rf-ii-e-s {
position : absolute;
top : 0px;
left : 0px;
@@ -63,7 +64,7 @@
}
.rf-ii-btn {
- background-image : "url(#{resource['org.richfaces.images:inplaceBtnGrad.png']})";
+ background-image : url("#{resource['org.richfaces.images:inplaceBtnGrad.png']}");
background-attachment: scroll;
background-position: center top;
background-repeat: repeat-x;
@@ -75,8 +76,8 @@
margin : 0px;
}
-.rf-ii-btn-prsd {
- background-image : "url(#{resource['org.richfaces.images:inplaceBtnPressGrad.png']})";
+.rf-ii-btn-p {
+ background-image : url("#{resource['org.richfaces.images:inplaceBtnPressGrad.png']}");
background-position: top;
background-repeat: repeat-x;
background-color: '#{richSkin.tabBackgroundColor}';
@@ -86,6 +87,13 @@
padding : 0px;
margin : 0px;
}
+
+.rf-ii-btn-set {
+ position : absolute;
+ top:0px;
+ left : 100px;
+ white-space : nowrap;
+}
.rf-ii-btn-prepos {
position : absolute;
Modified: branches/RF-8742/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.js
===================================================================
--- branches/RF-8742/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.js 2010-10-08 15:48:10 UTC (rev 19508)
+++ branches/RF-8742/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.js 2010-10-08 17:57:34 UTC (rev 19509)
@@ -1,199 +1,108 @@
-// TODO: remove when these functions will be moved to the RichFaces.Event
-$.extend(RichFaces.Event, {
- bindScrollEventHandlers: function(element, handler, component) {
- var elements = [];
- element = RichFaces.getDomElement(element).parentNode;
- while (element && element!=window.document.body)
- {
- if (element.offsetWidth!=element.scrollWidth || element.offsetHeight!=element.scrollHeight)
- {
- elements.push(element);
- RichFaces.Event.bind(element, "scroll"+component.getNamespace(), handler, component);
- }
- element = element.parentNode;
- }
- return elements;
- },
- unbindScrollEventHandlers: function(elements, component) {
- RichFaces.Event.unbind(elements, "scroll"+component.getNamespace());
- }
-});
-
(function ($, rf) {
rf.ui = rf.ui || {};
rf.ui.InplaceInput = function(id, options) {
- /*TODO: use defaultOptions*/
- $super.constructor.call(this, id);
- this.attachToDom(id);
+ $super.constructor.call(this, id, options);
- this.namespace = this.namespace || "." + rf.Event.createNamespace(this.name, this.id);
-
- this.currentState = options.state;
- this.editEvent = options.editEvent;
- this.noneCss = options.noneCss;
- this.changedCss = options.changedCss;
- this.showControls = options.showControls;
- this.defaultLabel = options.defaultLabel;
-
- this.element = $(document.getElementById(id));
- this.editContainer = $(document.getElementById(options.editContainer));
- this.input = $(document.getElementById(options.input));
+ this.input = $(document.getElementById(options.input));
this.label = $(document.getElementById(options.label));
- this.focusElement = $(document.getElementById(options.focusElement));
-
+
var label = this.label.text();
var inputLabel = this.input.val();
-
this.initialValue = (label == inputLabel) ? label : "";
+ this.saveOnBlur = options.saveOnBlur;
- this.element.bind(this.editEvent, $.proxy(this.__editHandler, this));
- this.input.bind("focus", $.proxy(this.__editHandler, this));
+ this.input.bind("focus", $.proxy(this.__editHandler, this));
this.input.bind("change", $.proxy(this.__changeHandler, this));
this.input.bind("blur", $.proxy(this.__blurHandler, this));
this.input.bind("keydown", $.proxy(this.__keydownHandler, this));
-
- if(this.showControls) {
- this.okbtn = $(document.getElementById(options.okbtn));
- this.cancelbtn = $(document.getElementById(options.cancelbtn));
- this.okbtn.bind("mousedown", $.proxy(this.__saveBtnHandler, this));
- this.cancelbtn.bind("mousedown", $.proxy(this.__cancelBtnHandler, this));
- }
+
+ this.focusElement = $(document.getElementById(options.focusElement));
};
-
- // Extend component class and add protected methods from parent class to our container
- rf.BaseComponent.extend( rf.ui.InplaceInput);
-
- // define super class link
- var $super = rf.ui.InplaceInput.$super;
+ rf.ui.InplaceBase.extend(rf.ui.InplaceInput);
+ var $super = rf.ui.InplaceInput.$super;
+
$.extend(rf.ui.InplaceInput.prototype, ( function () {
-
- var isSaved = false;
- var isValueChanged = false;
-
+
return {
- name : "inplaceInput",
-/****************** public methods *****************************************/
+ name : "inplaceInput",
+
+ geName: function() {
+ return this.name;
+ },
+
+ geNamespace: function() {
+ return this.namespace;
+ },
- getNamespace: function () {
- return this.namespace;
- },
-
- edit: function() {
- isSaved = false;
- this.__show();
- this.input.focus();
- },
-
- save: function() {
- var inputValue = this.input.val();
- if(inputValue.length > 0) {
- this.label.text(inputValue);
- isValueChanged = true;
- } else {
- this.label.text(this.defaultLabel);
- isValueChanged = false;
+ __keydownHandler: function(e) {
+ switch(e.keyCode) {
+ case 27:
+ this.cancel();
+ break;
+ case 13:
+ this.save();
+ return false;
}
-
- if(inputValue != this.initialValue) {
- this.element.addClass(this.changedCss);
+ },
+
+ __blurHandler: function(e) {
+ if(!this.isValueSaved() && this.__isSaveOnBlur()) {
+ this.save();
} else {
- this.element.removeClass(this.changedCss);
+ this.__hide();
}
- isSaved = true;
- this.__hide();
- },
-
- cancel: function() {
- var text = "";
- if(isValueChanged) {
- text = this.label.text();
- }
- this.input.val(text);
- isSaved = true;
- this.__hide();
- this.element.focus();
+ return false;
},
+
+ __changeHandler: function(e) {
+ if(!this.isValueSaved()) {
+ this.save();
+ }
+ },
- setValue: function (value) {
- this.input.val(value);
- this.save();
+ __isSaveOnBlur: function() {
+ return this.saveOnBlur;
},
- getValue: function() {
- return this.input.val();
- },
+ __setInputFocus: function() {
+ this.input.unbind("focus", this.__editHandler);
+ this.input.focus();
+ this.input.bind("focus", $.proxy(this.__editHandler, this));
+ },
-/****************** private methods *****************************************/
+ getValue: function() {
+ return this.input.val();
+ },
- __saveBtnHandler: function(e) {
- this.save();
- return false;
+ setValue: function(value){
+ this.input.val(value);
},
- __cancelBtnHandler: function(e) {
- this.cancel();
- return false;
+ getLabel: function() {
+ return this.label.text();
},
-
- __editHandler: function(e) {
- this.input.unbind("focus", this.__editHandler);
- this.edit();
- this.input.bind("focus", $.proxy(this.__editHandler, this));
+
+ setLabel: function(value) {
+ this.label.text(value);
},
- __changeHandler: function(e) {
- if(!isSaved) {
- this.save();
- }
- },
-
- __blurHandler: function(e) {
- if(!isSaved) {
- this.save();
- }
- return false;
+ isValueChanged: function () {
+ return (this.getValue() != this.initialValue);
},
-
- __scrollHandler: function(e) {
- this.cancel();
- },
-
- __keydownHandler: function(e) {
- switch(e.keyCode) {
- /*Esc*/
- case 27:
- this.cancel();
- break;
- /*Enter*/
- case 13:
- this.save();
- return false;
- }
-
- },
-
- __show: function() {
- this.scrollElements = rf.Event.bindScrollEventHandlers(this.id, this.__scrollHandler, this);
- this.editContainer.removeClass(this.noneCss);
- },
-
- __hide: function() {
- rf.Event.unbindScrollEventHandlers(this.scrollElements, this);
- this.scrollElements = null;
- this.editContainer.addClass(this.noneCss);
- this.focusElement.focus();
- },
+
+ onshow: function(){
+ this.__setInputFocus();
+ },
+
+ onhide: function() {
+ this.focusElement.focus();
+ }
- destroy: function () {
- //TODO: unbind handlers
- $super.destroy.call(this);
- }
- }
- })());
+ }
+ })());
-})(jQuery, window.RichFaces);
-
+})(jQuery, window.RichFaces);
\ No newline at end of file
Copied: branches/RF-8742/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.ecss (from rev 19507, trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.ecss)
===================================================================
--- branches/RF-8742/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.ecss (rev 0)
+++ branches/RF-8742/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.ecss 2010-10-08 17:57:34 UTC (rev 19509)
@@ -0,0 +1,218 @@
+input.rf-is-fld {
+ background : '#{richSkin.editBackgroundColor}';
+ padding : 0px 0px 0px 0px;
+ border : 0px;
+ margin : 0px;
+ width : 112px;
+ background-image:"url(#{resource['org.richfaces:mark_list.gif']})";
+ background-position : center right;
+ background-repeat : no-repeat;
+ font-family:inherit;
+ font-size : inherit;
+}
+
+.rf-is-none {
+ clip: "rect(0px 0px 1px 1px)";
+}
+
+.rf-is-none {
+ clip: rect(0px, 0px, 1px, 1px);
+}
+
+.rf-is-fnt {
+}
+
+.rf-is-d-s {
+ display : inline-block;
+ position : relative;
+ white-space : nowrap;
+ background-color : '#{richSkin.editorBackgroundColor}';
+ border-bottom-width : 1px;
+ border-bottom-style : dashed;
+ border-bottom-color : '#{richSkin.generalTextColor}';
+ padding-left : 3px;
+ padding-right : 3px;
+}
+
+.rf-is-c-s {
+ display : inline-block;
+ background-image : "url(#{resource['org.richfaces:mark_changed.gif']})";
+ background-position : top left;
+ background-repeat : no-repeat;
+}
+
+.rf-is-e-s {
+ position : absolute;
+ top : 0px;
+ left : 0px;
+ width : 100px;
+ background-color : '#{richSkin.editBackgroundColor}';
+}
+
+.rf-is-fld {
+ background-color : '#{richSkin.editBackgroundColor}';
+ padding : 0px 0px 0px 0px;
+ border : 0px;
+ margin : 0px;
+ width : 112px;
+ background-image: "url(#{resource['org.richfaces:mark_list.gif']})";
+ background-position : center right;
+ background-repeat : no-repeat;
+}
+
+.rf-is-btn {
+ background-image : url("#{resource['org.richfaces.images:inplaceBtnGrad.png']}");
+ background-position : top;
+ background-repeat: repeat-x;
+ background-color: '#{richSkin.tabBackgroundColor}';
+ border-width : 1px;
+ border-style : outset;
+ border-color : '#{richSkin.panelBorderColor}';
+ padding : 3px;
+ margin : 0px;
+}
+
+.rf-is-btn-p {
+ background-image : url("#{resource['org.richfaces.images:inplaceBtnPressGrad.png']}");
+ background-position : top;
+ background-repeat : repeat-x;
+ background-color : '#{richSkin.tabBackgroundColor}';
+ border-width : 1px;
+ border-style : inset;
+ border-color : '#{richSkin.panelBorderColor}';
+ padding : 3px;
+ margin : 0px;
+}
+
+.rf-is-btn-set {
+ position : absolute;
+ top : 0px;
+ left : 112px;
+ white-space : nowrap;
+}
+
+.rf-is-lst-cord {
+ display : block;
+ /*font-size : 0px;*/
+ position : relative;
+ font-family:inherit;
+ font-size : inherit;
+}
+
+.rf-is-lst-pos {
+ display : block;
+ position : absolute;
+ top: 0px;
+ left: -1px;
+}
+
+.rf-is-lst-dec {
+ display : block;
+ border-width : 1px;
+ border-style : solid;
+ border-color : '#{richSkin.panelBorderColor}';
+ padding : 0px;
+ /*width: 100%;*/
+ background-color : '#{richSkin.editBackgroundColor}';
+}
+
+.rf-is-lst-scrl {
+ display : block;
+ overflow : auto;
+ overflow-x : hidden;
+ /*height : 100px;*/
+}
+
+.rf-is-opt {
+ display : block;
+ padding : 2px;
+ white-space : nowrap;
+ background-color : '#{richSkin.editBackgroundColor}';
+ cursor : default;
+}
+
+.rf-is-sel {
+ display : block;
+ padding : 1px;
+ background-color: #DFE8F6; /*get from skin???*/
+ border-width : 1px;
+ border-style : dotted;
+ border-color : '#{richSkin.generalTextColor}';
+}
+
+.rf-is-btn-prepos {
+ display : block;
+ position : absolute;
+ top : -4px;
+ right : 0px;
+ wigth : 1px;
+ height : 1px;
+}
+
+.rf-is-btn-pos {
+ display : block;
+ position : absolute;
+ top : 0px;
+ left : 0px;
+ white-space : nowrap;
+}
+
+.rf-is-btn-shdw {
+ display : block;
+ position: relative;
+ padding : 6px 6px 6px 6px;
+ top : -6px;
+ right : -6px;
+}
+
+.rf-is-shdw {
+ display : block;
+ position: relative;
+ padding : 6px 6px 6px 6px;
+ top : -6px;
+ left : -6px;
+}
+
+.rf-is-shdw-t {
+ display : block;
+ background-image : "url(#{resource['org.richfaces:bg_shadow.png']})";
+ background-position : top left;
+ position: absolute;
+ width: 6px;
+ top: 0px;
+ bottom: 6px;
+ left : 0px
+}
+
+.rf-is-shdw-l {
+ display : block;
+ background-image : "url(#{resource['org.richfaces:bg_shadow.png']})";
+ background-position : bottom left;
+ position : absolute;
+ height : 6px;
+ bottom : 0px;
+ left : 0px;
+ right : 6px;
+}
+
+.rf-is-shdw-r {
+ display : block;
+ background : "url(#{resource['org.richfaces:bg_shadow.png']})";
+ background-position : bottom right;
+ position : absolute;
+ width : 6px;
+ top : 6px;
+ bottom : 0px;
+ right : 0px;
+}
+
+.rf-is-shdw-b {
+ display : block;
+ background : "url(#{resource['org.richfaces:bg_shadow.png']})";
+ background-position : right top;
+ position: absolute;
+ height : 6px;
+ top: 0px;
+ left : 6px;
+ right : 0px;
+}
Copied: branches/RF-8742/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js (from rev 19507, trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js)
===================================================================
--- branches/RF-8742/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js (rev 0)
+++ branches/RF-8742/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js 2010-10-08 17:57:34 UTC (rev 19509)
@@ -0,0 +1,99 @@
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ rf.ui.InplaceSelect = function(id, options) {
+ $super.constructor.call(this, id, options)
+ this.select = new rf.ui.Select(options.listCord, this, options);
+ this.selectItems = options.selectItems;
+ this.selValueInput = $(document.getElementById(options.selValueInput));
+ this.openPopup = false;
+
+ }
+
+ rf.ui.InplaceInput.extend(rf.ui.InplaceSelect);
+ $.extend(rf.ui.InplaceSelect, rf.ui.SelectListener);
+
+ var $super = rf.ui.InplaceSelect.$super;
+ $.extend(rf.ui.InplaceSelect.prototype, ( function () {
+
+ return{
+ name : "inplaceSelect",
+
+ getName: function() {
+ return this.name;
+ },
+
+ geNamespace: function() {
+ return this.namespace;
+ },
+
+ onshow: function() {
+ if(this.openPopup) {
+ this.select.show();
+ }
+
+ if(!this.openPopup) {
+ this.openPopup = true;
+ }
+
+ $super.onshow.call(this);
+ },
+
+ onhide: function() {
+ this.select.hide();
+ this.openPopup = false;
+ },
+
+ processItem: function(event, element) {
+ var key = element.attr("id");
+ var value = this.getItemValue(key);
+ this.saveItemValue(value);
+
+ var label = this.getItemLabel(key);
+ //inplace label
+ this.setValue(label);
+ this.select.hide();
+
+ this.__setInputFocus();
+ },
+
+ getItemValue: function(key) {
+ for(var i in this.selectItems) {
+ var item = this.selectItems[i];
+ if(item && item.id == key) {
+ return item.value;
+ }
+ }
+ },
+
+ saveItemValue: function(value) {
+ this.selValueInput.val(value);
+ },
+
+ getItemLabel: function(key) {
+ for(var i in this.selectItems) {
+ var item = this.selectItems[i];
+ if(item && item.id == key) {
+ return item.label;
+ }
+ }
+ },
+
+ __blurHandler: function(e) {
+ var target = $(e.originalEvent.explicitOriginalTarget);
+ if(!this.__isPopupList(target)) {
+ $super.__blurHandler.call(this,e);
+ }
+ return false;
+ },
+
+ __isPopupList: function(target) {
+ var parentId = target.parents(".rf-is-lst-cord").attr("id");
+ return (parentId && (parentId == this.select.__getId()));
+ }
+ }
+
+ })());
+
+})(jQuery, window.RichFaces);
Modified: branches/RF-8742/ui/input/ui/src/main/templates/inplaceInput.template.xml
===================================================================
--- branches/RF-8742/ui/input/ui/src/main/templates/inplaceInput.template.xml 2010-10-08 15:48:10 UTC (rev 19508)
+++ branches/RF-8742/ui/input/ui/src/main/templates/inplaceInput.template.xml 2010-10-08 17:57:34 UTC (rev 19509)
@@ -49,14 +49,13 @@
<input id="#{clientId}:focus" type="image" style="position: absolute; top: 0px; left: 0px; outline-style: none;" class="rf-ii-none"/>
<span id="#{clientId}:edit" class="#{getEditStyleClass(component, inplaceState)}">
<input id="#{clientId}:input" autocomplete="off" name="#{clientId}"
- type="text" value="#{getInputValue(facesContext, component)}" class="rf-ii-fld" style="width: #{component.attributes['inputWidth']};"
- cdk:passThrough="tabIndex">
+ type="text" value="#{getInputValue(facesContext, component)}" class="rf-ii-fld" style="width: #{component.attributes['inputWidth']};" cdk:passThrough="tabIndex">
<cdk:call expression="renderInputHandlers(facesContext, component);"/>
</input>
<c:if test="#{component.attributes['showControls']}">
<span class="rf-ii-btn-prepos">
<span class="rf-ii-btn-pos">
- <span id="#{clientId}:btnshadow" class="rf-ii-btn-shdw">
+ <span id="#{clientId}:btnshadow" class="rf-ii-btn-shadow">
<span class="rf-ii-btn-shdw-t"></span>
<span class="rf-ii-btn-shdw-l"></span>
<span class="rf-ii-btn-shdw-r"></span>
@@ -66,12 +65,12 @@
<input type="image"
id="#{clientId}:okbtn"
src="#{getResourcePath(facesContext, 'org.richfaces/ico_ok.gif')}"
- class="rf-ii-btn" onmousedown="this.className='rf-ii-btn-prsd'"
+ class="rf-ii-btn" onmousedown="this.className='rf-ii-btn-p'"
onmouseout="this.className='rf-ii-btn'" onmouseup="this.className='rf-ii-btn'" />
<input type="image"
id="#{clientId}:cancelbtn"
src="#{getResourcePath(facesContext,'org.richfaces/ico_cancel.gif')}"
- class="rf-ii-btn" onmousedown="this.className='rf-ii-btn-prsd'"
+ class="rf-ii-btn" onmousedown="this.className='rf-ii-btn-press'"
onmouseout="this.className='rf-ii-btn'" onmouseup="this.className='rf-ii-btn'" />
<br />
</span>
@@ -81,7 +80,7 @@
</c:if>
</span>
<script type="text/javascript">
- <cdk:call expression="buildScript(responseWriter, facesContext, component);"/>
+ <cdk:call expression="buildScript(responseWriter, facesContext, component, null);"/>
</script>
</span>
</cc:implementation>
Copied: branches/RF-8742/ui/input/ui/src/main/templates/inplaceSelect.template.xml (from rev 19507, trunk/ui/input/ui/src/main/templates/inplaceSelect.template.xml)
===================================================================
--- branches/RF-8742/ui/input/ui/src/main/templates/inplaceSelect.template.xml (rev 0)
+++ branches/RF-8742/ui/input/ui/src/main/templates/inplaceSelect.template.xml 2010-10-08 17:57:34 UTC (rev 19509)
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- JBoss, Home of Professional Open Source Copyright ${year}, 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. -->
+<cdk:root xmlns="http://jboss.org/schema/richfaces/cdk/xhtml-el"
+ xmlns:cdk="http://jboss.org/schema/richfaces/cdk/core" xmlns:c="http://jboss.org/schema/richfaces/cdk/jstl/core"
+ xmlns:cc="http://jboss.org/schema/richfaces/cdk/jsf/composite"
+ xmlns:javaee="http://java.sun.com/xml/ns/javaee">
+
+ <cc:interface>
+ <cdk:class>org.richfaces.renderkit.html.InplaceSelectRenderer
+ </cdk:class>
+ <cdk:superclass>org.richfaces.renderkit.InplaceSelectBaseRenderer
+ </cdk:superclass>
+ <cdk:component-family>org.richfaces.InplaceSelect
+ </cdk:component-family>
+ <cdk:renderer-type>org.richfaces.InplaceSelectRenderer
+ </cdk:renderer-type>
+ </cc:interface>
+
+ <cc:implementation>
+ <cdk:object type="org.richfaces.component.InplaceState"
+ name="inplaceState" value="#{getInplaceState(component)}" />
+ <cdk:object type="java.lang.String" name="inplaceValue"
+ value="#{getSelectLabel(facesContext, component)}"/>
+
+ <cdk:object type="java.util.List" type-arguments="InplaceSelectBaseRenderer.ClientSelectItem" name="clientSelectItems"
+ value="#{getConvertedSelectItems(facesContext, component)}" />
+
+ <span id="#{clientId}" class="#{getReadyStyleClass(component, inplaceState)}"
+ cdk:passThroughWithExclusions="id class">
+
+ <span id="#{clientId}:label" class="rf-is-lbl">
+ #{inplaceValue}
+ </span>
+
+ <input id="#{clientId}:focus" type="image" style="position: absolute; top: 0px; left: 0px; outline-style: none;" class="rf-is-none" />
+
+ <span id="#{clientId}:edit" class="#{getEditStyleClass(component, inplaceState)}">
+ <input id="#{clientId}selValue" name="#{clientId}" type="hidden" value="#{getValue(facesContext, component)}"/>
+ <input id="#{clientId}:input" autocomplete="off"
+ type="text" value="#{getSelectInputLabel(facesContext, component)}"
+ class="rf-is-fld" style="width: #{component.attributes['inputWidth']};" readonly="readonly"
+ cdk:passThrough="tabIndex">
+ <cdk:call expression="renderInputHandlers(facesContext, component);" />
+ </input>
+ <c:if test="#{component.attributes['showControls']}">
+ <span class="rf-is-btn-prepos">
+ <span class="rf-is-btn-pos">
+ <span id="#{clientId}:btnshadow" class="rf-is-shdw">
+ <span class="rf-is-shdw-t"></span>
+ <span class="rf-is-shdw-l"></span>
+ <span class="rf-is-shdw-r"></span>
+ <span class="rf-is-shdw-b"></span>
+
+ <span id="#{clientId}:btn" style="position : relative;">
+ <input type="image" id="#{clientId}:okbtn"
+ src="#{getResourcePath(facesContext, 'org.richfaces/ico_ok.gif')}"
+ class="rf-is-btn" onmousedown="this.className='rf-is-btn-press'"
+ onmouseout="this.className='rf-is-btn'" onmouseup="this.className='rf-is-btn'" />
+ <input type="image" id="#{clientId}:cancelbtn"
+ src="#{getResourcePath(facesContext,'org.richfaces/ico_cancel.gif')}"
+ class="rf-is-btn" onmousedown="this.className='rf-is-btn-press'"
+ onmouseout="this.className='rf-is-btn'" onmouseup="this.className='rf-is-btn'" />
+ <br />
+ </span>
+ </span>
+ </span>
+ </span>
+ </c:if>
+ <span id="#{clientId}List" class="rf-is-none rf-is-lst-cord">
+ <span class="rf-is-lst-pos" style="width: #{component.attributes['listWidth']}">
+ <span class="rf-is-shdw">
+ <span class="rf-is-shdw-t"></span>
+ <span class="rf-is-shdw-l"></span>
+ <span class="rf-is-shdw-r"></span>
+ <span class="rf-is-shdw-b"></span>
+ <span class="rf-is-lst-dec">
+ <span class="rf-is-lst-scrl" id="#{clientId}Items" style="height: #{component.attributes['listHeight']}">
+ <cdk:call expression="encodeOptions(facesContext, component, clientSelectItems);"/>
+ </span>
+ </span>
+ </span>
+ </span>
+ </span>
+ </span>
+ <script type="text/javascript">
+ <cdk:call expression="buildScript(responseWriter, facesContext, component, clientSelectItems);" />
+ </script>
+ </span>
+ </cc:implementation>
+</cdk:root>
\ No newline at end of file
Modified: branches/RF-8742/ui/input/ui/src/test/java/org/richfaces/renderkit/InplaceInputRendererTest.java
===================================================================
--- branches/RF-8742/ui/input/ui/src/test/java/org/richfaces/renderkit/InplaceInputRendererTest.java 2010-10-08 15:48:10 UTC (rev 19508)
+++ branches/RF-8742/ui/input/ui/src/test/java/org/richfaces/renderkit/InplaceInputRendererTest.java 2010-10-08 17:57:34 UTC (rev 19509)
@@ -59,7 +59,7 @@
HtmlPage page = environment.getPage("/test.jsf");
HtmlElement span = page.getFirstByXPath("//*[@id = 'form:input_default']");
assertEquals("span", span.getNodeName());
- assertEquals("rf-ii-ready-st", span.getAttribute(HtmlConstants.CLASS_ATTRIBUTE));
+ assertEquals("rf-ii-d-s", span.getAttribute(HtmlConstants.CLASS_ATTRIBUTE));
HtmlElement label = (HtmlElement)span.getFirstChild();
assertEquals("span", label.getNodeName());
@@ -69,7 +69,7 @@
HtmlElement edit = page.getFirstByXPath("//*[@id = 'form:input_default:edit']");
assertEquals("span", edit.getNodeName());
- assertEquals("rf-ii-edt-st rf-ii-none", edit.getAttribute(HtmlConstants.CLASS_ATTRIBUTE));
+ assertEquals("rf-ii-e-s rf-ii-none", edit.getAttribute(HtmlConstants.CLASS_ATTRIBUTE));
HtmlElement input = (HtmlElement)edit.getFirstChild();
assertEquals("input", input.getNodeName());
@@ -87,7 +87,7 @@
HtmlElement span = page.getFirstByXPath("//*[@id = 'form:input_edit']");
assertEquals("span", span.getNodeName());
- assertEquals("rf-ii-ready-st", span.getAttribute(HtmlConstants.CLASS_ATTRIBUTE));
+ assertEquals("rf-ii-d-s", span.getAttribute(HtmlConstants.CLASS_ATTRIBUTE));
HtmlElement label = (HtmlElement)span.getFirstChild();
assertEquals("span", label.getNodeName());
@@ -97,7 +97,7 @@
HtmlElement edit = page.getFirstByXPath("//*[@id = 'form:input_edit:edit']");
assertEquals("span", edit.getNodeName());
- assertEquals("rf-ii-edt-st", edit.getAttribute(HtmlConstants.CLASS_ATTRIBUTE));
+ assertEquals("rf-ii-e-s", edit.getAttribute(HtmlConstants.CLASS_ATTRIBUTE));
HtmlElement input = (HtmlElement)edit.getFirstChild();
assertEquals("input", input.getNodeName());
@@ -127,7 +127,7 @@
DomText text = page.getFirstByXPath("//*[@id = 'form:input_default:label']/text()");
assertEquals("Another Test String", text.getTextContent());
HtmlElement span = page.getFirstByXPath("//*[@id = 'form:input_default']");
- assertEquals("rf-ii-ready-st rf-ii-chd-st", span.getAttribute(HtmlConstants.CLASS_ATTRIBUTE));
+ assertEquals("rf-ii-d-s rf-ii-c-s", span.getAttribute(HtmlConstants.CLASS_ATTRIBUTE));
}
private void blur(HtmlPage page) throws Exception {
@@ -145,7 +145,7 @@
HtmlElement span = page.getFirstByXPath("//*[@id = 'form:" + inplaceInputId + "']");
span.click();
HtmlElement edit = page.getFirstByXPath("//*[@id = 'form:" + inplaceInputId + ":edit']");
- assertEquals("rf-ii-edt-st", edit.getAttribute(HtmlConstants.CLASS_ATTRIBUTE));
+ assertEquals("rf-ii-e-s", edit.getAttribute(HtmlConstants.CLASS_ATTRIBUTE));
typeNewValue(page, inplaceInputId, value);
}
@@ -161,7 +161,7 @@
assertEquals("Test String", text.getTextContent());
HtmlElement span = page.getFirstByXPath("//*[@id = 'form:input_controls']");
- assertEquals("rf-ii-ready-st", span.getAttribute(HtmlConstants.CLASS_ATTRIBUTE));
+ assertEquals("rf-ii-d-s", span.getAttribute(HtmlConstants.CLASS_ATTRIBUTE));
edit(page, "input_controls", "Another Test String");
@@ -172,7 +172,7 @@
assertEquals("Another Test String", text.getTextContent());
span = page.getFirstByXPath("//*[@id = 'form:input_controls']");
- assertEquals("rf-ii-ready-st rf-ii-chd-st", span.getAttribute(HtmlConstants.CLASS_ATTRIBUTE));
+ assertEquals("rf-ii-d-s rf-ii-c-s", span.getAttribute(HtmlConstants.CLASS_ATTRIBUTE));
edit(page, "input_controls", "Test String");
Modified: branches/RF-8742/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanel.ecss
===================================================================
--- branches/RF-8742/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanel.ecss 2010-10-08 15:48:10 UTC (rev 19508)
+++ branches/RF-8742/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanel.ecss 2010-10-08 17:57:34 UTC (rev 19509)
@@ -8,7 +8,7 @@
top: 0px;
z-index: -300;
opacity: 0.1;
- filter: 'alpha(opacity \5C 3D 10)';
+ filter: 'alpha(opacity = 10)';
}
.rf-pp-shade {
@@ -19,13 +19,13 @@
left: 0px;
background-color: #D0D0D0;
opacity: 0.5;
- filter: 'alpha(opacity \5C 3D 50)';
+ filter: 'alpha(opacity = 50)';
}
.rf-pp-shdw {
background-color: #000000;
opacity: 0.1;
- filter: 'alpha(opacity \5C 3D 10)';
+ filter: 'alpha(opacity = 10)';
}
.rf-pp-cntr {
@@ -79,11 +79,10 @@
font-size : '#{richSkin.generalSizeFont}';
}
.rf-pp-hndlr {
- background : red;
opacity:0;
position : absolute;
margin : -4px;
- filter : 'alpha(opacity \5C 3D 0)';
+ filter : 'alpha(opacity = 0)';
}
.rf-pp-hndlr-l {
Modified: branches/RF-8742/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/progressBar.js
===================================================================
--- branches/RF-8742/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/progressBar.js 2010-10-08 15:48:10 UTC (rev 19508)
+++ branches/RF-8742/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/progressBar.js 2010-10-08 17:57:34 UTC (rev 19509)
@@ -286,7 +286,7 @@
renderLabel: renderLabel,
switchState: switchState,
renderState: renderState,
- forceState: forceState,
+ forceState: forceState
};
})());
13 years, 11 months
JBoss Rich Faces SVN: r19508 - sandbox/trunk/prototypes/calendar.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2010-10-08 11:48:10 -0400 (Fri, 08 Oct 2010)
New Revision: 19508
Modified:
sandbox/trunk/prototypes/calendar/calendar-utils.js
sandbox/trunk/prototypes/calendar/calendar.js
sandbox/trunk/prototypes/calendar/test.html
Log:
https://jira.jboss.org/browse/RF-9152
https://jira.jboss.org/browse/RF-9168
calendar prototype
Modified: sandbox/trunk/prototypes/calendar/calendar-utils.js
===================================================================
--- sandbox/trunk/prototypes/calendar/calendar-utils.js 2010-10-08 15:21:01 UTC (rev 19507)
+++ sandbox/trunk/prototypes/calendar/calendar-utils.js 2010-10-08 15:48:10 UTC (rev 19508)
@@ -58,6 +58,7 @@
}
});*/
+ // TODO: move joinArray to richfaces utils
joinArray: function(array, begin, end, separator)
{
var value = '';
Modified: sandbox/trunk/prototypes/calendar/calendar.js
===================================================================
--- sandbox/trunk/prototypes/calendar/calendar.js 2010-10-08 15:21:01 UTC (rev 19507)
+++ sandbox/trunk/prototypes/calendar/calendar.js 2010-10-08 15:48:10 UTC (rev 19508)
@@ -19,7 +19,7 @@
if (!calendar.selectedDate || calendar.params.showApplyButton) return "";
- var text = Richfaces.Calendar.formatDate(calendar.selectedDate,(calendar.timeType ? calendar.datePattern : calendar.params.datePattern), calendar.params.monthLabels, calendar.params.monthLabelsShort);
+ var text = rf.calendarUtils.formatDate(calendar.selectedDate,(calendar.timeType ? calendar.datePattern : calendar.params.datePattern), calendar.params.monthLabels, calendar.params.monthLabelsShort);
var onclick = "RichFaces.$$('Calendar',this).showSelectedDate(); return true;"
var markup = ( calendar.params.disabled ?
new E('div', {'class': 'rich-calendar-tool-btn-disabled'}, [new ET(text)]) :
@@ -32,7 +32,7 @@
if (!calendar.selectedDate || !calendar.timeType) return "";
- var text = Richfaces.Calendar.formatDate(calendar.selectedDate, calendar.timePattern, calendar.params.monthLabels, calendar.params.monthLabelsShort);
+ var text = rf.calendarUtils.formatDate(calendar.selectedDate, calendar.timePattern, calendar.params.monthLabels, calendar.params.monthLabelsShort);
var onmouseover = "jQuery(this).removeClass('rich-calendar-tool-btn-press');";
var onmouseout = "jQuery(this).addClass('rich-calendar-tool-btn-press');";
@@ -60,7 +60,7 @@
return (!context.calendar.params.disabled ? CalendarView.getControl("<", CalendarView.toolButtonAttributes, "prevMonth") : "");
},
currentMonthControl: function (context) {
- var text = Richfaces.Calendar.formatDate(context.calendar.getCurrentDate(), "MMMM, yyyy", context.monthLabels, context.monthLabelsShort);
+ var text = rf.calendarUtils.formatDate(context.calendar.getCurrentDate(), "MMMM, yyyy", context.monthLabels, context.monthLabelsShort);
var markup = context.calendar.params.disabled ?
new E('div',{className: "rich-calendar-tool-btn-disabled"},[new T(text)]) :
CalendarView.getControl(text, CalendarView.toolButtonAttributes, "showDateEditor");
@@ -323,11 +323,10 @@
$super.constructor.call(this, componentId);
this.namespace = "."+rf.Event.createNamespace(this.name, componentId);
- this.attachToDom(componentId);
//create parameters
//this.options = $.extend(this.options, defaultOptions, options);
- this.params = $.extend(this.options, defaultOptions, Richfaces.Calendar[locale], options, markups);
+ this.params = $.extend({}, defaultOptions, locales[locale], options, markups);
// labels
var value = options.labels || {};
@@ -370,7 +369,6 @@
this.POPUP_ID = this.id+'Popup';
this.POPUP_BUTTON_ID = this.id+'PopupButton';
this.INPUT_DATE_ID = this.id+'InputDate';
- this.IFRAME_ID = this.id+'IFrame';
this.EDITOR_ID = this.id+'Editor';
this.EDITOR_SHADOW_ID = this.id+'EditorShadow';
@@ -410,7 +408,6 @@
var htmlControlsHeader = (this.params.showHeader ? '<tr><td class="rich-calendar-header" colspan="'+colspan+'" id="'+this.id+'Header"></td></tr>' : '');
var htmlControlsFooter = (this.params.showFooter ? '<tr><td class="rich-calendar-footer" colspan="'+colspan+'" id="'+this.id+'Footer"></td></tr>' : '');
var htmlTextFooter = '</tbody></table>'
- var htmlTextIFrame = '<iframe src="javascript:\'\'" frameborder="0" scrolling="no" id="' + this.IFRAME_ID + '" style="display:none; position: absolute; width: 1px; height: 1px; background-color:white;">'+'</iframe>';
// days bar creation
var styleClass;
@@ -473,39 +470,13 @@
htmlTextWeek.push('</tr>');
}
- var obj = rf.getDomElement(this.POPUP_ID).nextSibling;
- if (this.params.popup && Richfaces.browser.isIE6)
- {
- do {
- if (obj.id == this.IFRAME_ID)
- {
- var iframe = obj;
- obj = obj.nextSibling;
- Element.replace(iframe, htmlTextIFrame);
- break;
- }
- } while (obj = obj.nextSibling);
- }
+ var div = rf.getDomElement(this.id);
+ $(div).replaceWith(htmlTextHeader+htmlHeaderOptional+htmlControlsHeader+htmlTextWeekDayBar.join('')+htmlTextWeek.join('')+htmlControlsFooter+htmlFooterOptional+htmlTextFooter);
+ this.attachToDom(div);
- do {
- if (obj.id == id)
- {
- var div = obj;
- obj = obj.previousSibling;
- Element.replace(div, htmlTextHeader+htmlHeaderOptional+htmlControlsHeader+htmlTextWeekDayBar.join('')+htmlTextWeek.join('')+htmlControlsFooter+htmlFooterOptional+htmlTextFooter);
- break;
- }
- } while (obj = obj.nextSibling);
-
- // set content
- obj=obj.nextSibling;
- obj.component = this;
- obj.richfacesComponent="richfaces:calendar";
- this["rich:destructor"] = "destructor";
+ // memory leaks fix // from old 3.3.x code, may be not needed now
+ div = null;
- // memory leaks fix
- obj = null;
-
if(this.params.submitFunction) this.submitFunction = this.params.submitFunction.bind(this);
this.prepareEvents(); //TODO: function
@@ -530,7 +501,7 @@
rf.BaseComponent.extend(rf.ui.Calendar);
// define super class link
- var $super = rf.BaseComponent.$super;
+ var $super = rf.ui.Calendar.$super;
// static methods definition
var locales = {};
@@ -539,7 +510,7 @@
if (!locales[locale]) {
locales[locale] = symbols;
}
- },
+ };
/*
* Prototype definition
@@ -892,10 +863,6 @@
Richfaces.removeScrollEventHandlers(this.scrollElements, this.eventOnScroll);
Event.stopObserving(window.document, "click", this.eventOnCollapse, false);
- var iframe=null;
- if (Richfaces.browser.isIE6) iframe = $(this.IFRAME_ID);
- if (iframe) Element.hide(iframe);
-
Element.hide(element);
this.isVisible = false;
@@ -919,9 +886,6 @@
if (this.invokeEvent("expand", element, e))
{
- var iframe=null;
- if (Richfaces.browser.isIE6) iframe = $(this.IFRAME_ID);
-
var base = $(this.POPUP_ID)
var baseInput = base.firstChild;
var baseButton = baseInput.nextSibling;
@@ -955,15 +919,6 @@
Richfaces.Calendar.setElementPosition(element, o, this.params.jointPoint, this.params.direction, this.popupOffset);
- if (iframe)
- {
- iframe.style.left = element.style.left;
- iframe.style.top = element.style.top;
- var edim = Richfaces.Calendar.getOffsetDimensions(element);
- iframe.style.width = edim.width+'px';
- iframe.style.height = edim.height+'px';
- Element.show(iframe);
- }
Element.show(element);
this.isVisible = true;
@@ -1466,16 +1421,6 @@
//alert(new Date().getTime()-_d.getTime());
- // hack for IE 6.0 //fix 1072 // TODO check this bug again
- /*if (Richfaces.browser.isIE6)
- {
- var element = $(this.id);
- if (element)
- {
- element.style.width = "0px";
- element.style.height = "0px";
- }
- }*/
},
renderHF: function()
@@ -1504,13 +1449,22 @@
var e = $(elementId);
if (!e) return;
- e.innerHTML = markup.invoke('getContent', context).join('');
+ e.innerHTML = evaluateMarkup(markup, context);
},
evaluateMarkup: function(markup, context)
{
if (!markup) return "";
- return markup.invoke('getContent', context).join('');
+
+ var result = [];
+ var m;
+ for (var i=0; i<markup.length; i++) {
+ m = markup[i]['getContent'];
+ if (m) {
+ result.push(m(context));
+ }
+ }
+ return result.join('');
},
onUpdate: function()
Modified: sandbox/trunk/prototypes/calendar/test.html
===================================================================
--- sandbox/trunk/prototypes/calendar/test.html 2010-10-08 15:21:01 UTC (rev 19507)
+++ sandbox/trunk/prototypes/calendar/test.html 2010-10-08 15:48:10 UTC (rev 19508)
@@ -18,6 +18,17 @@
<body style="margin : 30px">
<form id="myForm">
+<div id="j_id354:calendar"><span id="j_id354:j_id355Popup"><input class="rich-calendar-input " id="j_id354:j_id355InputDate" name="j_id354:j_id355InputDate" style="vertical-align: middle; " type="text" readonly="readonly" /><img alt="" class="rich-calendar-button " id="j_id354:j_id355PopupButton" style="vertical-align: middle" src="/richfaces-demo/a4j/g/3_3_3.Finalorg.richfaces.renderkit.html.iconimages.CalendarIcon/DATB/eAH7cW0fw6znAA8XBA4_.jsf" /><input autocomplete="off" id="j_id354:j_id355InputCurrentDate" name="j_id354:j_id355InputCurrentDate" style="display:none" type="hidden" value="10/2010" /><style type="text/css">
+<![CDATA[
+.j_id354_j_id355DayCell{width:24px;height:22px;}
+]]>
+</style></span><div id="j_id354:j_id355" style="display: none;"></div><div id="j_id354:j_id355Script" style="display: none;"><script type="text/javascript">
+//<![CDATA[
+RichFaces.ui.Calendar.addLocale('en_US', {'weekDayLabels':['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'] ,'weekDayLabelsShort':['Sun','Mon','Tue','Wed','Thu','Fri','Sat'] ,'monthLabels':['January','February','March','April','May','June','July','August','September','October','November','December'] ,'monthLabelsShort':['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'] ,'minDaysInFirstWeek':1,'firstWeekDay':0} );
+new RichFaces.ui.Calendar('j_id354:j_id355',
+ "en_US",{'showApplyButton':true,'style':'z\x2Dindex: 3; width:200px','currentDate':new Date(2010,9,8),'datePattern':'d/M/yy HH:mm','dayCellClass':'j_id354_j_id355DayCell'} ,{} ).load();
+//]]>
+</script></div></div>
</form>
</body>
<html>
\ No newline at end of file
13 years, 11 months
JBoss Rich Faces SVN: r19507 - in trunk/ui/input/ui/src/main: templates and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-10-08 11:21:01 -0400 (Fri, 08 Oct 2010)
New Revision: 19507
Modified:
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.ecss
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.ecss
trunk/ui/input/ui/src/main/templates/inplaceSelect.template.xml
Log:
fix button background gradients
Modified: trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.ecss
===================================================================
--- trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.ecss 2010-10-08 15:03:43 UTC (rev 19506)
+++ trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.ecss 2010-10-08 15:21:01 UTC (rev 19507)
@@ -64,7 +64,7 @@
}
.rf-ii-btn {
- background-image : "url(#{resource['org.richfaces.renderkit.html.images.InplaceComponentButtonGradientImage']})";
+ background-image : url("#{resource['org.richfaces.images:inplaceBtnGrad.png']}");
background-attachment: scroll;
background-position: center top;
background-repeat: repeat-x;
@@ -77,7 +77,7 @@
}
.rf-ii-btn-p {
- background-image : "url(#{resource['org.richfaces.renderkit.html.images.InplaceComponentPressButtonGradientImage']})";
+ background-image : url("#{resource['org.richfaces.images:inplaceBtnPressGrad.png']}");
background-position: top;
background-repeat: repeat-x;
background-color: '#{richSkin.tabBackgroundColor}';
Modified: trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.ecss
===================================================================
--- trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.ecss 2010-10-08 15:03:43 UTC (rev 19506)
+++ trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.ecss 2010-10-08 15:21:01 UTC (rev 19507)
@@ -61,7 +61,7 @@
}
.rf-is-btn {
- background-image : "url(#{resource['org.richfaces.renderkit.html.images.InplaceComponentButtonGradientImage']})";
+ background-image : url("#{resource['org.richfaces.images:inplaceBtnGrad.png']}");
background-position : top;
background-repeat: repeat-x;
background-color: '#{richSkin.tabBackgroundColor}';
@@ -73,7 +73,7 @@
}
.rf-is-btn-p {
- background-image : "url(#{resource['org.richfaces.renderkit.html.images.InplaceComponentPressButtonGradientImage']})";
+ background-image : url("#{resource['org.richfaces.images:inplaceBtnPressGrad.png']}");
background-position : top;
background-repeat : repeat-x;
background-color : '#{richSkin.tabBackgroundColor}';
Modified: trunk/ui/input/ui/src/main/templates/inplaceSelect.template.xml
===================================================================
--- trunk/ui/input/ui/src/main/templates/inplaceSelect.template.xml 2010-10-08 15:03:43 UTC (rev 19506)
+++ trunk/ui/input/ui/src/main/templates/inplaceSelect.template.xml 2010-10-08 15:21:01 UTC (rev 19507)
@@ -67,11 +67,11 @@
<input type="image" id="#{clientId}:okbtn"
src="#{getResourcePath(facesContext, 'org.richfaces/ico_ok.gif')}"
class="rf-is-btn" onmousedown="this.className='rf-is-btn-press'"
- onmouseout="this.className='rf-is-btn-press'" onmouseup="this.className='rf-is-btn'" />
+ onmouseout="this.className='rf-is-btn'" onmouseup="this.className='rf-is-btn'" />
<input type="image" id="#{clientId}:cancelbtn"
src="#{getResourcePath(facesContext,'org.richfaces/ico_cancel.gif')}"
class="rf-is-btn" onmousedown="this.className='rf-is-btn-press'"
- onmouseout="this.className='rf-is-btn-press'" onmouseup="this.className='rf-is-btn'" />
+ onmouseout="this.className='rf-is-btn'" onmouseup="this.className='rf-is-btn'" />
<br />
</span>
</span>
13 years, 11 months
JBoss Rich Faces SVN: r19506 - in trunk/ui/input/ui/src: main/resources/META-INF/resources/org.richfaces and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-10-08 11:03:43 -0400 (Fri, 08 Oct 2010)
New Revision: 19506
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.ecss
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.ecss
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js
trunk/ui/input/ui/src/main/templates/inplaceInput.template.xml
trunk/ui/input/ui/src/main/templates/inplaceSelect.template.xml
trunk/ui/input/ui/src/test/java/org/richfaces/renderkit/InplaceInputRendererTest.java
Log:
rename css according richfaces css names convention
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java 2010-10-08 14:29:46 UTC (rev 19505)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java 2010-10-08 15:03:43 UTC (rev 19506)
@@ -120,8 +120,8 @@
@Override
public void addToOptions(FacesContext facesContext, UIComponent component,
Map<String, Object> options, Object additional) {
- options.put(OPTIONS_ITEM_CLASS, "insel_option");
- options.put(OPTIONS_SELECT_ITEM_CLASS, "insel_select");
+ options.put(OPTIONS_ITEM_CLASS, "rf-is-opt");
+ options.put(OPTIONS_SELECT_ITEM_CLASS, "rf-is-sel");
String clientId = component.getClientId(facesContext);
options.put(OPTIONS_LIST_CORD, clientId + "List");
options.put(OPTIONS_ITEMS_CORD, clientId + "Items");
@@ -192,15 +192,15 @@
}
public String getReadyStateCss() {
- return "insel_default_state";
+ return "rf-is-d-s";
}
public String getEditStateCss() {
- return "insel_edit_state";
+ return "rf-is-e-s";
}
public String getChangedStateCss() {
- return "insel_changed_state";
+ return "rf-is-c-s";
}
public String getNoneCss() {
@@ -208,7 +208,7 @@
}
public String getOptionCss() {
- return "insel_option insel_font";
+ return "rf-is-opt rf-is-fnt";
}
}
Modified: trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.ecss
===================================================================
--- trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.ecss 2010-10-08 14:29:46 UTC (rev 19505)
+++ trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.ecss 2010-10-08 15:03:43 UTC (rev 19506)
@@ -1,4 +1,4 @@
-input.rf-ii-f {
+input.rf-ii-fld {
background-image: none;
background-color : '#{richSkin.editBackgroundColor}';
/*TODO: seems these styles are incorrect*/
@@ -46,7 +46,7 @@
width: 100%;
}
-.rf-ii-f {
+.rf-ii-fld {
background-color : '#{richSkin.editBackgroundColor}';
border-bottom-width : 10px;
border-bottom-style: solid;
@@ -110,7 +110,7 @@
white-space : nowrap;
}
-.rf-ii-btn-shadow {
+.rf-ii-btn-shdw {
display: inline-block;
position: relative;
padding : 6px 6px 6px 6px;
@@ -118,7 +118,7 @@
right : -6px;
}
-.rf-ii-btn-shadow-t {
+.rf-ii-btn-shdw-t {
background-position : left top;
background-image : url("#{resource['org.richfaces:bg_shadow.png']}");
background-attachment: scroll;
@@ -131,7 +131,7 @@
left : 0px
}
-.rf-ii-btn-shadow-l {
+.rf-ii-btn-shdw-l {
background-position : left bottom;
background-image : url("#{resource['org.richfaces:bg_shadow.png']}");
background-attachment: scroll;
@@ -144,7 +144,7 @@
right : 6px;
}
-.rf-ii-btn-shadow-r {
+.rf-ii-btn-shdw-r {
background-position : right bottom;
background-image : url("#{resource['org.richfaces:bg_shadow.png']}");
background-attachment: scroll;
@@ -157,7 +157,7 @@
right: 0px;
}
-.rf-ii-btn-shadow-b {
+.rf-ii-btn-shdw-b {
background-position : right top;
background-image : url("#{resource['org.richfaces:bg_shadow.png']}");
background-attachment: scroll;
Modified: trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.ecss
===================================================================
--- trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.ecss 2010-10-08 14:29:46 UTC (rev 19505)
+++ trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.ecss 2010-10-08 15:03:43 UTC (rev 19506)
@@ -1,4 +1,4 @@
-input.insel_field {
+input.rf-is-fld {
background : '#{richSkin.editBackgroundColor}';
padding : 0px 0px 0px 0px;
border : 0px;
@@ -12,13 +12,17 @@
}
.rf-is-none {
- clip:rect(0px, 0px, 1px, 1px);
+ clip: "rect(0px 0px 1px 1px)";
}
-.insel_font {
+.rf-is-none {
+ clip: rect(0px, 0px, 1px, 1px);
}
-.insel_default_state {
+.rf-is-fnt {
+}
+
+.rf-is-d-s {
display : inline-block;
position : relative;
white-space : nowrap;
@@ -30,14 +34,14 @@
padding-right : 3px;
}
-.insel_changed_state {
+.rf-is-c-s {
display : inline-block;
background-image : "url(#{resource['org.richfaces:mark_changed.gif']})";
background-position : top left;
background-repeat : no-repeat;
}
-.insel_edit_state{
+.rf-is-e-s {
position : absolute;
top : 0px;
left : 0px;
@@ -45,7 +49,7 @@
background-color : '#{richSkin.editBackgroundColor}';
}
-.insel_field {
+.rf-is-fld {
background-color : '#{richSkin.editBackgroundColor}';
padding : 0px 0px 0px 0px;
border : 0px;
@@ -56,7 +60,7 @@
background-repeat : no-repeat;
}
-.insel_btn {
+.rf-is-btn {
background-image : "url(#{resource['org.richfaces.renderkit.html.images.InplaceComponentButtonGradientImage']})";
background-position : top;
background-repeat: repeat-x;
@@ -68,7 +72,7 @@
margin : 0px;
}
-.insel_btn_press {
+.rf-is-btn-p {
background-image : "url(#{resource['org.richfaces.renderkit.html.images.InplaceComponentPressButtonGradientImage']})";
background-position : top;
background-repeat : repeat-x;
@@ -80,14 +84,14 @@
margin : 0px;
}
-.insel_btn_set {
+.rf-is-btn-set {
position : absolute;
top : 0px;
left : 112px;
white-space : nowrap;
}
-.insel_list_cord {
+.rf-is-lst-cord {
display : block;
/*font-size : 0px;*/
position : relative;
@@ -95,14 +99,14 @@
font-size : inherit;
}
-.insel_list_position {
+.rf-is-lst-pos {
display : block;
position : absolute;
top: 0px;
left: -1px;
}
-.insel_list_decoration {
+.rf-is-lst-dec {
display : block;
border-width : 1px;
border-style : solid;
@@ -112,14 +116,14 @@
background-color : '#{richSkin.editBackgroundColor}';
}
-.insel_list_scroll {
+.rf-is-lst-scrl {
display : block;
overflow : auto;
overflow-x : hidden;
/*height : 100px;*/
}
-.insel_option {
+.rf-is-opt {
display : block;
padding : 2px;
white-space : nowrap;
@@ -127,7 +131,7 @@
cursor : default;
}
-.insel_select {
+.rf-is-sel {
display : block;
padding : 1px;
background-color: #DFE8F6; /*get from skin???*/
@@ -136,7 +140,7 @@
border-color : '#{richSkin.generalTextColor}';
}
-.insel_btn_preposition {
+.rf-is-btn-prepos {
display : block;
position : absolute;
top : -4px;
@@ -145,7 +149,7 @@
height : 1px;
}
-.insel_btn_position {
+.rf-is-btn-pos {
display : block;
position : absolute;
top : 0px;
@@ -153,7 +157,7 @@
white-space : nowrap;
}
-.insel_btn_shadow {
+.rf-is-btn-shdw {
display : block;
position: relative;
padding : 6px 6px 6px 6px;
@@ -161,7 +165,7 @@
right : -6px;
}
-.insel_shadow {
+.rf-is-shdw {
display : block;
position: relative;
padding : 6px 6px 6px 6px;
@@ -169,7 +173,7 @@
left : -6px;
}
-.insel_shadow_t {
+.rf-is-shdw-t {
display : block;
background-image : "url(#{resource['org.richfaces:bg_shadow.png']})";
background-position : top left;
@@ -180,7 +184,7 @@
left : 0px
}
-.insel_shadow_l {
+.rf-is-shdw-l {
display : block;
background-image : "url(#{resource['org.richfaces:bg_shadow.png']})";
background-position : bottom left;
@@ -191,7 +195,7 @@
right : 6px;
}
-.insel_shadow_r {
+.rf-is-shdw-r {
display : block;
background : "url(#{resource['org.richfaces:bg_shadow.png']})";
background-position : bottom right;
@@ -202,7 +206,7 @@
right : 0px;
}
-.insel_shadow_b {
+.rf-is-shdw-b {
display : block;
background : "url(#{resource['org.richfaces:bg_shadow.png']})";
background-position : right top;
Modified: trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js
===================================================================
--- trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js 2010-10-08 14:29:46 UTC (rev 19505)
+++ trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js 2010-10-08 15:03:43 UTC (rev 19506)
@@ -89,7 +89,7 @@
},
__isPopupList: function(target) {
- var parentId = target.parents(".insel_list_cord").attr("id");
+ var parentId = target.parents(".rf-is-lst-cord").attr("id");
return (parentId && (parentId == this.select.__getId()));
}
}
Modified: trunk/ui/input/ui/src/main/templates/inplaceInput.template.xml
===================================================================
--- trunk/ui/input/ui/src/main/templates/inplaceInput.template.xml 2010-10-08 14:29:46 UTC (rev 19505)
+++ trunk/ui/input/ui/src/main/templates/inplaceInput.template.xml 2010-10-08 15:03:43 UTC (rev 19506)
@@ -49,17 +49,17 @@
<input id="#{clientId}:focus" type="image" style="position: absolute; top: 0px; left: 0px; outline-style: none;" class="rf-ii-none"/>
<span id="#{clientId}:edit" class="#{getEditStyleClass(component, inplaceState)}">
<input id="#{clientId}:input" autocomplete="off" name="#{clientId}"
- type="text" value="#{getInputValue(facesContext, component)}" class="rf-ii-f" style="width: #{component.attributes['inputWidth']};" cdk:passThrough="tabIndex">
+ type="text" value="#{getInputValue(facesContext, component)}" class="rf-ii-fld" style="width: #{component.attributes['inputWidth']};" cdk:passThrough="tabIndex">
<cdk:call expression="renderInputHandlers(facesContext, component);"/>
</input>
<c:if test="#{component.attributes['showControls']}">
<span class="rf-ii-btn-prepos">
<span class="rf-ii-btn-pos">
<span id="#{clientId}:btnshadow" class="rf-ii-btn-shadow">
- <span class="rf-ii-btn-shadow-t"></span>
- <span class="rf-ii-btn-shadow-l"></span>
- <span class="rf-ii-btn-shadow-r"></span>
- <span class="rf-ii-btn-shadow-b"></span>
+ <span class="rf-ii-btn-shdw-t"></span>
+ <span class="rf-ii-btn-shdw-l"></span>
+ <span class="rf-ii-btn-shdw-r"></span>
+ <span class="rf-ii-btn-shdw-b"></span>
<span id="#{clientId}:btn" style="position : relative">
<input type="image"
Modified: trunk/ui/input/ui/src/main/templates/inplaceSelect.template.xml
===================================================================
--- trunk/ui/input/ui/src/main/templates/inplaceSelect.template.xml 2010-10-08 14:29:46 UTC (rev 19505)
+++ trunk/ui/input/ui/src/main/templates/inplaceSelect.template.xml 2010-10-08 15:03:43 UTC (rev 19506)
@@ -50,48 +50,47 @@
<input id="#{clientId}selValue" name="#{clientId}" type="hidden" value="#{getValue(facesContext, component)}"/>
<input id="#{clientId}:input" autocomplete="off"
type="text" value="#{getSelectInputLabel(facesContext, component)}"
- class="insel_field" style="width: #{component.attributes['inputWidth']};" readonly="readonly"
+ class="rf-is-fld" style="width: #{component.attributes['inputWidth']};" readonly="readonly"
cdk:passThrough="tabIndex">
<cdk:call expression="renderInputHandlers(facesContext, component);" />
</input>
<c:if test="#{component.attributes['showControls']}">
- <span class="insel_btn_preposition">
- <span class="insel_btn_position">
- <span id="#{clientId}:btnshadow" class="insel_shadow">
- <span class="insel_shadow_t"></span>
- <span class="insel_shadow_l"></span>
- <span class="insel_shadow_r"></span>
- <span class="insel_shadow_b"></span>
+ <span class="rf-is-btn-prepos">
+ <span class="rf-is-btn-pos">
+ <span id="#{clientId}:btnshadow" class="rf-is-shdw">
+ <span class="rf-is-shdw-t"></span>
+ <span class="rf-is-shdw-l"></span>
+ <span class="rf-is-shdw-r"></span>
+ <span class="rf-is-shdw-b"></span>
<span id="#{clientId}:btn" style="position : relative;">
<input type="image" id="#{clientId}:okbtn"
src="#{getResourcePath(facesContext, 'org.richfaces/ico_ok.gif')}"
- class="insel_btn" onmousedown="this.className='insel_btn_press'"
- onmouseout="this.className='insel_btn_press'" onmouseup="this.className='insel_btn'" />
+ class="rf-is-btn" onmousedown="this.className='rf-is-btn-press'"
+ onmouseout="this.className='rf-is-btn-press'" onmouseup="this.className='rf-is-btn'" />
<input type="image" id="#{clientId}:cancelbtn"
src="#{getResourcePath(facesContext,'org.richfaces/ico_cancel.gif')}"
- class="insel_btn" onmousedown="this.className='insel_btn_press'"
- onmouseout="this.className='insel_btn_press'" onmouseup="this.className='insel_btn'" />
+ class="rf-is-btn" onmousedown="this.className='rf-is-btn-press'"
+ onmouseout="this.className='rf-is-btn-press'" onmouseup="this.className='rf-is-btn'" />
<br />
</span>
</span>
</span>
</span>
</c:if>
- <span id="#{clientId}List" class="rf-is-none insel_list_cord">
- <span class="insel_list_position" style="width: #{component.attributes['listWidth']}">
- <span class="insel_shadow">
- <span class="insel_shadow_t"></span>
- <span class="insel_shadow_l"></span>
- <span class="insel_shadow_r"></span>
- <span class="insel_shadow_b"></span>
- <span class="insel_list_decoration">
- <span class="insel_list_scroll" id="#{clientId}Items" style="height: #{component.attributes['listHeight']}">
+ <span id="#{clientId}List" class="rf-is-none rf-is-lst-cord">
+ <span class="rf-is-lst-pos" style="width: #{component.attributes['listWidth']}">
+ <span class="rf-is-shdw">
+ <span class="rf-is-shdw-t"></span>
+ <span class="rf-is-shdw-l"></span>
+ <span class="rf-is-shdw-r"></span>
+ <span class="rf-is-shdw-b"></span>
+ <span class="rf-is-lst-dec">
+ <span class="rf-is-lst-scrl" id="#{clientId}Items" style="height: #{component.attributes['listHeight']}">
<cdk:call expression="encodeOptions(facesContext, component, clientSelectItems);"/>
</span>
</span>
</span>
-
</span>
</span>
</span>
Modified: trunk/ui/input/ui/src/test/java/org/richfaces/renderkit/InplaceInputRendererTest.java
===================================================================
--- trunk/ui/input/ui/src/test/java/org/richfaces/renderkit/InplaceInputRendererTest.java 2010-10-08 14:29:46 UTC (rev 19505)
+++ trunk/ui/input/ui/src/test/java/org/richfaces/renderkit/InplaceInputRendererTest.java 2010-10-08 15:03:43 UTC (rev 19506)
@@ -73,7 +73,7 @@
HtmlElement input = (HtmlElement)edit.getFirstChild();
assertEquals("input", input.getNodeName());
- assertEquals("rf-ii-f", input.getAttribute(HtmlConstants.CLASS_ATTRIBUTE));
+ assertEquals("rf-ii-fld", input.getAttribute(HtmlConstants.CLASS_ATTRIBUTE));
assertEquals(text.getNodeValue(), input.getAttribute(HtmlConstants.VALUE_ATTRIBUTE));
List<?> buttons = page.getByXPath("//*[@id = 'form:input_default:btn']");
@@ -101,7 +101,7 @@
HtmlElement input = (HtmlElement)edit.getFirstChild();
assertEquals("input", input.getNodeName());
- assertEquals("rf-ii-f", input.getAttribute(HtmlConstants.CLASS_ATTRIBUTE));
+ assertEquals("rf-ii-fld", input.getAttribute(HtmlConstants.CLASS_ATTRIBUTE));
assertEquals(text.getNodeValue(), input.getAttribute(HtmlConstants.VALUE_ATTRIBUTE));
HtmlElement button = page.getFirstByXPath("//*[@id = 'form:input_edit:btn']");
13 years, 11 months