/* * Copyright 2000-2016 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package com.vaadin.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import com.vaadin.ui.UI; /** * Defines a specific widgetset for a {@link UI}. */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) @Inherited public @interface Widgetset { /** * @return name of the widgetset */ public String value(); } value='7.7'>7.7 Vaadin 6, 7, 8 is a Java framework for modern Java web applications: https://github.com/vaadin/frameworkwww-data
aboutsummaryrefslogtreecommitdiffstats
path: root/documentation/layout/layout-overview.asciidoc
blob: 9e6a58a836d0a24268295d4d7eb577f60f4340ff (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
---
title: Overview
order: 1
layout: page
---

[[layout.overview]]
= Overview

The user interface components in Vaadin can roughly be divided in two groups:
components that the user can interact with and layout components for placing the
other components to specific places in the user interface.
The layout components are identical in their purpose to layout managers in regular desktop frameworks for Java.
You can use plain Java to accomplish sophisticated component layouts.

[[figure.layout.intro.simple]]
.Layout example
image::img/layout-intro-example-1.png[width=75%, scaledwidth=100%]

You start by creating a content layout for the UI and then add other layout
components hierarchically, and finally the interaction components as the leaves
of the component tree.

[[figure.layout.intro.schematic]]
.Layout schematic
image::img/layout-schematic.png[width=100%, scaledwidth=100%]

Let us look at building a bit simplified version of the layout in <<figure.layout.intro.simple>>:

[source, java]
----
// Set the root layout for the UI
VerticalLayout content = new VerticalLayout();
setContent(content);

HorizontalLayout titleBar = new HorizontalLayout();
titleBar.setWidth("100%");
root.addComponent(titleBar);

Label title = new Label("The Ultimate Cat Finder");
titleBar.addComponent(title);
titleBar.setExpandRatio(title, 1.0f); // Expand

Label titleComment = new Label("for Vaadin");
titleComment.setSizeUndefined(); // Take minimum space
titleBar.addComponent(titleComment);

... build rest of the layout ...
----

Or in the declarative format (roughly):

[source, html]
----
<vaadin-vertical-layout>
  <vaadin-label>The Ultimate Cat Finder</vaadin-label>

  <vaadin-horizontal-layout>
    <vaadin-radio-button-group caption="Possible Places"/>
    <vaadin-panel/>
    ...
  </vaadin-horizontal-layout>
</vaadin-vertical-layout>
----

You will usually need to tune the layout components a bit by setting sizes,
expansion ratios, alignments, spacings, and so on. The general settings are
described in
<<dummy/../../../framework/layout/layout-settings#layout.settings,"Layout
Formatting">>.

Layouts are coupled with themes that specify various layout features, such as
backgrounds, borders, text alignment, and so on. Definition and use of themes is
described in
<<dummy/../../../framework/themes/themes-overview.asciidoc#themes.overview,"Themes">>.

You can see a finished version of the above example in
<<figure.layout.intro.simple>>.