blob: 10fef434cad3d179e22c922b17dfd8cbd304b407 (
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
|
package com.vaadin.tests.components.notification;
import com.vaadin.server.Page;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.NativeSelect;
import com.vaadin.ui.Notification;
import com.vaadin.ui.Notification.Type;
import com.vaadin.ui.TextArea;
public class Notifications extends TestBase implements ClickListener {
private static final String CAPTION = "CAPTION";
private TextArea tf;
private NativeSelect type;
@SuppressWarnings("deprecation")
@Override
protected void setup() {
tf = new TextArea("Text", "Hello world");
tf.setRows(10);
addComponent(tf);
type = new NativeSelect();
type.setNullSelectionAllowed(false);
type.addContainerProperty(CAPTION, String.class, "");
type.setItemCaptionPropertyId(CAPTION);
type.addItem(Notification.TYPE_HUMANIZED_MESSAGE)
.getItemProperty(CAPTION).setValue("Humanized");
type.addItem(Notification.TYPE_ERROR_MESSAGE).getItemProperty(CAPTION)
.setValue("Error");
type.addItem(Notification.TYPE_WARNING_MESSAGE)
.getItemProperty(CAPTION).setValue("Warning");
type.addItem(Notification.TYPE_TRAY_NOTIFICATION)
.getItemProperty(CAPTION).setValue("Tray");
type.setValue(type.getItemIds().iterator().next());
addComponent(type);
Button showNotification = new Button("Show notification", this);
addComponent(showNotification);
}
@Override
protected String getDescription() {
return "Generic test case for notifications";
}
@Override
protected Integer getTicketNumber() {
// TODO Auto-generated method stub
return null;
}
@Override
public void buttonClick(ClickEvent event) {
Notification n = new Notification(tf.getValue(), (Type) type.getValue());
n.setHtmlContentAllowed(true);
n.show(Page.getCurrent());
}
}
|