Skip to main content

Home/ GWT - Samples/ Group items tagged form

Rss Feed Group items tagged

Esfand S

How to use GWT to build, validate and submit a form - Community Wiki - Confluence - 0 views

  • A disadvantage of GWT is that you do not have a very big influence on the html that is being built. If you want to ban tables from your pages and only use divs, you can forget about GTW. If you want your form to be read by form readers for disabled users, GTW does not give you a lot of support for that.
Esfand S

GWT, Blobstore, the new high performance image serving API, and cute dogs on ... - 0 views

  • Blobstore crash course It’ll be best if we gave a quick refresher course on the blobstore before we begin. Here’s the standard flow for a blobstore upload: Create a new blobstore session and generate an upload URL for a form to POST to. This is done using the createUploadUrl() method of BlobstoreService. Pass a callback URL to this method. This URL is where the user will be forwarded after the upload has completed. Present an upload form to the user. The action is the URL generated in step 1. Each URL must be unique: you cannot use the same URL for multiple sessions, as this will cause an error. After the URL has uploaded the file, the user is forwarded to the callback URL in your App Engine application specified in step 1. The key of the uploaded blob, a String blob key, is passed as an URL parameter. Save this URL and pass the user to their final destination
Esfand S

JSNI Components « Technology I/O - 0 views

  • JSNI lets you interface between Java and JavaScript in a type-safe way; you can use JavaScript objects in the Java code and rely on Java’s strong typing to protect you against various programming errors. But again, the more functionality you include in a single JSNI block, the less you can rely on Java’s strong typing to minimize errors. JSNI also provides a seamless way of moving between Java and JavaScript, allowing you to pass objects and exceptions across the boundary in both directions. Through JSNI, you manage JavaScript objects from Java, and you can call back to the Java code from the JavaScript code you write. One use is to wrap a third-party JavaScript library, where you create JavaScript objects from the library and pass them around the GWT Java code before perhaps sending them back to the JavaScript library.
  • A guiding principle of JSNI coding is to spend as little time as possible in “the dark side”; each JSNI method should be at an atomic level (perform one clear function) so that you isolate issues and keep as much control as possible in the strongly-types Java realm.
  • Here’s a simple JSNI method call: public static native void method_name(ObjectTyp someData) /*-{ someData.@org.gwtbook.client.Data::data1 == "GWT In Action" }-*/; We hope that doesn’t look too scary, even with the @ and :: symbols sprinkled in.
  • ...7 more annotations...
  • To help any syntax checkers know that they should avoid parsing the JavaScript code, you wrap it as a comment by using a modified standard comment, which starts with the characters /*- (a forward slash, an asterisk, and a dash) and ends with -*/ (a dash, an asterisk, and a forward slash) (2). It’s also important not to forget the trailing semicolon at the end of the definition; otherwise your code won’t compile!
  • Crossing the boundary from Java to JavaScript can come in two forms: writing JavaScript code in the Java application that performs some dedicated functionality, or writing JavaScript in the Java application that calls functionality in a Java- Script library already loaded into the web browser.
  • If you provide a return type, rather than just a void, then the JavaScript must return an object of the correct type. (Be aware that JSNI code can’t create new Java objects; it can manipulate ones passed in or create new JavaScript objects, but not new Java objects.) REMEMBER It isn’t possible to create new Java objects in a JSNI code block. Return types must either be primitive types, manipulated Java objects that have been passed in as input parameters, or references to newly created Java- Script objects (a JavaScriptObject type). It’s important to understand how the objects you provide as parameters are handled across the Java-to-JavaScript boundary
  • ensure that a clearly defined and repeatable mapping exists between Java typed objects and JavaScript untyped objects, which is what GWT provides.
  • Primitive Java numeric types, such as byte, short, char, int, long, float, or double, become simple objects in JavaScript whose value is that of the original object. For example, if you have a Java char, char keyPress = ‘a’, then it will become the JavaScript variable var k = ‘a’. Similarly, the Java int, int val = 10, becomes the JavaScript variable var v = 10. A Java String is translated across into JavaScript as a simple variable to which the original text is assigned. Therefore the Java object String name = “GWT In Action” becomes the JavaScript variable var s = “GWT In Action”. Finally the simple Java boolean, becomes another simple JavaScript variable; the Java boolean b = true becomes the JavaScript variable var b = true.
  • Moving on to more complicated Java objects that can be passed across the boundary, you have the Java array, a Java object, and a new object to GWT called the JavaScriptObject. We’ll discuss the last object more in the next section; for now, you should think of it as just a reference to a JavaScript object created somewhere else that can be passed around the Java code and on to other JavaScript methods—but you can’t look into its contents from the GWT Java code. This may sound strange, but we’ll explain in more detail later in the section on this object. Passing an array across the Java-to-JavaScript boundary is treated in a similar opaque way; you know you have an array object, but you can’t look into its contents. This means that if the JavaScript code needs to use values in the array, then you should move them out of the array before you cross the boundary: either into separate parameters or into another type of user-defined Java object. You can manage Java objects in JavaScript through the JSNI interface, as we’ll discuss next. You can also pass your own defined Java objects across the Java-to-JavaScript  boundary; GWT provides a special syntax allowing you to access the fields and methods of that Java object. This will take a little bit of explaining, so please, stick with us.
  • Event
Esfand S

how to enable scrolling for app using DecoratedTabPanel? - Google Web Toolkit | Google ... - 1 views

  • There is two type of layouts: RIA-like and web-page-like. The RIA-like layout is done using the layout panels. The app stretch to the whole available space. There is no scrollbars. The web-page-like layout is done using HTML tags (and some standard panels). The app don't stretch. If the content is larger than the viewport, scrollbars appears, like in traditional pages. Looking at the first screenshot, here is my proposal: 1) The main panel is a DockLayoutPanel attached to RootLayoutPanel. 2) The north slot contains the header. 3) The center slot contains a TabLayoutPanel. But when you show data (list, form...) you may have no enough space to show all. Here you start to use web-page-like layout. So: 4) The contain of the contact tab is a LayoutPanel with four slot: Tighformat, the list, Detail view, Relations. 5) Tighformat, Detail view and Relations are standard panels (FlowPanel) into ScrollPanels. If there not enough space, a scrollbar will appear. 6) The list is some sort of DockLayoutPanel with the headers top, the navigation buttons bottom and the contains of the list in the center with a scrollbar is needed. The exact implementation depends on the used widget for the list (SmartGWT, GXT, gwt-incubator...)
1 - 4 of 4
Showing 20 items per page