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 @Override
67 public String getHtml() {
68 StringBuffer html = new StringBuffer();
69 String id = this.getId();
70 if (id == null) {
71 id = this.getName();
72 }
73 if (this.getRows().equals("1")) {
74 html.append("<input type=\"text\"");
75 html.append(" name=\"" + this.getName() + "\"");
76 html.append(" id=\"" + id + "\"");
77 html.append(" value=\"" + getEncodedValue() + "\"");
78 html.append(getHtmlEvents());
79 html.append(this.getHtmlCssClass());
80 html.append(this.getHtmlCssStyles());
81 html.append(" />");
82 } else {
83 html.append("<textarea");
84 html.append(" name=\"" + this.getName() + "\"");
85 html.append(" id=\"" + id + "\"");
86 html.append(" rows=\"" + this.getRows() + "\"");
87 html.append(" cols=\"100\"");
88 html.append(this.getHtmlCssClass());
89 html.append(this.getHtmlCssStyles());
90 html.append(getHtmlEvents());
91 html.append(">");
92 html.append(getEncodedValue());
93 html.append("</textarea>");
94 }
95 if (this.getSaveInfo()) {
96 html.append(this.getHtmlSaveInfo());
97 }
98 return html.toString();
99 }
100
101 protected String getEncodedValue() {
102 return escapeHTML(this.getValue());
103 }
104 }