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.

clientside-module.asciidoc 2.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. ---
  2. title: Client-Side Module Descriptor
  3. order: 3
  4. layout: page
  5. ---
  6. [[clientside.module]]
  7. = Client-Side Module Descriptor
  8. Client-side Vaadin modules, such as the Vaadin Client-Side Engine (widget set)
  9. or pure client-side applications, that are to be compiled to JavaScript, are
  10. defined in a __module descriptor__ ( [filename]#.gwt.xml#) file.
  11. When defining a widget set to build the Vaadin client-side engine, the only
  12. necessary task is to inherit a base widget set. If you are developing a regular
  13. widget set, you should normally inherit the [classname]#DefaultWidgetSet#.
  14. ----
  15. <?xml version="1.0" encoding="UTF-8"?>
  16. <!DOCTYPE module PUBLIC
  17. "-//Google Inc.//DTD Google Web Toolkit 2.8.2//EN"
  18. "http://www.gwtproject.org/doctype/2.8.2/gwt-module.dtd">
  19. <module>
  20. <!-- Inherit the default widget set -->
  21. <inherits name="com.vaadin.DefaultWidgetSet" />
  22. </module>
  23. ----
  24. If you are developing a pure client-side application, you should instead inherit
  25. [classname]#com.vaadin.Vaadin#, as described in
  26. <<../clientsideapp/clientsideapp-overview.asciidoc#clientsideapp.overview,"Client-Side
  27. Applications">>. In that case, the module descriptor also needs an entry-point.
  28. If you are using the Eclipse IDE, the New Vaadin Widget wizard will
  29. automatically create the GWT module descriptor. See
  30. <<../gwt/gwt-eclipse#gwt.eclipse.widget,"Creating a
  31. Widget">> for detailed instructions.
  32. [[clientside.module.stylesheet]]
  33. == Specifying a Stylesheet
  34. A client-side module can include CSS stylesheets. When the module is compiled,
  35. these stylesheets are copied to the output target. In the module descriptor,
  36. define a [literal]#++stylesheet++# element.
  37. For example, if you are developing a custom widget and want to have a default
  38. stylesheet for it, you could define it as follows:
  39. ----
  40. <stylesheet src="mywidget/styles.css"/>
  41. ----
  42. The specified path is relative to the __public__ folder under the folder of the
  43. module descriptor.
  44. [[gwt.module.compilation-limiting]]
  45. == Limiting Compilation Targets
  46. Compiling widget sets takes considerable time. You can reduce the compilation
  47. time significantly by compiling the widget sets only for your browser, which is
  48. useful during development. You can do this by setting the
  49. [parameter]#user.agent# property in the module descriptor.
  50. ----
  51. <set-property name="user.agent" value="gecko1_8"/>
  52. ----
  53. The [parameter]#value# attribute should match your browser. The browsers
  54. supported by GWT depend on the GWT version, below is a list of browser
  55. identifiers supported by GWT.
  56. .GWT User Agents
  57. [options="header"]
  58. |===============
  59. |Identifier|Name
  60. |ie6|Internet Explorer 6
  61. |ie8|Internet Explorer 8
  62. |gecko1_8|Mozilla Firefox 1.5 and later
  63. |safari|Apple Safari and other Webkit-based browsers including Google Chrome
  64. |opera|Opera
  65. |ie9|Internet Explorer 9
  66. |===============
  67. For more information about the GWT Module XML Format, please see Google Web
  68. Toolkit Developer Guide.