You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

gwt-overview.asciidoc 3.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. ---
  2. title: Overview
  3. order: 1
  4. layout: page
  5. ---
  6. [[gwt.overview]]
  7. = Overview
  8. Vaadin components consist of two parts: a server-side and a client-side
  9. component. The latter are also called __widgets__ in Google Web Toolkit (GWT)
  10. parlance. A Vaadin application uses the API of the server-side component, which
  11. is rendered as a client-side widget in the browser. As on the server-side, the
  12. client-side widgets form a hierarchy of layout widgets and regular widgets as
  13. the leaves.
  14. [[figure.gwt.overview.widget-integration]]
  15. .Integration of Client-Side Widgets
  16. image::img/widget-integration-hi.png[]
  17. The communication between a client-side widget and a server-side component is
  18. managed with a __connector__ that handles syncronizing the widget state and
  19. events to and from the server-side.
  20. ((("connector")))
  21. When rendering the user interface, a client-side connector and a widget are
  22. created for each server-side component. The mapping from a component to a
  23. connector is defined in the connector class with a [literal]#++@Connect++#
  24. annotation, and the widget is created by the connector class.
  25. ((("@Connect")))
  26. The state of a server-side component is synchronized automatically to the
  27. client-side widget using a __shared state__ object. A shared state object
  28. extends [classname]#AbstractComponentState# and it is used both in the
  29. server-side and the client-side component. On the client-side, a connector
  30. always has access to its state instance, as well to the state of its parent
  31. component state and the states of its children. ((("state
  32. object")))
  33. ((("[classname]#AbstractComponentState#")))
  34. The state sharing assumes that state is defined with standard Java types, such
  35. as primitive and boxed primitive types, [classname]#String#, arrays, and certain
  36. collections ( [classname]#List#, [classname]#Set#, and [classname]#Map#) of the
  37. supported types. Also the Vaadin [classname]#Connector# and some special
  38. internal types can be shared.
  39. In addition to state, both server- and client-side can make remote procedure
  40. calls (RPC) to the other side. RPC is used foremost for event notifications. For
  41. example, when a client-side connector of a button receives a click, it sends the
  42. event to the server-side using RPC.
  43. [[gwt.overview.project]]
  44. == Project Structure
  45. Widget set compilation, as described in
  46. <<../clientside/clientside-module#clientside.module,"Client-Side
  47. Module Descriptor">>, requires using a special project structure, where the
  48. client-side classes are located under a [filename]#client# package under the
  49. package of the module descriptor. Any static resources, such as stylesheets and
  50. images, should be located under a [filename]#public# folder (not Java package).
  51. The source for the server-side component may be located anywhere, except not in
  52. the client-side package.
  53. The basic project structure is illustrated in <<figure.gwt.overview.project>>.
  54. [[figure.gwt.overview.project]]
  55. .Basic Widget Integration Project Structure
  56. image::img/gwt-widget-files-hi.png[]
  57. The Eclipse wizard, described in
  58. <<gwt-eclipse#gwt.eclipse,"Starting It Simple With
  59. Eclipse">>, creates a widget integration skeleton with the above structure.
  60. [[gwt.overview.javascript]]
  61. == Integrating JavaScript Components
  62. In addition to the GWT widget integration, Vaadin offers a simplified way to
  63. integrate pure JavaScript components. The JavaScript connector code is published
  64. from the server-side. As the JavaScript integration does not involve GWT
  65. programming, no widget set compilation is needed.
  66. ((("JavaScript")))