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.component;
21
22 import javax.faces.context.FacesContext;
23 import org.apache.myfaces.tobago.context.Markup;
24 import org.apache.myfaces.tobago.internal.component.AbstractUIFlowLayout;
25 import org.apache.myfaces.tobago.layout.Measure;
26 import org.apache.myfaces.tobago.layout.TextAlign;
27 import org.apache.commons.lang.ArrayUtils;
28 import org.apache.commons.lang.StringUtils;
29 import org.apache.myfaces.tobago.internal.util.Deprecation;
30 import org.apache.myfaces.tobago.renderkit.MarginValues;
31 import org.apache.myfaces.tobago.renderkit.SpacingValues;
32 import org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer;
33 import javax.el.ELException;
34 import javax.faces.FacesException;
35 import java.util.ArrayList;
36 import java.util.List;
37 import javax.el.MethodExpression;
38 import javax.el.ValueExpression;
39
40
41
42
43
44
45
46 public class UIFlowLayout
47 extends AbstractUIFlowLayout implements SupportsMarkup {
48
49 public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.FlowLayout";
50
51 public static final String COMPONENT_FAMILY = "org.apache.myfaces.tobago.FlowLayout";
52
53 private org.apache.myfaces.tobago.context.Markup currentMarkup;
54
55 enum PropertyKeys {
56 marginBottom,
57 markup,
58 marginTop,
59 marginLeft,
60 marginRight,
61 textAlign,
62 margin,
63 }
64
65 public String getFamily() {
66 return COMPONENT_FAMILY;
67 }
68
69
70
71
72
73
74 public org.apache.myfaces.tobago.layout.Measure getMarginBottom() {
75 Object object = getStateHelper().eval(PropertyKeys.marginBottom);
76 if (object != null) {
77 return Measure.valueOf(object);
78 }
79 return getMargin() != null
80 ? getMargin()
81 : ((MarginValues)getRenderer(getFacesContext())).getMarginBottom(getFacesContext(), this);
82 }
83
84 public void setMarginBottom(org.apache.myfaces.tobago.layout.Measure marginBottom) {
85 getStateHelper().put(PropertyKeys.marginBottom, marginBottom);
86 }
87
88 public org.apache.myfaces.tobago.context.Markup getMarkup() {
89 Object object = getStateHelper().eval(PropertyKeys.markup);
90 if (object != null) {
91 return Markup.valueOf(object);
92 }
93 return null;
94 }
95
96 public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) {
97 getStateHelper().put(PropertyKeys.markup, markup);
98 }
99
100
101
102
103
104 public org.apache.myfaces.tobago.layout.Measure getMarginTop() {
105 Object object = getStateHelper().eval(PropertyKeys.marginTop);
106 if (object != null) {
107 return Measure.valueOf(object);
108 }
109 return getMargin() != null
110 ? getMargin()
111 : ((MarginValues)getRenderer(getFacesContext())).getMarginTop(getFacesContext(), this);
112 }
113
114 public void setMarginTop(org.apache.myfaces.tobago.layout.Measure marginTop) {
115 getStateHelper().put(PropertyKeys.marginTop, marginTop);
116 }
117
118
119
120
121
122 public org.apache.myfaces.tobago.layout.Measure getMarginLeft() {
123 Object object = getStateHelper().eval(PropertyKeys.marginLeft);
124 if (object != null) {
125 return Measure.valueOf(object);
126 }
127 return getMargin() != null
128 ? getMargin()
129 : ((MarginValues)getRenderer(getFacesContext())).getMarginLeft(getFacesContext(), this);
130 }
131
132 public void setMarginLeft(org.apache.myfaces.tobago.layout.Measure marginLeft) {
133 getStateHelper().put(PropertyKeys.marginLeft, marginLeft);
134 }
135
136
137
138
139
140 public org.apache.myfaces.tobago.layout.Measure getMarginRight() {
141 Object object = getStateHelper().eval(PropertyKeys.marginRight);
142 if (object != null) {
143 return Measure.valueOf(object);
144 }
145 return getMargin() != null
146 ? getMargin()
147 : ((MarginValues)getRenderer(getFacesContext())).getMarginRight(getFacesContext(), this);
148 }
149
150 public void setMarginRight(org.apache.myfaces.tobago.layout.Measure marginRight) {
151 getStateHelper().put(PropertyKeys.marginRight, marginRight);
152 }
153
154 public org.apache.myfaces.tobago.context.Markup getCurrentMarkup() {
155 if (currentMarkup != null) {
156 return currentMarkup;
157 }
158 return null;
159 }
160
161 public void setCurrentMarkup(org.apache.myfaces.tobago.context.Markup currentMarkup) {
162 this.currentMarkup = currentMarkup;
163 }
164
165
166
167
168
169
170 public org.apache.myfaces.tobago.layout.TextAlign getTextAlign() {
171 org.apache.myfaces.tobago.layout.TextAlign textAlign = (org.apache.myfaces.tobago.layout.TextAlign) getStateHelper().eval(PropertyKeys.textAlign);
172 if (textAlign != null) {
173 return textAlign;
174 }
175 return TextAlign.LEFT;
176 }
177
178 public void setTextAlign(org.apache.myfaces.tobago.layout.TextAlign textAlign) {
179 getStateHelper().put(PropertyKeys.textAlign, textAlign);
180 }
181
182
183
184
185
186 public org.apache.myfaces.tobago.layout.Measure getMargin() {
187 Object object = getStateHelper().eval(PropertyKeys.margin);
188 if (object != null) {
189 return Measure.valueOf(object);
190 }
191 return null;
192 }
193
194 public void setMargin(org.apache.myfaces.tobago.layout.Measure margin) {
195 getStateHelper().put(PropertyKeys.margin, margin);
196 }
197
198 public Object saveState(FacesContext context) {
199 currentMarkup = null;
200 return super.saveState(context);
201 }
202
203
204 }