SearchForm.java
2.5 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* org.apache.sling.api.SlingHttpServletRequest
*/
package com.day.cq.searchpromote.xml.form;
import com.day.cq.searchpromote.xml.form.AutoComplete;
import com.day.cq.searchpromote.xml.form.Form;
import com.day.cq.searchpromote.xml.form.Input;
import com.day.cq.searchpromote.xml.form.Tnt;
import java.util.List;
import org.apache.sling.api.SlingHttpServletRequest;
public class SearchForm {
private SlingHttpServletRequest request;
private AutoComplete autocomplete;
private Tnt tnt;
private Form form;
private String action;
public SearchForm(SlingHttpServletRequest request, AutoComplete autocomplete, Tnt tnt, Form form) {
this.request = request;
this.autocomplete = autocomplete;
this.tnt = tnt;
this.form = form;
}
public SearchForm(AutoComplete autocomplete, Tnt tnt, Form form) {
this(null, autocomplete, tnt, form);
}
public SlingHttpServletRequest getRequest() {
return this.request;
}
public void setRequest(SlingHttpServletRequest request) {
this.request = request;
}
public String getAction() {
return this.action;
}
public void setAction(String action) {
this.action = action;
}
public AutoComplete getAutocomplete() {
return this.autocomplete;
}
public Tnt getTnt() {
return this.tnt;
}
public Form getForm() {
return this.form;
}
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append("<form method=\"GET\"");
if (this.form.getId() != null) {
sb.append(" id=\"" + this.form.getId() + "\"");
}
if (this.form.getName() != null) {
sb.append(" name=\"" + this.form.getName() + "\"");
}
sb.append(" action=\"" + (this.action != null ? this.action : this.form.getAction()) + "\"");
sb.append(">\n");
for (Input input : this.form.getInputs()) {
sb.append(input.toString() + "\n");
}
if (this.autocomplete != null && this.autocomplete.getEnabled().booleanValue() && this.autocomplete.getFormContent() != null) {
sb.append(this.autocomplete.getFormContent());
}
if (this.tnt != null && this.tnt.getEnabled().booleanValue() && this.tnt.getFormContent() != null) {
sb.append(this.tnt.getFormContent());
}
sb.append("</form>");
return sb.toString();
}
}