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.component.UIOutput; 023 import javax.faces.context.FacesContext; 024 import org.apache.commons.lang.ArrayUtils; 025 import org.apache.commons.lang.StringUtils; 026 import org.apache.myfaces.tobago.component.MethodBindingToMethodExpression; 027 import org.apache.myfaces.tobago.component.MethodExpressionToMethodBinding; 028 import org.apache.myfaces.tobago.internal.util.Deprecation; 029 import org.apache.myfaces.tobago.renderkit.MarginValues; 030 import org.apache.myfaces.tobago.renderkit.SpacingValues; 031 import org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer; 032 import javax.el.ELException; 033 import javax.faces.FacesException; 034 import java.util.ArrayList; 035 import java.util.List; 036 import javax.el.MethodExpression; 037 import javax.el.ValueExpression; 038 039 /** 040 Renders a set of option related to and same type as the <strong>for</strong> 041 component. 042 * UIComponent class, generated from template {@code component1.2.stg} with class 043 * {@link org.apache.myfaces.tobago.internal.taglib.component.SelectReferenceTagDeclaration}. 044 */ 045 public class UISelectReference 046 extends UIOutput { 047 048 public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.SelectReference"; 049 050 private java.lang.String renderRange; 051 private java.lang.String forComponent; 052 053 054 /** 055 Range of items to render. 056 057 */ 058 public java.lang.String getRenderRange() { 059 if (renderRange != null) { 060 return renderRange; 061 } 062 ValueExpression ve = getValueExpression("renderRange"); 063 if (ve != null) { 064 try { 065 return (java.lang.String) ve.getValue(getFacesContext().getELContext()); 066 } catch (ELException e) { 067 throw new FacesException(e); 068 } 069 } 070 return null; 071 } 072 073 public void setRenderRange(java.lang.String renderRange) { 074 this.renderRange = renderRange; 075 } 076 077 /** 078 Id of the component, this is related to. 079 080 */ 081 public java.lang.String getFor() { 082 if (forComponent != null) { 083 return forComponent; 084 } 085 ValueExpression ve = getValueExpression("for"); 086 if (ve != null) { 087 try { 088 return (java.lang.String) ve.getValue(getFacesContext().getELContext()); 089 } catch (ELException e) { 090 throw new FacesException(e); 091 } 092 } 093 return null; 094 } 095 096 public void setFor(java.lang.String forComponent) { 097 this.forComponent = forComponent; 098 } 099 100 public void restoreState(FacesContext context, Object componentState) { 101 Object[] values = (Object[]) componentState; 102 super.restoreState(context, values[0]); 103 renderRange = (java.lang.String) values[1]; 104 forComponent = (java.lang.String) values[2]; 105 } 106 107 public Object saveState(FacesContext context) { 108 Object[] values = new Object[3]; 109 values[0] = super.saveState(context); 110 values[1] = renderRange; 111 values[2] = forComponent; 112 return values; 113 } 114 115 116 }