[isidorus-cvs] r476 - in branches/gdl-frontend/playground/GWT-JSNI/GWT-JSNI-example: src/gdl/isidor/us/client src/gdl/isidor/us/server src/gdl/isidor/us/shared war war/WEB-INF

lgiessmann at common-lisp.net lgiessmann at common-lisp.net
Tue Jun 14 14:15:46 UTC 2011


Author: lgiessmann
Date: Tue Jun 14 07:15:45 2011
New Revision: 476

Log:
changed the fundamentals code sections

Deleted:
   branches/gdl-frontend/playground/GWT-JSNI/GWT-JSNI-example/src/gdl/isidor/us/client/GreetingService.java
   branches/gdl-frontend/playground/GWT-JSNI/GWT-JSNI-example/src/gdl/isidor/us/client/GreetingServiceAsync.java
   branches/gdl-frontend/playground/GWT-JSNI/GWT-JSNI-example/src/gdl/isidor/us/server/GreetingServiceImpl.java
   branches/gdl-frontend/playground/GWT-JSNI/GWT-JSNI-example/src/gdl/isidor/us/shared/FieldVerifier.java
Modified:
   branches/gdl-frontend/playground/GWT-JSNI/GWT-JSNI-example/src/gdl/isidor/us/client/GWT_JSNI_example.java
   branches/gdl-frontend/playground/GWT-JSNI/GWT-JSNI-example/war/GWT_JSNI_example.css
   branches/gdl-frontend/playground/GWT-JSNI/GWT-JSNI-example/war/GWT_JSNI_example.html
   branches/gdl-frontend/playground/GWT-JSNI/GWT-JSNI-example/war/WEB-INF/web.xml

Modified: branches/gdl-frontend/playground/GWT-JSNI/GWT-JSNI-example/src/gdl/isidor/us/client/GWT_JSNI_example.java
==============================================================================
--- branches/gdl-frontend/playground/GWT-JSNI/GWT-JSNI-example/src/gdl/isidor/us/client/GWT_JSNI_example.java	Tue Jun 14 05:31:00 2011	(r475)
+++ branches/gdl-frontend/playground/GWT-JSNI/GWT-JSNI-example/src/gdl/isidor/us/client/GWT_JSNI_example.java	Tue Jun 14 07:15:45 2011	(r476)
@@ -1,152 +1,45 @@
 package gdl.isidor.us.client;
 
-import gdl.isidor.us.shared.FieldVerifier;
 import com.google.gwt.core.client.EntryPoint;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.event.dom.client.KeyCodes;
-import com.google.gwt.event.dom.client.KeyUpEvent;
-import com.google.gwt.event.dom.client.KeyUpHandler;
-import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.Window;
 import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.DialogBox;
-import com.google.gwt.user.client.ui.HTML;
-import com.google.gwt.user.client.ui.Label;
 import com.google.gwt.user.client.ui.RootPanel;
