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.commons.lang.ArrayUtils; 027 import org.apache.commons.lang.StringUtils; 028 import org.apache.myfaces.tobago.component.MethodBindingToMethodExpression; 029 import org.apache.myfaces.tobago.component.MethodExpressionToMethodBinding; 030 import org.apache.myfaces.tobago.internal.util.Deprecation; 031 import org.apache.myfaces.tobago.renderkit.MarginValues; 032 import org.apache.myfaces.tobago.renderkit.SpacingValues; 033 import org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer; 034 import javax.el.ELException; 035 import javax.faces.FacesException; 036 import java.util.ArrayList; 037 import java.util.List; 038 import javax.el.MethodExpression; 039 import javax.el.ValueExpression; 040 041 /** 042 XXX Warning: Still in progress! Please do not use it until other announcement. 043 Renders a FlowLayout that positions the content components in there natural order. 044 * UIComponent class, generated from template {@code component1.2.stg} with class 045 * {@link org.apache.myfaces.tobago.internal.taglib.component.FlowLayoutTagDeclaration}. 046 */ 047 public class UIFlowLayout 048 extends AbstractUIFlowLayout implements SupportsMarkup { 049 050 public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.FlowLayout"; 051 052 public static final String COMPONENT_FAMILY = "org.apache.myfaces.tobago.FlowLayout"; 053 054 private org.apache.myfaces.tobago.layout.Measure marginBottom; 055 private org.apache.myfaces.tobago.context.Markup markup; 056 private org.apache.myfaces.tobago.layout.Measure marginTop; 057 private org.apache.myfaces.tobago.layout.Measure marginLeft; 058 private org.apache.myfaces.tobago.layout.Measure marginRight; 059 private org.apache.myfaces.tobago.context.Markup currentMarkup; 060 private org.apache.myfaces.tobago.layout.Measure margin; 061 062 public String getFamily() { 063 return COMPONENT_FAMILY; 064 } 065 066 067 /** 068 Bottom margin between container component and the children. 069 070 */ 071 public org.apache.myfaces.tobago.layout.Measure getMarginBottom() { 072 if (marginBottom != null) { 073 return marginBottom; 074 } 075 ValueExpression ve = getValueExpression("marginBottom"); 076 if (ve != null) { 077 try { 078 Object object = ve.getValue(getFacesContext().getELContext()); 079 return Measure.valueOf(object); 080 } catch (ELException e) { 081 throw new FacesException(e); 082 } 083 } 084 return getMargin() != null 085 ? getMargin() 086 : ((MarginValues)getRenderer(getFacesContext())).getMarginBottom(getFacesContext(), this); 087 } 088 089 public void setMarginBottom(org.apache.myfaces.tobago.layout.Measure marginBottom) { 090 this.marginBottom = marginBottom; 091 } 092 093 public org.apache.myfaces.tobago.context.Markup getMarkup() { 094 if (markup != null) { 095 return markup; 096 } 097 ValueExpression ve = getValueExpression("markup"); 098 if (ve != null) { 099 try { 100 Object object = ve.getValue(getFacesContext().getELContext()); 101 return Markup.valueOf(object); 102 } catch (ELException e) { 103 throw new FacesException(e); 104 } 105 } 106 return null; 107 } 108 109 public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) { 110 this.markup = markup; 111 } 112 113 /** 114 Top margin between container component and the children. 115 116 */ 117 public org.apache.myfaces.tobago.layout.Measure getMarginTop() { 118 if (marginTop != null) { 119 return marginTop; 120 } 121 ValueExpression ve = getValueExpression("marginTop"); 122 if (ve != null) { 123 try { 124 Object object = ve.getValue(getFacesContext().getELContext()); 125 return Measure.valueOf(object); 126 } catch (ELException e) { 127 throw new FacesException(e); 128 } 129 } 130 return getMargin() != null 131 ? getMargin() 132 : ((MarginValues)getRenderer(getFacesContext())).getMarginTop(getFacesContext(), this); 133 } 134 135 public void setMarginTop(org.apache.myfaces.tobago.layout.Measure marginTop) { 136 this.marginTop = marginTop; 137 } 138 139 /** 140 Left margin between container component and the children. 141 142 */ 143 public org.apache.myfaces.tobago.layout.Measure getMarginLeft() { 144 if (marginLeft != null) { 145 return marginLeft; 146 } 147 ValueExpression ve = getValueExpression("marginLeft"); 148 if (ve != null) { 149 try { 150 Object object = ve.getValue(getFacesContext().getELContext()); 151 return Measure.valueOf(object); 152 } catch (ELException e) { 153 throw new FacesException(e); 154 } 155 } 156 return getMargin() != null 157 ? getMargin() 158 : ((MarginValues)getRenderer(getFacesContext())).getMarginLeft(getFacesContext(), this); 159 } 160 161 public void setMarginLeft(org.apache.myfaces.tobago.layout.Measure marginLeft) { 162 this.marginLeft = marginLeft; 163 } 164 165 /** 166 Right margin between container component and the children. 167 168 */ 169 public org.apache.myfaces.tobago.layout.Measure getMarginRight() { 170 if (marginRight != null) { 171 return marginRight; 172 } 173 ValueExpression ve = getValueExpression("marginRight"); 174 if (ve != null) { 175 try { 176 Object object = ve.getValue(getFacesContext().getELContext()); 177 return Measure.valueOf(object); 178 } catch (ELException e) { 179 throw new FacesException(e); 180 } 181 } 182 return getMargin() != null 183 ? getMargin() 184 : ((MarginValues)getRenderer(getFacesContext())).getMarginRight(getFacesContext(), this); 185 } 186 187 public void setMarginRight(org.apache.myfaces.tobago.layout.Measure marginRight) { 188 this.marginRight = marginRight; 189 } 190 191 public org.apache.myfaces.tobago.context.Markup getCurrentMarkup() { 192 if (currentMarkup != null) { 193 return currentMarkup; 194 } 195 ValueExpression ve = getValueExpression("currentMarkup"); 196 if (ve != null) { 197 try { 198 Object object = ve.getValue(getFacesContext().getELContext()); 199 return Markup.valueOf(object); 200 } catch (ELException e) { 201 throw new FacesException(e); 202 } 203 } 204 return null; 205 } 206 207 public void setCurrentMarkup(org.apache.myfaces.tobago.context.Markup currentMarkup) { 208 this.currentMarkup = currentMarkup; 209 } 210 211 /** 212 Margin between container component and the children. 213 214 */ 215 public org.apache.myfaces.tobago.layout.Measure getMargin() { 216 if (margin != null) { 217 return margin; 218 } 219 ValueExpression ve = getValueExpression("margin"); 220 if (ve != null) { 221 try { 222 Object object = ve.getValue(getFacesContext().getELContext()); 223 return Measure.valueOf(object); 224 } catch (ELException e) { 225 throw new FacesException(e); 226 } 227 } 228 return null; 229 } 230 231 public void setMargin(org.apache.myfaces.tobago.layout.Measure margin) { 232 this.margin = margin; 233 } 234 235 public void restoreState(FacesContext context, Object componentState) { 236 Object[] values = (Object[]) componentState; 237 super.restoreState(context, values[0]); 238 marginBottom = (org.apache.myfaces.tobago.layout.Measure) values[1]; 239 markup = (org.apache.myfaces.tobago.context.Markup) values[2]; 240 marginTop = (org.apache.myfaces.tobago.layout.Measure) values[3]; 241 marginLeft = (org.apache.myfaces.tobago.layout.Measure) values[4]; 242 marginRight = (org.apache.myfaces.tobago.layout.Measure) values[5]; 243 currentMarkup = (org.apache.myfaces.tobago.context.Markup) values[6]; 244 margin = (org.apache.myfaces.tobago.layout.Measure) values[7]; 245 } 246 247 public Object saveState(FacesContext context) { 248 Object[] values = new Object[8]; 249 values[0] = super.saveState(context); 250 values[1] = marginBottom; 251 values[2] = markup; 252 values[3] = marginTop; 253 values[4] = marginLeft; 254 values[5] = marginRight; 255 values[6] = currentMarkup; 256 values[7] = margin; 257 return values; 258 } 259 260 261 }