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
|
package com.vaadin.tests.components.table;
import com.vaadin.event.Action;
import com.vaadin.event.LayoutEvents.LayoutClickEvent;
import com.vaadin.event.LayoutEvents.LayoutClickListener;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Button;
import com.vaadin.ui.Component;
import com.vaadin.ui.Link;
import com.vaadin.ui.Table;
import com.vaadin.ui.TextField;
import com.vaadin.ui.VerticalLayout;
public class TableContextMenuOnField extends TestBase {
private static final Action ACTION_MYACTION = new Action("Action!!");
@Override
protected void setup() {
Table table = new Table();
table.setSelectable(true);
table.setMultiSelect(true);
table.addActionHandler(new Action.Handler() {
@Override
public void handleAction(Action action, Object sender, Object target) {
// TODO Auto-generated method stub
}
@Override
public Action[] getActions(Object target, Object sender) {
return new Action[] { ACTION_MYACTION };
}
});
table.addGeneratedColumn("layout", new Table.ColumnGenerator() {
@Override
public Component generateCell(Table source, Object itemId,
Object columnId) {
VerticalLayout layout = new VerticalLayout();
layout.addComponent(new TextField());
layout.addListener(new LayoutClickListener() {
@Override
public void layoutClick(LayoutClickEvent event) {
getMainWindow().showNotification("HELLO");
}
});
return layout;
}
});
table.addGeneratedColumn("textfield", new Table.ColumnGenerator() {
@Override
public Component generateCell(Table source, Object itemId,
Object columnId) {
return new TextField();
}
});
table.addGeneratedColumn("link", new Table.ColumnGenerator() {
@Override
public Component generateCell(Table source, Object itemId,
Object columnId) {
return new Link("Link", null);
}
});
table.addGeneratedColumn("button", new Table.ColumnGenerator() {
@Override
public Component generateCell(Table source, Object itemId,
Object columnId) {
return new Button("Button");
}
});
table.addItem();
table.addItem();
table.addItem();
addComponent(table);
}
@Override
protected String getDescription() {
return "Right clicking on an item without a context menu should bring"
+ "up the Tables context menu";
}
@Override
protected Integer getTicketNumber() {
return 4264;
}
}
|