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.component;
21
22 import org.apache.myfaces.tobago.component.OnComponentCreated;
23 import org.apache.myfaces.tobago.component.TreeModelBuilder;
24 import org.apache.myfaces.tobago.internal.util.Deprecation;
25 import org.apache.myfaces.tobago.model.MixedTreeModel;
26
27 import javax.el.ValueExpression;
28 import javax.faces.component.NamingContainer;
29 import javax.faces.component.UIComponent;
30 import javax.faces.context.FacesContext;
31
32
33
34
35 @Deprecated
36 public abstract class AbstractUITreeData extends javax.faces.component.UIInput
37 implements NamingContainer, TreeModelBuilder, OnComponentCreated {
38
39 public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.TreeData";
40
41 private String var;
42
43
44
45
46 public void onComponentCreated(FacesContext facesContext, UIComponent parent) {
47 Deprecation.LOG.warn("Please not use the <tc:treeData> tag.");
48 if (parent instanceof AbstractUITree) {
49 ValueExpression ve = getValueExpression("var");
50 if (ve != null) {
51 parent.setValueExpression("var", ve);
52 } else {
53 ((AbstractUITree) parent).setVar(getVar());
54 }
55 }
56
57 if (parent instanceof AbstractUITree) {
58 ValueExpression ve = getValueExpression("value");
59 if (ve != null) {
60 parent.setValueExpression("value", ve);
61 } else {
62 ((AbstractUITree) parent).setValue(getValue());
63 }
64 }
65 }
66
67 public String getVar() {
68 return var;
69 }
70
71 public void setVar(String var) {
72 this.var = var;
73 }
74
75 public void restoreState(FacesContext context, Object componentState) {
76 Object[] values = (Object[]) componentState;
77 super.restoreState(context, values[0]);
78 var = (String) values[1];
79 }
80
81 public Object saveState(FacesContext context) {
82 Object[] values = new Object[2];
83 values[0] = super.saveState(context);
84 values[1] = var;
85 return values;
86 }
87
88
89
90
91 @Deprecated
92 public void buildTreeModelBegin(FacesContext facesContext, MixedTreeModel model) {
93 Deprecation.LOG.error("Doesn't work anymore.");
94 }
95
96
97
98
99 @Deprecated
100 public void buildTreeModelChildren(FacesContext facesContext, MixedTreeModel model) {
101 Deprecation.LOG.error("Doesn't work anymore.");
102 }
103
104
105
106
107 @Deprecated
108 public void buildTreeModelEnd(FacesContext facesContext, MixedTreeModel model) {
109 Deprecation.LOG.error("Doesn't work anymore.");
110 }
111 }