blob: 9e2825c519fe0a4ce0ba56c1902b3a21e57ca90a (
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
/*
@ITMillApache2LicenseForJavaFiles@
*/
package com.vaadin.ui;
import com.vaadin.terminal.PaintException;
import com.vaadin.terminal.PaintTarget;
import com.vaadin.terminal.gwt.client.ui.VOrderedLayout;
/**
* Ordered layout.
*
* <code>OrderedLayout</code> is a component container, which shows the
* subcomponents in the order of their addition in specified orientation.
*
* @author IT Mill Ltd.
* @version
* @VERSION@
* @since 3.0
* @deprecated Replaced by VerticalLayout/HorizontalLayout. For type checking
* please not that VerticalLayout/HorizontalLayout do not extend
* OrderedLayout but AbstractOrderedLayout (which also OrderedLayout
* extends).
*/
@SuppressWarnings("serial")
@Deprecated
@ClientWidget(VOrderedLayout.class)
public class OrderedLayout extends AbstractOrderedLayout {
/* Predefined orientations */
/**
* Components are to be laid out vertically.
*/
public static final int ORIENTATION_VERTICAL = 0;
/**
* Components are to be laid out horizontally.
*/
public static final int ORIENTATION_HORIZONTAL = 1;
/**
* Orientation of the layout.
*/
private int orientation;
/**
* Creates a new ordered layout. The order of the layout is
* <code>ORIENTATION_VERTICAL</code>.
*
* @deprecated Use VerticalLayout instead.
*/
@Deprecated
public OrderedLayout() {
this(ORIENTATION_VERTICAL);
}
/**
* Create a new ordered layout. The orientation of the layout is given as
* parameters.
*
* @param orientation
* the Orientation of the layout.
*
* @deprecated Use VerticalLayout/HorizontalLayout instead.
*/
@Deprecated
public OrderedLayout(int orientation) {
this.orientation = orientation;
if (orientation == ORIENTATION_VERTICAL) {
setWidth(100, UNITS_PERCENTAGE);
}
}
/**
* Gets the orientation of the container.
*
* @return the Value of property orientation.
*/
public int getOrientation() {
return orientation;
}
/**
* Sets the orientation of this OrderedLayout. This method should only be
* used before initial paint.
*
* @param orientation
* the New value of property orientation.
* @deprecated Use VerticalLayout/HorizontalLayout or define orientation in
* constructor instead
*/
@Deprecated
public void setOrientation(int orientation) {
setOrientation(orientation, true);
}
/**
* Internal method to change orientation of layout. This method should only
* be used before initial paint.
*
* @param orientation
*/
protected void setOrientation(int orientation, boolean needsRepaint) {
// Checks the validity of the argument
if (orientation < ORIENTATION_VERTICAL
|| orientation > ORIENTATION_HORIZONTAL) {
throw new IllegalArgumentException();
}
this.orientation = orientation;
if (needsRepaint) {
requestRepaint();
}
}
@Override
public void paintContent(PaintTarget target) throws PaintException {
super.paintContent(target);
// Adds the orientation attributes (the default is vertical)
if (orientation == ORIENTATION_HORIZONTAL) {
target.addAttribute("orientation", "horizontal");
}
}
}
|