1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.myfaces.tobago.internal.taglib;
21
22 import javax.faces.application.Application;
23 import javax.faces.component.UIComponent;
24 import javax.faces.context.FacesContext;
25 import org.apache.commons.lang.StringUtils;
26 import org.apache.myfaces.tobago.component.UIImage;
27 import org.slf4j.Logger;
28 import org.slf4j.LoggerFactory;
29
30
31
32
33
34 public final class ImageTag extends TobagoELTag {
35 private static final Logger LOG = LoggerFactory.getLogger(ImageTag.class);
36 private javax.el.ValueExpression markup;
37 private javax.el.ValueExpression tip;
38 private javax.el.ValueExpression height;
39 private javax.el.ValueExpression alt;
40 private javax.el.ValueExpression value;
41 private javax.el.ValueExpression border;
42 private javax.el.ValueExpression width;
43 private javax.el.ValueExpression disabled;
44
45 @Override
46 public String getComponentType() {
47 return UIImage.COMPONENT_TYPE;
48 }
49 @Override
50 public String getRendererType() {
51 return "Image";
52 }
53
54 @Override
55 protected void setProperties(final UIComponent uiComponent) {
56 super.setProperties(uiComponent);
57 final UIImage component = (UIImage) uiComponent;
58 final FacesContext context = FacesContext.getCurrentInstance();
59 final Application application = context.getApplication();
60 if (markup != null) {
61 if (!markup.isLiteralText()) {
62 component.setValueExpression("markup", markup);
63 } else {
64 component.setMarkup(org.apache.myfaces.tobago.context.Markup.valueOf(markup.getExpressionString()));
65 }
66 }
67 if (tip != null) {
68 component.setValueExpression("tip", tip);
69 }
70
71 if (height != null) {
72 if (!height.isLiteralText()) {
73 component.setValueExpression("height", height);
74 } else {
75 component.setHeight(org.apache.myfaces.tobago.layout.Measure.valueOf(height.getExpressionString()));
76 }
77 }
78 if (alt != null) {
79 component.setValueExpression("alt", alt);
80 }
81
82 if (value != null) {
83 component.setValueExpression("value", value);
84 }
85
86 if (border != null) {
87 component.setValueExpression("border", border);
88 }
89
90 if (width != null) {
91 if (!width.isLiteralText()) {
92 component.setValueExpression("width", width);
93 } else {
94 component.setWidth(org.apache.myfaces.tobago.layout.Measure.valueOf(width.getExpressionString()));
95 }
96 }
97 if (disabled != null) {
98 if (!disabled.isLiteralText()) {
99 component.setValueExpression("disabled", disabled);
100 } else {
101 component.setDisabled(Boolean.parseBoolean(disabled.getExpressionString()));
102 }
103 }
104 }
105
106 public javax.el.ValueExpression getMarkup() {
107 return markup;
108 }
109
110 public void setMarkup(final javax.el.ValueExpression markup) {
111 this.markup = markup;
112 }
113
114 public javax.el.ValueExpression getTip() {
115 return tip;
116 }
117
118 public void setTip(final javax.el.ValueExpression tip) {
119 this.tip = tip;
120 }
121
122 public javax.el.ValueExpression getHeight() {
123 return height;
124 }
125
126 public void setHeight(final javax.el.ValueExpression height) {
127 this.height = height;
128 }
129
130 public javax.el.ValueExpression getAlt() {
131 return alt;
132 }
133
134 public void setAlt(final javax.el.ValueExpression alt) {
135 this.alt = alt;
136 }
137
138 public javax.el.ValueExpression getValue() {
139 return value;
140 }
141
142 public void setValue(final javax.el.ValueExpression value) {
143 this.value = value;
144 }
145
146 public javax.el.ValueExpression getBorder() {
147 return border;
148 }
149
150 public void setBorder(final javax.el.ValueExpression border) {
151 this.border = border;
152 }
153
154 public javax.el.ValueExpression getWidth() {
155 return width;
156 }
157
158 public void setWidth(final javax.el.ValueExpression width) {
159 this.width = width;
160 }
161
162 public javax.el.ValueExpression getDisabled() {
163 return disabled;
164 }
165
166 public void setDisabled(final javax.el.ValueExpression disabled) {
167 this.disabled = disabled;
168 }
169
170
171
172 @Override
173 public void release() {
174 super.release();
175 markup = null;
176 tip = null;
177 height = null;
178 alt = null;
179 value = null;
180 border = null;
181 width = null;
182 disabled = null;
183 }
184 }