summaryrefslogtreecommitdiffstats
path: root/documentation/themes/themes-eclipse.asciidoc
blob: bd35ce6fedddc703f6061488f61588123fc00c12 (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
---
title: Creating a Theme in Eclipse
order: 6
layout: page
---

[[themes.eclipse]]
= Creating a Theme in Eclipse

The Eclipse plugin automatically creates a theme stub for new Vaadin projects.
It also includes a wizard for creating new custom themes. Do the following steps
to create a new theme.

. Select "File > New > Other..." in the main menu or right-click the
[guilabel]#Project Explorer# and select "New > Other...". A window will open.

. In the [guilabel]#Select a wizard# step, select the "Vaadin > Vaadin Theme"
wizard.

+
image::img/eclipse-theme-new.png[]

+
Click [guibutton]#Next# to proceed to the next step.

. In the [guilabel]#Create a new Vaadin theme# step, you have the following
settings:

[guilabel]#Project#(mandatory):: The project in which the theme should be created.

[guilabel]#Theme name#(mandatory):: The theme name is used as the name of the theme folder and in a CSS tag
(prefixed with " [literal]#++v-theme-++#"), so it must be a proper identifier.
Only latin alphanumerics, underscore, and minus sign are allowed.

[guilabel]#Modify application classes to use theme#(optional):: The setting allows the wizard to write a code statement that enables the theme
in the constructor of the selected application (UI) class(es). If you need to
control the theme with dynamic logic, you can leave the setting unchecked or
change the generated line later.



+
image::img/eclipse-theme-settings.png[]

+
Click [guibutton]#Finish# to create the theme.


The wizard creates the theme folder under the
[filename]#WebContent/VAADIN/themes# folder and the actual style sheet as
[filename]#mytheme.scss# and [filename]#styles.scss# files, as illustrated in
<<figure.eclipse.theme.created>>.

[[figure.eclipse.theme.created]]
.Newly Created Theme
image::img/eclipse-theme-created-annotated-hi.png[]

The created theme extends a built-in base theme with an [literal]#++@import++#
statement. See the explanation of theme inheritance in
<<dummy/../../../framework/themes/themes-creating#themes.creating,"Creating and
Using Themes">>. Notice that the [filename]#reindeer# theme is not located in
the [filename]#widgetsets# folder, but in the Vaadin JAR. See
<<dummy/../../../framework/themes/themes-creating#themes.creating.builtin,"Built-in
Themes">> for information for serving the built-in themes.

If you selected a UI class or classes in the [guilabel]#Modify application
classes to use theme# in the theme wizard, the wizard will add the
[literal]#++@Theme++# annotation to the UI class.

If you later rename the theme in Eclipse, notice that changing the name of the
folder will not automatically change the [literal]#++@Theme++# annotation. You
need to change such references to theme names in the calls manually.