001 // ---------- Attention: Generated code, please do not modify! ----------- 002 003 /* 004 * Licensed to the Apache Software Foundation (ASF) under one or more 005 * contributor license agreements. See the NOTICE file distributed with 006 * this work for additional information regarding copyright ownership. 007 * The ASF licenses this file to You under the Apache License, Version 2.0 008 * (the "License"); you may not use this file except in compliance with 009 * the License. You may obtain a copy of the License at 010 * 011 * http://www.apache.org/licenses/LICENSE-2.0 012 * 013 * Unless required by applicable law or agreed to in writing, software 014 * distributed under the License is distributed on an "AS IS" BASIS, 015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 016 * See the License for the specific language governing permissions and 017 * limitations under the License. 018 */ 019 020 package org.apache.myfaces.tobago.component; 021 022 import javax.faces.context.FacesContext; 023 import org.apache.myfaces.tobago.context.Markup; 024 import org.apache.myfaces.tobago.internal.component.AbstractUIFlowLayout; 025 import org.apache.myfaces.tobago.layout.Measure; 026 import org.apache.myfaces.tobago.layout.TextAlign; 027 import org.apache.commons.lang.ArrayUtils; 028 import org.apache.commons.lang.StringUtils; 029 import org.apache.myfaces.tobago.component.MethodBindingToMethodExpression; 030 import org.apache.myfaces.tobago.component.MethodExpressionToMethodBinding; 031 import org.apache.myfaces.tobago.internal.util.Deprecation; 032 import org.apache.myfaces.tobago.renderkit.MarginValues; 033 import org.apache.myfaces.tobago.renderkit.SpacingValues; 034 import org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer; 035 import javax.el.ELException; 036 import javax.faces.FacesException; 037 import java.util.ArrayList; 038 import java.util.List; 039 import javax.el.MethodExpression; 040 import javax.el.ValueExpression; 041 042 /** 043 XXX Warning: Still in progress! Please do not use it until other announcement. 044 Renders a FlowLayout that positions the content components in there natural order. 045 * UIComponent class, generated from template {@code component1.2.stg} with class 046 * {@link org.apache.myfaces.tobago.internal.taglib.component.FlowLayoutTagDeclaration}. 047 */ 048 public class UIFlowLayout 049 extends AbstractUIFlowLayout implements SupportsMarkup { 050 051 public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.FlowLayout"; 052 053 public static final String COMPONENT_FAMILY = "org.apache.myfaces.tobago.FlowLayout"; 054 055 private org.apache.myfaces.tobago.layout.Measure marginBottom; 056 private org.apache.myfaces.tobago.context.Markup markup; 057 private org.apache.myfaces.tobago.layout.Measure marginTop; 058 private org.apache.myfaces.tobago.layout.Measure marginLeft; 059 private org.apache.myfaces.tobago.layout.Measure marginRight; 060 private org.apache.myfaces.tobago.context.Markup currentMarkup; 061 private org.apache.myfaces.tobago.layout.TextAlign textAlign; 062 private org.apache.myfaces.tobago.layout.Measure margin; 063 064 public String getFamily() { 065 return COMPONENT_FAMILY; 066 } 067 068 069 /** 070 Bottom margin between container component and the children. 071 072 */ 073 public org.apache.myfaces.tobago.layout.Measure getMarginBottom() { 074 if (marginBottom != null) { 075 return marginBottom; 076 } 077 ValueExpression ve = getValueExpression("marginBottom"); 078 if (ve != null) { 079 try { 080 Object object = ve.getValue(getFacesContext().getELContext()); 081 return Measure.valueOf(object); 082 } catch (ELException e) { 083 throw new FacesException(e); 084 } 085 } 086 return getMargin() != null 087 ? getMargin() 088 : ((MarginValues)getRenderer(getFacesContext())).getMarginBottom(getFacesContext(), this); 089 } 090 091 public void setMarginBottom(org.apache.myfaces.tobago.layout.Measure marginBottom) { 092 this.marginBottom = marginBottom; 093 } 094 095 public org.apache.myfaces.tobago.context.Markup getMarkup() { 096 if (markup != null) { 097 return markup; 098 } 099 ValueExpression ve = getValueExpression("markup"); 100 if (ve != null) { 101 try { 102 Object object = ve.getValue(getFacesContext().getELContext()); 103 return Markup.valueOf(object); 104 } catch (ELException e) { 105 throw new FacesException(e); 106 } 107 } 108 return null; 109 } 110 111 public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) { 112 this.markup = markup; 113 } 114 115 /** 116 Top margin between container component and the children. 117 118 */ 119 public org.apache.myfaces.tobago.layout.Measure getMarginTop() { 120 if (marginTop != null) { 121 return marginTop; 122 } 123 ValueExpression ve = getValueExpression("marginTop"); 124 if (ve != null) { 125 try { 126 Object object = ve.getValue(getFacesContext().getELContext()); 127 return Measure.valueOf(object); 128 } catch (ELException e) { 129 throw new FacesException(e); 130 } 131 } 132 return getMargin() != null 133 ? getMargin() 134 : ((MarginValues)getRenderer(getFacesContext())).getMarginTop(getFacesContext(), this); 135 } 136 137 public void setMarginTop(org.apache.myfaces.tobago.layout.Measure marginTop) { 138 this.marginTop = marginTop; 139 } 140 141 /** 142 Left margin between container component and the children. 143 144 */ 145 public org.apache.myfaces.tobago.layout.Measure getMarginLeft() { 146 if (marginLeft != null) { 147 return marginLeft; 148 } 149 ValueExpression ve = getValueExpression("marginLeft"); 150 if (ve != null) { 151 try { 152 Object object = ve.getValue(getFacesContext().getELContext()); 153 return Measure.valueOf(object); 154 } catch (ELException e) { 155 throw new FacesException(e); 156 } 157 } 158 return getMargin() != null 159 ? getMargin() 160 : ((MarginValues)getRenderer(getFacesContext())).getMarginLeft(getFacesContext(), this); 161 } 162 163 public void setMarginLeft(org.apache.myfaces.tobago.layout.Measure marginLeft) { 164 this.marginLeft = marginLeft; 165 } 166 167 /** 168 Right margin between container component and the children. 169 170 */ 171 public org.apache.myfaces.tobago.layout.Measure getMarginRight() { 172 if (marginRight != null) { 173 return marginRight; 174 } 175 ValueExpression ve = getValueExpression("marginRight"); 176 if (ve != null) { 177 try { 178 Object object = ve.getValue(getFacesContext().getELContext()); 179 return Measure.valueOf(object); 180 } catch (ELException e) { 181 throw new FacesException(e); 182 } 183 } 184 return getMargin() != null 185 ? getMargin() 186 : ((MarginValues)getRenderer(getFacesContext())).getMarginRight(getFacesContext(), this); 187 } 188 189 public void setMarginRight(org.apache.myfaces.tobago.layout.Measure marginRight) { 190 this.marginRight = marginRight; 191 } 192 193 public org.apache.myfaces.tobago.context.Markup getCurrentMarkup() { 194 if (currentMarkup != null) { 195 return currentMarkup; 196 } 197 return null; 198 } 199 200 public void setCurrentMarkup(org.apache.myfaces.tobago.context.Markup currentMarkup) { 201 this.currentMarkup = currentMarkup; 202 } 203 204 /** 205 The alignment of the elements inside of the container, possible values are: 206 { 207 <br />Default: <code>TextAlign.LEFT</code><br />Allowed Values: <code>left,right,center,justify</code> 208 */ 209 public org.apache.myfaces.tobago.layout.TextAlign getTextAlign() { 210 if (textAlign != null) { 211 return textAlign; 212 } 213 ValueExpression ve = getValueExpression("textAlign"); 214 if (ve != null) { 215 try { 216 org.apache.myfaces.tobago.layout.TextAlign textAlign = (org.apache.myfaces.tobago.layout.TextAlign) ve.getValue(getFacesContext().getELContext()); 217 if (textAlign != null) { 218 return textAlign; 219 } 220 } catch (ELException e) { 221 throw new FacesException(e); 222 } 223 } 224 return TextAlign.LEFT; 225 } 226 227 public void setTextAlign(org.apache.myfaces.tobago.layout.TextAlign textAlign) { 228 this.textAlign = textAlign; 229 } 230 231 /** 232 Margin between container component and the children. 233 234 */ 235 public org.apache.myfaces.tobago.layout.Measure getMargin() { 236 if (margin != null) { 237 return margin; 238 } 239 ValueExpression ve = getValueExpression("margin"); 240 if (ve != null) { 241 try { 242 Object object = ve.getValue(getFacesContext().getELContext()); 243 return Measure.valueOf(object); 244 } catch (ELException e) { 245 throw new FacesException(e); 246 } 247 } 248 return null; 249 } 250 251 public void setMargin(org.apache.myfaces.tobago.layout.Measure margin) { 252 this.margin = margin; 253 } 254 255 public void restoreState(FacesContext context, Object componentState) { 256 Object[] values = (Object[]) componentState; 257 super.restoreState(context, values[0]); 258 marginBottom = (org.apache.myfaces.tobago.layout.Measure) values[1]; 259 markup = (org.apache.myfaces.tobago.context.Markup) values[2]; 260 marginTop = (org.apache.myfaces.tobago.layout.Measure) values[3]; 261 marginLeft = (org.apache.myfaces.tobago.layout.Measure) values[4]; 262 marginRight = (org.apache.myfaces.tobago.layout.Measure) values[5]; 263 textAlign = (org.apache.myfaces.tobago.layout.TextAlign) values[6]; 264 margin = (org.apache.myfaces.tobago.layout.Measure) values[7]; 265 } 266 267 public Object saveState(FacesContext context) { 268 Object[] values = new Object[8]; 269 values[0] = super.saveState(context); 270 values[1] = marginBottom; 271 values[2] = markup; 272 values[3] = marginTop; 273 values[4] = marginLeft; 274 values[5] = marginRight; 275 values[6] = textAlign; 276 values[7] = margin; 277 currentMarkup = null; 278 return values; 279 } 280 281 282 }