-import com.google.gwt.user.client.ui.TextBox;
+import com.google.gwt.user.client.ui.AbsolutePanel;
 import com.google.gwt.user.client.ui.VerticalPanel;
 
 /**
  * Entry point classes define <code>onModuleLoad()</code>.
  */
 public class GWT_JSNI_example implements EntryPoint {
-	/**
-	 * The message displayed to the user when the server cannot be reached or
-	 * returns an error.
-	 */
-	private static final String SERVER_ERROR = "An error occurred while "
-			+ "attempting to contact the server. Please check your network "
-			+ "connection and try again.";
-
-	/**
-	 * Create a remote service proxy to talk to the server-side Greeting service.
-	 */
-	private final GreetingServiceAsync greetingService = GWT
-			.create(GreetingService.class);
+	private VerticalPanel mainPanel = new VerticalPanel();
+	private AbsolutePanel absolutePanel = new AbsolutePanel();
+	
 
 	/**
 	 * This is the entry point method.
 	 */
 	public void onModuleLoad() {
-		final Button sendButton = new Button("Send");
-		final TextBox nameField = new TextBox();
-		nameField.setText("GWT User");
-		final Label errorLabel = new Label();
-
-		// We can add style names to widgets
-		sendButton.addStyleName("sendButton");
-
-		// Add the nameField and sendButton to the RootPanel
-		// Use RootPanel.get() to get the entire body element
-		RootPanel.get("nameFieldContainer").add(nameField);
-		RootPanel.get("sendButtonContainer").add(sendButton);
-		RootPanel.get("errorLabelContainer").add(errorLabel);
-
-		// Focus the cursor on the name field when the app loads
-		nameField.setFocus(true);
-		nameField.selectAll();
-
-		// Create the popup dialog box
-		final DialogBox dialogBox = new DialogBox();
-		dialogBox.setText("Remote Procedure Call");
-		dialogBox.setAnimationEnabled(true);
-		final Button closeButton = new Button("Close");
-		// We can set the id of a widget by accessing its Element
-		closeButton.getElement().setId("closeButton");
-		final Label textToServerLabel = new Label();
-		final HTML serverResponseLabel = new HTML();
-		VerticalPanel dialogVPanel = new VerticalPanel();
-		dialogVPanel.addStyleName("dialogVPanel");
-		dialogVPanel.add(new HTML("<b>Sending name to the server:</b>"));
-		dialogVPanel.add(textToServerLabel);
-		dialogVPanel.add(new HTML("<br><b>Server replies:</b>"));
-		dialogVPanel.add(serverResponseLabel);
-		dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_RIGHT);
-		dialogVPanel.add(closeButton);
-		dialogBox.setWidget(dialogVPanel);
-
-		// Add a handler to close the DialogBox
-		closeButton.addClickHandler(new ClickHandler() {
-			public void onClick(ClickEvent event) {
-				dialogBox.hide();
-				sendButton.setEnabled(true);
-				sendButton.setFocus(true);
-			}
-		});
-
-		// Create a handler for the sendButton and nameField
-		class MyHandler implements ClickHandler, KeyUpHandler {
-			/**
-			 * Fired when the user clicks on the sendButton.
-			 */
-			public void onClick(ClickEvent event) {
-				sendNameToServer();
-			}
-
-			/**
-			 * Fired when the user types in the nameField.
-			 */
-			public void onKeyUp(KeyUpEvent event) {
-				if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
-					sendNameToServer();
-				}
-			}
-
-			/**
-			 * Send the name from the nameField to the server and wait for a response.
-			 */
-			private void sendNameToServer() {
-				// First, we validate the input.
-				errorLabel.setText("");
-				String textToServer = nameField.getText();
-				if (!FieldVerifier.isValidName(textToServer)) {
-					errorLabel.setText("Please enter at least four characters");
-					return;
-				}
-
-				// Then, we send the input to the server.
-				sendButton.setEnabled(false);
-				textToServerLabel.setText(textToServer);
-				serverResponseLabel.setText("");
-				greetingService.greetServer(textToServer,
-						new AsyncCallback<String>() {
-							public void onFailure(Throwable caught) {
-								// Show the RPC error message to the user
-								dialogBox
-										.setText("Remote Procedure Call - Failure");
-								serverResponseLabel
-										.addStyleName("serverResponseLabelError");
-								serverResponseLabel.setHTML(SERVER_ERROR);
-								dialogBox.center();
-								closeButton.setFocus(true);
-							}
-
-							public void onSuccess(String result) {
-								dialogBox.setText("Remote Procedure Call");
-								serverResponseLabel
-										.removeStyleName("serverResponseLabelError");
-								serverResponseLabel.setHTML(result);
-								dialogBox.center();
-								closeButton.setFocus(true);
-							}
-						});
-			}
-		}
-
-		// Add a handler to send the name to the server
-		MyHandler handler = new MyHandler();
-		sendButton.addClickHandler(handler);
-		nameField.addKeyUpHandler(handler);
+		mainPanel.setBorderWidth(1);
+		
+		int mpWidth = 500;
+		int mpHeight = 500;
+		mainPanel.setPixelSize(mpWidth, mpHeight);
+		RootPanel.get("gwtCode").add(mainPanel);
+		
+		int apWidth = 290;
+		int apHeight = 290;
+		absolutePanel.setPixelSize(apWidth, apHeight);
+		mainPanel.add(absolutePanel);
+		DOM.setStyleAttribute(absolutePanel.getElement(), "marginLeft", "auto");
+		DOM.setStyleAttribute(absolutePanel.getElement(), "marginRight", "auto");
+		DOM.setStyleAttribute(absolutePanel.getElement(), "marginTop", (mpHeight - apHeight)/2 + "px");
+		
+		Button actionButton = new Button();
+		actionButton.setText("process");
+		absolutePanel.addStyleName("absolutePanel");
+		
+		absolutePanel.add(actionButton);
+		absolutePanel.setWidgetPosition(actionButton, apWidth - actionButton.getOffsetWidth(), apHeight - actionButton.getOffsetHeight());
 	}
 }

