Hello Miguel, I'd like for you to review the attached patch (& screenshot)
It changes the layout of the demo just a bit to put some margin around the outside. It also adds code to toggle the enable/disable state of the buttons to match the user's actions. M samples/resourcestore/src/com/google/gwt/gears/sample/resourcestore/client/ResourceStoreDemo.java M samples/resourcestore/src/com/google/gwt/gears/sample/resourcestore/public/ResourceStoreDemo.html -Eric. -- Eric Z. Ayers - GWT Team - Atlanta, GA USA http://code.google.com/webtoolkit/ --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---
<<inline: foo.png>>
M samples/resourcestore/src/com/google/gwt/gears/sample/resourcestore/client/ResourceStoreDemo.java M samples/resourcestore/src/com/google/gwt/gears/sample/resourcestore/public/ResourceStoreDemo.html Index: samples/resourcestore/src/com/google/gwt/gears/sample/resourcestore/client/ResourceStoreDemo.java =================================================================== --- samples/resourcestore/src/com/google/gwt/gears/sample/resourcestore/client/ResourceStoreDemo.java (revision 874) +++ samples/resourcestore/src/com/google/gwt/gears/sample/resourcestore/client/ResourceStoreDemo.java (working copy) @@ -25,6 +25,7 @@ import com.google.gwt.user.client.ui.HorizontalPanel; import com.google.gwt.user.client.ui.Label; import com.google.gwt.user.client.ui.RootPanel; +import com.google.gwt.user.client.ui.VerticalPanel; import com.google.gwt.user.client.ui.Widget; /** @@ -32,13 +33,13 @@ * class. */ public class ResourceStoreDemo implements EntryPoint { - private static final String RESOURCE_STORE_NAME = "helloworld-store"; private static final String[] FILES_TO_CAPTURE = { getLocationPathName(), "resource.txt"}; + private static final String RESOURCE_STORE_NAME = "helloworld-store"; private static native String getLocationPathName() /*-{ - return $doc.location.href; - }-*/; + return $doc.location.href; + }-*/; private final HorizontalPanel buttonPanel = new HorizontalPanel(); private final Button captureButton = new Button("Capture"); @@ -84,20 +85,27 @@ buttonPanel.add(uncaptureButton); buttonPanel.add(removeStoreButton); - RootPanel.get().add(buttonPanel); - RootPanel.get().add(statusLabel); + setButtons(true, false, false, false); + VerticalPanel outerPanel = new VerticalPanel(); + outerPanel.add(buttonPanel); + outerPanel.add(statusLabel); + RootPanel.get("demo").add(outerPanel); + localServer = Factory.getInstance().createLocalServer(); } private void captureUrls() { statusLabel.setText("Capturing..."); + setButtons(false, false, false, false); resourceStore.capture(new ResourceStoreUrlCaptureHandler() { public void onCapture(ResourceStoreUrlCaptureEvent event) { if (event.isSuccess()) { statusLabel.setText("Captured URL: " + event.getUrl()); + setButtons(false, true, true, true); } else { statusLabel.setText("Failed to capture URL: " + event.getUrl()); + setButtons(true, false, false, false); } } }, FILES_TO_CAPTURE); @@ -106,6 +114,7 @@ private void createResourceStore() { resourceStore = localServer.createStore(RESOURCE_STORE_NAME); statusLabel.setText("Created a ResourceStore"); + setButtons(false, true, false, true); } private void removeStore() { @@ -117,6 +126,7 @@ statusLabel.setText("The store '" + RESOURCE_STORE_NAME + "' does not exist."); } + setButtons(true, false, false, false); } private void removeURLs() { @@ -125,5 +135,14 @@ resourceStore.remove(url); } statusLabel.setText("Removed URLs from the store"); + setButtons(false, true, false, true); } + + private void setButtons(boolean createStore, boolean capture, + boolean uncapture, boolean remove) { + createStoreButton.setEnabled(createStore); + captureButton.setEnabled(capture); + uncaptureButton.setEnabled(uncapture); + removeStoreButton.setEnabled(remove); + } } Index: samples/resourcestore/src/com/google/gwt/gears/sample/resourcestore/public/ResourceStoreDemo.html =================================================================== --- samples/resourcestore/src/com/google/gwt/gears/sample/resourcestore/public/ResourceStoreDemo.html (revision 874) +++ samples/resourcestore/src/com/google/gwt/gears/sample/resourcestore/public/ResourceStoreDemo.html (working copy) @@ -1,35 +1,21 @@ <html> - <head> - - <!-- --> - <!-- Any title is fine --> - <!-- --> - <title>Wrapper HTML for ResourceStoreDemo</title> - - <!-- --> - <!-- This script loads your compiled module. --> - <!-- If you add any GWT meta tags, they must --> - <!-- be added before this line. --> - <!-- --> - <script language='javascript' src='com.google.gwt.gears.sample.resourcestore.ResourceStoreDemo.nocache.js'></script> - </head> + <head> + <title>Gears Library for GWT - ResourceStoreDemo</title> + <style type="text/css"> +.outer-page-div { + margin: 15px; +} + </style> + <script language='javascript' + src='com.google.gwt.gears.sample.resourcestore.ResourceStoreDemo.nocache.js'></script> + </head> + <body> + <div class="outer-page-div"> + <h1>ResourceStoreDemo</h1> - <!-- --> - <!-- The body can have arbitrary html, or --> - <!-- you can leave the body empty if you want --> - <!-- to create a completely dynamic ui --> - <!-- --> - <body> - <h1>ResourceStoreDemo</h1> + <p>This is an example of how to use the ResourceStore class.</p> - <p> - This is an example of how to use the ResourceStore class. - </p> - - <table align=center> - <tr> - <td id="slot1"></td><td id="slot2"></td> - </tr> - </table> - </body> + <div id="demo"></div> + </div> + </body> </html>