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.UIInput; 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 hidden input element. 041 * UIComponent class, generated from template {@code component1.2.stg} with class 042 * {@link org.apache.myfaces.tobago.internal.taglib.component.HiddenTagDeclaration}. 043 */ 044 public class UIHidden 045 extends UIInput { 046 047 public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.Hidden"; 048 049 private java.lang.Boolean readonly; 050 private java.lang.Boolean disabled; 051 052 053 /** 054 Flag indicating that this component will prohibit changes by the user. 055 <br />Default: <code>false</code> 056 */ 057 public boolean isReadonly() { 058 if (readonly != null) { 059 return readonly; 060 } 061 ValueExpression ve = getValueExpression("readonly"); 062 if (ve != null) { 063 try { 064 Boolean bool = (Boolean) ve.getValue(getFacesContext().getELContext()); 065 if (bool != null) { 066 return bool; 067 } 068 } catch (ELException e) { 069 throw new FacesException(e); 070 } 071 } 072 return false; 073 } 074 075 public void setReadonly(boolean readonly) { 076 this.readonly = readonly; 077 } 078 079 /** 080 Flag indicating that this element is disabled. 081 <br />Default: <code>false</code> 082 */ 083 public boolean isDisabled() { 084 if (disabled != null) { 085 return disabled; 086 } 087 ValueExpression ve = getValueExpression("disabled"); 088 if (ve != null) { 089 try { 090 Boolean bool = (Boolean) ve.getValue(getFacesContext().getELContext()); 091 if (bool != null) { 092 return bool; 093 } 094 } catch (ELException e) { 095 throw new FacesException(e); 096 } 097 } 098 return false; 099 } 100 101 public void setDisabled(boolean disabled) { 102 this.disabled = disabled; 103 } 104 105 public void restoreState(FacesContext context, Object componentState) { 106 Object[] values = (Object[]) componentState; 107 super.restoreState(context, values[0]); 108 readonly = (java.lang.Boolean) values[1]; 109 disabled = (java.lang.Boolean) values[2]; 110 } 111 112 public Object saveState(FacesContext context) { 113 Object[] values = new Object[3]; 114 values[0] = super.saveState(context); 115 values[1] = readonly; 116 values[2] = disabled; 117 return values; 118 } 119 120 121 }