Update to ApplicationCreator templates. Review by: scottb git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@2890 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/user/tools/AppClassTemplate.javasrc b/user/src/com/google/gwt/user/tools/AppClassTemplate.javasrc index e8c0251..f3ca397 100644 --- a/user/src/com/google/gwt/user/tools/AppClassTemplate.javasrc +++ b/user/src/com/google/gwt/user/tools/AppClassTemplate.javasrc
@@ -3,8 +3,10 @@ import com.google.gwt.core.client.EntryPoint; import com.google.gwt.user.client.ui.Button; import com.google.gwt.user.client.ui.ClickListener; -import com.google.gwt.user.client.ui.Label; +import com.google.gwt.user.client.ui.DialogBox; +import com.google.gwt.user.client.ui.Image; import com.google.gwt.user.client.ui.RootPanel; +import com.google.gwt.user.client.ui.VerticalPanel; import com.google.gwt.user.client.ui.Widget; /** @@ -16,23 +18,43 @@ * This is the entry point method. */ public void onModuleLoad() { - final Button button = new Button("Click me"); - final Label label = new Label(); + Image img = new Image("http://code.google.com/webtoolkit/logo-185x175.gif"); + Button button = new Button("Click me"); - button.addClickListener(new ClickListener() { + VerticalPanel vPanel = new VerticalPanel(); + // We can add style names. + vPanel.addStyleName("widePanel"); + vPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER); + vPanel.add(img); + vPanel.add(button); + + // Add image and button to the RootPanel + RootPanel.get().add(vPanel); + + // Create the dialog box + final DialogBox dialogBox = new DialogBox(); + dialogBox.setText("Welcome to GWT!"); + dialogBox.setAnimationEnabled(true); + Button closeButton = new Button("close"); + VerticalPanel dialogVPanel = new VerticalPanel(); + dialogVPanel.setWidth("100%"); + dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER); + dialogVPanel.add(closeButton); + + closeButton.addClickListener(new ClickListener() { public void onClick(Widget sender) { - if (label.getText().equals("")) - label.setText("Hello World!"); - else - label.setText(""); + dialogBox.hide(); } }); - /* Assume that the host HTML has elements defined whose - * IDs are "slot1", "slot2". You must be careful to ensure - * that all IDs are unique if you use this approach. - */ - RootPanel.get("slot1").add(button); - RootPanel.get("slot2").add(label); + // Set the contents of the Widget + dialogBox.setWidget(dialogVPanel); + + button.addClickListener(new ClickListener() { + public void onClick(Widget sender) { + dialogBox.center(); + dialogBox.show(); + } + }); } }
diff --git a/user/src/com/google/gwt/user/tools/AppCss.csssrc b/user/src/com/google/gwt/user/tools/AppCss.csssrc index 84c87d6..8ac0360 100644 --- a/user/src/com/google/gwt/user/tools/AppCss.csssrc +++ b/user/src/com/google/gwt/user/tools/AppCss.csssrc
@@ -1 +1,33 @@ -/** Add css rules here for your application. */ +/** Add css rules here for your application. */ +body { + font-family:arial,sans-serif +} + +div,td { + color:#000000 +} + +a:link { + color:#0000cc +} + +a:visited { + color:#551a8b +} + +a:active { + color:#ff0000 +} + +button { + display: block; + font-size: 16pt +} + +.widePanel { + width: 100% +} + +img { + margin-top: 20px; +} \ No newline at end of file
diff --git a/user/src/com/google/gwt/user/tools/AppHtml.htmlsrc b/user/src/com/google/gwt/user/tools/AppHtml.htmlsrc index 269f56c..246fc64 100644 --- a/user/src/com/google/gwt/user/tools/AppHtml.htmlsrc +++ b/user/src/com/google/gwt/user/tools/AppHtml.htmlsrc
@@ -1,6 +1,6 @@ -<!-- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" --> -<!-- "http://www.w3.org/TR/html4/loose.dtd"> --> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" +"http://www.w3.org/TR/html4/loose.dtd"> <!-- The HTML 4.01 Transitional DOCTYPE declaration--> <!-- above set at the top of the file will set --> @@ -17,18 +17,7 @@ <!-- --> <!-- Any title is fine --> <!-- --> - <title>Wrapper HTML for @className</title> - - <!-- --> - <!-- Use normal html, such as style --> - <!-- --> - <style type="text/css"> - 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> + <title>@className</title> <!-- --> <!-- This script loads your compiled module. --> @@ -48,19 +37,5 @@ <!-- OPTIONAL: include this if you want history support --> <iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' style="position:absolute;width:0;height:0;border:0"></iframe> - <h1>@className</h1> - - <p> - This is an example of a host page for the @className application. - You can attach a Web Toolkit module to any HTML page you like, - making it easy to add bits of AJAX functionality to existing pages - without starting from scratch. - </p> - <table> - <tr> - <td id="slot1"></td> - <td id="slot2"></td> - </tr> - </table> </body> </html>