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.UITabGroup;
27 import org.slf4j.Logger;
28 import org.slf4j.LoggerFactory;
29
30
31
32
33
34 public final class TabGroupTag extends TobagoELTag {
35 private static final Logger LOG = LoggerFactory.getLogger(TabGroupTag.class);
36 private javax.el.MethodExpression actionListener;
37 private javax.el.ValueExpression markup;
38 private javax.el.MethodExpression action;
39 private javax.el.ValueExpression showNavigationBar;
40 private javax.el.MethodExpression tabChangeListener;
41 private javax.el.ValueExpression selectedIndex;
42 private javax.el.ValueExpression switchType;
43 private javax.el.ValueExpression immediate;
44 private javax.el.ValueExpression renderedPartially;
45
46 @Override
47 public String getComponentType() {
48 return UITabGroup.COMPONENT_TYPE;
49 }
50 @Override
51 public String getRendererType() {
52 return "TabGroup";
53 }
54
55 @Override
56 protected void setProperties(final UIComponent uiComponent) {
57 super.setProperties(uiComponent);
58 final UITabGroup component = (UITabGroup) uiComponent;
59 final FacesContext context = FacesContext.getCurrentInstance();
60 final Application application = context.getApplication();
61 if (actionListener != null) {
62 component.addActionListener(new javax.faces.event.MethodExpressionActionListener(actionListener));
63 }
64 if (markup != null) {
65 if (!markup.isLiteralText()) {
66 component.setValueExpression("markup", markup);
67 } else {
68 component.setMarkup(org.apache.myfaces.tobago.context.Markup.valueOf(markup.getExpressionString()));
69 }
70 }
71 if (action != null) {
72 component.setActionExpression(action);
73 }
74 if (showNavigationBar != null) {
75 if (!showNavigationBar.isLiteralText()) {
76 component.setValueExpression("showNavigationBar", showNavigationBar);
77 } else {
78 component.setShowNavigationBar(Boolean.parseBoolean(showNavigationBar.getExpressionString()));
79 }
80 }
81 if (tabChangeListener != null) {
82 component.addTabChangeListener(new org.apache.myfaces.tobago.event.MethodExpressionTabChangeListener(tabChangeListener));
83 }
84 if (selectedIndex != null) {
85 if (!selectedIndex.isLiteralText()) {
86 component.setValueExpression("selectedIndex", selectedIndex);
87 } else {
88 component.setSelectedIndex(Integer.parseInt(selectedIndex.getExpressionString()));
89 }
90 }
91 if (switchType != null) {
92 component.setValueExpression("switchType", switchType);
93 }
94
95 if (immediate != null) {
96 if (!immediate.isLiteralText()) {
97 component.setValueExpression("immediate", immediate);
98 } else {
99 component.setImmediate(Boolean.parseBoolean(immediate.getExpressionString()));
100 }
101 }
102 if (renderedPartially != null) {
103 if (!renderedPartially.isLiteralText()) {
104 component.setValueExpression("renderedPartially", renderedPartially);
105 } else {
106 component.setRenderedPartially(splitList(renderedPartially.getExpressionString()));
107 }
108 }
109 }
110
111 public javax.el.MethodExpression getActionListener() {
112 return actionListener;
113 }
114
115 public void setActionListener(final javax.el.MethodExpression actionListener) {
116 this.actionListener = actionListener;
117 }
118
119 public javax.el.ValueExpression getMarkup() {
120 return markup;
121 }
122
123 public void setMarkup(final javax.el.ValueExpression markup) {
124 this.markup = markup;
125 }
126
127 public javax.el.MethodExpression getAction() {
128 return action;
129 }
130
131 public void setAction(final javax.el.MethodExpression action) {
132 this.action = action;
133 }
134
135 public javax.el.ValueExpression getShowNavigationBar() {
136 return showNavigationBar;
137 }
138
139 public void setShowNavigationBar(final javax.el.ValueExpression showNavigationBar) {
140 this.showNavigationBar = showNavigationBar;
141 }
142
143 public javax.el.MethodExpression getTabChangeListener() {
144 return tabChangeListener;
145 }
146
147 public void setTabChangeListener(final javax.el.MethodExpression tabChangeListener) {
148 this.tabChangeListener = tabChangeListener;
149 }
150
151 public javax.el.ValueExpression getSelectedIndex() {
152 return selectedIndex;
153 }
154
155 public void setSelectedIndex(final javax.el.ValueExpression selectedIndex) {
156 this.selectedIndex = selectedIndex;
157 }
158
159 public javax.el.ValueExpression getSwitchType() {
160 return switchType;
161 }
162
163 public void setSwitchType(final javax.el.ValueExpression switchType) {
164 this.switchType = switchType;
165 }
166
167 public javax.el.ValueExpression getImmediate() {
168 return immediate;
169 }
170
171 public void setImmediate(final javax.el.ValueExpression immediate) {
172 this.immediate = immediate;
173 }
174
175 public javax.el.ValueExpression getRenderedPartially() {
176 return renderedPartially;
177 }
178
179 public void setRenderedPartially(final javax.el.ValueExpression renderedPartially) {
180 this.renderedPartially = renderedPartially;
181 }
182
183
184
185 @Override
186 public void release() {
187 super.release();
188 actionListener = null;
189 markup = null;
190 action = null;
191 showNavigationBar = null;
192 tabChangeListener = null;
193 selectedIndex = null;
194 switchType = null;
195 immediate = null;
196 renderedPartially = null;
197 }
198 }