1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.taglib.ui;
16  
17  import com.liferay.taglib.util.IncludeTag;
18  
19  import javax.servlet.http.HttpServletRequest;
20  
21  /**
22   * <a href="IconTag.java.html"><b><i>View Source</i></b></a>
23   *
24   * @author Brian Wing Shun Chan
25   */
26  public class IconTag extends IncludeTag {
27  
28      public void setCssClass(String cssClass) {
29          _cssClass = cssClass;
30      }
31  
32      public void setImage(String image) {
33          _image = image;
34      }
35  
36      public void setImageHover(String imageHover) {
37          _imageHover = imageHover;
38      }
39  
40      public void setLabel(boolean label) {
41          _label = label;
42      }
43  
44      public void setLang(String lang) {
45          _lang = lang;
46      }
47  
48      public void setMessage(String message) {
49          _message = message;
50      }
51  
52      public void setMethod(String method) {
53          _method = method;
54      }
55  
56      public void setSrc(String src) {
57          _src = src;
58      }
59  
60      public void setSrcHover(String srcHover) {
61          _srcHover = srcHover;
62      }
63  
64      public void setTarget(String target) {
65          _target = target;
66      }
67  
68      public void setToolTip(boolean toolTip) {
69          _toolTip = toolTip;
70      }
71  
72      public void setUrl(String url) {
73          _url = url;
74      }
75  
76      protected void cleanUp() {
77          _cssClass = null;
78          _image = null;
79          _imageHover = null;
80          _label = false;
81          _lang = null;
82          _message = null;
83          _method = null;
84          _src = null;
85          _srcHover = null;
86          _target = null;
87          _toolTip = false;
88          _url = null;
89      }
90  
91      protected String getPage() {
92          return _PAGE;
93      }
94  
95      protected boolean isCleanUpSetAttributes() {
96          return _CLEAN_UP_SET_ATTRIBUTES;
97      }
98  
99      protected void setAttributes(HttpServletRequest request) {
100         request.setAttribute("liferay-ui:icon:cssClass", _cssClass);
101         request.setAttribute("liferay-ui:icon:image", _image);
102         request.setAttribute("liferay-ui:icon:imageHover", _imageHover);
103         request.setAttribute("liferay-ui:icon:label", String.valueOf(_label));
104         request.setAttribute("liferay-ui:icon:lang", _lang);
105         request.setAttribute("liferay-ui:icon:message", _message);
106         request.setAttribute("liferay-ui:icon:method", _method);
107         request.setAttribute("liferay-ui:icon:src", _src);
108         request.setAttribute("liferay-ui:icon:srcHover", _srcHover);
109         request.setAttribute("liferay-ui:icon:target", _target);
110         request.setAttribute(
111             "liferay-ui:icon:toolTip", String.valueOf(_toolTip));
112         request.setAttribute("liferay-ui:icon:url", _url);
113     }
114 
115     private static final boolean _CLEAN_UP_SET_ATTRIBUTES = true;
116 
117     private static final String _PAGE = "/html/taglib/ui/icon/page.jsp";
118 
119     private String _cssClass;
120     private String _image;
121     private String _imageHover;
122     private boolean _label;
123     private String _lang;
124     private String _message;
125     private String _method;
126     private String _src;
127     private String _srcHover;
128     private String _target = "_self";
129     private boolean _toolTip;
130     private String _url;
131 
132 }