blob: 7ac97ce88294181350962c352e67a23b7030b385 (
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
|
/*
@ITMillApache2LicenseForJavaFiles@
*/
package com.vaadin.tests;
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.ui.Button;
import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.Label;
import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.RichTextArea;
import com.vaadin.ui.Button.ClickEvent;
/**
*
* @author IT Mill Ltd.
*/
public class TestForRichTextEditor extends CustomComponent implements
ValueChangeListener {
private final OrderedLayout main = new OrderedLayout();
private Label l;
private RichTextArea rte;
public TestForRichTextEditor() {
setCompositionRoot(main);
createNewView();
}
public void createNewView() {
main.removeAllComponents();
main.addComponent(new Label(
"RTE uses google richtextArea and their examples toolbar."));
rte = new RichTextArea();
rte.addListener(this);
main.addComponent(rte);
main.addComponent(new Button("commit content to label below"));
l = new Label("", Label.CONTENT_XHTML);
main.addComponent(l);
Button b = new Button("enabled");
b.setSwitchMode(true);
b.setImmediate(true);
b.addListener(new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
rte.setEnabled(!rte.isEnabled());
}
});
main.addComponent(b);
}
public void valueChange(ValueChangeEvent event) {
l.setValue(rte.getValue());
}
}
|