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.component.PeriodClientDataComponent;
13 import org.rcfaces.core.internal.tools.ListenersTools;
14 import javax.faces.context.FacesContext;
15
16 public class PeriodClientDataTag extends CameliaTag implements Tag {
17
18
19 private static final Log LOG=LogFactory.getLog(PeriodClientDataTag.class);
20
21 private ValueExpression name;
22 private ValueExpression value;
23 public String getComponentType() {
24 return PeriodClientDataComponent.COMPONENT_TYPE;
25 }
26
27 public final void setName(ValueExpression name) {
28 this.name = name;
29 }
30
31 public final void setValue(ValueExpression value) {
32 this.value = value;
33 }
34
35 protected void setProperties(UIComponent uiComponent) {
36 if (LOG.isDebugEnabled()) {
37 if (PeriodClientDataComponent.COMPONENT_TYPE==getComponentType()) {
38 LOG.debug("Component id='"+getId()+"' type='"+getComponentType()+"'.");
39 }
40 LOG.debug(" name='"+name+"'");
41 LOG.debug(" value='"+value+"'");
42 }
43 if ((uiComponent instanceof PeriodClientDataComponent)==false) {
44 if (uiComponent instanceof UIViewRoot) {
45 throw new IllegalStateException("The first component of the page must be a UIViewRoot component !");
46 }
47 throw new IllegalStateException("Component specified by tag is not instanceof of 'PeriodClientDataComponent'.");
48 }
49
50 super.setProperties(uiComponent);
51
52 PeriodClientDataComponent component = (PeriodClientDataComponent) uiComponent;
53 FacesContext facesContext = getFacesContext();
54
55 if (name != null) {
56 if (name.isLiteralText()==false) {
57 component.setValueExpression(Properties.NAME, name);
58
59 } else {
60 component.setName(name.getExpressionString());
61 }
62 }
63
64 if (value != null) {
65 if (value.isLiteralText()==false) {
66 component.setValueExpression(Properties.VALUE, value);
67
68 } else {
69 component.setValue(value.getExpressionString());
70 }
71 }
72 }
73
74 public void release() {
75 name = null;
76 value = null;
77
78 super.release();
79 }
80
81 }