aboutsummaryrefslogtreecommitdiffstats
path: root/documentation/clientside/clientside-module.asciidoc
blob: 117b4be3a6c63c85926d38cbab80935d8784d00b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
---
title: Client-Side Module Descriptor
order: 3
layout: page
---

[[clientside.module]]
= Client-Side Module Descriptor

Client-side Vaadin modules, such as the Vaadin Client-Side Engine (widget set)
or pure client-side applications, that are to be compiled to JavaScript, are
defined in a __module descriptor__ ( [filename]#.gwt.xml#) file.

When defining a widget set to build the Vaadin client-side engine, the only
necessary task is to inherit a base widget set. If you are developing a regular
widget set, you should normally inherit the [classname]#DefaultWidgetSet#.


----

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC
  "-//Google Inc.//DTD Google Web Toolkit 2.8.2//EN"
  "http://www.gwtproject.org/doctype/2.8.2/gwt-module.dtd">

<module>
    <!-- Inherit the default widget set -->
    <inherits name="com.vaadin.DefaultWidgetSet" />
</module>
----

If you are developing a pure client-side application, you should instead inherit
[classname]#com.vaadin.Vaadin#, as described in
<<../clientsideapp/clientsideapp-overview.asciidoc#clientsideapp.overview,"Client-Side
Applications">>. In that case, the module descriptor also needs an entry-point.

If you are using the Eclipse IDE, the New Vaadin Widget wizard will
automatically create the GWT module descriptor. See
<<../gwt/gwt-eclipse#gwt.eclipse.widget,"Creating a
Widget">> for detailed instructions.

[[clientside.module.stylesheet]]
== Specifying a Stylesheet

A client-side module can include CSS stylesheets. When the module is compiled,
these stylesheets are copied to the output target. In the module descriptor,
define a [literal]#++stylesheet++# element.

For example, if you are developing a custom widget and want to have a default
stylesheet for it, you could define it as follows:


----
<stylesheet src="mywidget/styles.css"/>
----

The specified path is relative to the __public__ folder under the folder of the
module descriptor.


[[gwt.module.compilation-limiting]]
== Limiting Compilation Targets

Compiling widget sets takes considerable time. You can reduce the compilation
time significantly by compiling the widget sets only for your browser, which is
useful during development. You can do this by setting the
[parameter]#user.agent# property in the module descriptor.


----
<set-property name="user.agent" value="gecko1_8"/>
----

The [parameter]#value# attribute should match your browser. The browsers
supported by GWT depend on the GWT version, below is a list of browser
identifiers supported by GWT.

.GWT User Agents
[options="header"]
|===============
|Identifier|Name
|ie6|Internet Explorer 6
|ie8|Internet Explorer 8
|gecko1_8|Mozilla Firefox 1.5 and later
|safari|Apple Safari and other Webkit-based browsers including Google Chrome
|opera|Opera
|ie9|Internet Explorer 9

|===============




For more information about the GWT Module XML Format, please see Google Web
Toolkit Developer Guide.