Modified: branches/gdl-frontend/playground/GWT-JSNI/GWT-JSNI-example/war/GWT_JSNI_example.css
==============================================================================
--- branches/gdl-frontend/playground/GWT-JSNI/GWT-JSNI-example/war/GWT_JSNI_example.css	Tue Jun 14 05:31:00 2011	(r475)
+++ branches/gdl-frontend/playground/GWT-JSNI/GWT-JSNI-example/war/GWT_JSNI_example.css	Tue Jun 14 07:15:45 2011	(r476)
@@ -32,3 +32,7 @@
 #closeButton {
   margin: 15px 6px 6px;
 }
+
+.absolutePanel{
+	background-color: yellow;
+	}
\ No newline at end of file

Modified: branches/gdl-frontend/playground/GWT-JSNI/GWT-JSNI-example/war/GWT_JSNI_example.html
==============================================================================
--- branches/gdl-frontend/playground/GWT-JSNI/GWT-JSNI-example/war/GWT_JSNI_example.html	Tue Jun 14 05:31:00 2011	(r475)
+++ branches/gdl-frontend/playground/GWT-JSNI/GWT-JSNI-example/war/GWT_JSNI_example.html	Tue Jun 14 07:15:45 2011	(r476)
@@ -17,7 +17,7 @@
     <!--                                           -->
     <!-- Any title is fine                         -->
     <!--                                           -->
-    <title>Web Application Starter Project</title>
+    <title>GWT/JSNI with tmjs</title>
     
     <!--                                           -->
     <!-- This script loads your compiled module.   -->
@@ -45,19 +45,10 @@
       </div>
     </noscript>
 
-    <h1>Web Application Starter Project</h1>
+    <h1>GWT/JSNI with tmjs</h1>
 
-    <table align="center">
-      <tr>
-        <td colspan="2" style="font-weight:bold;">Please enter your name:</td>        
-      </tr>
-      <tr>
-        <td id="nameFieldContainer"></td>
-        <td id="sendButtonContainer"></td>
-      </tr>
-      <tr>
-        <td colspan="2" style="color:red;" id="errorLabelContainer"></td>
-      </tr>
-    </table>
+	<center>
+		<div id="gwtCode"></div>
+	</center>
   </body>
 </html>

Modified: branches/gdl-frontend/playground/GWT-JSNI/GWT-JSNI-example/war/WEB-INF/web.xml
==============================================================================
--- branches/gdl-frontend/playground/GWT-JSNI/GWT-JSNI-example/war/WEB-INF/web.xml	Tue Jun 14 05:31:00 2011	(r475)
+++ branches/gdl-frontend/playground/GWT-JSNI/GWT-JSNI-example/war/WEB-INF/web.xml	Tue Jun 14 07:15:45 2011	(r476)
@@ -6,15 +6,6 @@
 <web-app>
   
   <!-- Servlets -->
-  <servlet>
-    <servlet-name>greetServlet</servlet-name>
-    <servlet-class>gdl.isidor.us.server.GreetingServiceImpl</servlet-class>
-  </servlet>
-  
-  <servlet-mapping>
-    <servlet-name>greetServlet</servlet-name>
-    <url-pattern>/gwt_jsni_example/greet</url-pattern>
-  </servlet-mapping>
   
   <!-- Default page to serve -->
   <welcome-file-list>




More information about the Isidorus-cvs mailing list