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.internal.taglib;
21  
22  import javax.faces.application.Application;
23  import javax.faces.component.UIComponent;
24  import javax.faces.context.FacesContext;
25  import org.apache.myfaces.tobago.component.UIHidden;
26  import org.apache.myfaces.tobago.internal.util.StringUtils;
27  import org.slf4j.Logger;
28  import org.slf4j.LoggerFactory;
29  
30  /** 
31   * JSP Tag class, generated from template {@code tag1.2.stg} with class 
32   * {@link org.apache.myfaces.tobago.internal.taglib.component.HiddenTagDeclaration}.
33   */
34  public final class HiddenTag extends TobagoELTag {
35    private static final Logger LOG = LoggerFactory.getLogger(HiddenTag.class);
36    private javax.el.ValueExpression  converter;
37    private javax.el.MethodExpression  validator;
38    private javax.el.ValueExpression  value;
39    private javax.el.ValueExpression  readonly;
40    private javax.el.ValueExpression  disabled;
41  
42    @Override
43    public String getComponentType() {
44      return UIHidden.COMPONENT_TYPE;
45    }
46    @Override
47    public String getRendererType() {
48      return "Hidden";
49    }
50  
51    @Override
52    protected void setProperties(final UIComponent uiComponent) {
53      super.setProperties(uiComponent);
54      final UIHidden component = (UIHidden) uiComponent;
55      final FacesContext context = FacesContext.getCurrentInstance();
56      final Application application = context.getApplication();
57      if (converter != null) {
58        if (!converter.isLiteralText()) {
59          component.setValueExpression("converter", converter);
60        } else {
61          component.setConverter(application.createConverter(converter.getExpressionString()));
62        }
63      }
64      if (validator != null) {
65        component.addValidator(new javax.faces.validator.MethodExpressionValidator(validator));
66      }
67      if (value != null) {
68        component.setValueExpression("value", value);
69      }
70  
71      if (readonly != null) {
72        if (!readonly.isLiteralText()) {
73          component.setValueExpression("readonly", readonly);
74        } else {
75          component.setReadonly(Boolean.parseBoolean(readonly.getExpressionString()));
76        }
77      }
78      if (disabled != null) {
79        if (!disabled.isLiteralText()) {
80          component.setValueExpression("disabled", disabled);
81        } else {
82          component.setDisabled(Boolean.parseBoolean(disabled.getExpressionString()));
83        }
84      }
85    }
86  
87    public javax.el.ValueExpression getConverter() {
88      return converter;
89    }
90  
91    public void setConverter(final javax.el.ValueExpression converter) {
92      this.converter = converter;
93    }
94  
95    public javax.el.MethodExpression getValidator() {
96      return validator;
97    }
98  
99    public void setValidator(final javax.el.MethodExpression validator) {
100     this.validator = validator;
101   }
102 
103   public javax.el.ValueExpression getValue() {
104     return value;
105   }
106 
107   public void setValue(final javax.el.ValueExpression value) {
108     this.value = value;
109   }
110 
111   public javax.el.ValueExpression getReadonly() {
112     return readonly;
113   }
114 
115   public void setReadonly(final javax.el.ValueExpression readonly) {
116     this.readonly = readonly;
117   }
118 
119   public javax.el.ValueExpression getDisabled() {
120     return disabled;
121   }
122 
123   public void setDisabled(final javax.el.ValueExpression disabled) {
124     this.disabled = disabled;
125   }
126 
127 
128 
129   @Override
130   public void release() {
131     super.release();
132     converter = null;
133     validator = null;
134     value = null;
135     readonly = null;
136     disabled = null;
137   }
138 }