JBoss Rich Faces SVN: r15305 - root/framework/trunk/api/src/main/java/org/ajax4jsf/component.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2009-08-25 17:18:02 -0400 (Tue, 25 Aug 2009)
New Revision: 15305
Modified:
root/framework/trunk/api/src/main/java/org/ajax4jsf/component/AjaxClientBehavior.java
Log:
add methods
Modified: root/framework/trunk/api/src/main/java/org/ajax4jsf/component/AjaxClientBehavior.java
===================================================================
--- root/framework/trunk/api/src/main/java/org/ajax4jsf/component/AjaxClientBehavior.java 2009-08-25 21:11:15 UTC (rev 15304)
+++ root/framework/trunk/api/src/main/java/org/ajax4jsf/component/AjaxClientBehavior.java 2009-08-25 21:18:02 UTC (rev 15305)
@@ -1,4 +1,4 @@
- package org.ajax4jsf.component;
+package org.ajax4jsf.component;
import java.util.Collection;
@@ -39,4 +39,24 @@
public void setSimilarityGroupingId(String similarityGroupingId);
+ public String getOnevent();
+
+ public void setOnevent(String onevent);
+
+ public String getOnerror();
+
+ public void setOnerror(String onerror);
+
+ public String getOncomplete();
+
+ public void setOncomplete(String oncomplete);
+
+ public String getOnbegin();
+
+ public void setOnbegin(String onbegin);
+
+ public String getOnBeforeDomUpdate();
+
+ public void setOnBeforeDomUpdate(String onbeforedomupdate);
+
}
15 years, 4 months
JBoss Rich Faces SVN: r15304 - root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2009-08-25 17:11:15 -0400 (Tue, 25 Aug 2009)
New Revision: 15304
Modified:
root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/AjaxRendererUtils.java
Log:
Modified: root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/AjaxRendererUtils.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/AjaxRendererUtils.java 2009-08-25 21:10:30 UTC (rev 15303)
+++ root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/AjaxRendererUtils.java 2009-08-25 21:11:15 UTC (rev 15304)
@@ -288,6 +288,29 @@
}
}
+ public static <A,T> AjaxEventOptions buildEventOptions(T t , CommonAttributesAccessor<A, T> accessor) {
+
+ AjaxEventOptions ajaxEventOptions = new AjaxEventOptions();
+ String ajaxStatusName = accessor.getStatusId(t);
+ if(ajaxStatusName != null && ajaxStatusName.trim().length() != 0) {
+ ajaxEventOptions.set(STATUS_ATTR_NAME, ajaxStatusName);
+ }
+
+ Map<String, Object> parameters = ajaxEventOptions.getParameters();
+ A context = accessor.getContext();
+
+ if(context instanceof ClientBehaviorContext) {
+ UIComponent parent = ((ClientBehaviorContext) context).getComponent();
+ FacesContext facesContext = ((ClientBehaviorContext) context).getFacesContext();
+ appendParameters(facesContext, parent, parameters);
+ } else if(context instanceof FacesContext){
+ FacesContext facesContext = (FacesContext)context;
+ appendParameters(facesContext, (UIComponent)t, parameters);
+ }
+
+ return ajaxEventOptions;
+ }
+
private static enum EventOptionsData {
begin {
@Override
@@ -322,7 +345,7 @@
if (ajaxStatusName != null && ajaxStatusName.length() != 0) {
ajaxEventOptions.set(STATUS_ATTR_NAME, ajaxStatusName);
}
-
+
Map<String, Object> parametersMap = new LinkedHashMap<String, Object>();
appendParameters(facesContext, component, parametersMap);
ajaxEventOptions.getParameters().putAll(parametersMap);
15 years, 4 months
JBoss Rich Faces SVN: r15303 - root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2009-08-25 17:10:30 -0400 (Tue, 25 Aug 2009)
New Revision: 15303
Added:
root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/CommonAtributesAccessorImpl.java
root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/CommonAttributesAccessor.java
Log:
accessor
Added: root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/CommonAtributesAccessorImpl.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/CommonAtributesAccessorImpl.java (rev 0)
+++ root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/CommonAtributesAccessorImpl.java 2009-08-25 21:10:30 UTC (rev 15303)
@@ -0,0 +1,103 @@
+package org.ajax4jsf.renderkit;
+
+import javax.faces.component.UIComponent;
+
+import org.ajax4jsf.component.AjaxClientBehavior;
+
+
+/**
+ * @author Anton Belevich
+ *
+ * @param <T>
+ * accessor implementation for the component/behavior common attributes
+ */
+public class CommonAtributesAccessorImpl <A,T> implements CommonAttributesAccessor<A,T> {
+
+ private A wrappedContext;
+
+ public enum types {
+ component, behavior;
+
+ public static types type(Object obj) {
+ if (obj instanceof UIComponent) {
+ return component;
+ } else if(obj instanceof AjaxClientBehavior) {
+ return behavior;
+ } else {
+ return null;
+ }
+ }
+ }
+
+ public CommonAtributesAccessorImpl(A wrappedContext) {
+ this.wrappedContext = wrappedContext;
+ }
+
+ public String getOnBeforeDomUpdate(T t) {
+ switch (types.type(t)) {
+ case component: return getComponentOnBeforeDomUpdate((UIComponent)t);
+ case behavior: return getBehaviorOnBeforeDomUpdate((AjaxClientBehavior)t);
+ default: return null;
+ }
+ }
+
+ public String getOnBegin(T t) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getOnComplete(T t) {
+ switch (types.type(t)) {
+ case component: return getComponentOnComplete((UIComponent)t);
+ case behavior: return getBehaviorOnComplete((AjaxClientBehavior)t);
+ default: return null;
+ }
+ }
+
+ public String getOnError(T t) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getOnEvent(T t) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getStatusId(T t) {
+ switch (types.type(t)) {
+ case component: return getComponentAjaxStatus((UIComponent)t);
+ case behavior: return getBehaviorAjaxStatus((AjaxClientBehavior)t);
+ default: return null;
+ }
+ }
+
+ private String getComponentAjaxStatus(UIComponent component) {
+ return AjaxRendererUtils.getAjaxStatus(component);
+ }
+
+ private String getBehaviorAjaxStatus(AjaxClientBehavior behavior) {
+ return behavior.getStatusId();
+ }
+
+ private String getComponentOnComplete(UIComponent component) {
+ return AjaxRendererUtils.getAjaxOncomplete(component);
+ }
+
+ private String getBehaviorOnComplete(AjaxClientBehavior behavior) {
+ return behavior.getOncomplete();
+ }
+
+ private String getComponentOnBeforeDomUpdate(UIComponent component) {
+ return AjaxRendererUtils.getAjaxOnBeforeDomUpdate(component);
+ }
+
+ private String getBehaviorOnBeforeDomUpdate(AjaxClientBehavior behavior) {
+ return behavior.getOnBeforeDomUpdate();
+ }
+
+ public A getContext() {
+ return wrappedContext;
+ }
+
+}
Added: root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/CommonAttributesAccessor.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/CommonAttributesAccessor.java (rev 0)
+++ root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/CommonAttributesAccessor.java 2009-08-25 21:10:30 UTC (rev 15303)
@@ -0,0 +1,28 @@
+package org.ajax4jsf.renderkit;
+
+
+/**
+ * @author Anton Belevich
+ *
+ * @param <A>
+ * @param <T>
+ *
+ * interface for accessors implementation
+ */
+public interface CommonAttributesAccessor <A,T> {
+
+ public String getOnComplete(T t);
+
+ public String getOnError(T t);
+
+ public String getOnBegin(T t);
+
+ public String getOnBeforeDomUpdate(T t);
+
+ public String getOnEvent(T t);
+
+ public String getStatusId(T t);
+
+ public A getContext();
+
+}
15 years, 4 months
JBoss Rich Faces SVN: r15302 - root.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2009-08-25 13:14:38 -0400 (Tue, 25 Aug 2009)
New Revision: 15302
Modified:
root/richfaces-examples.xml
Log:
Update 4.0 ALPHA1 assembler for new structure
https://jira.jboss.org/jira/browse/RF-7745
Modified: root/richfaces-examples.xml
===================================================================
--- root/richfaces-examples.xml 2009-08-25 17:11:40 UTC (rev 15301)
+++ root/richfaces-examples.xml 2009-08-25 17:14:38 UTC (rev 15302)
@@ -21,13 +21,12 @@
<outputDirectoryMapping>${module.artifactId}</outputDirectoryMapping>
<excludeSubModuleDirectories>false</excludeSubModuleDirectories>
<fileSets>
- <fileSet>
- <directory>/</directory>
- <includes>
- <include>**/src/</include>
- <include>**/pom.xml</include>
- </includes>
- </fileSet>
+ <fileSet>
+ <directory>/</directory>
+ <excludes>
+ <exclude>target</exclude>
+ </excludes>
+ </fileSet>
</fileSets>
</sources>
@@ -54,8 +53,8 @@
<fileSet>
<directory>/</directory>
<includes>
- <include>**/src/</include>
- <include>**/pom.xml</include>
+ <include>**/src</include>
+ <include>./pom.xml</include>
</includes>
</fileSet>
</fileSets>
15 years, 4 months
JBoss Rich Faces SVN: r15301 - branches/community/3.3.X/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: atsebro
Date: 2009-08-25 13:11:40 -0400 (Tue, 25 Aug 2009)
New Revision: 15301
Modified:
branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_jQuery.xml
Log:
RF-7756: Rich Miscellaneous component group description review --> rich:jQuery
Modified: branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_jQuery.xml
===================================================================
--- branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_jQuery.xml 2009-08-25 17:11:12 UTC (rev 15300)
+++ branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_jQuery.xml 2009-08-25 17:11:40 UTC (rev 15301)
@@ -109,72 +109,59 @@
</thead>
<tbody>
-
<row>
- <entry>"p[a]"</entry>
+ <entry>p[a]</entry>
<entry>In a document all "p" tags with "a" tag inside are selected</entry>
</row>
-
<row>
- <entry>"ul/li"</entry>
+ <entry>ul/li</entry>
<entry>All "li" elements of unordered "ul" lists are selected </entry>
</row>
-
<row>
- <entry>"p.foo[a]"</entry>
+ <entry>p.foo[a]</entry>
<entry>All "p" tags with "foo" class and inserted "a" tag are selected</entry>
</row>
-
<row>
- <entry>"input[@name=bar]"</entry>
+ <entry>input[@name=bar]</entry>
<entry>All "input" tags with "name" attribute which value is "bar" are selected</entry>
</row>
-
<row>
- <entry>"input[@type=radio][@checked]"</entry>
+ <entry>input[@type=radio][@checked]</entry>
<entry>All "input" tags with attribute "type"="radio" and attribute value = "chekced" are selected</entry>
</row>
-
<row>
- <entry>"p,span,td"</entry>
+ <entry>p,span,td</entry>
<entry>All tag elements "p" or"span" or "td" are selected</entry>
</row>
<row>
- <entry>"p#secret"</entry>
+ <entry>p#secret</entry>
<entry>"p" paragraph element with "id" identification = "secret" is selected</entry>
</row>
-
<row>
- <entry>"p span"</entry>
+ <entry>p span</entry>
<entry>"span" tag is a (direct or non-direct) child of "p" tag. If it's necessary, use "p > span" or "p/span" is selected</entry>
</row>
-
<row>
- <entry>"p[@foo^=bar]"</entry>
+ <entry>p[@foo^=bar]</entry>
<entry>"p" tag containing "foo" attribute with textual value beginning with "bar" word is selected</entry>
</row>
-
<row>
- <entry>"p[@foo$=bar] "</entry>
+ <entry>p[@foo$=bar]</entry>
<entry>"p" tag containing "foo" attribute with textual value ending with "bar" word is selected</entry>
</row>
-
<row>
- <entry>"p[@foo*=bar] "</entry>
+ <entry>p[@foo*=bar]</entry>
<entry>"p" tag with "foo" attribute containing substring "bar" in any place is selected</entry>
</row>
-
<row>
- <entry>"p//span "</entry>
+ <entry>p//span</entry>
<entry>"span" tag that is a (direct or non-direct) child of "p" tag is selected</entry>
</row>
-
<row>
- <entry>"p/../span "</entry>
+ <entry>p/../span</entry>
<entry>"span" tag that is a grandchild of "p" tag is selected</entry>
</row>
-
</tbody>
</tgroup>
</table>
@@ -307,10 +294,17 @@
</section>
<section>
<title>Relevant Resources Links</title>
- <para>More information about jQuery framework and its features you can read in<ulink url="http://jquery.com/">jQuery official documentation</ulink>.</para>
- <para>How to use jQuery with other libraries see also in<ulink url="http://docs.jquery.com/Using_jQuery_with_Other_Libraries">jQuery official documentation</ulink>.</para>
-
- <para> Some additional information about usage of component can be found <ulink url="http://livedemo.exadel.com/richfaces-demo/richfaces/jQuery.jsf?c=jQuery">on its LiveDemo</ulink>. </para>
-
+ <para>
+ Visit the <ulink url="http://livedemo.exadel.com/richfaces-demo/richfaces/jQuery.jsf?c=jQuery">jQuery page</ulink> at RichFaces LiveDemo for examples of component usage and their sources.
+ </para>
+ <para>More information about jQuery framework you can find in<ulink url="http://jquery.com/">jQuery official documentation</ulink>.</para>
+ <para>See also:</para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ "<ulink url="http://docs.jquery.com/Using_jQuery_with_Other_Libraries">Using jQuery with Other Libraries</ulink>" in jQuery official documentation.
+ </para>
+ </listitem>
+ </itemizedlist>
</section>
</section>
15 years, 4 months
JBoss Rich Faces SVN: r15300 - root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces.js.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-08-25 13:11:12 -0400 (Tue, 25 Aug 2009)
New Revision: 15300
Modified:
root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces.js/4_0_0.js
Log:
Unit test fixed
Modified: root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces.js/4_0_0.js
===================================================================
--- root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces.js/4_0_0.js 2009-08-25 16:56:23 UTC (rev 15299)
+++ root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces.js/4_0_0.js 2009-08-25 17:11:12 UTC (rev 15300)
@@ -403,12 +403,12 @@
var eventHandlers;
for (var i = 0; i < AJAX_EVENTS.length; i++) {
- var event = AJAX_EVENTS[i];
- var eventHandlerOption = options[event];
+ var eventName = AJAX_EVENTS[i];
+ var eventHandlerOption = options[eventName];
if (eventHandlerOption) {
eventHandlers = eventHandlers || {};
- eventHandlers[event] = new Function('event', eventHandlerOption);
+ eventHandlers[eventName] = new Function('event', eventHandlerOption);
}
}
15 years, 4 months
JBoss Rich Faces SVN: r15299 - branches/community/3.3.X/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: atsebro
Date: 2009-08-25 12:56:23 -0400 (Tue, 25 Aug 2009)
New Revision: 15299
Modified:
branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_jQuery.xml
Log:
RF-7756: Rich Miscellaneous component group description review --> rich:jQuery
Modified: branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_jQuery.xml
===================================================================
--- branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_jQuery.xml 2009-08-25 16:41:21 UTC (rev 15298)
+++ branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_jQuery.xml 2009-08-25 16:56:23 UTC (rev 15299)
@@ -44,21 +44,26 @@
<para>as a JavaScript function that can be invoked from the JavaScript code</para>
</listitem>
</itemizedlist>
+
<para>The mode is chosen with <emphasis>
- <property>"timing"</property>
- </emphasis> attribute that has the following options:</para>
+ <property>"timing"</property></emphasis> attribute that has the following options:</para>
<itemizedlist>
<listitem>
- <para>"immediate" - applying a query immediately</para>
+ <para>
+ <code>immediate</code> — applying a query immediately;
+ </para>
</listitem>
<listitem>
- <para>"onload" - applying a query when a document is loaded</para>
+ <para>
+ <code>onload</code> — applying a query when a document is loaded;
+ </para>
</listitem>
<listitem>
- <para>onJScall - applying a query by invoked JavaScript function defined with the <emphasis>
- <property>"name"</property>
- </emphasis> attribute</para>
+ <para>
+ <code>onJScall</code> — applying a query by invoked JavaScript function defined with the <emphasis><property>"name"</property></emphasis> attribute.
+ </para>
</listitem>
+
</itemizedlist>
<para>Definition of the <emphasis>
<property>"name"</property>
@@ -75,9 +80,7 @@
<property>"query"</property>
</emphasis>attribute.</para>
<para>Here is an example of how to highlight odd rows in a table:</para>
- <para>
- <emphasis role="bold">Example:</emphasis>
- </para>
+
<programlisting role="CSS"><style>
.odd {background-color: #FFC;}
</style></programlisting>
15 years, 4 months
JBoss Rich Faces SVN: r15298 - branches/community/3.3.X/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: atsebro
Date: 2009-08-25 12:41:21 -0400 (Tue, 25 Aug 2009)
New Revision: 15298
Modified:
branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_jQuery.xml
Log:
RF-7756: Rich Miscellaneous component group description review --> rich:jQuery
Modified: branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_jQuery.xml
===================================================================
--- branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_jQuery.xml 2009-08-25 16:34:42 UTC (rev 15297)
+++ branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_jQuery.xml 2009-08-25 16:41:21 UTC (rev 15298)
@@ -1,368 +1,313 @@
<section role="NotInToc" id="rich_jQuery">
- <title>
- <
- rich:jQuery
- >
- <emphasis role="since">
- <superscript> available since <emphasis role="version">3.0.0</emphasis>
- </superscript>
- </emphasis>
- </title>
- <section>
- <title>Description</title>
- <para>The <emphasis role="bold">
- <property><rich:jQuery></property>
- </emphasis> allows to apply styles and behaviour to DOM objects.</para>
+ <title> < rich:jQuery > <emphasis role="since">
+ <superscript> available since <emphasis role="version">3.0.0</emphasis>
+ </superscript>
+ </emphasis>
+ </title>
+ <section>
+ <title>Description</title>
+ <para>The <emphasis role="bold">
+ <property><rich:jQuery></property>
+ </emphasis> allows to apply styles and behaviour to DOM objects.</para>
- <!--mediaobject>
+ <!--mediaobject>
<imageobject>
<imagedata fileref="images/jQuery.png"/>
</imageobject>
</mediaobject-->
- </section>
- <section>
- <title>Key Features</title>
- <itemizedlist>
- <listitem>
- <para>Presents jQuery JavaScript framework functionality</para>
- </listitem>
- <listitem>
- <para>Able to apply onto JSF components and other DOM objects.</para>
- </listitem>
- <listitem>
- <para>Works without conflicts with prototype.js library</para>
- </listitem>
- </itemizedlist>
- </section>
- <section>
- <title>Details of Usage</title>
- <para>
- <emphasis role="bold">
- <property><rich:jQuery></property>
- </emphasis> can be used in two main modes:</para>
- <itemizedlist>
- <listitem>
- <para>as a one-time query applied immediately or on a document ready event</para>
- </listitem>
- <listitem>
- <para>as a JavaScript function that can be invoked from the JavaScript code</para>
- </listitem>
- </itemizedlist>
- <para>The mode is chosen with <emphasis>
- <property>"timing"</property>
- </emphasis> attribute that has the following options:</para>
- <itemizedlist>
- <listitem>
- <para>"immediate" - applying a query immediately</para>
- </listitem>
- <listitem>
- <para>"onload" - applying a query when a document is loaded</para>
- </listitem>
- <listitem>
- <para>onJScall - applying a query by invoked JavaScript function defined with the <emphasis>
- <property>"name"</property>
- </emphasis> attribute</para>
- </listitem>
- </itemizedlist>
- <para>Definition of the <emphasis>
- <property>"name"</property>
- </emphasis> attribute is mandatory when the value of <emphasis>
- <property>"timing"</property>
- </emphasis> attribute is "onJScall". If the<emphasis>
- <property>"name"</property>
- </emphasis> attribute is defined when <emphasis>
- <property>"timing"</property>
- </emphasis> value equals to "immediate" or
- "onload", the query is applied according to this
- value, but you still have an opportunity to invoke it by a function name.</para>
- <para>The <emphasis>
- <property>"selector"</property>
- </emphasis> attribute defines an object or a list of objects. The query is defined with the <emphasis>
- <property>"query"</property>
- </emphasis>attribute.</para>
- <para>Here is an example of how to highlight odd rows in a table:</para>
- <para>
- <emphasis role="bold">Example:</emphasis>
- </para>
- <programlisting role="CSS">...
-<style>
- .odd {
- background-color: #FFC;
- }
-</style>
-...</programlisting>
-
- <programlisting role="XML">...
-<rich:table id="customList" ...>
- ...
-</rich:table>
-...
-<rich:jQuery selector="#customList tr:odd" timing="onload" query="addClass(odd)" />
-...</programlisting>
- <para>The <emphasis>
- <property>"selector"</property>
- </emphasis> attribute uses defined by w3c consortium syntax for CSS rule <ulink url="http://www.w3.org/TR/REC-CSS2/selector.html">selector</ulink> with some jQuery
- extensions </para>
- <para>Those are typical examples of using selector in the <emphasis role="bold">
- <property><rich:jQuery></property>
- </emphasis> component.</para>
+ </section>
+ <section>
+ <title>Key Features</title>
+ <itemizedlist>
+ <listitem>
+ <para>Presents jQuery JavaScript framework functionality</para>
+ </listitem>
+ <listitem>
+ <para>Able to apply onto JSF components and other DOM objects.</para>
+ </listitem>
+ <listitem>
+ <para>Works without conflicts with prototype.js library</para>
+ </listitem>
+ </itemizedlist>
+ </section>
+ <section>
+ <title>Details of Usage</title>
+ <para>
+ <emphasis role="bold">
+ <property><rich:jQuery></property>
+ </emphasis> can be used in two main modes:</para>
+ <itemizedlist>
+ <listitem>
+ <para>as a one-time query applied immediately or on a document ready event</para>
+ </listitem>
+ <listitem>
+ <para>as a JavaScript function that can be invoked from the JavaScript code</para>
+ </listitem>
+ </itemizedlist>
+ <para>The mode is chosen with <emphasis>
+ <property>"timing"</property>
+ </emphasis> attribute that has the following options:</para>
+ <itemizedlist>
+ <listitem>
+ <para>"immediate" - applying a query immediately</para>
+ </listitem>
+ <listitem>
+ <para>"onload" - applying a query when a document is loaded</para>
+ </listitem>
+ <listitem>
+ <para>onJScall - applying a query by invoked JavaScript function defined with the <emphasis>
+ <property>"name"</property>
+ </emphasis> attribute</para>
+ </listitem>
+ </itemizedlist>
+ <para>Definition of the <emphasis>
+ <property>"name"</property>
+ </emphasis> attribute is mandatory when the value of <emphasis>
+ <property>"timing"</property>
+ </emphasis> attribute is "onJScall". If the<emphasis>
+ <property>"name"</property>
+ </emphasis> attribute is defined when <emphasis>
+ <property>"timing"</property>
+ </emphasis> value equals to "immediate" or "onload", the query is applied according to this value, but you still have an opportunity to invoke it by a function name.</para>
+ <para>The <emphasis>
+ <property>"selector"</property>
+ </emphasis> attribute defines an object or a list of objects. The query is defined with the <emphasis>
+ <property>"query"</property>
+ </emphasis>attribute.</para>
+ <para>Here is an example of how to highlight odd rows in a table:</para>
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
+ <programlisting role="CSS"><style>
+ .odd {background-color: #FFC;}
+</style></programlisting>
- <table>
- <title>Examples of using selector</title>
+ <programlisting role="XML"><rich:dataTable id="customList" ...>
+ ...
+ </rich:table>
+<rich:jQuery selector="#customList tr:odd" timing="onload" query="addClass(odd)" /></programlisting>
+ <para>The <emphasis>
+ <property>"selector"</property>
+ </emphasis> attribute uses defined by w3c consortium syntax for CSS rule <ulink url="http://www.w3.org/TR/REC-CSS2/selector.html">selector</ulink> with some jQuery extensions </para>
+ <para>Those are typical examples of using selector in the <emphasis role="bold">
+ <property><rich:jQuery></property>
+ </emphasis> component.</para>
- <tgroup cols="2">
- <thead>
- <row>
- <entry>Selector</entry>
+ <table>
+ <title>Examples of using selector</title>
- <entry>Comment</entry>
- </row>
- </thead>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Selector</entry>
- <tbody>
+ <entry>Comment</entry>
+ </row>
+ </thead>
- <row>
- <entry>"p[a]"</entry>
- <entry>In a document all "p" tags with "a" tag
- inside are selected</entry>
- </row>
+ <tbody>
- <row>
- <entry>"ul/li"</entry>
- <entry>All "li" elements of unordered "ul" lists are selected
- </entry>
- </row>
+ <row>
+ <entry>"p[a]"</entry>
+ <entry>In a document all "p" tags with "a" tag inside are selected</entry>
+ </row>
- <row>
- <entry>"p.foo[a]"</entry>
- <entry>All "p" tags with "foo" class and inserted
- "a" tag are selected</entry>
- </row>
+ <row>
+ <entry>"ul/li"</entry>
+ <entry>All "li" elements of unordered "ul" lists are selected </entry>
+ </row>
- <row>
- <entry>"input[@name=bar]"</entry>
- <entry>All "input" tags with "name" attribute which
- value is "bar" are selected</entry>
- </row>
+ <row>
+ <entry>"p.foo[a]"</entry>
+ <entry>All "p" tags with "foo" class and inserted "a" tag are selected</entry>
+ </row>
- <row>
- <entry>"input[@type=radio][@checked]"</entry>
- <entry>All "input" tags with attribute
- "type"="radio" and attribute value =
- "chekced" are selected</entry>
- </row>
+ <row>
+ <entry>"input[@name=bar]"</entry>
+ <entry>All "input" tags with "name" attribute which value is "bar" are selected</entry>
+ </row>
- <row>
- <entry>"p,span,td"</entry>
- <entry>All tag elements "p" or"span" or
- "td" are selected</entry>
- </row>
+ <row>
+ <entry>"input[@type=radio][@checked]"</entry>
+ <entry>All "input" tags with attribute "type"="radio" and attribute value = "chekced" are selected</entry>
+ </row>
- <row>
- <entry>"p#secret"</entry>
- <entry>"p" paragraph element with "id"
- identification = "secret" is selected</entry>
- </row>
+ <row>
+ <entry>"p,span,td"</entry>
+ <entry>All tag elements "p" or"span" or "td" are selected</entry>
+ </row>
- <row>
- <entry>"p span"</entry>
- <entry>"span" tag is a (direct or non-direct) child of
- "p" tag. If it's necessary, use "p >
- span" or "p/span" is selected</entry>
- </row>
+ <row>
+ <entry>"p#secret"</entry>
+ <entry>"p" paragraph element with "id" identification = "secret" is selected</entry>
+ </row>
- <row>
- <entry>"p[@foo^=bar]"</entry>
- <entry>"p" tag containing "foo" attribute with
- textual value beginning with "bar" word is selected</entry>
- </row>
+ <row>
+ <entry>"p span"</entry>
+ <entry>"span" tag is a (direct or non-direct) child of "p" tag. If it's necessary, use "p > span" or "p/span" is selected</entry>
+ </row>
- <row>
- <entry>"p[@foo$=bar] "</entry>
- <entry>"p" tag containing "foo" attribute with
- textual value ending with "bar" word is selected</entry>
- </row>
+ <row>
+ <entry>"p[@foo^=bar]"</entry>
+ <entry>"p" tag containing "foo" attribute with textual value beginning with "bar" word is selected</entry>
+ </row>
- <row>
- <entry>"p[@foo*=bar] "</entry>
- <entry>"p" tag with "foo" attribute containing
- substring "bar" in any place is selected</entry>
- </row>
+ <row>
+ <entry>"p[@foo$=bar] "</entry>
+ <entry>"p" tag containing "foo" attribute with textual value ending with "bar" word is selected</entry>
+ </row>
- <row>
- <entry>"p//span "</entry>
- <entry>"span" tag that is a (direct or non-direct) child of
- "p" tag is selected</entry>
- </row>
+ <row>
+ <entry>"p[@foo*=bar] "</entry>
+ <entry>"p" tag with "foo" attribute containing substring "bar" in any place is selected</entry>
+ </row>
- <row>
- <entry>"p/../span "</entry>
- <entry>"span" tag that is a grandchild of "p" tag is selected</entry>
- </row>
+ <row>
+ <entry>"p//span "</entry>
+ <entry>"span" tag that is a (direct or non-direct) child of "p" tag is selected</entry>
+ </row>
- </tbody>
- </tgroup>
- </table>
+ <row>
+ <entry>"p/../span "</entry>
+ <entry>"span" tag that is a grandchild of "p" tag is selected</entry>
+ </row>
- <para>In addition, RichFaces allows using either a component id or client id if you apply the
- query to a JSF component. When you define a selector, RichFaces examines its content and
- tries to replace the defined in the selector id with a component id if it's found.</para>
- <para>For example, you have the following code:</para>
+ </tbody>
+ </tgroup>
+ </table>
- <programlisting role="XML">...
+ <para>In addition, RichFaces allows using either a component id or client id if you apply the query to a JSF component. When you define a selector, RichFaces examines its content and tries to replace the defined in the selector
+ id with a component id if it's found.</para>
+ <para>For example, you have the following code:</para>
+
+ <programlisting role="XML">
<h:form id="form">
- ...
- <h:panelGrid id="menu">
- <h:graphicImage ... />
- <h:graphicImage ... />
- ...
- </h:panelGrid>
-</h:form>
-...</programlisting>
+ <h:panelGrid id="menu">
+ <h:graphicImage value="pic1.jpg" />
+ <h:graphicImage value="pic2.jpg" />
+ </h:panelGrid>
+</h:form></programlisting>
- <para>The actual id of the <emphasis role="bold">
- <property><h:panelGrid></property>
- </emphasis> table in the browser DOM is <code>"form:menu"</code>. However, you still can
- reference to images inside this table using the following selector: </para>
+ <para>The actual id of the <emphasis role="bold">
+ <property><h:panelGrid></property>
+ </emphasis> table in the browser DOM is <code>"form:menu"</code>. However, you still can reference to images inside this table using the following selector: </para>
- <programlisting role="XML">...
+ <programlisting role="XML">...
<rich:jQuery selector="#menu img" query="..." />
...</programlisting>
- <para>You can define the exact id in the selector if you want. The following code reference to
- the same set of a DOM object:</para>
+ <para>You can define the exact id in the selector if you want. The following code reference to the same set of a DOM object:</para>
- <programlisting role="XML">...
+ <programlisting role="XML">...
<rich:jQuery selector="#form\\:menu img" query="..." />
...</programlisting>
- <para>Pay attention to double slashes that escape a colon in the id.</para>
+ <para>Pay attention to double slashes that escape a colon in the id.</para>
- <para>In case when the <emphasis>
- <property>"name"</property>
- </emphasis> attribute is defined, <emphasis role="bold">
- <property><rich:jQuery></property>
- </emphasis> generates a JavaScript function that might be used from any place of JavaScript
- code on a page.</para>
+ <para>In case when the <emphasis>
+ <property>"name"</property>
+ </emphasis> attribute is defined, <emphasis role="bold">
+ <property><rich:jQuery></property>
+ </emphasis> generates a JavaScript function that might be used from any place of JavaScript code on a page.</para>
- <para>There is an example of how to enlarge the picture smoothly on a mouse over event and return
- back to the normal size on mouse out:</para>
+ <para>There is an example of how to enlarge the picture smoothly on a mouse over event and return back to the normal size on mouse out:</para>
- <programlisting role="XML">...
-<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)" />
+ <programlisting role="XML">...
+<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'})"/>
...</programlisting>
- <para>The JavaScript could use two parameters. The first parameter is a replacement for the
- selector attribute. Thus, you can share the same query, applying it to the different DOM
- objects. You can use a literal value or a direct reference for an existing DOM object. The
- second parameter can be used to path the specific value inside the query. The JSON syntax is
- used for the second parameter. The "param." namespace is used for
- referencing data inside the parameter value.</para>
+ <para>The JavaScript could use two parameters. The first parameter is a replacement for the selector attribute. Thus, you can share the same query, applying it to the different DOM objects. You can use a literal value or a
+ direct reference for an existing DOM object. The second parameter can be used to path the specific value inside the query. The JSON syntax is used for the second parameter. The "param." namespace is used for referencing
+ data inside the parameter value.</para>
- <para>
- <emphasis role="bold">
- <property><rich:jQuery></property>
- </emphasis> adds styles and behavior to the DOM object dynamically. This means if you replace
- something on a page during an Ajax response, the applied artifacts is overwritten. But you
- are allowed to apply them again after the Ajax response is complete.</para>
- <para>Usually, it could be done with reRendering the <emphasis role="bold">
- <property><rich:jQuery></property>
- </emphasis> components in the same Ajax interaction with the components these queries are
- applied to. Note, that queries with <emphasis>
- <property>"timing"</property>
- </emphasis> attribute set to "onload" are not
- invoked even if the query is reRendered, because a DOM document is not fully reloaded during
- the Ajax interaction. If you need to re-applies query with
- "onload" value of <emphasis>
- <property>"timing"</property>
- </emphasis> attribute, define the <emphasis>
- <property>"name"</property>
- </emphasis> attribute and invoke the query by name in the <emphasis>
- <property>"oncomplete"</property>
- </emphasis> attribute of the Ajax component.</para>
+ <para>
+ <emphasis role="bold">
+ <property><rich:jQuery></property>
+ </emphasis> adds styles and behavior to the DOM object dynamically. This means if you replace something on a page during an Ajax response, the applied artifacts is overwritten. But you are allowed to apply them again after
+ the Ajax response is complete.</para>
+ <para>Usually, it could be done with reRendering the <emphasis role="bold">
+ <property><rich:jQuery></property>
+ </emphasis> components in the same Ajax interaction with the components these queries are applied to. Note, that queries with <emphasis>
+ <property>"timing"</property>
+ </emphasis> attribute set to "onload" are not invoked even if the query is reRendered, because a DOM document is not fully reloaded during the Ajax interaction. If you need to re-applies query with "onload" value of <emphasis>
+ <property>"timing"</property>
+ </emphasis> attribute, define the <emphasis>
+ <property>"name"</property>
+ </emphasis> attribute and invoke the query by name in the <emphasis>
+ <property>"oncomplete"</property>
+ </emphasis> attribute of the Ajax component.</para>
- <para>RichFaces includes jQuery JavaScript framework. You can use the futures of jQuery directly
- without defining the <emphasis role="bold">
- <property><rich:jQuery></property>
- </emphasis> component on a page if it is convenient for you. To start using the jQuery feature
- on the page, include the library into a page with the following code:</para>
+ <para>RichFaces includes jQuery JavaScript framework. You can use the futures of jQuery directly without defining the <emphasis role="bold">
+ <property><rich:jQuery></property>
+ </emphasis> component on a page if it is convenient for you. To start using the jQuery feature on the page, include the library into a page with the following code:</para>
- <programlisting role="XML">...
+ <programlisting role="XML">...
<a4j:loadScript src="resource://jquery.js"/>
...</programlisting>
- <para>Refer to the <ulink url="http://docs.jquery.com/">jQuery documentation</ulink> for the
- right syntax. Remember to use <code>jQuery()</code> function instead of <code>$()</code>, as soon as jQuery works
- without conflicts with <code>prototype.js</code>.</para>
- </section>
- <section>
- <title>Reference Data</title>
- <para>
- <ulink url="&tlddoc;rich/jQuery.html">Table of
- <rich:jQuery>
- attributes</ulink>.
- </para>
- <table>
- <title>Component Identification Parameters</title>
+ <para>Refer to the <ulink url="http://docs.jquery.com/">jQuery documentation</ulink> for the right syntax. Remember to use <code>jQuery()</code> function instead of <code>$()</code>, as soon as jQuery works without conflicts
+ with <code>prototype.js</code>.</para>
+ </section>
+ <section>
+ <title>Reference Data</title>
+ <para>
+ <ulink url="&tlddoc;rich/jQuery.html">Table of <rich:jQuery> attributes</ulink>. </para>
+ <table>
+ <title>Component Identification Parameters</title>
- <tgroup cols="2">
- <thead>
- <row>
- <entry>Name</entry>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Name</entry>
- <entry>Value</entry>
- </row>
- </thead>
+ <entry>Value</entry>
+ </row>
+ </thead>
- <tbody>
- <row>
- <entry>component-type</entry>
+ <tbody>
+ <row>
+ <entry>component-type</entry>
- <entry>org.richfaces.JQuery</entry>
- </row>
+ <entry>org.richfaces.JQuery</entry>
+ </row>
- <row>
- <entry>component-class</entry>
+ <row>
+ <entry>component-class</entry>
- <entry>org.richfaces.component.html.HtmlJQuery</entry>
- </row>
+ <entry>org.richfaces.component.html.HtmlJQuery</entry>
+ </row>
- <row>
- <entry>component-family</entry>
+ <row>
+ <entry>component-family</entry>
- <entry>org.richfaces.JQuery</entry>
- </row>
+ <entry>org.richfaces.JQuery</entry>
+ </row>
- <row>
- <entry>renderer-type</entry>
+ <row>
+ <entry>renderer-type</entry>
- <entry>org.richfaces.JQueryRenderer</entry>
- </row>
+ <entry>org.richfaces.JQueryRenderer</entry>
+ </row>
- <row>
- <entry>tag-class</entry>
+ <row>
+ <entry>tag-class</entry>
- <entry>org.richfaces.taglib.JQueryTag</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- </section>
- <section>
- <title>Relevant Resources Links</title>
- <para>More information about jQuery framework and its features you can read in<ulink url="http://jquery.com/">jQuery official documentation</ulink>.</para>
- <para>How to use jQuery with other libraries see also in<ulink url="http://docs.jquery.com/Using_jQuery_with_Other_Libraries">jQuery official documentation</ulink>.</para>
+ <entry>org.richfaces.taglib.JQueryTag</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </section>
+ <section>
+ <title>Relevant Resources Links</title>
+ <para>More information about jQuery framework and its features you can read in<ulink url="http://jquery.com/">jQuery official documentation</ulink>.</para>
+ <para>How to use jQuery with other libraries see also in<ulink url="http://docs.jquery.com/Using_jQuery_with_Other_Libraries">jQuery official documentation</ulink>.</para>
- <para>
- Some additional information about usage of component can be found
- <ulink url="http://livedemo.exadel.com/richfaces-demo/richfaces/jQuery.jsf?c=jQuery">on its LiveDemo</ulink>.
- </para>
-
- </section>
-</section>
\ No newline at end of file
+ <para> Some additional information about usage of component can be found <ulink url="http://livedemo.exadel.com/richfaces-demo/richfaces/jQuery.jsf?c=jQuery">on its LiveDemo</ulink>. </para>
+
+ </section>
+</section>
15 years, 4 months
JBoss Rich Faces SVN: r15297 - in root: framework/trunk/api/src/main/java/org/ajax4jsf/component and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-08-25 12:34:42 -0400 (Tue, 25 Aug 2009)
New Revision: 15297
Modified:
root/examples/trunk/components/core-demo/src/main/webapp/function.xhtml
root/framework/trunk/api/src/main/java/org/ajax4jsf/component/AjaxComponent.java
root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/AjaxRendererUtils.java
root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces-jsf-log.js/4_0_0.js
root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces.js/4_0_0.js
root/ui/trunk/components/core/src/main/java/org/richfaces/component/html/HtmlAjaxFunction.java
Log:
Added begin/beforedomupdate/complete events support
Modified: root/examples/trunk/components/core-demo/src/main/webapp/function.xhtml
===================================================================
--- root/examples/trunk/components/core-demo/src/main/webapp/function.xhtml 2009-08-25 15:54:16 UTC (rev 15296)
+++ root/examples/trunk/components/core-demo/src/main/webapp/function.xhtml 2009-08-25 16:34:42 UTC (rev 15297)
@@ -29,6 +29,10 @@
<f:param name="idsToRender" value="time2" />
</a4j:jsFunction>
+ <a4j:jsFunction name="eventsBoundFunction" status="someStatus" onbegin="alert(event.type + ' begin')" oncomplete="alert(event.type + ' complete')" onbeforedomupdate="alert(event.type + ' beforedomupdate')">
+ <f:ajax event="complete" />
+ </a4j:jsFunction>
+
<h:commandLink value="test">
<f:ajax />
<f:param name="a" value="b" />
@@ -39,6 +43,7 @@
<a href="javascript:testFunction1Limited()">Call test function1 with limitRender=true</a>
<a href="javascript:testFunction2()">Call test function2</a>
<a href="javascript:testFunction2Limited()">Call test function2 with limitRender=true</a>
+ <a href="javascript:eventsBoundFunction()">Call events bound function</a>
<a4j:log />
</h:body>
</f:view>
Modified: root/framework/trunk/api/src/main/java/org/ajax4jsf/component/AjaxComponent.java
===================================================================
--- root/framework/trunk/api/src/main/java/org/ajax4jsf/component/AjaxComponent.java 2009-08-25 15:54:16 UTC (rev 15296)
+++ root/framework/trunk/api/src/main/java/org/ajax4jsf/component/AjaxComponent.java 2009-08-25 16:34:42 UTC (rev 15297)
@@ -90,8 +90,6 @@
*/
public abstract String getOncomplete();
-
-
/**
* @return value or result of valueBinding of Name of JavaScript function, called before updating DOM
*/
@@ -102,6 +100,10 @@
* @param new value of Name of JavaScript function, called before updating DOM to set
*/
public abstract void setOnbeforedomupdate(String beforeUpdate);
+
+ public abstract String getOnbegin();
+
+ public abstract void setOnbegin(String onbegin);
/**
* setter method for property
Modified: root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/AjaxRendererUtils.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/AjaxRendererUtils.java 2009-08-25 15:54:16 UTC (rev 15296)
+++ root/framework/trunk/impl/src/main/java/org/ajax4jsf/renderkit/AjaxRendererUtils.java 2009-08-25 16:34:42 UTC (rev 15297)
@@ -99,6 +99,7 @@
*/
public static final String ONBEFOREDOMUPDATE_ATTR_NAME = "onbeforedomupdate";
+ public static final String ONBEGIN_ATTR_NAME = "onbegin";
/**
* Attribute to keep
@@ -287,6 +288,31 @@
}
}
+ private static enum EventOptionsData {
+ begin {
+ @Override
+ public String getAttributeValue(UIComponent component) {
+ return getAjaxOnBegin(component);
+ }
+ },
+
+ beforedomupdate {
+ @Override
+ public String getAttributeValue(UIComponent component) {
+ return getAjaxOnBeforeDomUpdate(component);
+ }
+ },
+
+ complete {
+ @Override
+ public String getAttributeValue(UIComponent component) {
+ return getAjaxOncomplete(component);
+ }
+ };
+
+ public abstract String getAttributeValue(UIComponent component);
+ }
+
public static AjaxEventOptions buildEventOptions(FacesContext facesContext,
UIComponent component) {
@@ -296,9 +322,40 @@
if (ajaxStatusName != null && ajaxStatusName.length() != 0) {
ajaxEventOptions.set(STATUS_ATTR_NAME, ajaxStatusName);
}
+
+ Map<String, Object> parametersMap = new LinkedHashMap<String, Object>();
+ appendParameters(facesContext, component, parametersMap);
+ ajaxEventOptions.getParameters().putAll(parametersMap);
- appendParameters(facesContext, component, ajaxEventOptions.getParameters());
+ Collection<Parameter> behaviorParametersList = null;
+ Map<String, List<ClientBehavior>> behaviorsMap = Collections.EMPTY_MAP; /* null object */
+
+ if (component instanceof ClientBehaviorHolder) {
+ ClientBehaviorHolder clientBehaviorHolder = (ClientBehaviorHolder) component;
+ behaviorsMap = clientBehaviorHolder.getClientBehaviors();
+ }
+ for (EventOptionsData eventOptionsData : EventOptionsData.values()) {
+ String behaviorName = eventOptionsData.toString();
+ ClientBehaviorContext behaviorContext = null;
+ List<ClientBehavior> behaviorsList = behaviorsMap.get(behaviorName);
+ if (behaviorsList != null) {
+ if (behaviorParametersList == null) {
+ behaviorParametersList = getBehaviorParametersList(facesContext, component, parametersMap);
+ }
+
+ behaviorContext = ClientBehaviorContext.createClientBehaviorContext(facesContext, component,
+ behaviorName, null, behaviorParametersList);
+ }
+
+ String behaviorsChain = createBehaviorsChain(facesContext, eventOptionsData.getAttributeValue(component),
+ behaviorsList, behaviorContext, false);
+
+ if (isNonEmpty(behaviorsChain)) {
+ ajaxEventOptions.set(behaviorName, behaviorsChain);
+ }
+ }
+
return ajaxEventOptions;
}
@@ -727,6 +784,13 @@
return (String) component.getAttributes().get(ONBEFOREDOMUPDATE_ATTR_NAME);
}
+ public static String getAjaxOnBegin(UIComponent component) {
+ if (component instanceof AjaxComponent) {
+ return ((AjaxComponent) component).getOnbegin();
+ }
+
+ return (String) component.getAttributes().get(ONBEGIN_ATTR_NAME);
+ }
/**
* Calculate, must be component render only given areas, or all sended from
@@ -1160,10 +1224,8 @@
return result;
}
- public static Collection<ClientBehaviorContext.Parameter> getBehaviorParametersList(FacesContext context, UIComponent component) {
- Map<String, Object> parametersMap = new LinkedHashMap<String, Object>();
- //TODO: merge to a single method
- appendParameters(context, component, parametersMap);
+ private static Collection<ClientBehaviorContext.Parameter> getBehaviorParametersList(FacesContext context, UIComponent component,
+ Map<String, Object> parametersMap) {
List<Parameter> result = new ArrayList<ClientBehaviorContext.Parameter>(parametersMap.size());
for (Map.Entry<String, Object> entry : parametersMap.entrySet()) {
@@ -1171,4 +1233,12 @@
}
return result;
}
+
+ public static Collection<ClientBehaviorContext.Parameter> getBehaviorParametersList(FacesContext context, UIComponent component) {
+ Map<String, Object> parametersMap = new LinkedHashMap<String, Object>();
+ //TODO: merge to a single method
+ appendParameters(context, component, parametersMap);
+
+ return getBehaviorParametersList(context, component, parametersMap);
+ }
}
Modified: root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces-jsf-log.js/4_0_0.js
===================================================================
--- root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces-jsf-log.js/4_0_0.js 2009-08-25 15:54:16 UTC (rev 15296)
+++ root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces-jsf-log.js/4_0_0.js 2009-08-25 16:34:42 UTC (rev 15297)
@@ -52,17 +52,16 @@
var log = richfaces.log;
var source = data.source;
- var status = data.status;
var type = data.type;
var responseCode = data.responseCode;
var responseXML = data.responseXML;
var responseText = data.responseText;
- if (type == 'event') {
- log.info("Received '" + status + "' event from " + identifyElement(source));
+ if (type != 'error') {
+ log.info("Received '" + type + "' event from " + identifyElement(source));
- if (status == 'complete') {
+ if (type == 'beforedomupdate') {
var partialResponse;
if (responseXML) {
@@ -78,17 +77,26 @@
log.info(responseTextEntry);
}
}
- } else if (type == 'error') {
- log.error("Received '" + status + "' error event from " + identifyElement(source));
+ } else {
+ var status = data.status;
+ log.error("Received '" + type + '@' + status + "' event from " + identifyElement(source));
log.error("[" + data.responseCode + "] " + data.errorName + ": " + data.errorMessage);
}
} catch (e) {
//ignore logging errors
}
};
+
+ var eventsListener = richfaces.createJSFEventsAdapter({
+ begin: jsfAjaxLogAdapter,
+ beforedomupdate: jsfAjaxLogAdapter,
+ success: jsfAjaxLogAdapter,
+ complete: jsfAjaxLogAdapter,
+ error: jsfAjaxLogAdapter
+ });
- jsf.ajax.addOnEvent(jsfAjaxLogAdapter);
- jsf.ajax.addOnError(jsfAjaxLogAdapter);
+ jsf.ajax.addOnEvent(eventsListener);
+ jsf.ajax.addOnError(eventsListener);
//
}(jQuery, RichFaces, jsf));
Modified: root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces.js/4_0_0.js
===================================================================
--- root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces.js/4_0_0.js 2009-08-25 15:54:16 UTC (rev 15296)
+++ root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces.js/4_0_0.js 2009-08-25 16:34:42 UTC (rev 15297)
@@ -310,19 +310,21 @@
var jsfEventsAdapterEventNames = {
event: {
- 'begin': ['onsubmit'],
- 'success': ['onsuccess', 'oncomplete']
+ 'begin': ['begin'],
+ 'complete': ['beforedomupdate'],
+ 'success': ['success', 'complete']
},
- error: ['onerror', 'oncomplete']
+ error: ['error', 'complete']
};
richfaces.createJSFEventsAdapter = function(handlers) {
//hash of handlers
//supported are:
- // - onsubmit
- // - onsuccess
- // - onerror
- // - oncomplete
+ // - begin
+ // - beforedomupdate
+ // - success
+ // - error
+ // - complete
handlers = handlers || {};
return function(eventData) {
@@ -336,9 +338,17 @@
if (handlerNames) {
for (var i = 0; i < handlerNames.length; i++) {
- var handler = handlers[handlerNames[i]];
+ var eventType = handlerNames[i];
+ var handler = handlers[eventType];
if (handler) {
- handler.call(source, eventData);
+ var event = {};
+ jQuery.extend(event, eventData);
+ event.type = eventType;
+ if (type != 'error') {
+ delete event.status;
+ }
+
+ handler.call(source, event);
}
}
}
@@ -358,6 +368,26 @@
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;
+ };
+ }
+ };
+
+ //TODO take events just from .java code using #{...}
+ var AJAX_EVENTS = ['begin', 'complete', 'beforedomupdate'];
+
richfaces.ajax = function(source, event, options) {
options = options || {};
var sourceId = (typeof source == 'object' && source.id) ? source.id : source;
@@ -369,19 +399,37 @@
if (!parameters.RICHFACES_AJAX) {
parameters.RICHFACES_AJAX = sourceId;
}
+
+ var eventHandlers;
- var eventsHandler;
-
+ for (var i = 0; i < AJAX_EVENTS.length; i++) {
+ var event = AJAX_EVENTS[i];
+ var eventHandlerOption = options[event];
+
+ if (eventHandlerOption) {
+ eventHandlers = eventHandlers || {};
+ eventHandlers[event] = new Function('event', eventHandlerOption);
+ }
+ }
+
if (options.status) {
- eventsHandler = richfaces.createJSFEventsAdapter({
- onsubmit: function() { setGlobalStatusNameVariable(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;
+ }
}
-
+
parameters[sourceId] = sourceId;
- if (eventsHandler) {
- parameters['onevent'] = eventsHandler;
- parameters['onerror'] = eventsHandler;
+
+ if (eventHandlers) {
+ var eventsAdapter = richfaces.createJSFEventsAdapter(eventHandlers);
+ parameters['onevent'] = eventsAdapter;
+ parameters['onerror'] = eventsAdapter;
}
jsf.ajax.request(source, event, parameters);
@@ -439,10 +487,10 @@
thisFunction.initialized = true;
var jsfEventsListener = richfaces.createJSFEventsAdapter({
- onsubmit: function(eventData) { statusAjaxEventHandler(eventData, 'start'); },
- onerror: function(eventData) { statusAjaxEventHandler(eventData, 'error'); },
- onsuccess: function(eventData) { statusAjaxEventHandler(eventData, 'success'); },
- oncomplete: function() { setGlobalStatusNameVariable(null); }
+ 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);
Modified: root/ui/trunk/components/core/src/main/java/org/richfaces/component/html/HtmlAjaxFunction.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/component/html/HtmlAjaxFunction.java 2009-08-25 15:54:16 UTC (rev 15296)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/component/html/HtmlAjaxFunction.java 2009-08-25 16:34:42 UTC (rev 15297)
@@ -1,17 +1,27 @@
package org.richfaces.component.html;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashSet;
+
import javax.el.ELException;
import javax.el.ValueExpression;
import javax.faces.FacesException;
import javax.faces.component.UICommand;
+import javax.faces.component.behavior.ClientBehaviorHolder;
import javax.faces.context.FacesContext;
-public class HtmlAjaxFunction extends UICommand {
+public class HtmlAjaxFunction extends UICommand implements ClientBehaviorHolder {
public final static String COMPONENT_FAMILY = "javax.faces.Command";
public final static String COMPONENT_TYPE = "org.richfaces.Function";
+ private static final Collection<String> EVENT_NAMES = Collections.unmodifiableCollection(
+ new LinkedHashSet<String>(Arrays.asList("begin", "complete", "beforedomupdate"))
+ );
+
public HtmlAjaxFunction() {
setRendererType("org.richfaces.FunctionRenderer");
}
@@ -73,6 +83,8 @@
*/
private String _onbeforedomupdate = null;
+ private String _onbegin = null;
+
/*
* The client-side script method to be called after the request is completed
*/
@@ -553,13 +565,43 @@
this._timeoutSet = true;
}
+ /**
+ * @return the _onbegin
+ */
+ public String getOnbegin() {
+ if (this._onbegin != null) {
+ return this._onbegin;
+ }
+ ValueExpression ve = getValueExpression("onbegin");
+ if (ve != null) {
+ String value = null;
+
+ try {
+ value = (String) ve.getValue(getFacesContext().getELContext());
+ } catch (ELException e) {
+ throw new FacesException(e);
+ }
+
+ return value;
+ }
+
+ return null;
+ }
+
+ /**
+ * @param onbegin the _onbegin to set
+ */
+ public void setOnbegin(String onbegin) {
+ _onbegin = onbegin;
+ }
+
public String getFamily(){
return COMPONENT_FAMILY;
}
@Override
public Object saveState(FacesContext context){
- Object [] state = new Object[23];
+ Object [] state = new Object[24];
state[0] = super.saveState(context);
state[1] = Boolean.valueOf(_ajaxSingle);
state[2] = Boolean.valueOf(_ajaxSingleSet);
@@ -583,6 +625,7 @@
state[20] = _status;
state[21] = Integer.valueOf(_timeout);
state[22] = Boolean.valueOf(_timeoutSet);
+ state[23] = _onbegin;
return state;
}
@@ -612,7 +655,12 @@
_status = (String)states[20];;
_timeout = ((Integer)states[21]).intValue();
_timeoutSet = ((Boolean)states[22]).booleanValue();
+ _onbegin = (String) states[23];
+ }
+ @Override
+ public Collection<String> getEventNames() {
+ return EVENT_NAMES;
}
-
+
}
15 years, 4 months
JBoss Rich Faces SVN: r15296 - in root/examples/trunk/richfaces-demo/src/main/webapp: richfaces and 5 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: ilya_shaikovsky
Date: 2009-08-25 11:54:16 -0400 (Tue, 25 Aug 2009)
New Revision: 15296
Added:
root/examples/trunk/richfaces-demo/src/main/webapp/richfaces/button/
root/examples/trunk/richfaces-demo/src/main/webapp/richfaces/button/usage.xhtml
root/examples/trunk/richfaces-demo/src/main/webapp/richfaces/commandButton.xhtml
root/examples/trunk/richfaces-demo/src/main/webapp/richfaces/commandLink.xhtml
root/examples/trunk/richfaces-demo/src/main/webapp/richfaces/link/
root/examples/trunk/richfaces-demo/src/main/webapp/richfaces/link/usage.xhtml
root/examples/trunk/richfaces-demo/src/main/webapp/richfaces/log.xhtml
root/examples/trunk/richfaces-demo/src/main/webapp/richfaces/log/
root/examples/trunk/richfaces-demo/src/main/webapp/richfaces/log/usage.xhtml
root/examples/trunk/richfaces-demo/src/main/webapp/script/
root/examples/trunk/richfaces-demo/src/main/webapp/script/swfobject.js
Modified:
root/examples/trunk/richfaces-demo/src/main/webapp/richfaces/status.xhtml
root/examples/trunk/richfaces-demo/src/main/webapp/templates/includes/navigation.xhtml
Log:
continue rf-demo
Added: root/examples/trunk/richfaces-demo/src/main/webapp/richfaces/button/usage.xhtml
===================================================================
--- root/examples/trunk/richfaces-demo/src/main/webapp/richfaces/button/usage.xhtml (rev 0)
+++ root/examples/trunk/richfaces-demo/src/main/webapp/richfaces/button/usage.xhtml 2009-08-25 15:54:16 UTC (rev 15296)
@@ -0,0 +1,29 @@
+<!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:a4j="http://richfaces.org/a4j">
+
+<ui:composition>
+ <style>
+ <!--
+ .outhello {
+ font-weight: bold;
+ }
+ -->
+ </style>
+ <h:form>
+ <h:panelGrid columns="3">
+ <h:outputText value="Name:" />
+ <h:inputText value="#{userBean.name}" />
+ <a4j:commandButton value="Say Hello" render="out" />
+ </h:panelGrid>
+ </h:form>
+ <br />
+ <a4j:outputPanel id="out">
+ <h:outputText value="Hello #{userBean.name} !" rendered="#{not empty userBean.name}" styleClass="outhello" />
+ </a4j:outputPanel>
+</ui:composition>
+
+</html>
\ No newline at end of file
Added: root/examples/trunk/richfaces-demo/src/main/webapp/richfaces/commandButton.xhtml
===================================================================
--- root/examples/trunk/richfaces-demo/src/main/webapp/richfaces/commandButton.xhtml (rev 0)
+++ root/examples/trunk/richfaces-demo/src/main/webapp/richfaces/commandButton.xhtml 2009-08-25 15:54:16 UTC (rev 15296)
@@ -0,0 +1,19 @@
+<!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">
+
+<ui:composition template="/templates/main.xhtml">
+ <ui:define name="body">
+ <p>
+ Description for commandButton goes there.
+ </p>
+ <fieldset>
+ <legend>commandButton Sample</legend>
+ <ui:include src="/richfaces/button/usage.xhtml" />
+ </fieldset>
+ </ui:define>
+</ui:composition>
+
+</html>
\ No newline at end of file
Added: root/examples/trunk/richfaces-demo/src/main/webapp/richfaces/commandLink.xhtml
===================================================================
--- root/examples/trunk/richfaces-demo/src/main/webapp/richfaces/commandLink.xhtml (rev 0)
+++ root/examples/trunk/richfaces-demo/src/main/webapp/richfaces/commandLink.xhtml 2009-08-25 15:54:16 UTC (rev 15296)
@@ -0,0 +1,19 @@
+<!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">
+
+<ui:composition template="/templates/main.xhtml">
+ <ui:define name="body">
+ <p>
+ Description for commandLink goes there.
+ </p>
+ <fieldset>
+ <legend>commandLink Sample</legend>
+ <ui:include src="/richfaces/link/usage.xhtml" />
+ </fieldset>
+ </ui:define>
+</ui:composition>
+
+</html>
\ No newline at end of file
Added: root/examples/trunk/richfaces-demo/src/main/webapp/richfaces/link/usage.xhtml
===================================================================
--- root/examples/trunk/richfaces-demo/src/main/webapp/richfaces/link/usage.xhtml (rev 0)
+++ root/examples/trunk/richfaces-demo/src/main/webapp/richfaces/link/usage.xhtml 2009-08-25 15:54:16 UTC (rev 15296)
@@ -0,0 +1,28 @@
+<!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:a4j="http://richfaces.org/a4j">
+
+ <ui:composition>
+ <style>
+ <!--
+ .outhello {
+ font-weight: bold;
+ }
+ -->
+ </style>
+ <h:form>
+ <h:panelGrid columns="3">
+ <h:outputText value="Name:" />
+ <h:inputText value="#{userBean.name}" />
+ <a4j:commandLink value="Say Hello" render="out" />
+ </h:panelGrid>
+ </h:form>
+ <br />
+ <a4j:outputPanel id="out">
+ <h:outputText value="Hello #{userBean.name} !" rendered="#{not empty userBean.name}" styleClass="outhello" />
+ </a4j:outputPanel>
+</ui:composition>
+</html>
\ No newline at end of file
Added: root/examples/trunk/richfaces-demo/src/main/webapp/richfaces/log/usage.xhtml
===================================================================
--- root/examples/trunk/richfaces-demo/src/main/webapp/richfaces/log/usage.xhtml (rev 0)
+++ root/examples/trunk/richfaces-demo/src/main/webapp/richfaces/log/usage.xhtml 2009-08-25 15:54:16 UTC (rev 15296)
@@ -0,0 +1,19 @@
+<!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:a4j="http://richfaces.org/a4j">
+
+ <ui:composition>
+ <h:form>
+ <h:inputText value="#{userBean.name}" />
+ <a4j:commandButton value="Submit" render="out"/>
+ <br/>
+ <a4j:outputPanel id="out">
+ <h:outputText value="Hello #{userBean.name}!" rendered="#{not empty userBean.name}"/>
+ </a4j:outputPanel>
+ </h:form>
+ <a4j:log/>
+ </ui:composition>
+</html>
\ No newline at end of file
Added: root/examples/trunk/richfaces-demo/src/main/webapp/richfaces/log.xhtml
===================================================================
--- root/examples/trunk/richfaces-demo/src/main/webapp/richfaces/log.xhtml (rev 0)
+++ root/examples/trunk/richfaces-demo/src/main/webapp/richfaces/log.xhtml 2009-08-25 15:54:16 UTC (rev 15296)
@@ -0,0 +1,19 @@
+<!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">
+
+<ui:composition template="/templates/main.xhtml">
+ <ui:define name="body">
+ <p>
+ Description for log goes there.
+ </p>
+ <fieldset>
+ <legend>log Sample</legend>
+ <ui:include src="/richfaces/log/usage.xhtml" />
+ </fieldset>
+ </ui:define>
+</ui:composition>
+
+</html>
\ No newline at end of file
Modified: root/examples/trunk/richfaces-demo/src/main/webapp/richfaces/status.xhtml
===================================================================
--- root/examples/trunk/richfaces-demo/src/main/webapp/richfaces/status.xhtml 2009-08-25 14:52:10 UTC (rev 15295)
+++ root/examples/trunk/richfaces-demo/src/main/webapp/richfaces/status.xhtml 2009-08-25 15:54:16 UTC (rev 15296)
@@ -19,7 +19,7 @@
</fieldset>
<fieldset>
<legend>Referenced status sample</legend>
- TO DO. (Awaiting for component functionality)
+ <ui:include src="/richfaces/status/referencedusage.xhtml" />
</fieldset>
</ui:define>
</ui:composition>
Added: root/examples/trunk/richfaces-demo/src/main/webapp/script/swfobject.js
===================================================================
--- root/examples/trunk/richfaces-demo/src/main/webapp/script/swfobject.js (rev 0)
+++ root/examples/trunk/richfaces-demo/src/main/webapp/script/swfobject.js 2009-08-25 15:54:16 UTC (rev 15296)
@@ -0,0 +1,733 @@
+/*! SWFObject v2.1 <http://code.google.com/p/swfobject/>
+ Copyright (c) 2007-2008 Geoff Stearns, Michael Williams, and Bobby van der Sluis
+ This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
+*/
+
+var swfobject = function() {
+
+ var UNDEF = "undefined",
+ OBJECT = "object",
+ SHOCKWAVE_FLASH = "Shockwave Flash",
+ SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
+ FLASH_MIME_TYPE = "application/x-shockwave-flash",
+ EXPRESS_INSTALL_ID = "SWFObjectExprInst",
+
+ win = window,
+ doc = document,
+ nav = navigator,
+
+ domLoadFnArr = [],
+ regObjArr = [],
+ objIdArr = [],
+ listenersArr = [],
+ script,
+ timer = null,
+ storedAltContent = null,
+ storedAltContentId = null,
+ isDomLoaded = false,
+ isExpressInstallActive = false;
+
+ /* Centralized function for browser feature detection
+ - Proprietary feature detection (conditional compiling) is used to detect Internet Explorer's features
+ - User agent string detection is only used when no alternative is possible
+ - Is executed directly for optimal performance
+ */
+ var ua = function() {
+ var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
+ playerVersion = [0,0,0],
+ d = null;
+ if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
+ d = nav.plugins[SHOCKWAVE_FLASH].description;
+ if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
+ d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
+ playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
+ playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
+ playerVersion[2] = /r/.test(d) ? parseInt(d.replace(/^.*r(.*)$/, "$1"), 10) : 0;
+ }
+ }
+ else if (typeof win.ActiveXObject != UNDEF) {
+ var a = null, fp6Crash = false;
+ try {
+ a = new ActiveXObject(SHOCKWAVE_FLASH_AX + ".7");
+ }
+ catch(e) {
+ try {
+ a = new ActiveXObject(SHOCKWAVE_FLASH_AX + ".6");
+ playerVersion = [6,0,21];
+ a.AllowScriptAccess = "always"; // Introduced in fp6.0.47
+ }
+ catch(e) {
+ if (playerVersion[0] == 6) {
+ fp6Crash = true;
+ }
+ }
+ if (!fp6Crash) {
+ try {
+ a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
+ }
+ catch(e) {}
+ }
+ }
+ if (!fp6Crash && a) { // a will return null when ActiveX is disabled
+ try {
+ d = a.GetVariable("$version"); // Will crash fp6.0.21/23/29
+ if (d) {
+ d = d.split(" ")[1].split(",");
+ playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
+ }
+ }
+ catch(e) {}
+ }
+ }
+ var u = nav.userAgent.toLowerCase(),
+ p = nav.platform.toLowerCase(),
+ webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
+ ie = false,
+ windows = p ? /win/.test(p) : /win/.test(u),
+ mac = p ? /mac/.test(p) : /mac/.test(u);
+ /*@cc_on
+ ie = true;
+ @if (@_win32)
+ windows = true;
+ @elif (@_mac)
+ mac = true;
+ @end
+ @*/
+ return { w3cdom:w3cdom, pv:playerVersion, webkit:webkit, ie:ie, win:windows, mac:mac };
+ }();
+
+ /* Cross-browser onDomLoad
+ - Based on Dean Edwards' solution: http://dean.edwards.name/weblog/2006/06/again/
+ - Will fire an event as soon as the DOM of a page is loaded (supported by Gecko based browsers - like Firefox -, IE, Opera9+, Safari)
+ */
+ var onDomLoad = function() {
+ if (!ua.w3cdom) {
+ return;
+ }
+ addDomLoadEvent(main);
+ if (ua.ie && ua.win) {
+ try { // Avoid a possible Operation Aborted error
+ doc.write("<scr" + "ipt id=__ie_ondomload defer=true src=//:></scr" + "ipt>"); // String is split into pieces to avoid Norton AV to add code that can cause errors
+ script = getElementById("__ie_ondomload");
+ if (script) {
+ addListener(script, "onreadystatechange", checkReadyState);
+ }
+ }
+ catch(e) {}
+ }
+ if (ua.webkit && typeof doc.readyState != UNDEF) {
+ timer = setInterval(function() { if (/loaded|complete/.test(doc.readyState)) { callDomLoadFunctions(); }}, 10);
+ }
+ if (typeof doc.addEventListener != UNDEF) {
+ doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, null);
+ }
+ addLoadEvent(callDomLoadFunctions);
+ }();
+
+ function checkReadyState() {
+ if (script.readyState == "complete") {
+ script.parentNode.removeChild(script);
+ callDomLoadFunctions();
+ }
+ }
+
+ function callDomLoadFunctions() {
+ if (isDomLoaded) {
+ return;
+ }
+ if (ua.ie && ua.win) { // Test if we can really add elements to the DOM; we don't want to fire it too early
+ var s = createElement("span");
+ try { // Avoid a possible Operation Aborted error
+ var t = doc.getElementsByTagName("body")[0].appendChild(s);
+ t.parentNode.removeChild(t);
+ }
+ catch (e) {
+ return;
+ }
+ }
+ isDomLoaded = true;
+ if (timer) {
+ clearInterval(timer);
+ timer = null;
+ }
+ var dl = domLoadFnArr.length;
+ for (var i = 0; i < dl; i++) {
+ domLoadFnArr[i]();
+ }
+ }
+
+ function addDomLoadEvent(fn) {
+ if (isDomLoaded) {
+ fn();
+ }
+ else {
+ domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
+ }
+ }
+
+ /* Cross-browser onload
+ - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
+ - Will fire an event as soon as a web page including all of its assets are loaded
+ */
+ function addLoadEvent(fn) {
+ if (typeof win.addEventListener != UNDEF) {
+ win.addEventListener("load", fn, false);
+ }
+ else if (typeof doc.addEventListener != UNDEF) {
+ doc.addEventListener("load", fn, false);
+ }
+ else if (typeof win.attachEvent != UNDEF) {
+ addListener(win, "onload", fn);
+ }
+ else if (typeof win.onload == "function") {
+ var fnOld = win.onload;
+ win.onload = function() {
+ fnOld();
+ fn();
+ };
+ }
+ else {
+ win.onload = fn;
+ }
+ }
+
+ /* Main function
+ - Will preferably execute onDomLoad, otherwise onload (as a fallback)
+ */
+ function main() { // Static publishing only
+ var rl = regObjArr.length;
+ for (var i = 0; i < rl; i++) { // For each registered object element
+ var id = regObjArr[i].id;
+ if (ua.pv[0] > 0) {
+ var obj = getElementById(id);
+ if (obj) {
+ regObjArr[i].width = obj.getAttribute("width") ? obj.getAttribute("width") : "0";
+ regObjArr[i].height = obj.getAttribute("height") ? obj.getAttribute("height") : "0";
+ if (hasPlayerVersion(regObjArr[i].swfVersion)) { // Flash plug-in version >= Flash content version: Houston, we have a match!
+ if (ua.webkit && ua.webkit < 312) { // Older webkit engines ignore the object element's nested param elements
+ fixParams(obj);
+ }
+ setVisibility(id, true);
+ }
+ else if (regObjArr[i].expressInstall && !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac)) { // Show the Adobe Express Install dialog if set by the web page author and if supported (fp6.0.65+ on Win/Mac OS only)
+ showExpressInstall(regObjArr[i]);
+ }
+ else { // Flash plug-in and Flash content version mismatch: display alternative content instead of Flash content
+ displayAltContent(obj);
+ }
+ }
+ }
+ else { // If no fp is installed, we let the object element do its job (show alternative content)
+ setVisibility(id, true);
+ }
+ }
+ }
+
+ /* Fix nested param elements, which are ignored by older webkit engines
+ - This includes Safari up to and including version 1.2.2 on Mac OS 10.3
+ - Fall back to the proprietary embed element
+ */
+ function fixParams(obj) {
+ var nestedObj = obj.getElementsByTagName(OBJECT)[0];
+ if (nestedObj) {
+ var e = createElement("embed"), a = nestedObj.attributes;
+ if (a) {
+ var al = a.length;
+ for (var i = 0; i < al; i++) {
+ if (a[i].nodeName == "DATA") {
+ e.setAttribute("src", a[i].nodeValue);
+ }
+ else {
+ e.setAttribute(a[i].nodeName, a[i].nodeValue);
+ }
+ }
+ }
+ var c = nestedObj.childNodes;
+ if (c) {
+ var cl = c.length;
+ for (var j = 0; j < cl; j++) {
+ if (c[j].nodeType == 1 && c[j].nodeName == "PARAM") {
+ e.setAttribute(c[j].getAttribute("name"), c[j].getAttribute("value"));
+ }
+ }
+ }
+ obj.parentNode.replaceChild(e, obj);
+ }
+ }
+
+ /* Show the Adobe Express Install dialog
+ - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
+ */
+ function showExpressInstall(regObj) {
+ isExpressInstallActive = true;
+ var obj = getElementById(regObj.id);
+ if (obj) {
+ if (regObj.altContentId) {
+ var ac = getElementById(regObj.altContentId);
+ if (ac) {
+ storedAltContent = ac;
+ storedAltContentId = regObj.altContentId;
+ }
+ }
+ else {
+ storedAltContent = abstractAltContent(obj);
+ }
+ if (!(/%$/.test(regObj.width)) && parseInt(regObj.width, 10) < 310) {
+ regObj.width = "310";
+ }
+ if (!(/%$/.test(regObj.height)) && parseInt(regObj.height, 10) < 137) {
+ regObj.height = "137";
+ }
+ doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
+ var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
+ dt = doc.title,
+ fv = "MMredirectURL=" + win.location + "&MMplayerType=" + pt + "&MMdoctitle=" + dt,
+ replaceId = regObj.id;
+ // For IE when a SWF is loading (AND: not available in cache) wait for the onload event to fire to remove the original object element
+ // In IE you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
+ if (ua.ie && ua.win && obj.readyState != 4) {
+ var newObj = createElement("div");
+ replaceId += "SWFObjectNew";
+ newObj.setAttribute("id", replaceId);
+ obj.parentNode.insertBefore(newObj, obj); // Insert placeholder div that will be replaced by the object element that loads expressinstall.swf
+ obj.style.display = "none";
+ var fn = function() {
+ obj.parentNode.removeChild(obj);
+ };
+ addListener(win, "onload", fn);
+ }
+ createSWF({ data:regObj.expressInstall, id:EXPRESS_INSTALL_ID, width:regObj.width, height:regObj.height }, { flashvars:fv }, replaceId);
+ }
+ }
+
+ /* Functions to abstract and display alternative content
+ */
+ function displayAltContent(obj) {
+ if (ua.ie && ua.win && obj.readyState != 4) {
+ // For IE when a SWF is loading (AND: not available in cache) wait for the onload event to fire to remove the original object element
+ // In IE you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
+ var el = createElement("div");
+ obj.parentNode.insertBefore(el, obj); // Insert placeholder div that will be replaced by the alternative content
+ el.parentNode.replaceChild(abstractAltContent(obj), el);
+ obj.style.display = "none";
+ var fn = function() {
+ obj.parentNode.removeChild(obj);
+ };
+ addListener(win, "onload", fn);
+ }
+ else {
+ obj.parentNode.replaceChild(abstractAltContent(obj), obj);
+ }
+ }
+
+ function abstractAltContent(obj) {
+ var ac = createElement("div");
+ if (ua.win && ua.ie) {
+ ac.innerHTML = obj.innerHTML;
+ }
+ else {
+ var nestedObj = obj.getElementsByTagName(OBJECT)[0];
+ if (nestedObj) {
+ var c = nestedObj.childNodes;
+ if (c) {
+ var cl = c.length;
+ for (var i = 0; i < cl; i++) {
+ if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
+ ac.appendChild(c[i].cloneNode(true));
+ }
+ }
+ }
+ }
+ }
+ return ac;
+ }
+
+ /* Cross-browser dynamic SWF creation
+ */
+ function createSWF(attObj, parObj, id) {
+ var r, el = getElementById(id);
+ if (el) {
+ if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
+ attObj.id = id;
+ }
+ if (ua.ie && ua.win) { // IE, the object element and W3C DOM methods do not combine: fall back to outerHTML
+ var att = "";
+ for (var i in attObj) {
+ if (attObj[i] != Object.prototype[i]) { // Filter out prototype additions from other potential libraries, like Object.prototype.toJSONString = function() {}
+ if (i.toLowerCase() == "data") {
+ parObj.movie = attObj[i];
+ }
+ else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
+ att += ' class="' + attObj[i] + '"';
+ }
+ else if (i.toLowerCase() != "classid") {
+ att += ' ' + i + '="' + attObj[i] + '"';
+ }
+ }
+ }
+ var par = "";
+ for (var j in parObj) {
+ if (parObj[j] != Object.prototype[j]) { // Filter out prototype additions from other potential libraries
+ par += '<param name="' + j + '" value="' + parObj[j] + '" />';
+ }
+ }
+ el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
+ objIdArr[objIdArr.length] = attObj.id; // Stored to fix object 'leaks' on unload (dynamic publishing only)
+ r = getElementById(attObj.id);
+ }
+ else if (ua.webkit && ua.webkit < 312) { // Older webkit engines ignore the object element's nested param elements: fall back to the proprietary embed element
+ var e = createElement("embed");
+ e.setAttribute("type", FLASH_MIME_TYPE);
+ for (var k in attObj) {
+ if (attObj[k] != Object.prototype[k]) { // Filter out prototype additions from other potential libraries
+ if (k.toLowerCase() == "data") {
+ e.setAttribute("src", attObj[k]);
+ }
+ else if (k.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
+ e.setAttribute("class", attObj[k]);
+ }
+ else if (k.toLowerCase() != "classid") { // Filter out IE specific attribute
+ e.setAttribute(k, attObj[k]);
+ }
+ }
+ }
+ for (var l in parObj) {
+ if (parObj[l] != Object.prototype[l]) { // Filter out prototype additions from other potential libraries
+ if (l.toLowerCase() != "movie") { // Filter out IE specific param element
+ e.setAttribute(l, parObj[l]);
+ }
+ }
+ }
+ el.parentNode.replaceChild(e, el);
+ r = e;
+ }
+ else { // Well-behaving browsers
+ var o = createElement(OBJECT);
+ o.setAttribute("type", FLASH_MIME_TYPE);
+ for (var m in attObj) {
+ if (attObj[m] != Object.prototype[m]) { // Filter out prototype additions from other potential libraries
+ if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
+ o.setAttribute("class", attObj[m]);
+ }
+ else if (m.toLowerCase() != "classid") { // Filter out IE specific attribute
+ o.setAttribute(m, attObj[m]);
+ }
+ }
+ }
+ for (var n in parObj) {
+ if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // Filter out prototype additions from other potential libraries and IE specific param element
+ createObjParam(o, n, parObj[n]);
+ }
+ }
+ el.parentNode.replaceChild(o, el);
+ r = o;
+ }
+ }
+ return r;
+ }
+
+ function createObjParam(el, pName, pValue) {
+ var p = createElement("param");
+ p.setAttribute("name", pName);
+ p.setAttribute("value", pValue);
+ el.appendChild(p);
+ }
+
+ /* Cross-browser SWF removal
+ - Especially needed to safely and completely remove a SWF in Internet Explorer
+ */
+ function removeSWF(id) {
+ var obj = getElementById(id);
+ if (obj && (obj.nodeName == "OBJECT" || obj.nodeName == "EMBED")) {
+ if (ua.ie && ua.win) {
+ if (obj.readyState == 4) {
+ removeObjectInIE(id);
+ }
+ else {
+ win.attachEvent("onload", function() {
+ removeObjectInIE(id);
+ });
+ }
+ }
+ else {
+ obj.parentNode.removeChild(obj);
+ }
+ }
+ }
+
+ function removeObjectInIE(id) {
+ var obj = getElementById(id);
+ if (obj) {
+ for (var i in obj) {
+ if (typeof obj[i] == "function") {
+ obj[i] = null;
+ }
+ }
+ obj.parentNode.removeChild(obj);
+ }
+ }
+
+ /* Functions to optimize JavaScript compression
+ */
+ function getElementById(id) {
+ var el = null;
+ try {
+ el = doc.getElementById(id);
+ }
+ catch (e) {}
+ return el;
+ }
+
+ function createElement(el) {
+ return doc.createElement(el);
+ }
+
+ /* Updated attachEvent function for Internet Explorer
+ - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
+ */
+ function addListener(target, eventType, fn) {
+ target.attachEvent(eventType, fn);
+ listenersArr[listenersArr.length] = [target, eventType, fn];
+ }
+
+ /* Flash Player and SWF content version matching
+ */
+ function hasPlayerVersion(rv) {
+ var pv = ua.pv, v = rv.split(".");
+ v[0] = parseInt(v[0], 10);
+ v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
+ v[2] = parseInt(v[2], 10) || 0;
+ return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
+ }
+
+ /* Cross-browser dynamic CSS creation
+ - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
+ */
+ function createCSS(sel, decl) {
+ if (ua.ie && ua.mac) {
+ return;
+ }
+ var h = doc.getElementsByTagName("head")[0], s = createElement("style");
+ s.setAttribute("type", "text/css");
+ s.setAttribute("media", "screen");
+ if (!(ua.ie && ua.win) && typeof doc.createTextNode != UNDEF) {
+ s.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
+ }
+ h.appendChild(s);
+ if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
+ var ls = doc.styleSheets[doc.styleSheets.length - 1];
+ if (typeof ls.addRule == OBJECT) {
+ try {
+ ls.addRule(sel, decl);
+ } catch(e) {}
+ }
+ }
+ }
+
+ function setVisibility(id, isVisible) {
+ var v = isVisible ? "visible" : "hidden";
+ if (isDomLoaded && getElementById(id)) {
+ getElementById(id).style.visibility = v;
+ }
+ else {
+ createCSS("#" + id, "visibility:" + v);
+ }
+ }
+
+ /* Filter to avoid XSS attacks
+ */
+ function urlEncodeIfNecessary(s) {
+ var regex = /[\\\"<>\.;]/;
+ var hasBadChars = regex.exec(s) != null;
+ return hasBadChars ? encodeURIComponent(s) : s;
+ }
+
+ /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
+ */
+ var cleanup = function() {
+ if (ua.ie && ua.win) {
+ window.attachEvent("onunload", function() {
+ // remove listeners to avoid memory leaks
+ var ll = listenersArr.length;
+ for (var i = 0; i < ll; i++) {
+ listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
+ }
+ // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
+ var il = objIdArr.length;
+ for (var j = 0; j < il; j++) {
+ removeSWF(objIdArr[j]);
+ }
+ // cleanup library's main closures to avoid memory leaks
+ for (var k in ua) {
+ ua[k] = null;
+ }
+ ua = null;
+ for (var l in swfobject) {
+ swfobject[l] = null;
+ }
+ swfobject = null;
+ });
+ }
+ }();
+
+
+ return {
+ /* Public API
+ - Reference: http://code.google.com/p/swfobject/wiki/SWFObject_2_0_documentation
+ */
+ registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr) {
+ if (!ua.w3cdom || !objectIdStr || !swfVersionStr) {
+ return;
+ }
+ var regObj = {};
+ regObj.id = objectIdStr;
+ regObj.swfVersion = swfVersionStr;
+ regObj.expressInstall = xiSwfUrlStr ? xiSwfUrlStr : false;
+ regObjArr[regObjArr.length] = regObj;
+ setVisibility(objectIdStr, false);
+ },
+
+ getObjectById: function(objectIdStr) {
+ var r = null;
+ if (ua.w3cdom) {
+ var o = getElementById(objectIdStr);
+ if (o) {
+ var n = o.getElementsByTagName(OBJECT)[0];
+ if (!n || (n && typeof o.SetVariable != UNDEF)) {
+ r = o;
+ }
+ else if (typeof n.SetVariable != UNDEF) {
+ r = n;
+ }
+ }
+ }
+ return r;
+ },
+
+ embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj) {
+ if (!ua.w3cdom || !swfUrlStr || !replaceElemIdStr || !widthStr || !heightStr || !swfVersionStr) {
+ return;
+ }
+ widthStr += ""; // Auto-convert to string
+ heightStr += "";
+ if (hasPlayerVersion(swfVersionStr)) {
+ setVisibility(replaceElemIdStr, false);
+ var att = {};
+ if (attObj && typeof attObj === OBJECT) {
+ for (var i in attObj) {
+ if (attObj[i] != Object.prototype[i]) { // Filter out prototype additions from other potential libraries
+ att[i] = attObj[i];
+ }
+ }
+ }
+ att.data = swfUrlStr;
+ att.width = widthStr;
+ att.height = heightStr;
+ var par = {};
+ if (parObj && typeof parObj === OBJECT) {
+ for (var j in parObj) {
+ if (parObj[j] != Object.prototype[j]) { // Filter out prototype additions from other potential libraries
+ par[j] = parObj[j];
+ }
+ }
+ }
+ if (flashvarsObj && typeof flashvarsObj === OBJECT) {
+ for (var k in flashvarsObj) {
+ if (flashvarsObj[k] != Object.prototype[k]) { // Filter out prototype additions from other potential libraries
+ if (typeof par.flashvars != UNDEF) {
+ par.flashvars += "&" + k + "=" + flashvarsObj[k];
+ }
+ else {
+ par.flashvars = k + "=" + flashvarsObj[k];
+ }
+ }
+ }
+ }
+ addDomLoadEvent(function() {
+ createSWF(att, par, replaceElemIdStr);
+ if (att.id == replaceElemIdStr) {
+ setVisibility(replaceElemIdStr, true);
+ }
+ });
+ }
+ else if (xiSwfUrlStr && !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac)) {
+ isExpressInstallActive = true; // deferred execution
+ setVisibility(replaceElemIdStr, false);
+ addDomLoadEvent(function() {
+ var regObj = {};
+ regObj.id = regObj.altContentId = replaceElemIdStr;
+ regObj.width = widthStr;
+ regObj.height = heightStr;
+ regObj.expressInstall = xiSwfUrlStr;
+ showExpressInstall(regObj);
+ });
+ }
+ },
+
+ getFlashPlayerVersion: function() {
+ return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
+ },
+
+ hasFlashPlayerVersion: hasPlayerVersion,
+
+ createSWF: function(attObj, parObj, replaceElemIdStr) {
+ if (ua.w3cdom) {
+ return createSWF(attObj, parObj, replaceElemIdStr);
+ }
+ else {
+ return undefined;
+ }
+ },
+
+ removeSWF: function(objElemIdStr) {
+ if (ua.w3cdom) {
+ removeSWF(objElemIdStr);
+ }
+ },
+
+ createCSS: function(sel, decl) {
+ if (ua.w3cdom) {
+ createCSS(sel, decl);
+ }
+ },
+
+ addDomLoadEvent: addDomLoadEvent,
+
+ addLoadEvent: addLoadEvent,
+
+ getQueryParamValue: function(param) {
+ var q = doc.location.search || doc.location.hash;
+ if (param == null) {
+ return urlEncodeIfNecessary(q);
+ }
+ if (q) {
+ var pairs = q.substring(1).split("&");
+ for (var i = 0; i < pairs.length; i++) {
+ if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
+ return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
+ }
+ }
+ }
+ return "";
+ },
+
+ // For internal usage only
+ expressInstallCallback: function() {
+ if (isExpressInstallActive && storedAltContent) {
+ var obj = getElementById(EXPRESS_INSTALL_ID);
+ if (obj) {
+ obj.parentNode.replaceChild(storedAltContent, obj);
+ if (storedAltContentId) {
+ setVisibility(storedAltContentId, true);
+ if (ua.ie && ua.win) {
+ storedAltContent.style.display = "block";
+ }
+ }
+ storedAltContent = null;
+ storedAltContentId = null;
+ isExpressInstallActive = false;
+ }
+ }
+ }
+ };
+}();
Modified: root/examples/trunk/richfaces-demo/src/main/webapp/templates/includes/navigation.xhtml
===================================================================
--- root/examples/trunk/richfaces-demo/src/main/webapp/templates/includes/navigation.xhtml 2009-08-25 14:52:10 UTC (rev 15295)
+++ root/examples/trunk/richfaces-demo/src/main/webapp/templates/includes/navigation.xhtml 2009-08-25 15:54:16 UTC (rev 15296)
@@ -19,6 +19,12 @@
value="#{facesContext.externalContext.requestContextPath}/richfaces/status.jsf">a4j:status</h:outputLink>
<h:outputLink
value="#{facesContext.externalContext.requestContextPath}/richfaces/outputPanel.jsf">a4j:outputPanel</h:outputLink>
+ <h:outputLink
+ value="#{facesContext.externalContext.requestContextPath}/richfaces/commandButton.jsf">a4j:commandButton</h:outputLink>
+ <h:outputLink
+ value="#{facesContext.externalContext.requestContextPath}/richfaces/commandLink.jsf">a4j:commandLink</h:outputLink>
+ <h:outputLink
+ value="#{facesContext.externalContext.requestContextPath}/richfaces/log.jsf">a4j:log</h:outputLink>
</h:panelGrid>
</rich:panel>
</ui:composition>
15 years, 4 months