1 package org.rcfaces.core.internal.taglib;
2
3 import javax.faces.application.Application;
4 import javax.faces.component.UIComponent;
5 import org.rcfaces.core.internal.component.Properties;
6 import javax.el.ValueExpression;
7 import javax.faces.component.UIViewRoot;
8 import org.apache.commons.logging.Log;
9 import javax.servlet.jsp.tagext.Tag;
10 import org.apache.commons.logging.LogFactory;
11 import org.rcfaces.core.internal.tools.ListenersTools1_2;
12 import org.rcfaces.core.internal.tools.ListenersTools;
13 import org.rcfaces.core.component.HyperLinkComponent;
14 import javax.faces.context.FacesContext;
15
16 public class HyperLinkTag extends ButtonTag implements Tag {
17
18
19 private static final Log LOG=LogFactory.getLog(HyperLinkTag.class);
20
21 private ValueExpression converter;
22 public String getComponentType() {
23 return HyperLinkComponent.COMPONENT_TYPE;
24 }
25
26 public final void setConverter(ValueExpression converter) {
27 this.converter = converter;
28 }
29
30 protected void setProperties(UIComponent uiComponent) {
31 if (LOG.isDebugEnabled()) {
32 if (HyperLinkComponent.COMPONENT_TYPE==getComponentType()) {
33 LOG.debug("Component id='"+getId()+"' type='"+getComponentType()+"'.");
34 }
35 LOG.debug(" converter='"+converter+"'");
36 }
37 if ((uiComponent instanceof HyperLinkComponent)==false) {
38 if (uiComponent instanceof UIViewRoot) {
39 throw new IllegalStateException("The first component of the page must be a UIViewRoot component !");
40 }
41 throw new IllegalStateException("Component specified by tag is not instanceof of 'HyperLinkComponent'.");
42 }
43
44 super.setProperties(uiComponent);
45
46 HyperLinkComponent component = (HyperLinkComponent) uiComponent;
47 FacesContext facesContext = getFacesContext();
48
49 if (converter != null) {
50 if (converter.isLiteralText()==false) {
51 component.setValueExpression(Properties.CONVERTER, converter);
52
53 } else {
54 component.setConverter(converter.getExpressionString());
55 }
56 }
57 }
58
59 public void release() {
60 converter = null;
61
62 super.release();
63 }
64
65 }