1
2
3
4
5 package org.rcfaces.core.internal.taglib;
6
7 import javax.el.ValueExpression;
8 import javax.faces.component.UIComponent;
9 import javax.faces.webapp.UIComponentClassicTagBase;
10 import javax.servlet.jsp.JspException;
11 import javax.servlet.jsp.tagext.Tag;
12 import javax.servlet.jsp.tagext.TagSupport;
13
14 import org.rcfaces.core.internal.manager.IClientDataManager;
15
16
17
18
19
20
21 public class ClientDataTag extends TagSupport implements Tag {
22 private static final String REVISION = "$Revision: 1.17 $";
23
24 private static final long serialVersionUID = -7633749361412060360L;
25
26 protected String name;
27
28 protected ValueExpression value;
29
30 public void setName(String name) {
31 this.name = name;
32 }
33
34 public void setValue(ValueExpression value) {
35 this.value = value;
36 }
37
38 public int doStartTag() throws JspException {
39
40
41 UIComponentClassicTagBase tag = UIComponentClassicTagBase
42 .getParentUIComponentClassicTagBase(pageContext);
43 if (tag == null) {
44 throw new JspException("Not nested in a UIComponentTag");
45 }
46
47
48 if (!tag.getCreated()) {
49 return (SKIP_BODY);
50 }
51
52
53
54
55 UIComponent component = tag.getComponentInstance();
56 if ((component instanceof IClientDataManager) == false) {
57 throw new JspException(
58 "Component does not implement IClientDataManager");
59
60 }
61
62 IClientDataManager clientDataCapability = (IClientDataManager) component;
63
64 clientDataCapability.setClientData(name, value);
65
66 return (SKIP_BODY);
67
68 }
69
70
71
72
73
74 public void release() {
75 name = null;
76 value = null;
77
78 super.release();
79 }
80
81 }