blob: 5f7e516144aaec0636bf6249d797e85860c15429 (
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
|
package com.vaadin.tests.components.table;
import com.vaadin.event.Action;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractReindeerTestUI;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Notification;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.v7.ui.Table;
/*
* Differs from TableContextMenu by number of items, their numbering and
* immediate/selectable/multiselect toggling
*/
public class TableContextMenuTouch extends AbstractReindeerTestUI {
private static final Action ACTION_MYACTION = new Action("Action!!");
@Override
protected void setup(VaadinRequest req) {
HorizontalLayout hlay = new HorizontalLayout();
addComponent(hlay);
hlay.setSpacing(true);
final Table table = new Table();
table.addActionHandler(new Action.Handler() {
@Override
public void handleAction(Action action, Object sender,
Object target) {
Notification.show("Done that :-)");
}
@Override
public Action[] getActions(Object target, Object sender) {
return new Action[] { ACTION_MYACTION };
}
});
table.addContainerProperty("Foo", String.class, "BAR1");
table.addContainerProperty("Bar", String.class, "FOO2");
table.setHeight("200px");
for (int i = 0; i < 30; i++) {
Object key = table.addItem();
table.getItem(key).getItemProperty("Foo")
.setValue(new Integer(i).toString());
}
hlay.addComponent(table);
VerticalLayout vlay = new VerticalLayout();
hlay.addComponent(vlay);
final CheckBox immediateCheckBox = new CheckBox("Immediate");
vlay.addComponent(immediateCheckBox);
immediateCheckBox.addValueChangeListener(
event -> table.setImmediate(immediateCheckBox.getValue()));
immediateCheckBox.setValue(true);
table.setImmediate(immediateCheckBox.getValue());
final CheckBox selectableCheckBox = new CheckBox("Selectable");
final CheckBox multiselectCheckBox = new CheckBox("Multiselect");
vlay.addComponent(selectableCheckBox);
selectableCheckBox.addValueChangeListener(event -> {
table.setSelectable(selectableCheckBox.getValue());
multiselectCheckBox.setEnabled(selectableCheckBox.getValue());
});
selectableCheckBox.setValue(true);
multiselectCheckBox.setEnabled(selectableCheckBox.getValue());
table.setSelectable(selectableCheckBox.getValue());
vlay.addComponent(multiselectCheckBox);
multiselectCheckBox.addValueChangeListener(
event -> table.setMultiSelect(multiselectCheckBox.getValue()));
multiselectCheckBox.setValue(true);
table.setMultiSelect(multiselectCheckBox.getValue());
}
@Override
protected String getTestDescription() {
return "Context menu in Table on touch devices should not open on selection tapping";
}
@Override
protected Integer getTicketNumber() {
return 15297;
}
}
|