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.internal.component.AbstractUIHidden;
24  import org.apache.myfaces.tobago.internal.util.ArrayUtils;
25  import org.apache.myfaces.tobago.internal.util.StringUtils;
26  import org.apache.myfaces.tobago.internal.util.Deprecation;
27  import org.apache.myfaces.tobago.component.Tags;
28  import javax.annotation.Generated;
29  import javax.el.ELException;
30  import javax.faces.FacesException;
31  import java.util.Arrays;
32  import java.util.ArrayList;
33  import java.util.Collection;
34  import java.util.List;
35  import javax.el.MethodExpression;
36  import javax.el.ValueExpression;
37  
38  /**
39   Renders a hidden input element.
40    * UIComponent class, generated from template {@code component.stg} with class
41    * {@link org.apache.myfaces.tobago.internal.taglib.component.HiddenTagDeclaration}.
42   */
43  @Generated("component.stg")
44  public class UIHidden
45      extends AbstractUIHidden  {
46  
47    public static final String COMPONENT_TYPE = Tags.hidden.componentType();
48  
49    public static final String COMPONENT_FAMILY = "javax.faces.Input";
50  
51    private static final Collection<String> EVENT_NAMES = Arrays.asList("change");
52  
53    @Override
54    public Collection<String> getEventNames() {
55      return EVENT_NAMES;
56    }
57  
58    @Override
59    public String getDefaultEventName() {
60      return "change";
61    }
62  
63  
64    enum PropertyKeys {
65      readonly,
66      disabled,
67    }
68  
69    public String getFamily() {
70      return COMPONENT_FAMILY;
71    }
72  
73  
74    /**
75    Flag indicating that this component will prohibit changes by the user.
76    <br>Default: <code>false</code>
77    */
78    public boolean isReadonly() {
79      Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.readonly);
80      if (bool != null) {
81        return bool;
82      }
83      return false;
84    }
85  
86    public void setReadonly(boolean readonly) {
87      getStateHelper().put(PropertyKeys.readonly, readonly);
88    }
89  
90    /**
91    Flag indicating that this element is disabled.
92    <br>Default: <code>false</code>
93    */
94    public boolean isDisabled() {
95      Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.disabled);
96      if (bool != null) {
97        return bool;
98      }
99      return false;
100   }
101 
102   public void setDisabled(boolean disabled) {
103     getStateHelper().put(PropertyKeys.disabled, disabled);
104   }
105 
106 
107   @Override
108   public void restoreState(FacesContext context, Object state) {
109     // FIXME HACK for mojarra SystemEventListener state restoring bug
110     pushComponentToEL(context, this);
111     super.restoreState(context, state);
112     popComponentFromEL(context);
113   }
114 
115 }