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

Mobile Applications with TouchKit

22.3.3. Importing the Vornitologist Demo

The Vornitologist demo, illustrated in Figure 22.1, “The Vornitologist Demo for Vaadin TouchKit” in the overview, showcases most of the functionality in Vaadin TouchKit. You can try the demo on-line with a TouchKit-compatible browser at http://demo.vaadin.com/vornitologist/.

You can browse the sources on-line or, more conveniently, import the project in Eclipse (or other IDE). As the project is Maven-based, eclipse users need to install the m2e (or m2eclipse for older versions) plugin to be able to import Maven projects, as well as Subclipse for making SVN access easier. Once they are installed, you should be able to import Vornitologist as follows.

1. Select File Import

2. Select Maven Check out Maven Project from SCM, and click Next.

3.In SCM URL, select svn and enter URL for the repository. You can find the current repository URL from the TouchKit add-on page at http://vaadin.com/addon/vaadin-touchkit.

4.Click Finish.

Instead of using Subclipse, you can check out the project with another Subversion tool and then import it in Eclipse as a Maven project.

22.4. Elements of a TouchKit Application

At minimum, a TouchKit application requires a UI class, which is defined in a deployment descriptor, as usual for Vaadin applications. You usually also need to have a custom theme. To enable various other features, you may need to provide a custom servlet. These and other tasks are described in the following subsections.

22.4.1. Deployment Descriptor

The deployment descriptor of a TouchKit application is much like for any Vaadin application. However, you need to use the special TouchKitServlet class instead of the regular VaadinServlet in the web.xml deployment descriptor. Often you need to make some configuration or add special logic in a custom servlet, as described in the next section, in which case you need to define your servlet in the deployment descriptor.

As TouchKit comes with a custom widget set, you need to use a combining widget set for your project. The combining widget set descriptor is automatically generated by the Vaadin Plugin for Eclipse and in Maven when you install or define the TouchKit add-on.

<servlet>

<servlet-name>Vaadin UI Servlet</servlet-name> <servlet-class>

com.vaadin.addon.touchkit.server.TouchKitServlet

</servlet-class> <init-param>

<description>Vaadin UI class to start</description> <param-name>ui</param-name> <param-value>com.example.myapp.MyMobileUI</param-value>

</init-param> <init-param>

<param-name>widgetset</param-name> <param-value>com.example.myapp.MyAppWidgetSet</param-value>

</init-param> </servlet>

Importing the Vornitologist Demo

481

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