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
|
package com.vaadin.tests.components.datefield;
import java.util.Date;
import java.util.Locale;
import com.vaadin.shared.ui.datefield.Resolution;
import com.vaadin.tests.components.AbstractTestCase;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.DateField;
import com.vaadin.ui.GridLayout;
import com.vaadin.ui.LegacyWindow;
public class DateFieldPopupOffScreen extends AbstractTestCase {
@Override
protected String getDescription() {
return "Test for the popup position from a DateField. The popup should always be on-screen even if the DateField is close the the edge of the browser.";
}
@Override
protected Integer getTicketNumber() {
return 3639;
}
@Override
public void init() {
LegacyWindow mainWindow = new LegacyWindow(getClass().getName());
GridLayout mainLayout = new GridLayout(3, 3);
mainLayout.setSizeFull();
DateField df;
df = createDateField();
mainLayout.addComponent(df, 2, 0);
mainLayout.setComponentAlignment(df, Alignment.TOP_RIGHT);
df = createDateField();
mainLayout.addComponent(df, 2, 1);
mainLayout.setComponentAlignment(df, Alignment.MIDDLE_RIGHT);
df = createDateField();
mainLayout.addComponent(df, 2, 2);
mainLayout.setComponentAlignment(df, Alignment.BOTTOM_RIGHT);
df = createDateField();
mainLayout.addComponent(df, 0, 2);
mainLayout.setComponentAlignment(df, Alignment.BOTTOM_LEFT);
df = createDateField();
mainLayout.addComponent(df, 1, 2);
mainLayout.setComponentAlignment(df, Alignment.BOTTOM_CENTER);
mainWindow.setContent(mainLayout);
setMainWindow(mainWindow);
}
private DateField createDateField() {
DateField df = new DateField();
df.setLocale(new Locale("fi"));
df.setResolution(Resolution.SECOND);
df.setDescription("This is a long, multiline tooltip.<br/>It should always be on screen so it can be read.");
df.setValue(new Date(1000000L));
return df;
}
}
|