View Javadoc

1   // ---------- Attention: Generated code, please do not modify! -----------  
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one or more
5    * contributor license agreements.  See the NOTICE file distributed with
6    * this work for additional information regarding copyright ownership.
7    * The ASF licenses this file to You under the Apache License, Version 2.0
8    * (the "License"); you may not use this file except in compliance with
9    * the License.  You may obtain a copy of the License at
10   *
11   *      http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing, software
14   * distributed under the License is distributed on an "AS IS" BASIS,
15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   * See the License for the specific language governing permissions and
17   * limitations under the License.
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.AbstractUISplitLayout;
25  import org.apache.myfaces.tobago.layout.Measure;
26  import org.apache.myfaces.tobago.internal.util.ArrayUtils;
27  import org.apache.myfaces.tobago.internal.util.StringUtils;
28  import org.apache.myfaces.tobago.internal.util.Deprecation;
29  import org.apache.myfaces.tobago.renderkit.MarginValues;
30  import org.apache.myfaces.tobago.renderkit.SpacingValues;
31  import org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer;
32  import javax.el.ELException;
33  import javax.faces.FacesException;
34  import java.util.ArrayList;
35  import java.util.List;
36  import javax.el.MethodExpression;
37  import javax.el.ValueExpression;
38  
39  /** 
40   Renders a SplitLayout.
41    A area with two child components rendered horizontally or vertically and allows to change the
42    layout relation of this two components on the client.
43    * UIComponent class, generated from template {@code component2.0.stg} with class
44    * {@link org.apache.myfaces.tobago.internal.taglib.sandbox.SplitLayoutTagDeclaration}.
45   */
46  public class UISplitLayout
47      extends AbstractUISplitLayout implements SupportsMarkup {
48  
49    public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.SplitLayout";
50  
51    public static final String COMPONENT_FAMILY = "org.apache.myfaces.tobago.GridLayout";
52  
53    private org.apache.myfaces.tobago.context.Markup currentMarkup;
54  
55    enum PropertyKeys {
56      orientation,
57      markup,
58      marginLeft,
59      marginTop,
60      marginRight,
61      rigid,
62      cellspacing,
63      marginBottom,
64      rowSpacing,
65      layout,
66      margin,
67      border,
68      columnSpacing,
69    }
70  
71    public String getFamily() {
72      return COMPONENT_FAMILY;
73    }
74  
75  
76    /**
77    This value defines the orientation of the split layout.
78     Possible values are 'HORIZONTAL' and 'VERTICAL'.
79    <br />Allowed Values: <code>HORIZONTAL,VERTICAL</code>
80    */
81    public java.lang.String getOrientation() {
82      return (java.lang.String) getStateHelper().eval(PropertyKeys.orientation);
83    }
84  
85    public void setOrientation(java.lang.String orientation) {
86      getStateHelper().put(PropertyKeys.orientation, orientation);
87    }
88  
89    public org.apache.myfaces.tobago.context.Markup getMarkup() {
90      Object object = getStateHelper().eval(PropertyKeys.markup);
91      if (object != null) {
92        return Markup.valueOf(object);
93      }
94      return null;
95    }
96  
97    public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) {
98      getStateHelper().put(PropertyKeys.markup, markup);
99    }
100 
101   /**
102   Left margin between container component and the children.
103 
104   */
105   public org.apache.myfaces.tobago.layout.Measure getMarginLeft() {
106     Object object = getStateHelper().eval(PropertyKeys.marginLeft);
107     if (object != null) {
108        return Measure.valueOf(object);
109     }
110     return getMargin() != null
111    ? getMargin()
112    : getRendererType() != null ? ((MarginValues)getRenderer(getFacesContext())).getMarginLeft(getFacesContext(), this) : Measure.ZERO;
113   }
114 
115   public void setMarginLeft(org.apache.myfaces.tobago.layout.Measure marginLeft) {
116     getStateHelper().put(PropertyKeys.marginLeft, marginLeft);
117   }
118 
119   /**
120   Top margin between container component and the children.
121 
122   */
123   public org.apache.myfaces.tobago.layout.Measure getMarginTop() {
124     Object object = getStateHelper().eval(PropertyKeys.marginTop);
125     if (object != null) {
126        return Measure.valueOf(object);
127     }
128     return getMargin() != null
129    ? getMargin()
130    : getRendererType() != null ? ((MarginValues)getRenderer(getFacesContext())).getMarginTop(getFacesContext(), this) : Measure.ZERO;
131   }
132 
133   public void setMarginTop(org.apache.myfaces.tobago.layout.Measure marginTop) {
134     getStateHelper().put(PropertyKeys.marginTop, marginTop);
135   }
136 
137   /**
138   Right margin between container component and the children.
139 
140   */
141   public org.apache.myfaces.tobago.layout.Measure getMarginRight() {
142     Object object = getStateHelper().eval(PropertyKeys.marginRight);
143     if (object != null) {
144        return Measure.valueOf(object);
145     }
146     return getMargin() != null
147    ? getMargin()
148    : getRendererType() != null ? ((MarginValues)getRenderer(getFacesContext())).getMarginRight(getFacesContext(), this) : Measure.ZERO;
149   }
150 
151   public void setMarginRight(org.apache.myfaces.tobago.layout.Measure marginRight) {
152     getStateHelper().put(PropertyKeys.marginRight, marginRight);
153   }
154 
155   /**
156   This attribute advises the layout manager, to not use space that comes from non rendered components.
157 
158   */
159   public boolean isRigid() {
160     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.rigid);
161     if (bool != null) {
162       return bool;
163     }
164     return false;
165   }
166 
167   public void setRigid(boolean rigid) {
168     getStateHelper().put(PropertyKeys.rigid, rigid);
169   }
170 
171   /**
172   Spacing between component and layout cell's.
173    Can be overwritten by columnSpacing and rowSpacing.
174 
175   @deprecated*/
176   @Deprecated
177   public org.apache.myfaces.tobago.layout.Measure getCellspacing() {
178     Object object = getStateHelper().eval(PropertyKeys.cellspacing);
179     if (object != null) {
180        return Measure.valueOf(object);
181     }
182     return null;
183   }
184 
185   @Deprecated
186   public void setCellspacing(org.apache.myfaces.tobago.layout.Measure cellspacing) {
187       Deprecation.LOG.error("The attribute 'cellspacing' of 'UISplitLayout' is deprecated. "
188           + "Please refer the documentation for further information.");
189     getStateHelper().put(PropertyKeys.cellspacing, cellspacing);
190   }
191 
192   /**
193   Bottom margin between container component and the children.
194 
195   */
196   public org.apache.myfaces.tobago.layout.Measure getMarginBottom() {
197     Object object = getStateHelper().eval(PropertyKeys.marginBottom);
198     if (object != null) {
199        return Measure.valueOf(object);
200     }
201     return getMargin() != null
202    ? getMargin()
203    : getRendererType() != null ? ((MarginValues)getRenderer(getFacesContext())).getMarginBottom(getFacesContext(), this) : Measure.ZERO;
204   }
205 
206   public void setMarginBottom(org.apache.myfaces.tobago.layout.Measure marginBottom) {
207     getStateHelper().put(PropertyKeys.marginBottom, marginBottom);
208   }
209 
210   /**
211   Spacing between the rows in the actual layout.
212 
213   */
214   public org.apache.myfaces.tobago.layout.Measure getRowSpacing() {
215     Object object = getStateHelper().eval(PropertyKeys.rowSpacing);
216     if (object != null) {
217        return Measure.valueOf(object);
218     }
219     return getCellspacing() != null
220    ? getCellspacing()
221    : getRendererType() != null ? ((SpacingValues)getRenderer(getFacesContext())).getRowSpacing(getFacesContext(), this) : Measure.ZERO;
222   }
223 
224   public void setRowSpacing(org.apache.myfaces.tobago.layout.Measure rowSpacing) {
225     getStateHelper().put(PropertyKeys.rowSpacing, rowSpacing);
226   }
227 
228   /**
229   This value defines the layout constraints for the layout.
230    It is two layout tokens separated by a semicolon. See GridLayout.
231    Example: '2*;*'.
232   <br />Default: <code>1*;1*</code>
233   */
234   public java.lang.String getLayout() {
235     java.lang.String layout = (java.lang.String) getStateHelper().eval(PropertyKeys.layout);
236     if (layout != null) {
237       return layout;
238     }
239     return "1*;1*";
240   }
241 
242   public void setLayout(java.lang.String layout) {
243     getStateHelper().put(PropertyKeys.layout, layout);
244   }
245 
246   public org.apache.myfaces.tobago.context.Markup getCurrentMarkup() {
247     if (currentMarkup != null) {
248       return currentMarkup;
249     }
250     return null;
251   }
252 
253   public void setCurrentMarkup(org.apache.myfaces.tobago.context.Markup currentMarkup) {
254     this.currentMarkup = currentMarkup;
255   }
256 
257   /**
258   Margin between container component and the children.
259 
260   */
261   public org.apache.myfaces.tobago.layout.Measure getMargin() {
262     Object object = getStateHelper().eval(PropertyKeys.margin);
263     if (object != null) {
264        return Measure.valueOf(object);
265     }
266     return null;
267   }
268 
269   public void setMargin(org.apache.myfaces.tobago.layout.Measure margin) {
270     getStateHelper().put(PropertyKeys.margin, margin);
271   }
272 
273   /**
274   Border size of this component.
275 
276   */
277   public java.lang.String getBorder() {
278     return (java.lang.String) getStateHelper().eval(PropertyKeys.border);
279   }
280 
281   public void setBorder(java.lang.String border) {
282     getStateHelper().put(PropertyKeys.border, border);
283   }
284 
285   /**
286   Spacing between the columns in the actual layout.
287 
288   */
289   public org.apache.myfaces.tobago.layout.Measure getColumnSpacing() {
290     Object object = getStateHelper().eval(PropertyKeys.columnSpacing);
291     if (object != null) {
292        return Measure.valueOf(object);
293     }
294     return getCellspacing() != null
295    ? getCellspacing()
296    : getRendererType() != null ? ((SpacingValues)getRenderer(getFacesContext())).getColumnSpacing(getFacesContext(), this) : Measure.ZERO;
297   }
298 
299   public void setColumnSpacing(org.apache.myfaces.tobago.layout.Measure columnSpacing) {
300     getStateHelper().put(PropertyKeys.columnSpacing, columnSpacing);
301   }
302 
303   public Object saveState(FacesContext context) {
304     currentMarkup = null;
305     return super.saveState(context);
306   }
307 
308 }