blob: 699988489ff4ba983d835ee55222e9017ca14bb5 (
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
|
package com.vaadin.tests.components.tabsheet;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Button;
import com.vaadin.ui.Label;
import com.vaadin.ui.Panel;
import com.vaadin.ui.TabSheet;
import com.vaadin.ui.Button.ClickEvent;
public class TabSheetCaptions extends TestBase {
Panel panel1;
@Override
protected String getDescription() {
return "Updating the tabsheet tab text should not change the caption of the component. Click on the button to change the tab text. This must update the tab and not touch the Panel's caption.";
}
@Override
protected Integer getTicketNumber() {
return 2846;
}
@Override
protected void setup() {
final TabSheet tabSheet = new TabSheet();
// Define date and locale so that it doesn't change for machine/time
final SimpleDateFormat dateFormatter = new SimpleDateFormat(
"EEE, yyyy-MMM-dd", Locale.ENGLISH);
final Date date = new Date();
date.setTime((long) 1000000000000.0);
panel1 = new Panel("Panel initial caption (should also be tab caption)");
panel1.setSizeFull();
panel1.getLayout().setSizeFull();
panel1.addComponent(new Label("This is a panel"));
tabSheet.addTab(panel1);
Button button = new Button("Update tab caption");
button.addListener(new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
tabSheet.setTabCaption(panel1, "This is a new tab caption "
+ dateFormatter.format(date));
}
});
Button button2 = new Button("Update panel caption");
button2.addListener(new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
panel1.setCaption("This is a new panel caption "
+ dateFormatter.format(date));
}
});
addComponent(tabSheet);
addComponent(button);
addComponent(button2);
}
}
|