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.UINumberSlider;
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.sandbox.NumberSliderTagDeclaration}.
33   */
34  public final class NumberSliderTag extends TobagoELTag {
35    private static final Logger LOG = LoggerFactory.getLogger(NumberSliderTag.class);
36    private javax.el.ValueExpression  markup;
37    private javax.el.MethodExpression  valueChangeListener;
38    private javax.el.ValueExpression  value;
39    private javax.el.ValueExpression  min;
40    private javax.el.ValueExpression  max;
41    private javax.el.ValueExpression  readonly;
42    private javax.el.ValueExpression  disabled;
43  
44    @Override
45    public String getComponentType() {
46      return UINumberSlider.COMPONENT_TYPE;
47    }
48    @Override
49    public String getRendererType() {
50      return "NumberSlider";
51    }
52  
53    @Override
54    protected void setProperties(final UIComponent uiComponent) {
55      super.setProperties(uiComponent);
56      final UINumberSlider component = (UINumberSlider) uiComponent;
57      final FacesContext context = FacesContext.getCurrentInstance();
58      final Application application = context.getApplication();
59      if (markup != null) {
60        if (!markup.isLiteralText()) {
61          component.setValueExpression("markup", markup);
62        } else {
63          component.setMarkup(org.apache.myfaces.tobago.context.Markup.valueOf(markup.getExpressionString()));
64        }
65      }
66      if (valueChangeListener != null) {
67        component.addValueChangeListener(new javax.faces.event.MethodExpressionValueChangeListener(valueChangeListener));
68      }
69      if (value != null) {
70        component.setValueExpression("value", value);
71      }
72  
73      if (min != null) {
74        if (!min.isLiteralText()) {
75          component.setValueExpression("min", min);
76        } else {
77          component.setMin(Integer.parseInt(min.getExpressionString()));
78        }
79      }
80      if (max != null) {
81        if (!max.isLiteralText()) {
82          component.setValueExpression("max", max);
83        } else {
84          component.setMax(Integer.parseInt(max.getExpressionString()));
85        }
86      }
87      if (readonly != null) {
88        if (!readonly.isLiteralText()) {
89          component.setValueExpression("readonly", readonly);
90        } else {
91          component.setReadonly(Boolean.parseBoolean(readonly.getExpressionString()));
92        }
93      }
94      if (disabled != null) {
95        if (!disabled.isLiteralText()) {
96          component.setValueExpression("disabled", disabled);
97        } else {
98          component.setDisabled(Boolean.parseBoolean(disabled.getExpressionString()));
99        }
100     }
101   }
102 
103   public javax.el.ValueExpression getMarkup() {
104     return markup;
105   }
106 
107   public void setMarkup(final javax.el.ValueExpression markup) {
108     this.markup = markup;
109   }
110 
111   public javax.el.MethodExpression getValueChangeListener() {
112     return valueChangeListener;
113   }
114 
115   public void setValueChangeListener(final javax.el.MethodExpression valueChangeListener) {
116     this.valueChangeListener = valueChangeListener;
117   }
118 
119   public javax.el.ValueExpression getValue() {
120     return value;
121   }
122 
123   public void setValue(final javax.el.ValueExpression value) {
124     this.value = value;
125   }
126 
127   public javax.el.ValueExpression getMin() {
128     return min;
129   }
130 
131   public void setMin(final javax.el.ValueExpression min) {
132     this.min = min;
133   }
134 
135   public javax.el.ValueExpression getMax() {
136     return max;
137   }
138 
139   public void setMax(final javax.el.ValueExpression max) {
140     this.max = max;
141   }
142 
143   public javax.el.ValueExpression getReadonly() {
144     return readonly;
145   }
146 
147   public void setReadonly(final javax.el.ValueExpression readonly) {
148     this.readonly = readonly;
149   }
150 
151   public javax.el.ValueExpression getDisabled() {
152     return disabled;
153   }
154 
155   public void setDisabled(final javax.el.ValueExpression disabled) {
156     this.disabled = disabled;
157   }
158 
159 
160 
161   @Override
162   public void release() {
163     super.release();
164     markup = null;
165     valueChangeListener = null;
166     value = null;
167     min = null;
168     max = null;
169     readonly = null;
170     disabled = null;
171   }
172 }