[richfaces-svn-commits] JBoss Rich Faces SVN: r2188 - in trunk: samples/richfaces-demo/src/main/webapp/richfaces/actionparam/source and 5 other directories.
richfaces-svn-commits at lists.jboss.org
richfaces-svn-commits at lists.jboss.org
Fri Aug 10 00:19:58 EDT 2007
Author: SergeySmirnov
Date: 2007-08-10 00:19:58 -0400 (Fri, 10 Aug 2007)
New Revision: 2188
Added:
trunk/samples/richfaces-demo/src/main/webapp/richfaces/actionparam/source/assignTo.xhtml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/actionparam/source/changeSkin.xhtml
trunk/samples/richfaces-demo/src/main/webapp/templates/include/sourceview.xhtml
Modified:
trunk/samples/richfaces-demo/src/main/webapp/richfaces/actionparam/usage.xhtml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/effect/source/usage.html
trunk/samples/richfaces-demo/src/main/webapp/richfaces/effect/usage.xhtml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/support/usage.xhtml
trunk/ui/effect/src/main/java/org/richfaces/renderkit/EffectRendererBase.java
Log:
source view update
Added: trunk/samples/richfaces-demo/src/main/webapp/richfaces/actionparam/source/assignTo.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/actionparam/source/assignTo.xhtml (rev 0)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/actionparam/source/assignTo.xhtml 2007-08-10 04:19:58 UTC (rev 2188)
@@ -0,0 +1,14 @@
+<h:form>
+ <rich:panel>
+ <a4j:commandButton value="Set Name to Alex" reRender="rep" >
+ <a4j:actionparam name="username" value="Alex" assignTo="#{userBean.name}"/>
+ </a4j:commandButton>
+ <rich:spacer width="20" />
+ <a4j:commandButton value="Set Name to John" reRender="rep" >
+ <a4j:actionparam name="username" value="John" assignTo="#{userBean.name}"/>
+ </a4j:commandButton>
+ </rich:panel>
+ <rich:panel>
+ <h:outputText id="rep" value="Selected Name:#{userBean.name}"/>
+ </rich:panel>
+</h:form>
\ No newline at end of file
Added: trunk/samples/richfaces-demo/src/main/webapp/richfaces/actionparam/source/changeSkin.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/actionparam/source/changeSkin.xhtml (rev 0)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/actionparam/source/changeSkin.xhtml 2007-08-10 04:19:58 UTC (rev 2188)
@@ -0,0 +1,14 @@
+<h:form>
+ <rich:panel>
+ <f:facet name="header">
+ <h:outputText value="Change Demo Appplication Skin To: "/>
+ </f:facet>
+ <h:commandLink value="DeepMarine">
+ <a4j:actionparam name="skin" value="deepMarine" assignTo="#{skinBean.skin}"/>
+ </h:commandLink>
+ <rich:spacer width="20" />
+ <h:commandLink value="BlueSky" >
+ <a4j:actionparam name="skin" value="blueSky" assignTo="#{skinBean.skin}"/>
+ </h:commandLink>
+ </rich:panel>
+</h:form>
\ No newline at end of file
Modified: trunk/samples/richfaces-demo/src/main/webapp/richfaces/actionparam/usage.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/actionparam/usage.xhtml 2007-08-10 01:17:16 UTC (rev 2187)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/actionparam/usage.xhtml 2007-08-10 04:19:58 UTC (rev 2188)
@@ -33,6 +33,11 @@
<h:outputText id="rep" value="Selected Name:#{userBean.name}"/>
</rich:panel>
</h:form>
+ <ui:include src="/templates/include/sourceview.xhtml">
+ <ui:param name="sourcepath" value="/richfaces/actionparam/source/assignTo.xhtml"/>
+ </ui:include>
+
+
</div>
<p>
You can use a4j:param not only with ajax components, but with non-ajax command component also.
@@ -55,6 +60,10 @@
</h:commandLink>
</rich:panel>
</h:form>
+ <ui:include src="/templates/include/sourceview.xhtml">
+ <ui:param name="sourcepath" value="/richfaces/actionparam/source/changeSkin.xhtml"/>
+ </ui:include>
+
</div>
<p>Attributes 'name' and 'value' are mandatory. You can specify the converter with 'converter'
attribute if you need to convert the value before the model is updates. Note that
Modified: trunk/samples/richfaces-demo/src/main/webapp/richfaces/effect/source/usage.html
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/effect/source/usage.html 2007-08-10 01:17:16 UTC (rev 2187)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/effect/source/usage.html 2007-08-10 04:19:58 UTC (rev 2188)
@@ -1 +1,19 @@
-TODO: source should be added
\ No newline at end of file
+<!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:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich">
+ <ui:composition>
+<!-- invoking from javascript -->
+<div id="contentDiv">
+ ..... div content ......
+</div>
+
+<input type="button" onclick="hideDiv({duration:0.7})" value="Hide" />
+<input type="button" onclick="showDiv()" value="Show" />
+<rich:effect name="hideDiv" for="contentDiv" type="Fade" />
+<rich:effect name="showDiv" for="contentDiv" type="Appear" />
+</ui:composition>
+</html>
\ No newline at end of file
Modified: trunk/samples/richfaces-demo/src/main/webapp/richfaces/effect/usage.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/effect/usage.xhtml 2007-08-10 01:17:16 UTC (rev 2187)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/effect/usage.xhtml 2007-08-10 04:19:58 UTC (rev 2188)
@@ -52,25 +52,62 @@
<rich:separator height="1" style="padding-bottom:10px" />
- <rich:panel id="mypanel" style="background-color:lightblue;width:300px" >
- <rich:effect event="onmouseout" type="Opacity" params="from:1.0,to:0.3" />
- <rich:effect event="onmouseover" type="Opacity" params="from:0.3,to:1.0" />
+
+ <div id="mypaneldiv" style="padding:6px;background-color:lightblue;width:300px" >
+ <rich:effect for="mypaneldiv" event="onmouseout" type="Opacity" params="from:1.0,to:0.3" />
+ <rich:effect for="mypaneldiv" event="onmouseover" type="Opacity" params="from:0.3,to:1.0" />
- <f:verbatim>
The opacity of this panel will be set to 0.3 when the mouse cursor is out set
to 1.0 if the mouse is over. The default opacity is set to 0.3 when the page
is loaded.
-
- </f:verbatim>
-
- </rich:panel>
- <rich:effect for="window" event="load" type="Opacity" params="id:'mypanel',from:1.0,to:0.3" />
+
+ </div>
+ <rich:effect for="window" event="load" type="Opacity" params="id:'mypaneldiv',from:1.0,to:0.3" />
+
<rich:separator height="1" style="padding-top:10px" />
+ <ui:include src="/templates/include/sourceview.xhtml">
+ <ui:param name="sourcepath" value="/richfaces/effect/source/usage.html"/>
+ </ui:include>
+
+
</div>
+ <h2>Key Attributes</h2>
+ <p>
+ <b>name</b> attribute defines the name of the javascript function will be generated
+ on the page when the component is rendered. You can invoke this function to activate
+ the effect. The function access one parameter. It is a set of effect options in JSON
+ format.
+ </p>
+ <p>
+ <b>type</b> attribute defines the type of effect. For example, "Fade", "Blind",
+ "Opacity". Take a look at scriptaculous documentation for set of available effect.
+ </p>
+ <p>
+ <b>for</b> attribute defines the id of the component or html tag, the effect will
+ be attached to. Richfaces converts the 'for' attribute value to the client id
+ of the component if such component is found. If not, the value is left as is for
+ possible wiring with on the DOM element's id on the client side.<br/>
+ By default, the target of the effect is the same element that effect pointed to.
+ However, the target element is might be overridden with 'effectId' option passed
+ with 'params' attribute of with function paramenter.
+ </p>
+ <p>
+ <b>params</b> attribute allows to define the set of options possible for
+ particurar effect. For example, 'duration', 'delay', 'from', 'to'. Additionally to
+ the options used by the effect itself, there are two option that might override the
+ rich:effect attribute. Those are:
+ <ul>
+ <li><b>effectId</b> allows to re-define the target of effect. The option
+ is overrire the value of 'for' attribute</li>
+ <li><b>effectType</b> defines the effect type. The option
+ is overrire the value of 'type' attribute</li>
+ </ul>
+ </p>
+
</ui:define>
<ui:define name="sources">
Here is a fragment of page sources for the given example:
Modified: trunk/samples/richfaces-demo/src/main/webapp/richfaces/support/usage.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/support/usage.xhtml 2007-08-10 01:17:16 UTC (rev 2187)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/support/usage.xhtml 2007-08-10 04:19:58 UTC (rev 2188)
@@ -30,7 +30,7 @@
<div class="sample-container" >
- <rich:separator width="1"/>
+ <rich:separator height="1"/>
<h:form>
<h:panelGrid columns="2">
<h:inputText value="#{userBean.name}">
@@ -39,9 +39,13 @@
<h:outputText id="outtext" value="#{userBean.name}" />
</h:panelGrid>
</h:form>
- <rich:separator width="1" style="padding-top:10px"/>
+ <rich:separator height="1" style="padding-top:10px"/>
+ <ui:include src="/templates/include/sourceview.xhtml">
+ <ui:param name="sourcepath" value="/richfaces/support/source/usage.xhtml"/>
+ </ui:include>
</div>
-
+
+
<p>
a4j:support is wired with the event of the parent component during the Render Response
phase on the server side. So, the number of possible events is limited to the ones
Added: trunk/samples/richfaces-demo/src/main/webapp/templates/include/sourceview.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/templates/include/sourceview.xhtml (rev 0)
+++ trunk/samples/richfaces-demo/src/main/webapp/templates/include/sourceview.xhtml 2007-08-10 04:19:58 UTC (rev 2188)
@@ -0,0 +1,82 @@
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich">
+<ui:composition>
+
+
+
+ <rich:spacer height="8" />
+
+ <script>
+ //<![CDATA[
+ Effect.Transitions.exponential = function(pos) {
+ return 1-Math.pow(1-pos,2);
+ }
+ //]]>
+ </script>
+
+ <style>
+ .viewsourcebody {
+ padding:0;
+ }
+ .viewsourceheader {
+ background-color:#E6F3F7;
+ background-image:none;
+ border-width:0px;
+ padding:0px;
+ height:6px;
+ }
+ .viewsourcediv {
+ padding:0 10px 10px 10px;
+ }
+ .viewsourcediv pre {
+ margin:0;
+ }
+
+ .viewsourcelooklink {
+ cursor:pointer;
+ text-decoration:underline;
+ padding-left:5px;
+ color:blue;
+ font-size:11px;
+ font-family:Verdana;
+ }
+
+ .viewsourcehidelink {
+ text-align:right;
+ display:block;
+ background-color:#E6F3F7;
+ }
+
+ </style>
+ <f:subview>
+ <a4j:outputPanel styleClass="viewsourcelooklink" id="look">
+ <rich:effect for="look" event="onclick" type="BlindDown" params="id:'source1', delay:0.1,duration:1.0,from:0.1,to:1.0" />
+ <rich:effect for="look" event="onclick" type="Fade" params="duration:0.1" />
+ View Source >>
+ </a4j:outputPanel>
+ <rich:panel bodyClass="viewsourcebody" headerClass="viewsourceheader" id="source1" style="padding-bottom:0px;width:100%;overflow:auto;display:none;border-width:0;background-color:#FFFFE7 !important">
+ <f:facet name="header">
+ <rich:spacer height="3px" />
+ </f:facet>
+ <div class="viewsourcediv">
+ <rich:insert src="#{sourcepath}" highlight="xhtml"/>
+ </div>
+
+ <a4j:outputPanel id="hide" styleClass="viewsourcehidelink">
+ <rich:effect for="hide" event="onclick" type="BlindUp" params="id:'source1', duration:1.0" />
+ <rich:effect for="hide" event="onclick" type="Appear" params="id:'look', delay:1.0, duration:1.0" />
+ <h:outputText style="padding-right:5px" value="<<Hide Source"/>
+ </a4j:outputPanel>
+
+ </rich:panel>
+ </f:subview>
+
+
+
+</ui:composition>
+</html>
+
Modified: trunk/ui/effect/src/main/java/org/richfaces/renderkit/EffectRendererBase.java
===================================================================
--- trunk/ui/effect/src/main/java/org/richfaces/renderkit/EffectRendererBase.java 2007-08-10 01:17:16 UTC (rev 2187)
+++ trunk/ui/effect/src/main/java/org/richfaces/renderkit/EffectRendererBase.java 2007-08-10 04:19:58 UTC (rev 2188)
@@ -35,6 +35,8 @@
private static final Pattern VARIABLE_PATTERN = Pattern.compile("^\\s*[_,A-Z,a-z]\\w*(?:\\.[_,A-Z,a-z]\\w*)*\\s*$");
public String convertElementParameter(Object parameter) {
+ if (parameter==null)
+ return "''";
String s = parameter.toString();
if (VARIABLE_PATTERN.matcher(s).matches()) {
return "typeof "+s+" == \"object\" ? "+s+" : $('"+s+"')";
More information about the richfaces-svn-commits
mailing list