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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
|
/*
@ITMillApache2LicenseForJavaFiles@
*/
package com.vaadin.terminal;
import java.io.Serializable;
/**
* Interface to be implemented by components wishing to display some object that
* may be dynamically resized during runtime.
*
* @author IT Mill Ltd.
* @version
* @VERSION@
* @since 3.0
*/
public interface Sizeable extends Serializable {
/**
* Unit code representing pixels.
*/
public static final int UNITS_PIXELS = 0;
/**
* Unit code representing points (1/72nd of an inch).
*/
public static final int UNITS_POINTS = 1;
/**
* Unit code representing picas (12 points).
*/
public static final int UNITS_PICAS = 2;
/**
* Unit code representing the font-size of the relevant font.
*/
public static final int UNITS_EM = 3;
/**
* Unit code representing the x-height of the relevant font.
*/
public static final int UNITS_EX = 4;
/**
* Unit code representing millimeters.
*/
public static final int UNITS_MM = 5;
/**
* Unit code representing centimeters.
*/
public static final int UNITS_CM = 6;
/**
* Unit code representing inches.
*/
public static final int UNITS_INCH = 7;
/**
* Unit code representing in percentage of the containing element defined by
* terminal.
*/
public static final int UNITS_PERCENTAGE = 8;
public static final float SIZE_UNDEFINED = -1;
/**
* Textual representations of units symbols. Supported units and their
* symbols are:
* <ul>
* <li>{@link #UNITS_PIXELS}: "px"</li>
* <li>{@link #UNITS_POINTS}: "pt"</li>
* <li>{@link #UNITS_PICAS}: "pc"</li>
* <li>{@link #UNITS_EM}: "em"</li>
* <li>{@link #UNITS_EX}: "ex"</li>
* <li>{@link #UNITS_MM}: "mm"</li>
* <li>{@link #UNITS_CM}. "cm"</li>
* <li>{@link #UNITS_INCH}: "in"</li>
* <li>{@link #UNITS_PERCENTAGE}: "%"</li>
* </ul>
* These can be used like <code>Sizeable.UNIT_SYMBOLS[UNITS_PIXELS]</code>.
*/
public static final String[] UNIT_SYMBOLS = { "px", "pt", "pc", "em", "ex",
"mm", "cm", "in", "%" };
/**
* Gets the width of the object. Negative number implies unspecified size
* (terminal is free to set the size).
*
* @return width of the object in units specified by widthUnits property.
*/
public float getWidth();
/**
* Gets the height of the object. Negative number implies unspecified size
* (terminal is free to set the size).
*
* @return height of the object in units specified by heightUnits property.
*/
public float getHeight();
/**
* Gets the width property units.
*
* @return units used in width property.
*/
public int getWidthUnits();
/**
* Gets the height property units.
*
* @return units used in height property.
*/
public int getHeightUnits();
/**
* Sets the height of the component using String presentation.
*
* String presentation is similar to what is used in Cascading Style Sheets.
* Size can be length or percentage of available size.
*
* The empty string ("") or null will unset the height and set the units to
* pixels.
*
* See <a
* href="http://www.w3.org/TR/REC-CSS2/syndata.html#value-def-length">CSS
* specification</a> for more details.
*
* @param height
* in CSS style string representation
*/
public void setHeight(String height);
/**
* Sets the width of the object. Negative number implies unspecified size
* (terminal is free to set the size).
*
* @param width
* the width of the object.
* @param unit
* the unit used for the width. Possible values include
* {@link #UNITS_PIXELS}, {@link #UNITS_POINTS},
* {@link #UNITS_PICAS}, {@link #UNITS_EM}, {@link #UNITS_EX},
* {@link #UNITS_MM}, {@link #UNITS_CM}, {@link #UNITS_INCH},
* {@link #UNITS_PERCENTAGE}.
*/
public void setWidth(float width, int unit);
/**
* Sets the height of the object. Negative number implies unspecified size
* (terminal is free to set the size).
*
* @param height
* the height of the object.
* @param unit
* the unit used for the width. Possible values include
* {@link #UNITS_PIXELS}, {@link #UNITS_POINTS},
* {@link #UNITS_PICAS}, {@link #UNITS_EM}, {@link #UNITS_EX},
* {@link #UNITS_MM}, {@link #UNITS_CM}, {@link #UNITS_INCH},
* {@link #UNITS_PERCENTAGE}.
*/
public void setHeight(float height, int unit);
/**
* Sets the width of the component using String presentation.
*
* String presentation is similar to what is used in Cascading Style Sheets.
* Size can be length or percentage of available size.
*
* The empty string ("") or null will unset the width and set the units to
* pixels.
*
* See <a
* href="http://www.w3.org/TR/REC-CSS2/syndata.html#value-def-length">CSS
* specification</a> for more details.
*
* @param width
* in CSS style string representation, null or empty string to
* reset
*/
public void setWidth(String width);
/**
* Sets the size to 100% x 100%.
*/
public void setSizeFull();
/**
* Clears any size settings.
*/
public void setSizeUndefined();
}
|