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 package info.magnolia.cms.gui.control;
35
36 import info.magnolia.cms.core.Content;
37
38
39
40
41
42
43 public class Edit extends ControlImpl {
44
45 String rows = "1";
46
47 public Edit() {
48 }
49
50 public Edit(String name, String value) {
51 super(name, value);
52 }
53
54 public Edit(String name, Content websiteNode) {
55 super(name, websiteNode);
56 }
57
58 public void setRows(String s) {
59 this.rows = s;
60 }
61
62 public String getRows() {
63 return this.rows;
64 }
65
66 public String getHtml() {
67 StringBuffer html = new StringBuffer();
68 String id = this.getId();
69 if (id == null) {
70 id = this.getName();
71 }
72 if (this.getRows().equals("1")) {
73 html.append("<input type=\"text\"");
74 html.append(" name=\"" + this.getName() + "\"");
75 html.append(" id=\"" + id + "\"");
76 html.append(" value=\"" + getEncodedValue() + "\"");
77 html.append(getHtmlEvents());
78 html.append(this.getHtmlCssClass());
79 html.append(this.getHtmlCssStyles());
80 html.append(" />");
81 } else {
82 html.append("<textarea");
83 html.append(" name=\"" + this.getName() + "\"");
84 html.append(" id=\"" + id + "\"");
85 html.append(" rows=\"" + this.getRows() + "\"");
86 html.append(" cols=\"100\"");
87 html.append(this.getHtmlCssClass());
88 html.append(this.getHtmlCssStyles());
89 html.append(getHtmlEvents());
90 html.append(">");
91 html.append(getEncodedValue());
92 html.append("</textarea>");
93 }
94 if (this.getSaveInfo()) {
95 html.append(this.getHtmlSaveInfo());
96 }
97 return html.toString();
98 }
99
100 protected String getEncodedValue() {
101 return escapeHTML(this.getValue());
102 }
103 }