Author: RobJellinghaus
Date: 2007-06-26 01:10:05 -0400 (Tue, 26 Jun 2007)
New Revision: 281
Added:
trunk/samples/gwtjsf/
trunk/samples/gwtjsf/a4j-gwtKickStart/
trunk/samples/gwtjsf/a4j-gwtKickStart/.gwt-cache/
trunk/samples/gwtjsf/a4j-gwtKickStart/.gwt-cache/bytecode/
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/META-INF/
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/META-INF/faces-config.xml
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/META-INF/faces-config.xml.l4t
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/META-INF/gwt/
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/META-INF/gwt/demo.gwt.HelloWidget/
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/META-INF/gwt/demo.gwt.HelloWidget/history.html
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/META-INF/gwt/demo.gwt.HelloWidget/index.html
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/META-INF/gwt/demo.gwt.HelloWidget/tree_closed.gif
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/META-INF/gwt/demo.gwt.HelloWidget/tree_open.gif
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/META-INF/gwt/demo.gwt.HelloWidget/tree_white.gif
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/META-INF/module.taglib.xml
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/demo/
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/demo/gwt/
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/demo/gwt/HelloWidget.gwt.xml
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/demo/gwt/app/
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/demo/gwt/app/GreetingBean.java
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/demo/gwt/app/bundle/
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/demo/gwt/app/bundle/Labels.properties
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/demo/gwt/client/
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/demo/gwt/client/EventData.java
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/demo/gwt/client/HelloWidgetEntryPoint.java
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/demo/gwt/client/RequestGreetingService.java
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/demo/gwt/client/RequestGreetingServiceAsync.java
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/demo/gwt/client/ResultGreeting.java
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/demo/gwt/jsf/
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/demo/gwt/jsf/UIHelloWidget.java
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/demo/gwt/public/
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/demo/gwt/public/index.html
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/demo/gwt/server/
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/demo/gwt/server/MockHelloWidget.java
trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/
trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/WEB-INF/
trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/WEB-INF/faces-config.xml
trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/WEB-INF/lib/
trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/WEB-INF/lib/common-annotations.jar
trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/WEB-INF/lib/commons-beanutils.jar
trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/WEB-INF/lib/commons-collections.jar
trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/WEB-INF/lib/commons-digester.jar
trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/WEB-INF/lib/commons-logging.jar
trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/WEB-INF/lib/el-api.jar
trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/WEB-INF/lib/el-ri.jar
trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/WEB-INF/lib/jep-2.4.0.jar
trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/WEB-INF/lib/jsf-api.jar
trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/WEB-INF/lib/jsf-facelets.jar
trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/WEB-INF/lib/jsf-impl.jar
trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/WEB-INF/web.xml
trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/index.jsp
trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/pages/
trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/pages/Base.xhtml
trunk/samples/gwtjsf/a4j-gwtKickStart/build.properties.sample
trunk/samples/gwtjsf/a4j-gwtKickStart/build.xml
trunk/samples/gwtjsf/a4j-gwtKickStart/readme.txt
trunk/samples/gwtjsf/a4j-gwtKickStart/tests/
trunk/samples/gwtjsf/a4j-gwtKickStart/tests/demo/
trunk/samples/gwtjsf/a4j-gwtKickStart/tests/demo/gwt/
trunk/samples/gwtjsf/a4j-gwtKickStart/tests/demo/gwt/TestCase.gwt.xml
trunk/samples/gwtjsf/a4j-gwtKickStart/tests/demo/gwt/client/
trunk/samples/gwtjsf/a4j-gwtKickStart/tests/demo/gwt/client/EntryPointTestCase.java
Log:
This commit lands a modified version of the original a4j-gwtKickStart
example, tweaked to demonstrate the new GWT 1.4-based features of the
GWTJSF library.
Also see this thread:
http://jboss.com/index.html?module=bb&op=viewtopic&t=111314
Added: trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/META-INF/faces-config.xml
===================================================================
--- trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/META-INF/faces-config.xml
(rev 0)
+++ trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/META-INF/faces-config.xml 2007-06-26
05:10:05 UTC (rev 281)
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<faces-config version="1.2"
xmlns="http://java.sun.com/xml/ns/javaee"
+
xmlns:xi="http://www.w3.org/2001/XInclude"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
+ <component>
+ <component-type>demo.gwt.HelloWidget</component-type>
+ <component-class>demo.gwt.jsf.UIHelloWidget</component-class>
+ </component>
+</faces-config>
Added: trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/META-INF/faces-config.xml.l4t
===================================================================
--- trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/META-INF/faces-config.xml.l4t
(rev 0)
+++
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/META-INF/faces-config.xml.l4t 2007-06-26
05:10:05 UTC (rev 281)
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<PROCESS ENTITY="JSFProcess"/>
Added:
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/META-INF/gwt/demo.gwt.HelloWidget/history.html
===================================================================
---
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/META-INF/gwt/demo.gwt.HelloWidget/history.html
(rev 0)
+++
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/META-INF/gwt/demo.gwt.HelloWidget/history.html 2007-06-26
05:10:05 UTC (rev 281)
@@ -0,0 +1,20 @@
+<html>
+<head>
+<script>
+function hst() {
+ var search = location.search;
+ var historyToken = '';
+ if (location.search.length > 0)
+ historyToken = decodeURIComponent(location.search.substring(1));
+
+ document.getElementById('__historyToken').value = historyToken;
+ if (parent.__onHistoryChanged)
+ parent.__onHistoryChanged(historyToken);
+}
+</script></head>
+<body onload='hst()'>
+
+<input type='text' id='__historyToken'>
+
+</body>
+</html>
Added:
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/META-INF/gwt/demo.gwt.HelloWidget/index.html
===================================================================
---
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/META-INF/gwt/demo.gwt.HelloWidget/index.html
(rev 0)
+++
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/META-INF/gwt/demo.gwt.HelloWidget/index.html 2007-06-26
05:10:05 UTC (rev 281)
@@ -0,0 +1,22 @@
+<html>
+ <head>
+ <meta name="gwt:module" content="demo.gwt.HelloWidget">
+ <meta name="gwt:property" content="viewid=hello">
+ <meta name="gwt:property" content="action=/gwtFacesServlet">
+ <title>gwt-jsf integration</title>
+ </head>
+ <body bgcolor="white">
+ <script language="javascript" src="gwt.js"></script>
+ <iframe id="__gwt_historyFrame"
style="width:0;height:0;border:0"></iframe>
+
+ <span id="_id1" class="demo.gwt.HelloWidget">
+ <span id="_id1:_data" style="display:none;">
+ <span title="buttonLabel">Say Hello</span>
+ <span title="greeting">Hello GWT!</span>
+ <span title="requestGreetingService">false</span>
+ </span>
+ <input type="hidden" id="javax.faces.ViewState"
name="javax.faces.ViewState" value="_id0:_id0" />
+ </span>
+
+ </body>
+</html>
Added:
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/META-INF/gwt/demo.gwt.HelloWidget/tree_closed.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/META-INF/gwt/demo.gwt.HelloWidget/tree_closed.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/META-INF/gwt/demo.gwt.HelloWidget/tree_open.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/META-INF/gwt/demo.gwt.HelloWidget/tree_open.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/META-INF/gwt/demo.gwt.HelloWidget/tree_white.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/META-INF/gwt/demo.gwt.HelloWidget/tree_white.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/META-INF/module.taglib.xml
===================================================================
--- trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/META-INF/module.taglib.xml
(rev 0)
+++ trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/META-INF/module.taglib.xml 2007-06-26
05:10:05 UTC (rev 281)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE facelet-taglib PUBLIC
+ "-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN"
+ "http://java.sun.com/dtd/facelet-taglib_1_0.dtd">
+<facelet-taglib
xmlns="http://java.sun.com/JSF/Facelet">
+ <
namespace>https://ajax4jsf.dev.java.net/gwt/HelloWidget</namespace>
+
+
+ <tag>
+ <tag-name>component</tag-name>
+ <component>
+ <component-type>demo.gwt.HelloWidget</component-type>
+ <renderer-type>org.ajax4jsf.gwt.Widget</renderer-type>
+ <handler-class>org.ajax4jsf.gwt.jsf.GwtComponentHandler</handler-class>
+ </component>
+
+ </tag>
+</facelet-taglib>
\ No newline at end of file
Added: trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/demo/gwt/HelloWidget.gwt.xml
===================================================================
--- trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/demo/gwt/HelloWidget.gwt.xml
(rev 0)
+++
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/demo/gwt/HelloWidget.gwt.xml 2007-06-26
05:10:05 UTC (rev 281)
@@ -0,0 +1,10 @@
+<module>
+
+ <!-- Inherit the core Web Toolkit stuff. -->
+ <inherits name='com.google.gwt.user.User'/>
+ <inherits name='org.ajax4jsf.gwt.Jsf'/>
+ <!-- Specify the app entry point class. -->
+ <entry-point class='demo.gwt.client.HelloWidgetEntryPoint'/>
+ <public path="public"/>
+ <source path="client"/>
+</module>
Added: trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/demo/gwt/app/GreetingBean.java
===================================================================
--- trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/demo/gwt/app/GreetingBean.java
(rev 0)
+++
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/demo/gwt/app/GreetingBean.java 2007-06-26
05:10:05 UTC (rev 281)
@@ -0,0 +1,37 @@
+package demo.gwt.app;
+import demo.gwt.client.ResultGreeting;
+import demo.gwt.client.EventData;
+import demo.gwt.client.RequestGreetingService;
+
+public class GreetingBean implements RequestGreetingService {
+ String name;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * This method is invoked via the JSF GwtListenerMethodHelper:
+ * <gwt:gwtListener method="#{greetingBean.takeGreeting}" event
="demo.gwt.client.EventData"/>
+ * @param event the event data passed to the sendEvent method from the GWT client
side
+ * @return the GwtFacesresult data object that gets passed back from sendEvent
+ */
+ public ResultGreeting takeGreeting(EventData event) {
+ name = event.getName();
+ ResultGreeting result = new ResultGreeting();
+ result.setGreetingText("Hello " + name + " from JSF!");
+ return result;
+ }
+
+ /**
+ * This method is invoked via the JSF GwtListenerHelper:
+ * <gwt:gwtListener binding="#{greetingBean}"/>
+ */
+ public String makeGreeting (String input) {
+ return "Hello " + input + " from JSF RequestGreetingService
interface!";
+ }
+}
Added:
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/demo/gwt/app/bundle/Labels.properties
===================================================================
---
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/demo/gwt/app/bundle/Labels.properties
(rev 0)
+++
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/demo/gwt/app/bundle/Labels.properties 2007-06-26
05:10:05 UTC (rev 281)
@@ -0,0 +1,2 @@
+#
+buttonLabel=Say Hello!
Added: trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/demo/gwt/client/EventData.java
===================================================================
--- trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/demo/gwt/client/EventData.java
(rev 0)
+++
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/demo/gwt/client/EventData.java 2007-06-26
05:10:05 UTC (rev 281)
@@ -0,0 +1,16 @@
+package demo.gwt.client;
+
+import org.ajax4jsf.gwt.client.GwtFacesEvent;
+
+public class EventData extends GwtFacesEvent {
+ String name;
+
+public String getName() {
+ return name;
+}
+
+public void setName(String name) {
+ this.name = name;
+}
+
+}
Added:
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/demo/gwt/client/HelloWidgetEntryPoint.java
===================================================================
---
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/demo/gwt/client/HelloWidgetEntryPoint.java
(rev 0)
+++
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/demo/gwt/client/HelloWidgetEntryPoint.java 2007-06-26
05:10:05 UTC (rev 281)
@@ -0,0 +1,130 @@
+package demo.gwt.client;
+
+import java.util.Map;
+
+import org.ajax4jsf.gwt.client.ComponentEntryPoint;
+import org.ajax4jsf.gwt.client.GwtFacesServiceAsync;
+
+import com.google.gwt.user.client.Window;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.google.gwt.user.client.rpc.ServiceDefTarget;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.ClickListener;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.TextBox;
+import com.google.gwt.user.client.ui.Widget;
+import com.google.gwt.core.client.GWT;
+
+/**
+ * Entry point classes define <code>onModuleLoad()</code>.
+ */
+public class HelloWidgetEntryPoint extends ComponentEntryPoint {
+Label status;
+TextBox input;
+ protected Widget createWidget(final String id) {
+
+ Map m = getWidgetParams(id);
+ final String buttonLabel = (String) m.get("buttonLabel");
+
+ HorizontalPanel panel = new HorizontalPanel();
+
+
+ input = new TextBox();
+ status = new Label("Loaded.");
+
+ Button btn;
+
+ // This parameter is used only to allow this example to use either the old-style
+ // GwtFacesService or the new-style RequestGreetingService. Typical widgets will
+ // use one RPC style or the other, and won't need a special parameter to designate
+ // which.
+
+ final String useRequestGreetingService =
(String)m.get("requestGreetingService");
+ if ("true".equals(useRequestGreetingService)) {
+
+ // Set up a RequestGreetingService, specific to this particular component,
which
+ // routes to a specific bean that implements RequestGreetingService.
+ //
+ // The JSF uses this tag to wire the service up:
+ // <gwt:gwtListener binding="#{greetingBean}"/>
+ //
+ final RequestGreetingServiceAsync requestGreetingService =
createRequestGreetingService(id);
+
+ final AsyncCallback requestGreetingCallback = new AsyncCallback () {
+ public void onSuccess (Object result) {
+ if (null != result) {
+ status.setText("Loaded 2");
+ Window.alert((String)result);
+ } else {
+ status.setText("Request finished, but the result is
empty");
+ }
+ }
+
+ public void onFailure(Throwable caught) {
+ status.setText("Error call :" + caught.getMessage());
+ }
+ };
+
+ btn = new Button(buttonLabel, new ClickListener() {
+ public void onClick(Widget sender) {
+ requestGreetingService.makeGreeting(input.getText(),
requestGreetingCallback);
+ status.setText("Loading...");
+ }
+ });
+
+ } else {
+
+ // Set up a GwtFacesService which supports invoking an individual method on
an arbitrary bean,
+ // using the GwtFacesResult GwtFacesService.sendEvent(GwtFacesEvent)
service.
+ //
+ // The JSF uses this tag to wire the service up:
+ // <gwt:gwtListener method="#{greetingBean.takeGreeting}" event
="demo.gwt.client.EventData"/>
+ //
+ final GwtFacesServiceAsync facesService = createFacesService(id);
+
+ final AsyncCallback facesServiceCallback = new AsyncCallback() {
+ public void onSuccess(Object result) {
+ if (null != result) {
+ status.setText("Loaded");
+ String greeting = ((ResultGreeting)result).getGreetingText();
+ Window.alert(greeting);
+ } else {
+ status.setText("Request finished, but the result is
empty");
+ }
+ }
+
+ public void onFailure(Throwable caught) {
+ status.setText("Error call :" + caught.getMessage());
+ }
+ };
+
+ btn = new Button(buttonLabel, new ClickListener() {
+ public void onClick(Widget sender) {
+ EventData eventData = new EventData();
+ eventData.setName(input.getText());
+ facesService.sendEvent(eventData, facesServiceCallback);
+ status.setText("Loading...");
+ }
+ });
+ }
+
+
+ panel.add(input);
+ panel.add(btn);
+ panel.add(status);
+ return panel;
+ }
+
+
+ private static RequestGreetingServiceAsync createRequestGreetingService (String
clientId) {
+ RequestGreetingServiceAsync service = (RequestGreetingServiceAsync) GWT
+ .create(RequestGreetingService.class);
+ String endpoint = getEndpoint();
+ if (null != clientId) {
+ endpoint = endpoint + "&clientId=" + clientId;
+ }
+ ((ServiceDefTarget) service).setServiceEntryPoint(endpoint);
+ return service;
+ }
+}
Added:
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/demo/gwt/client/RequestGreetingService.java
===================================================================
---
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/demo/gwt/client/RequestGreetingService.java
(rev 0)
+++
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/demo/gwt/client/RequestGreetingService.java 2007-06-26
05:10:05 UTC (rev 281)
@@ -0,0 +1,13 @@
+package demo.gwt.client;
+
+import com.google.gwt.user.client.rpc.RemoteService;
+
+/**
+ * An interface exposed directly by the ResultGreeting bean.
+ */
+public interface RequestGreetingService extends RemoteService {
+ /**
+ * Get the greeting string, given the input string.
+ */
+ public String makeGreeting (String input);
+}
Added:
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/demo/gwt/client/RequestGreetingServiceAsync.java
===================================================================
---
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/demo/gwt/client/RequestGreetingServiceAsync.java
(rev 0)
+++
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/demo/gwt/client/RequestGreetingServiceAsync.java 2007-06-26
05:10:05 UTC (rev 281)
@@ -0,0 +1,14 @@
+package demo.gwt.client;
+
+import com.google.gwt.user.client.rpc.RemoteService;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+
+/**
+ * An interface exposed directly by the ResultGreeting bean.
+ */
+public interface RequestGreetingServiceAsync extends RemoteService {
+ /**
+ * Get the greeting string, given the input string.
+ */
+ public void makeGreeting (String input, AsyncCallback callback);
+}
Added:
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/demo/gwt/client/ResultGreeting.java
===================================================================
--- trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/demo/gwt/client/ResultGreeting.java
(rev 0)
+++
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/demo/gwt/client/ResultGreeting.java 2007-06-26
05:10:05 UTC (rev 281)
@@ -0,0 +1,15 @@
+package demo.gwt.client;
+
+import org.ajax4jsf.gwt.client.GwtFacesResult;
+
+public class ResultGreeting extends GwtFacesResult {
+ String greetingText;
+
+ public String getGreetingText() {
+ return this.greetingText;
+ }
+
+ public void setGreetingText(String greetingText) {
+ this.greetingText = greetingText;
+ }
+}
Added: trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/demo/gwt/jsf/UIHelloWidget.java
===================================================================
--- trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/demo/gwt/jsf/UIHelloWidget.java
(rev 0)
+++
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/demo/gwt/jsf/UIHelloWidget.java 2007-06-26
05:10:05 UTC (rev 281)
@@ -0,0 +1,150 @@
+/**
+ * Licensed under the Common Development and Distribution License,
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *
http://www.sun.com/cddl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package demo.gwt.jsf;
+
+import java.util.Map;
+import java.util.HashMap;
+import javax.el.MethodExpression;
+import javax.faces.FacesException;
+import javax.faces.component.UIComponentBase;
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.gwt.client.ComponentEntryPoint;
+import org.ajax4jsf.gwt.client.GwtFacesEvent;
+import org.ajax4jsf.gwt.client.GwtFacesResult;
+import org.ajax4jsf.gwt.jsf.GwtComponent;
+import org.ajax4jsf.gwt.jsf.GwtListener;
+import org.ajax4jsf.gwt.jsf.GwtSource;
+
+/**
+ * @author GENERATED BY ANT BUILD
+ *
+ */
+public class UIHelloWidget extends UIComponentBase implements GwtComponent,GwtSource {
+
+ /**
+ * field for instance of listener for GWT RPC events.
+ */
+ private MethodExpression _gwtActionListener;
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.component.UIComponent#getFamily()
+ */
+ public String getFamily() {
+ return "org.ajax4jsf.gwt.Widget";
+ }
+
+ /**
+ *
+ * @return Google web toolkit Module name for widget associated with component.
+ */
+ public String getModuleName() {
+ return "demo.gwt.HelloWidget";
+ }
+
+ /**
+ * For more then one Widget in one module, You can set concrete widget name
associated with component.
+ * this name is optional, You can use it in EntryPoint method createWidget for
choice.
+ * @return name of widget in module
+ */
+ public String getWidgetName() {
+ // For more then one widget in library spesify widget name in component.
+ return "HelloWidget";
+ }
+
+
+ /**
+ * Base renderer for widgets put parameters returned by this method into html
+ * code - on client side, you can got acces to it by {@link
ComponentEntryPoint#getWidgetParams(String id)} method
+ */
+ public Map getWidgetParameters() {
+ HashMap params = new HashMap();
+ params.put("greeting",getAttributes().get("greeting"));
+
params.put("buttonLabel",getAttributes().get("buttonLabel"));
+
params.put("requestGreetingService",getAttributes().get("requestGreetingService"));
+ return params;
+ }
+
+ /**
+ * @return Returns the gwtActionListener.
+ */
+ public MethodExpression getGwtActionListener() {
+ return _gwtActionListener;
+ }
+
+ /**
+ * @param gwtActionListener The gwtActionListener to set.
+ */
+ public void setGwtActionListener(MethodExpression gwtActionListener) {
+ _gwtActionListener = gwtActionListener;
+ }
+
+ /* (non-Javadoc)
+ * @see
javax.faces.component.UIComponentBase#restoreState(javax.faces.context.FacesContext,
java.lang.Object)
+ */
+ public void restoreState(FacesContext context, Object state) {
+ Object[] states = (Object[]) state;
+ super.restoreState(context, states[0]);
+ _gwtActionListener = (MethodExpression) restoreAttachedState(context,states[1]);
+ }
+
+ /* (non-Javadoc)
+ * @see
javax.faces.component.UIComponentBase#saveState(javax.faces.context.FacesContext)
+ */
+ public Object saveState(FacesContext context) {
+ Object[] states = new Object[2];
+ states[0] = super.saveState(context);
+ states[1] = saveAttachedState(context,_gwtActionListener);
+ return states;
+ }
+
+
+ /* (non-Javadoc)
+ * @see
org.ajax4jsf.gwt.jsf.GwtSource#addGwtListener(org.ajax4jsf.gwt.jsf.GwtListener)
+ */
+ public void addGwtListener(GwtListener listener) {
+ addFacesListener(listener);
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.gwt.jsf.GwtSource#getGwtListeners()
+ */
+ public GwtListener[] getGwtListeners() {
+ return (GwtListener[]) getFacesListeners(GwtListener.class);
+ }
+
+ /* (non-Javadoc)
+ * @see
org.ajax4jsf.gwt.jsf.GwtSource#removeGwtListener(org.ajax4jsf.gwt.jsf.GwtListener)
+ */
+ public void removeGwtListener(GwtListener listener) {
+ removeFacesListener(listener);
+ }
+
+ /*
+// * If You dont need to listeners, change GwtSource implementation to GwtListener and
uncoment next methods
+// *
+ public GwtFacesResult processEvent( GwtFacesEvent event ) {
+ GwtFacesResult res = null;
+ // Insert processing code here, like
+ // res = getGwtActionListener().invoke(getFacesContext()..getELContext(),new Object[] {
event });
+ return res;
+ }
+
+ public boolean isAcceptEvent(GwtFacesEvent event) {
+ return true;
+ }
+ */
+}
Added: trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/demo/gwt/public/index.html
===================================================================
--- trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/demo/gwt/public/index.html
(rev 0)
+++ trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/demo/gwt/public/index.html 2007-06-26
05:10:05 UTC (rev 281)
@@ -0,0 +1,22 @@
+<html>
+ <head>
+ <meta name="gwt:module" content="demo.gwt.HelloWidget">
+ <meta name="gwt:property" content="viewid=hello">
+ <meta name="gwt:property" content="action=/gwtFacesServlet">
+ <title>gwt-jsf integration</title>
+ </head>
+ <body bgcolor="white">
+ <script language="javascript" src="gwt.js"></script>
+ <iframe id="__gwt_historyFrame"
style="width:0;height:0;border:0"></iframe>
+
+ <span id="_id1" class="demo.gwt.HelloWidget">
+ <span id="_id1:_data" style="display:none;">
+ <span title="buttonLabel">Say Hello</span>
+ <span title="greeting">Hello GWT!</span>
+ <span title="requestGreetingService">false</span>
+ </span>
+ <input type="hidden" id="javax.faces.ViewState"
name="javax.faces.ViewState" value="_id0:_id0" />
+ </span>
+
+ </body>
+</html>
Added:
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/demo/gwt/server/MockHelloWidget.java
===================================================================
--- trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/demo/gwt/server/MockHelloWidget.java
(rev 0)
+++
trunk/samples/gwtjsf/a4j-gwtKickStart/JavaSource/demo/gwt/server/MockHelloWidget.java 2007-06-26
05:10:05 UTC (rev 281)
@@ -0,0 +1,40 @@
+/**
+ * Licensed under the Common Development and Distribution License,
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *
http://www.sun.com/cddl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package demo.gwt.server;
+
+import demo.gwt.client.ResultGreeting;
+import demo.gwt.client.EventData;
+import org.ajax4jsf.gwt.client.GwtFacesEvent;
+import org.ajax4jsf.gwt.client.GwtFacesException;
+import org.ajax4jsf.gwt.client.GwtFacesResult;
+import org.ajax4jsf.gwt.client.GwtFacesService;
+
+/**
+ * Stub class for test RPC calls in hosted mode.
+ * If no FacesContext instance found, RPC servlet will create instance of this class
+ * and call sendEvent method.
+ */
+public class MockHelloWidget implements GwtFacesService {
+
+ /* (non-Javadoc)
+ * @see
org.ajax4jsf.gwt.client.GwtFacesService#sendEvent(org.ajax4jsf.gwt.client.GwtFacesEvent)
+ */
+public GwtFacesResult sendEvent(GwtFacesEvent event){
+
+ ResultGreeting result = new ResultGreeting();
+ result.setGreetingText( "Hello " + ((EventData)event).getName() );
+ return result;
+ }
+}
Added: trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/WEB-INF/faces-config.xml
===================================================================
--- trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/WEB-INF/faces-config.xml
(rev 0)
+++ trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/WEB-INF/faces-config.xml 2007-06-26
05:10:05 UTC (rev 281)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces
Config 1.1//EN"
+ "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
+<faces-config>
+ <managed-bean>
+ <managed-bean-name>greetingBean</managed-bean-name>
+ <managed-bean-class>demo.gwt.app.GreetingBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ <managed-property>
+ <property-name>name</property-name>
+ <property-class>java.lang.String</property-class>
+ <value>GWT and JSF</value>
+ </managed-property>
+ </managed-bean>
+
+ <application>
+ <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
+ </application>
+
+ <lifecycle>
+
<phase-listener>org.ajax4jsf.gwt.jsf.GwtPhaseListener</phase-listener>
+ </lifecycle>
+</faces-config>
Added:
trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/WEB-INF/lib/common-annotations.jar
===================================================================
(Binary files differ)
Property changes on:
trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/WEB-INF/lib/common-annotations.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/WEB-INF/lib/commons-beanutils.jar
===================================================================
(Binary files differ)
Property changes on:
trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/WEB-INF/lib/commons-beanutils.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/WEB-INF/lib/commons-collections.jar
===================================================================
(Binary files differ)
Property changes on:
trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/WEB-INF/lib/commons-collections.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/WEB-INF/lib/commons-digester.jar
===================================================================
(Binary files differ)
Property changes on:
trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/WEB-INF/lib/commons-digester.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/WEB-INF/lib/commons-logging.jar
===================================================================
(Binary files differ)
Property changes on:
trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/WEB-INF/lib/commons-logging.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/WEB-INF/lib/el-api.jar
===================================================================
(Binary files differ)
Property changes on:
trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/WEB-INF/lib/el-api.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/WEB-INF/lib/el-ri.jar
===================================================================
(Binary files differ)
Property changes on:
trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/WEB-INF/lib/el-ri.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/WEB-INF/lib/jep-2.4.0.jar
===================================================================
(Binary files differ)
Property changes on:
trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/WEB-INF/lib/jep-2.4.0.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/WEB-INF/lib/jsf-api.jar
===================================================================
(Binary files differ)
Property changes on:
trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/WEB-INF/lib/jsf-api.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/WEB-INF/lib/jsf-facelets.jar
===================================================================
(Binary files differ)
Property changes on:
trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/WEB-INF/lib/jsf-facelets.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/WEB-INF/lib/jsf-impl.jar
===================================================================
(Binary files differ)
Property changes on:
trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/WEB-INF/lib/jsf-impl.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/WEB-INF/web.xml
===================================================================
--- trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/WEB-INF/web.xml
(rev 0)
+++ trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/WEB-INF/web.xml 2007-06-26 05:10:05
UTC (rev 281)
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+ <display-name>HelloWidget</display-name>
+
+ <context-param>
+ <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
+ <param-value>server</param-value>
+ </context-param>
+ <context-param>
+ <param-name>facelets.REFRESH_PERIOD</param-name>
+ <param-value>2</param-value>
+ </context-param>
+ <!-- Use Documents Saved as *.xhtml -->
+ <context-param>
+ <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
+ <param-value>.xhtml</param-value>
+ </context-param>
+ <!-- Special Debug Output for Development -->
+ <context-param>
+ <param-name>facelets.DEVELOPMENT</param-name>
+ <param-value>true</param-value>
+ </context-param>
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>/faces/*</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.jsf</url-pattern>
+ </servlet-mapping>
+ <login-config>
+ <auth-method>BASIC</auth-method>
+ </login-config>
+</web-app>
Added: trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/index.jsp
===================================================================
--- trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/index.jsp
(rev 0)
+++ trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/index.jsp 2007-06-26 05:10:05 UTC
(rev 281)
@@ -0,0 +1,7 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head></head>
+ <body>
+ <jsp:forward page="/faces/pages/Base.xhtml" />
+ </body>
+</html>
\ No newline at end of file
Added: trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/pages/Base.xhtml
===================================================================
--- trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/pages/Base.xhtml
(rev 0)
+++ trunk/samples/gwtjsf/a4j-gwtKickStart/WebContent/pages/Base.xhtml 2007-06-26 05:10:05
UTC (rev 281)
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+ -->
+<f:view
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:gwt="https://ajax4jsf.dev.java.net/gwt"
+
xmlns:widget="https://ajax4jsf.dev.java.net/gwt/HelloWidget"
+ contentType="text/html">
+ <f:loadBundle basename="demo.gwt.app.bundle.Labels"
var="bundle"/>
+ <gwt:page title="Wrapper HTML for Widget">
+ <f:facet name="head">
+ <h:panelGroup>
+ <!-- -->
+ <!-- Use normal html, such as style -->
+ <!-- -->
+ <style>
+ body,td,a,div,.p{font-family:arial,sans-serif}
+ div,td{color:#000000}
+ a:link,.w,.w a:link{color:#0000cc}
+ a:visited{color:#551a8b}
+ a:active{color:#ff0000}
+ </style>
+ </h:panelGroup>
+ </f:facet>
+
+ <!-- This widget binds to the takeGreeting method on greetingBean, via the
GwtFacesService
+ sendEvent method. -->
+ <widget:component id="main"
buttonLabel="#{bundle.buttonLabel}"
+ greeting="Hello #{greetingBean.name}!" >
+ <gwt:gwtListener method="#{greetingBean.takeGreeting}" event
="demo.gwt.client.EventData"/>
+ </widget:component>
+ <br/>
+
+ <!-- this widget binds directly to the RequestGreetingService interface on
greetingBean. -->
+ <widget:component id="main2"
buttonLabel="#{bundle.buttonLabel}2"
+ greeting="Hello #{greetingBean.name} 2!"
requestGreetingService="true">
+ <gwt:gwtListener serviceBean="#{greetingBean}"/>
+ </widget:component>
+ </gwt:page>
+</f:view>
Added: trunk/samples/gwtjsf/a4j-gwtKickStart/build.properties.sample
===================================================================
--- trunk/samples/gwtjsf/a4j-gwtKickStart/build.properties.sample
(rev 0)
+++ trunk/samples/gwtjsf/a4j-gwtKickStart/build.properties.sample 2007-06-26 05:10:05 UTC
(rev 281)
@@ -0,0 +1,17 @@
+# path to google web toolkit installation directory.
+# this directory must contain gwt-servlet.jar and gwt-user.jar
+gwt.home=/home/shura/work/gwt-1.4.10
+
+# gwtjsf home -- this will work if you have run "mvn install" at the root of an
ajax4jsf checkout,
+# or just in the gwtjsf directory.
+gwtjsf.home=../../gwtjsf/target
+gwtjsf.jar=gwtjsf-1.1.2-SNAPSHOT.jar
+gwtjsf.sources.jar=gwtjsf-1.1.2-SNAPSHOT-sources.jar
+
+# Path to JUnit home directory.
+# junit.home=/usr/local/eclipse/plugins/org.junit_3.8.1
+
+# If You plan to test JSF part with shale test environment, uncomment next lines and
+# set properly values.
+#htmlunit.home=/home/shura/work/htmlunit-1.8
+#shale.test.lib=/home/shura/work/jsf/shale-parent/shale-test/target/shale-test-1.0.3-SNAPSHOT.jar
Added: trunk/samples/gwtjsf/a4j-gwtKickStart/build.xml
===================================================================
--- trunk/samples/gwtjsf/a4j-gwtKickStart/build.xml (rev 0)
+++ trunk/samples/gwtjsf/a4j-gwtKickStart/build.xml 2007-06-26 05:10:05 UTC (rev 281)
@@ -0,0 +1,330 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<project name="org.ajax4jsf.gwt.sample.Components" default="help"
basedir=".">
+ <description>
+ org.ajax4jsf.gwt.sample.Components build file. This is used to package up your
project as a jar,
+ if you want to distribute it. This isn't needed for normal operation.
+ </description>
+
+ <!-- Load user property definition overrides -->
+ <property environment="env"/>
+ <property file="user.properties"/>
+ <property file="build.properties"/>
+ <property file="${user.home}/build.properties"/>
+
+ <!-- Establish property definition defaults -->
+ <property name="compile.debug" value="true"/>
+ <property name="compile.deprecation" value="false"/>
+ <property name="compile.optimize" value="true"/>
+ <property name="compile.source" value="1.4"/>
+ <property name="compile.target" value="1.4"/>
+ <!-- Project directories -->
+ <property name="build.dir" value="${basedir}/build"/>
+ <property name="build.expanded.dir"
value="${build.dir}/widgetexpanded"/>
+ <property name="build.war.dir" value="${build.dir}/war"/>
+ <property name="tests.src.dir" value="${basedir}/tests"/>
+ <property name="tests.classes.dir"
value="${build.dir}/tests"/>
+ <property name="module.src.dir"
value="${basedir}/JavaSource"/>
+ <property name="build.classes.dir"
value="${build.dir}/classes"/>
+
+ <!-- overridable in case of using Maven snapshot or some such -->
+ <property name="gwtjsf.jar" value="gwtjsf.jar"/>
+
+ <property name="project.name" value="a4j-gwtKickStart"/>
+
+ <property name="junit.home"
value="${eclipse.home}/plugins/org.junit_3.8.1"/>
+
+ <property name="jsf.lib.home"
value="WebContent/WEB-INF/lib"/>
+
+ <property name="htmlunit.home" value=""/>
+
+ <property name="shale.test.lib" value=""/>
+
+ <property name="gwt.module" value="demo.gwt.HelloWidget"/>
+
+ <property name="gwt.test.module"
value="demo.gwt.TestCase"/>
+
+ <target name="help">
+ <echo>
+To build WAR file, "ant clean war".
+
+Classpath:
+
+From this project: ${basedir}/JavaSource
+From gwtjsf/target: gwtjsf.jar
+From GWT: gwt-user.jar, gwt-servlet.jar, gwt-dev-windows.jar
+From ./WebContent/WEB-INF/lib: common-annotations.jar, commons-beanutils.jar,
+commons-collections.jar, commons-digester.jar, commons-logging.jar,
+el-api.jar, el-ri.jar, jep-2.4.0.jar, jsf-api.jar, jsf-facelets.jar, jsf-impl.jar
+
+To run in hosted mode with the embedded server, set up a debugger target as follows:
+ Main class: com.google.gwt.dev.GWTShell
+ Program parameters: -out WebContent demo.gwt.HelloWidget/index.html
+ Launch directory: ${basedir}
+
+To run in hosted mode against a separate Tomcat, set up a debugger target as follows:
+ Main class: com.google.gwt.dev.GWTShell
+ Program parameters: -noserver -out WebContent
http://localhost:8080/a4j-gwtKickStart
+ Launch directory: ${basedir}
+ </echo>
+ </target>
+
+
+ <!-- This is only for Linux and Mac at the present time. easy to add OS X though
-->
+ <target name="init">
+ <mkdir dir="${build.dir}"/>
+ <condition property="gwt.dev.lib"
value="${gwt.home}/gwt-dev-windows.jar">
+ <os family="windows"/>
+ </condition>
+ <condition property="gwt.dev.lib"
value="${gwt.home}/gwt-dev-linux.jar">
+ <equals arg1="${os.name}" arg2="Linux"/>
+ </condition>
+ </target>
+
+ <!-- set classpath -->
+ <path id="project.libs.path">
+
+ <!-- this doesn't exist??? -->
+ <!-- <pathelement path="${java.class.path}/"/> -->
+
+ <pathelement path="${gwt.home}/gwt-user.jar"/>
+ <pathelement path="${gwtjsf.home}/${gwtjsf.jar}"/>
+ <pathelement path="${gwtjsf.home}/${gwtjsf.sources.jar}"/>
+ <!-- Additional dependencies (such as junit) go here -->
+ <fileset dir="WebContent/WEB-INF/lib" id="weblibs">
+ <include name="*.jar"/>
+ <exclude name="gwt*.jar"/>
+ <exclude name="jsf-api.jar"/>
+ <exclude name="jsf-impl.jar"/>
+ </fileset>
+
+ <fileset dir="${jsf.lib.home}">
+ <include name="jsf-api.jar"/>
+ <include name="jsf-impl.jar"/>
+ </fileset>
+ </path>
+
+ <path id="test.hosted.class.path">
+ <!--path refid="project.libs.path" /-->
+ <pathelement path="${gwt.home}/gwt-user.jar"/>
+ <pathelement path="${junit.home}/junit.jar"/>
+ <pathelement path="WebContent/WEB-INF/lib/gwtjsf.jar"/>
+ </path>
+
+ <path id="test.class.path">
+ <path refid="project.libs.path"/>
+ <fileset dir="${htmlunit.home}/lib">
+ <include name="*.jar"/>
+ </fileset>
+ <pathelement path="${junit.home}/junit.jar"/>
+ <pathelement path="${shale.test.lib}"/>
+ </path>
+
+
+ <target name="compile-sample" description="Compile src to bin"
depends="init">
+ <mkdir dir="${build.classes.dir}"/>
+ <javac srcdir="${module.src.dir}"
destdir="${build.classes.dir}" includes="**"
debug="${compile.debug}"
+ debuglevel="lines,vars,source"
source="${compile.source}" target="${compile.target}"
+ optimize="${compile.optimize}"
deprecation="${compile.deprecation}">
+ <classpath refid="project.libs.path"/>
+ </javac>
+ </target>
+
+ <target name="compile-tests" description="Compile src to bin"
depends="init">
+ <mkdir dir="${tests.classes.dir}"/>
+ <javac srcdir="${tests.src.dir}"
destdir="${tests.classes.dir}" includes="**"
debug="${compile.debug}"
+ debuglevel="lines,vars,source"
source="${compile.source}" target="${compile.target}"
+ optimize="${compile.optimize}"
deprecation="${compile.deprecation}">
+ <classpath refid="project.libs.path"/>
+ </javac>
+ </target>
+
+ <!-- =================================
+ target: compile.js
+ ================================= -->
+ <target name="compile.js" depends="compile-sample"
description="--> Compile google widgets">
+ <java fork="true" dir="${basedir}"
classname="com.google.gwt.dev.GWTCompiler" failonerror="true">
+ <arg value="-style"/>
+ <arg value="DETAILED"/>
+ <arg value="-out"/>
+ <arg value="${build.expanded.dir}/META-INF/gwt"/>
+ <arg value="${gwt.module}"/>
+ <classpath path="${module.src.dir}"/>
+ <classpath path="${build.classes.dir}"/>
+ <classpath location="${gwt.dev.lib}"></classpath>
+ <classpath refid="project.libs.path"></classpath>
+ </java>
+ </target>
+
+ <!-- =================================
+ target: hosted mode shell
+ ================================= -->
+ <target name="shell" depends="compile-sample"
description="--> Compile google widgets hosted mode shell ">
+ <delete dir="${build.dir}/tomcat/work"
failonerror="false"/>
+ <java fork="true" dir="${build.dir}"
classname="com.google.gwt.dev.GWTShell">
+ <arg value="-style"/>
+ <arg value="detailed"/>
+ <arg value="-out"/>
+ <arg value="WebContent"/>
+ <arg value="${gwt.module}/index.html"/>
+ <classpath path="${module.src.dir}"/>
+ <classpath path="${build.classes.dir}"/>
+ <classpath location="${gwt.dev.lib}"></classpath>
+ <classpath refid="project.libs.path"></classpath>
+ <!-- <env key="LD_LIBRARY_PATH"
value="${gwt.home}${path.separator}${env.LD_LIBRARY_PATH}"/> -->
+ <!-- <env key="PATH"
value="${gwt.home}${path.separator}${env.PATH}"/> -->
+ <env key="LANG" value="en_US"/>
+ </java>
+ </target>
+
+
+ <!-- =================================
+ target: tests
+ ================================= -->
+ <target name="tests" depends="compile-tests"
description="--> Junit test cases">
+ <mkdir dir="${build.dir}/testreports"/>
+ <delete dir="${build.dir}/tomcat/work"
failonerror="false"/>
+ <!-- Hosted mode JUnit tests ( client part ) -->
+ <junit fork="true" forkmode="once"
dir="${build.dir}" printsummary="true" showoutput="true"
filtertrace="false">
+ <classpath path="${tests.src.dir}"/>
+ <classpath path="${tests.classes.dir}"/>
+ <classpath path="${gwt.dev.lib}"></classpath>
+ <classpath refid="test.hosted.class.path"></classpath>
+ <env key="LD_LIBRARY_PATH"
value="${gwt.home}${path.separator}${env.LD_LIBRARY_PATH}"/>
+ <env key="PATH"
value="${gwt.home}${path.separator}${env.PATH}"/>
+ <env key="LANG" value="en_US"/>
+ <formatter type="plain"/>
+ <batchtest todir="${build.dir}/testreports">
+ <fileset dir="${tests.src.dir}">
+ <include name="**/client/*Test*.java"/>
+ <exclude name="**/AllTests.java"/>
+ </fileset>
+ </batchtest>
+ </junit>
+ <!-- Server part tests -->
+ <junit fork="true" dir="${build.dir}"
printsummary="true" showoutput="true"
filtertrace="false">
+ <classpath path="${tests.src.dir}"/>
+ <classpath path="${tests.classes.dir}"/>
+ <classpath refid="test.class.path"></classpath>
+ <formatter type="plain"/>
+ <batchtest todir="${build.dir}/testreports">
+ <fileset dir="${tests.src.dir}">
+ <exclude name="**/client/*Test*.java"/>
+ <include name="**/*Test*.java"/>
+ <exclude name="**/AllTests.java"/>
+ </fileset>
+ </batchtest>
+ </junit>
+ </target>
+
+
+ <target name="package" depends="compile.js"
description="Package up the HelloWidget as a jar">
+
+ <!-- copy all the META-INF source files to the expanded directory -->
+ <copy todir="${build.expanded.dir}">
+ <fileset dir="${module.src.dir}">
+ <include name="**"/>
+ <exclude name="**/*.java"/>
+ </fileset>
+ </copy>
+
+ <jar destfile="${build.dir}/${gwt.module}.jar">
+ <fileset dir="${build.classes.dir}"/>
+ <fileset dir="${build.expanded.dir}"/>
+ </jar>
+ </target>
+
+
+ <!-- =================================
+ target: war
+ ================================= -->
+ <target name="war" depends="package" description="-->
Create sample war">
+ <copy todir="${build.war.dir}">
+ <fileset dir="WebContent"/>
+ </copy>
+
+ <copy todir="${build.war.dir}/WEB-INF/lib">
+ <fileset dir="${gwt.home}">
+ <!-- don't need gwt-user.jar except for compiling, or maybe in
hosted mode??? -->
+ <!--
+ <include name="gwt-user.jar"/>
+ -->
+ <include name="gwt-servlet.jar"/>
+ </fileset>
+ <fileset dir="${gwtjsf.home}">
+ <include name="${gwtjsf.jar}"/>
+ </fileset>
+
+ <fileset dir="${jsf.lib.home}">
+ <include name="jsf-api.jar"/>
+ <include name="jsf-impl.jar"/>
+ </fileset>
+
+ </copy>
+ <!-- <war destfile="${build.dir}/${project.name}.war"
webxml="WebContent/WEB-INF/web.xml"> -->
+ <war destfile="${build.dir}/${project.name}.war"
webxml="WebContent/WEB-INF/web.xml">
+ <fileset dir="${build.war.dir}"/>
+ <lib dir="${build.dir}">
+ <include name="${gwt.module}.jar"/>
+ </lib>
+ </war>
+ </target>
+
+
+ <target name="clean">
+ <!-- Delete the bin directory tree -->
+ <delete dir="${build.dir}" failonerror="false"/>
+ </target>
+
+
+ <!-- If you include catalina-ant.jar on your Ant classpath, you can use the following
targets
+ to handle Tomcat installation of this example.
+
+ <property name="tomcat.home"
value="${env.CATALINA_HOME}"/>
+ <property name="tomcat.base"
value="${env.CATALINA_BASE}"/>
+
+ <target name="deploy" depends="undeploy,war"
+ description="Deploy the example to Tomcat">
+ <echo>Don't forget to set the path of tomcat.home to Tomcat root
directory !</echo>
+ <copy file="${build.dir}/${project.name}.war"
todir="${tomcat.base}/webapps"/>
+ <echo>After you start Tomcat, the example will be available at:
http://localhost:8080/${example.name}</echo>
+ </target>
+
+ <target name="undeploy"
+ description="Undeploy the example from Tomcat">
+ <delete file="${tomcat.base}/webapps/${project.name}.war"/>
+ <delete dir="${tomcat.base}/webapps/${project.name}"/>
+ </target>
+
+ <taskdef name="stop"
classname="org.apache.catalina.ant.StopTask">
+ <classpath>
+ <path path="${tomcat.home}/server/lib/catalina-ant.jar"/>
+ </classpath>
+ </taskdef>
+ <taskdef name="start"
classname="org.apache.catalina.ant.StartTask">
+ <classpath>
+ <path path="${tomcat.home}/server/lib/catalina-ant.jar"/>
+ </classpath>
+ </taskdef>
+
+ <target name="stop" description="Stop a local Tomcat.">
+ <exec executable="${tomcat.home}/bin/shutdown.bat" dir="."
vmlauncher="false" failonerror="false">
+ <env key="CATALINA_BASE" file="${tomcat.base}"/>
+ </exec>
+
+ <sleep seconds="2"/>
+ </target>
+
+ <target name="start" description="Start a local Tomcat.">
+ <exec executable="${tomcat.home}/bin/startup.bat" dir="."
vmlauncher="false" spawn="true">
+ <env key="CATALINA_BASE" file="${tomcat.base}"/>
+ <env key="JPDA_TRANSPORT" value="dt_socket"/>
+ <env key="JPDA_ADDRESS" value="5005"/>
+ <arg value="start"/>
+ </exec>
+ </target>
+
+ <target name="bouncedeploy" depends="stop,deploy,start"/>
+
+ ... end commented-out Tomcat targets -->
+
+</project>
Added: trunk/samples/gwtjsf/a4j-gwtKickStart/readme.txt
===================================================================
--- trunk/samples/gwtjsf/a4j-gwtKickStart/readme.txt (rev 0)
+++ trunk/samples/gwtjsf/a4j-gwtKickStart/readme.txt 2007-06-26 05:10:05 UTC (rev 281)
@@ -0,0 +1,85 @@
+This sample application demonstrates the GWT-JSF integration library with a very simple
+widget implementation.
+
+
+BUILDING THE SAMPLE
+
+This assumes you have already downloaded this sample as part of the Ajax4JSF
distribution,
+and have compiled it with Maven, as per the instructions here:
+
+
http://labs.jboss.com/wiki/HowToBuildAjax4jsf
+
+- Download a copy of the GWT 1.4.10 release candidate (or later):
+
+
http://code.google.com/webtoolkit/download.html#rc
+
+- Copy the "build.properties.sample" file to "build.properties".
+
+- Edit the "build.properties" file to point to your GWT distribution.
+ You may also need to tweak the gwtjsf properties to point at the gwtjsf libs you built
+ via Maven, depending on whether the Ajax4JSF tree is still at version 1.1.2-SNAPSHOT.
+
+- Run "ant clean war". This will create a build/a4j-gwtKickStart.war file.
+
+- Drop this war file into a Tomcat webapps directory.
+
+- Go to
http://localhost:8080/a4j-gwtKickStart to see the sample in action.
+
+
+THE SAMPLE, EXPLAINED
+
+The GWT widget consists of a text entry box, a label, and a button. Entering text in
the
+box and clicking the button executes a GWT RPC call to the server; the server response
is
+shown in an alert.
+
+There are two ways to use the widget in a JSF page. See WebContent/pages/Base.xhtml for
+the source quoted here.
+
+The widget can be configured to use a JSF event listener on the server side:
+
+ <widget:component id="main"
buttonLabel="#{bundle.buttonLabel}"
+ greeting="Hello #{greetingBean.name}!" >
+ <gwt:gwtListener method="#{greetingBean.takeGreeting}"
+ event ="demo.gwt.client.EventData"/>
+ </widget:component>
+
+This tells the widget to invoke the takeGreeting method of the JSF managed bean named
+greetingBean. With this style of listener, the listener method must take a single
argument
+which is subclassed from GwtFacesEvent, and must return an object which is subclassed
from
+GwtFacesResult. This was the original style of GWT-JSF integration.
+
+The second way to use the widget is to configure it to directly invoke a custom RPC
+interface on the server:
+
+ <widget:component id="main2"
buttonLabel="#{bundle.buttonLabel}2"
+ greeting="Hello #{greetingBean.name} 2!"
+ requestGreetingService="true">
+ <gwt:gwtListener serviceBean="#{greetingBean}"/>
+ </widget:component>
+
+This invokes the greetingBean.requestGreeting method (via the RequestGreetingService
custom
+interface), passing a String and receiving a String in return. This style of RPC is
more
+familiar to GWT users, but was not possible with GWTJSF prior to the release of GWT 1.4.
+This style is recommended for future development with GWTJSF, but the previous style is
still
+supported for backwards compatibility.
+
+
+FOR MORE INFORMATION
+
+For more in-depth explanation of the details of this sample (in its pre-GwT-1.4
incarnation),
+see this article:
+
+http://www.theserverside.com/tt/articles/article.tss?l=GWTandJSF
+
+For more details on the changes made since the original release of the library, see
here:
+
+http://unrealities.com/seamgwt/article_0.2.html
+
+Please post any questions to the Ajax4JSF developer's forum:
+
+http://jboss.com/index.html?module=bb&op=viewforum&f=260
+
+Thanks to Sergey Smirnov, Alex Smirnov, and Igor Shabalov, the original developers of
the
+(vast majority of the) GWTJSF library.
+
+-- Rob Jellinghaus, 20070625
Added: trunk/samples/gwtjsf/a4j-gwtKickStart/tests/demo/gwt/TestCase.gwt.xml
===================================================================
--- trunk/samples/gwtjsf/a4j-gwtKickStart/tests/demo/gwt/TestCase.gwt.xml
(rev 0)
+++ trunk/samples/gwtjsf/a4j-gwtKickStart/tests/demo/gwt/TestCase.gwt.xml 2007-06-26
05:10:05 UTC (rev 281)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module>
+
+ <!-- Inherit the JUnit support -->
+ <inherits name='org.ajax4jsf.gwt.JUnit'/>
+ <source path="client"/>
+</module>
Added:
trunk/samples/gwtjsf/a4j-gwtKickStart/tests/demo/gwt/client/EntryPointTestCase.java
===================================================================
--- trunk/samples/gwtjsf/a4j-gwtKickStart/tests/demo/gwt/client/EntryPointTestCase.java
(rev 0)
+++
trunk/samples/gwtjsf/a4j-gwtKickStart/tests/demo/gwt/client/EntryPointTestCase.java 2007-06-26
05:10:05 UTC (rev 281)
@@ -0,0 +1,18 @@
+package demo.gwt.client;
+
+// TODO: make this not be excluded anymore... causing horrible trouble trying to run
hosted mode in IDEA...
+// it insists that this is part of the client code! why????
+
+import com.google.gwt.junit.client.GWTTestCase;
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.Element;
+
+public class EntryPointTestCase extends GWTTestCase {
+
+
+ public String getModuleName() {
+ // TODO Auto-generated method stub
+ return "demo.gwt.TestCase";
+ }
+
+}