Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
book-of-vaadin.pdf
Скачиваний:
88
Добавлен:
24.03.2015
Размер:
13.43 Mб
Скачать

Client-Side Vaadin Development

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.

13.3.2. 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 user.agent property in the module descriptor.

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

The 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.

Table 13.1. GWT User Agents

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.

13.4. Compiling a Client-Side Module

A client-side module, either a widget set or a pure client-side module, must be compiled to JavaScript using the Vaadin Client Compiler. During development, the Development Mode makes the compilation automatically when you reload the page, provided that the module has been initially compiled once with the compiler.

As most Vaadin add-ons include widgets, widget set compilation is usually needed when using add-ons. In that case, the widget sets from different add-ons are compiled into a project widget set, as described in Chapter 17, Using Vaadin Add-ons.

13.4.1. Vaadin Compiler Overview

The Vaadin Client Compiler compiles Java to JavaScript. It is provided as the vaadin-client-compiler JAR, which you can execute with the -jar parameter for the Java runtime. It requires the vaadin-client JAR, which contains the Vaadin client-side framework.

The compiler compiles a client module, which can be either a pure client-side module or a Vaadin widget set, that is, the Vaadin Client-Side Engine that includes the widgets used in the application. The client module is defined with a module descriptor, which was described in Section 13.3, “Client-Side Module Descriptor”.

Limiting Compilation Targets

345

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]