001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.portal.kernel.dao.search;
022:
023: import com.liferay.portal.kernel.util.StringMaker;
024: import com.liferay.portal.kernel.util.Validator;
025:
026: import javax.servlet.jsp.PageContext;
027:
028: /**
029: * <a href="TextSearchEntry.java.html"><b><i>View Source</i></b></a>
030: *
031: * @author Brian Wing Shun Chan
032: *
033: */
034: public class TextSearchEntry extends SearchEntry {
035:
036: public TextSearchEntry(String align, String valign, String name) {
037: this (align, valign, DEFAULT_COLSPAN, name, null);
038: }
039:
040: public TextSearchEntry(String align, String valign, int colspan,
041: String name) {
042:
043: this (align, valign, colspan, name, null);
044: }
045:
046: public TextSearchEntry(String align, String valign, String name,
047: String href) {
048:
049: this (align, valign, DEFAULT_COLSPAN, name, href, null, null);
050: }
051:
052: public TextSearchEntry(String align, String valign, int colspan,
053: String name, String href) {
054:
055: this (align, valign, colspan, name, href, null, null);
056: }
057:
058: public TextSearchEntry(String align, String valign, String name,
059: String href, String target, String title) {
060:
061: this (align, valign, DEFAULT_COLSPAN, name, href, null, null);
062: }
063:
064: public TextSearchEntry(String align, String valign, int colspan,
065: String name, String href, String target, String title) {
066:
067: super (align, valign, colspan);
068:
069: _name = name;
070: _href = href;
071: _target = target;
072: _title = title;
073: }
074:
075: public String getName() {
076: return _name;
077: }
078:
079: public void setName(String name) {
080: _name = name;
081: }
082:
083: public String getHref() {
084: return _href;
085: }
086:
087: public void setHref(String href) {
088: _href = href;
089: }
090:
091: public String getTarget() {
092: return _target;
093: }
094:
095: public void setTarget(String target) {
096: _target = target;
097: }
098:
099: public String getTitle() {
100: return _title;
101: }
102:
103: public void setTitle(String title) {
104: _title = title;
105: }
106:
107: public void print(PageContext pageContext) throws Exception {
108: if (_href == null) {
109: pageContext.getOut().print(_name);
110: } else {
111: StringMaker sm = new StringMaker();
112:
113: sm.append("<a href=\"");
114: sm.append(_href);
115: sm.append("\"");
116:
117: if (Validator.isNotNull(_target)) {
118: sm.append(" target=\"");
119: sm.append(_target);
120: sm.append("\"");
121: }
122:
123: if (Validator.isNotNull(_title)) {
124: sm.append(" title=\"");
125: sm.append(_title);
126: sm.append("\"");
127: }
128:
129: sm.append(">");
130: sm.append(_name);
131: sm.append("</a>");
132:
133: pageContext.getOut().print(sm.toString());
134: }
135: }
136:
137: public Object clone() {
138: return new TextSearchEntry(getAlign(), getValign(),
139: getColspan(), getName(), getHref(), getTarget(),
140: getTitle());
141: }
142:
143: private String _name;
144: private String _href;
145: private String _target;
146: private String _title;
147:
148: }
|