Author: SergeySmirnov
Date: 2007-11-09 15:46:09 -0500 (Fri, 09 Nov 2007)
New Revision: 3885
Added:
trunk/sandbox/ui/componentControl/src/main/templates/
trunk/sandbox/ui/componentControl/src/main/templates/htmlComponentControl.jspx
trunk/sandbox/ui/componentControl/src/test/
trunk/sandbox/ui/componentControl/src/test/java/
trunk/sandbox/ui/componentControl/src/test/java/org/
trunk/sandbox/ui/componentControl/src/test/java/org/richfaces/
trunk/sandbox/ui/componentControl/src/test/java/org/richfaces/sandbox/
trunk/sandbox/ui/componentControl/src/test/java/org/richfaces/sandbox/component/
trunk/sandbox/ui/componentControl/src/test/java/org/richfaces/sandbox/component/JSFComponentTest.java
trunk/sandbox/ui/rex-button/pom.xml
trunk/sandbox/ui/rex-button/src/
trunk/sandbox/ui/rex-button/src/main/
trunk/sandbox/ui/rex-button/src/main/config/
trunk/sandbox/ui/rex-button/src/main/config/component/
trunk/sandbox/ui/rex-button/src/main/config/component/button.xml
trunk/sandbox/ui/rex-button/src/main/java/
trunk/sandbox/ui/rex-button/src/main/java/org/
trunk/sandbox/ui/rex-button/src/main/java/org/richfaces/
trunk/sandbox/ui/rex-button/src/main/java/org/richfaces/sandbox/
trunk/sandbox/ui/rex-button/src/main/java/org/richfaces/sandbox/component/
trunk/sandbox/ui/rex-button/src/main/java/org/richfaces/sandbox/component/UIButton.java
trunk/sandbox/ui/rex-button/src/main/resources/
trunk/sandbox/ui/rex-button/src/main/templates/
trunk/sandbox/ui/rex-button/src/main/templates/htmlButton.jspx
trunk/sandbox/ui/rex-button/src/test/
trunk/sandbox/ui/rex-button/src/test/java/
trunk/sandbox/ui/rex-button/src/test/java/org/
trunk/sandbox/ui/rex-button/src/test/java/org/richfaces/
trunk/sandbox/ui/rex-button/src/test/java/org/richfaces/sandbox/
trunk/sandbox/ui/rex-button/src/test/java/org/richfaces/sandbox/component/
trunk/sandbox/ui/rex-button/src/test/java/org/richfaces/sandbox/component/JSFComponentTest.java
Log:
componentControl and rex-button
Added: trunk/sandbox/ui/componentControl/src/main/templates/htmlComponentControl.jspx
===================================================================
--- trunk/sandbox/ui/componentControl/src/main/templates/htmlComponentControl.jspx
(rev 0)
+++
trunk/sandbox/ui/componentControl/src/main/templates/htmlComponentControl.jspx 2007-11-09
20:46:09 UTC (rev 3885)
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<f:root
+
xmlns:f="http://ajax4jsf.org/cdk/template"
+ xmlns:c="
http://java.sun.com/jsf/core"
+ xmlns:ui="
http://ajax4jsf.org/cdk/ui"
+ xmlns:u="
http://ajax4jsf.org/cdk/u"
+ xmlns:x="
http://ajax4jsf.org/cdk/x"
+ class="org.richfaces.sandbox.renderkit.html.ComponentControlRenderer"
+ baseclass="org.richfaces.renderkit.ComponentControlRendererBase"
+ component="org.richfaces.sandbox.component.UIComponentControl"
+ >
+ <h:scripts>/org/richfaces/renderkit/html/scripts/jquery/jquery.js,/org/richfaces/renderkit/html/script/controlUtils.js</h:scripts>
+
+ <c:set var="event"
value="#{component.attributes['event']}"/>
+ <c:set var="forAttr"
value="#{component.attributes['for']}"/>
+ <c:set var="attachTiming"
value="#{component.attributes['attachTiming']}"/>
+ <c:set var="attachTo"
value="#{component.attributes['attachTo']}"/>
+ <c:set var="name"
value="#{component.attributes['name']}"/>
+ <c:set var="operation"
value="#{component.attributes['operation']}"/>
+ <c:set var="params"
value="#{component.attributes['params']}"/>
+
+
+ <f:clientid var="clientId"/>
+ <jsp:scriptlet>
+<![CDATA[
+ String event = (String) variables.getVariable("event");
+ String forAttr = (String) variables.getVariable("forAttr");
+ String attachTiming = (String) variables.getVariable("attachTiming");
+ String attachTo = (String) variables.getVariable("attachTo");
+ String name = (String) variables.getVariable("name");
+ String operation = (String) variables.getVariable("operation");
+
+ checkValidity(clientId, name, attachTiming, forAttr, operation);
+ System.out.println("Before search for client id:" + forAttr);
+ variables.setVariable("forAttr", replaceClientIds(context, component,
"#" + forAttr));
+ System.out.println("After search for client id:" + (String)
variables.getVariable("forAttr"));
+ System.out.println("Before search for client id:" + attachTo);
+ variables.setVariable("attachTo", replaceClientIds(context, component,
"#" + attachTo));
+ System.out.println("After search for client id:" + (String)
variables.getVariable("attachTo"));
+]]>
+</jsp:scriptlet>
+
+<jsp:scriptlet><![CDATA[ if (! "".equals(name.trim()) ) {
]]></jsp:scriptlet>
+<script type="text/javascript">
+ //<![CDATA[
+function #{name}() {
+ Richfaces.componentControl.performOperation(
+ null, '#{forAttr}', '#{operation}', {#{params}} );
+}
+//]]>
+</script>
+<jsp:scriptlet><![CDATA[ } ]]></jsp:scriptlet>
+
+
+<jsp:scriptlet><![CDATA[ if ( "immediate".equals(attachTiming) ) {
]]></jsp:scriptlet>
+<script type="text/javascript">
+ //<![CDATA[
+ {
+
+Richfaces.componentControl.attachEvent(
+ '#{attachTo}', null, '#{event}', '#{forAttr}',
'#{operation}', {#{params}} );
+
+}
+//]]>
+</script>
+<jsp:scriptlet><![CDATA[ } ]]></jsp:scriptlet>
+
+
+
+<jsp:scriptlet><![CDATA[ if ( "onload".equals(attachTiming) ) {
]]></jsp:scriptlet>
+<script type="text/javascript">
+ //<![CDATA[
+ jQuery(document).ready(function() {
+ Richfaces.componentControl.attachEvent(
+ '#{attachTo}', null, '#{event}', '#{forAttr}',
'#{operation}', {#{params}} );
+ });
+
+//]]>
+</script>
+<jsp:scriptlet><![CDATA[ } ]]></jsp:scriptlet>
+
+
+
+ <div id="#{clientId}"
+ x:passThruWithExclusions="value,name,type,id"
+ >Here we start
+ </div>
+</f:root>
\ No newline at end of file
Added:
trunk/sandbox/ui/componentControl/src/test/java/org/richfaces/sandbox/component/JSFComponentTest.java
===================================================================
---
trunk/sandbox/ui/componentControl/src/test/java/org/richfaces/sandbox/component/JSFComponentTest.java
(rev 0)
+++
trunk/sandbox/ui/componentControl/src/test/java/org/richfaces/sandbox/component/JSFComponentTest.java 2007-11-09
20:46:09 UTC (rev 3885)
@@ -0,0 +1,53 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.sandbox.component;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import javax.faces.component.UIComponent;
+
+/**
+ * Unit test for simple Component.
+ */
+public class JSFComponentTest
+ extends TestCase
+{
+ /**
+ * Create the test case
+ *
+ * @param testName name of the test case
+ */
+ public JSFComponentTest( String testName )
+ {
+ super( testName );
+ }
+
+
+ /**
+ * Rigourous Test :-)
+ */
+ public void testComponent()
+ {
+ assertTrue( true );
+ }
+}
Added: trunk/sandbox/ui/rex-button/pom.xml
===================================================================
--- trunk/sandbox/ui/rex-button/pom.xml (rev 0)
+++ trunk/sandbox/ui/rex-button/pom.xml 2007-11-09 20:46:09 UTC (rev 3885)
@@ -0,0 +1,49 @@
+<?xml version="1.0"?><project>
+ <parent>
+ <artifactId>ui</artifactId>
+ <groupId>org.richfaces.sandbox</groupId>
+ <version>3.2.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.richfaces.sandbox.ui</groupId>
+ <artifactId>rex-button</artifactId>
+ <name>rex-button</name>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>maven-cdk-plugin</artifactId>
+ <version>3.2.0-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <library>
+ <prefix>org.richfaces.sandbox</prefix>
+ <taglib>
+ <shortName>rex-button</shortName>
+ </taglib>
+ </library>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.framework</groupId>
+ <artifactId>richfaces-impl</artifactId>
+ <version>3.2.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
Added: trunk/sandbox/ui/rex-button/src/main/config/component/button.xml
===================================================================
--- trunk/sandbox/ui/rex-button/src/main/config/component/button.xml
(rev 0)
+++ trunk/sandbox/ui/rex-button/src/main/config/component/button.xml 2007-11-09 20:46:09
UTC (rev 3885)
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN"
"https://ajax4jsf.dev.java.net/nonav/dtds/component-config.dtd" >
+<components>
+ <component>
+ <name>org.richfaces.sandbox.Button</name>
+ <family>org.richfaces.sandbox.Button</family>
+ <classname>org.richfaces.sandbox.component.html.HtmlButton</classname>
+ <superclass>org.richfaces.sandbox.component.UIButton</superclass>
+ <description>
+ <![CDATA[
+ ]]>
+ </description>
+ <renderer generate="true" override="true">
+ <name>org.richfaces.sandbox.ButtonRenderer</name>
+ <template>htmlButton.jspx</template>
+ </renderer>
+ <tag>
+ <name>button</name>
+ <classname>org.richfaces.sandbox.taglib.ButtonTag</classname>
+ <superclass>
+ org.ajax4jsf.webapp.taglib.HtmlComponentTagBase
+ </superclass>
+ </tag>
+ <!--
+ <taghandler>
+ <classname>org.ajax4jsf.tag.TestHandler</classname>
+ </taghandler>
+ -->
+ &ui_component_attributes;
+ &html_events;
+ &html_style_attributes;
+ <property>
+ <name>value</name>
+ <classname>java.lang.String</classname>
+ <description>
+ The text appears on the button
+ </description>
+ <defaultvalue>""</defaultvalue>
+ </property>
+
+ <!--
+ <property>
+ <name>param</name>
+ <classname>java.lang.String</classname>
+ <description>
+ </description>
+ <defaultvalue>"default"</defaultvalue>
+ </property>
+ -->
+ </component>
+</components>
Added:
trunk/sandbox/ui/rex-button/src/main/java/org/richfaces/sandbox/component/UIButton.java
===================================================================
---
trunk/sandbox/ui/rex-button/src/main/java/org/richfaces/sandbox/component/UIButton.java
(rev 0)
+++
trunk/sandbox/ui/rex-button/src/main/java/org/richfaces/sandbox/component/UIButton.java 2007-11-09
20:46:09 UTC (rev 3885)
@@ -0,0 +1,19 @@
+/**
+ *
+ */
+
+package org.richfaces.sandbox.component;
+
+import javax.faces.component.UIComponentBase;
+
+/**
+ * JSF component class
+ *
+ */
+public abstract class UIButton extends UIComponentBase {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.sandbox.Button";
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.sandbox.Button";
+
+}
Added: trunk/sandbox/ui/rex-button/src/main/templates/htmlButton.jspx
===================================================================
--- trunk/sandbox/ui/rex-button/src/main/templates/htmlButton.jspx
(rev 0)
+++ trunk/sandbox/ui/rex-button/src/main/templates/htmlButton.jspx 2007-11-09 20:46:09 UTC
(rev 3885)
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<f:root
+
xmlns:f="http://ajax4jsf.org/cdk/template"
+ xmlns:c="
http://java.sun.com/jsf/core"
+ xmlns:ui="
http://ajax4jsf.org/cdk/ui"
+ xmlns:u="
http://ajax4jsf.org/cdk/u"
+ xmlns:x="
http://ajax4jsf.org/cdk/x"
+ class="org.richfaces.sandbox.renderkit.html.ButtonRenderer"
+ baseclass="org.ajax4jsf.renderkit.AjaxComponentRendererBase"
+ component="org.richfaces.sandbox.component.UIButton"
+ >
+ <h:styles>extjs/ext-all.css,extjs/ext-css-patch.xcss</h:styles>
+ <h:scripts>extjs/ext-base.js,extjs/ext-all.js,/org/richfaces/renderkit/html/scripts/jquery/jquery.js</h:scripts>
+
+ <c:set var="value"
value="#{component.attributes['value']}"/>
+
+ <f:clientid var="clientId"/>
+ <div id="#{clientId}" x:passThruWithExclusions="id"
style="width:auto">
+ <vcp:body>
+ <f:call name="renderChildren" />
+ </vcp:body>
+ <f:clientid var="clientId"/>
+ <script type="text/javascript">
+ var $pardiv = Ext.get('#{clientId}');
+ $pardiv.dom.button = new Object();
+ if (Ext.query('input','#{clientId}' ) != 0) {
+ $pardiv.dom.button.input = Ext.query('input','#{clientId}' );
+ jQuery($pardiv.dom.button.input).hide();
+ }
+ $pardiv.dom.button.extobj = new Ext.Button ({
+ text: '#{value}',
+ renderTo:'#{clientId}',
+ handler: function() {
+ var $bdiv = jQuery(Ext.get('#{clientId}').dom.button.input);
+ $bdiv.click();
+ }
+
+ });
+ $pardiv = null;
+ </script>
+
+
+ </div>
+</f:root>
\ No newline at end of file
Added:
trunk/sandbox/ui/rex-button/src/test/java/org/richfaces/sandbox/component/JSFComponentTest.java
===================================================================
---
trunk/sandbox/ui/rex-button/src/test/java/org/richfaces/sandbox/component/JSFComponentTest.java
(rev 0)
+++
trunk/sandbox/ui/rex-button/src/test/java/org/richfaces/sandbox/component/JSFComponentTest.java 2007-11-09
20:46:09 UTC (rev 3885)
@@ -0,0 +1,53 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.sandbox.component;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import javax.faces.component.UIComponent;
+
+/**
+ * Unit test for simple Component.
+ */
+public class JSFComponentTest
+ extends TestCase
+{
+ /**
+ * Create the test case
+ *
+ * @param testName name of the test case
+ */
+ public JSFComponentTest( String testName )
+ {
+ super( testName );
+ }
+
+
+ /**
+ * Rigourous Test :-)
+ */
+ public void testComponent()
+ {
+ assertTrue( true );
+ }
+}