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 org.rcfaces.core.component.AbstractSeparatorComponent;
7 import javax.el.ValueExpression;
8 import javax.faces.component.UIViewRoot;
9 import org.apache.commons.logging.Log;
10 import javax.servlet.jsp.tagext.Tag;
11 import org.apache.commons.logging.LogFactory;
12 import org.rcfaces.core.internal.tools.ListenersTools1_2;
13 import org.rcfaces.core.internal.tools.ListenersTools;
14 import javax.faces.context.FacesContext;
15
16 public abstract class AbstractSeparatorTag extends CameliaTag implements Tag {
17
18
19 private static final Log LOG=LogFactory.getLog(AbstractSeparatorTag.class);
20
21 private ValueExpression visible;
22 private ValueExpression hiddenMode;
23 private ValueExpression unlockedClientAttributeNames;
24 public final void setVisible(ValueExpression visible) {
25 this.visible = visible;
26 }
27
28 public final void setHiddenMode(ValueExpression hiddenMode) {
29 this.hiddenMode = hiddenMode;
30 }
31
32 public final void setUnlockedClientAttributeNames(ValueExpression unlockedClientAttributeNames) {
33 this.unlockedClientAttributeNames = unlockedClientAttributeNames;
34 }
35
36 protected void setProperties(UIComponent uiComponent) {
37 if (LOG.isDebugEnabled()) {
38 LOG.debug(" visible='"+visible+"'");
39 LOG.debug(" hiddenMode='"+hiddenMode+"'");
40 LOG.debug(" unlockedClientAttributeNames='"+unlockedClientAttributeNames+"'");
41 }
42 if ((uiComponent instanceof AbstractSeparatorComponent)==false) {
43 if (uiComponent instanceof UIViewRoot) {
44 throw new IllegalStateException("The first component of the page must be a UIViewRoot component !");
45 }
46 throw new IllegalStateException("Component specified by tag is not instanceof of 'AbstractSeparatorComponent'.");
47 }
48
49 super.setProperties(uiComponent);
50
51 AbstractSeparatorComponent component = (AbstractSeparatorComponent) uiComponent;
52 FacesContext facesContext = getFacesContext();
53
54 if (visible != null) {
55 if (visible.isLiteralText()==false) {
56 component.setValueExpression(Properties.VISIBLE, visible);
57
58 } else {
59 component.setVisible(getBool(visible.getExpressionString()));
60 }
61 }
62
63 if (hiddenMode != null) {
64 if (hiddenMode.isLiteralText()==false) {
65 component.setValueExpression(Properties.HIDDEN_MODE, hiddenMode);
66
67 } else {
68 component.setHiddenMode(hiddenMode.getExpressionString());
69 }
70 }
71
72 if (unlockedClientAttributeNames != null) {
73 if (unlockedClientAttributeNames.isLiteralText()==false) {
74 component.setValueExpression(Properties.UNLOCKED_CLIENT_ATTRIBUTE_NAMES, unlockedClientAttributeNames);
75
76 } else {
77 component.setUnlockedClientAttributeNames(unlockedClientAttributeNames.getExpressionString());
78 }
79 }
80 }
81
82 public void release() {
83 visible = null;
84 hiddenMode = null;
85 unlockedClientAttributeNames = null;
86
87 super.release();
88 }
89
90 }