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.UIMenu;
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.MenuTagDeclaration}.
33   */
34  public final class MenuTag extends TobagoELTag {
35    private static final Logger LOG = LoggerFactory.getLogger(MenuTag.class);
36    private javax.el.ValueExpression  markup;
37    private javax.el.ValueExpression  accessKey;
38    private javax.el.ValueExpression  image;
39    private javax.el.ValueExpression  label;
40    private javax.el.ValueExpression  disabled;
41  
42    @Override
43    public String getComponentType() {
44      return UIMenu.COMPONENT_TYPE;
45    }
46    @Override
47    public String getRendererType() {
48      return "Menu";
49    }
50  
51    @Override
52    protected void setProperties(final UIComponent uiComponent) {
53      super.setProperties(uiComponent);
54      final UIMenu component = (UIMenu) uiComponent;
55      final FacesContext context = FacesContext.getCurrentInstance();
56      final Application application = context.getApplication();
57      if (markup != null) {
58        if (!markup.isLiteralText()) {
59          component.setValueExpression("markup", markup);
60        } else {
61          component.setMarkup(org.apache.myfaces.tobago.context.Markup.valueOf(markup.getExpressionString()));
62        }
63      }
64      if (accessKey != null) {
65        if (!accessKey.isLiteralText()) {
66          component.setValueExpression("accessKey", accessKey);
67        } else {
68          component.setAccessKey(accessKey.getExpressionString().charAt(0));
69        }
70      }
71      if (image != null) {
72        component.setValueExpression("image", image);
73      }
74  
75      if (label != null) {
76        component.setValueExpression("label", label);
77      }
78  
79      if (disabled != null) {
80        if (!disabled.isLiteralText()) {
81          component.setValueExpression("disabled", disabled);
82        } else {
83          component.setDisabled(Boolean.parseBoolean(disabled.getExpressionString()));
84        }
85      }
86    }
87  
88    public javax.el.ValueExpression getMarkup() {
89      return markup;
90    }
91  
92    public void setMarkup(final javax.el.ValueExpression markup) {
93      this.markup = markup;
94    }
95  
96    public javax.el.ValueExpression getAccessKey() {
97      return accessKey;
98    }
99  
100   public void setAccessKey(final javax.el.ValueExpression accessKey) {
101     this.accessKey = accessKey;
102   }
103 
104   public javax.el.ValueExpression getImage() {
105     return image;
106   }
107 
108   public void setImage(final javax.el.ValueExpression image) {
109     this.image = image;
110   }
111 
112   public javax.el.ValueExpression getLabel() {
113     return label;
114   }
115 
116   public void setLabel(final javax.el.ValueExpression label) {
117     this.label = label;
118   }
119 
120   public javax.el.ValueExpression getDisabled() {
121     return disabled;
122   }
123 
124   public void setDisabled(final javax.el.ValueExpression disabled) {
125     this.disabled = disabled;
126   }
127 
128 
129 
130   @Override
131   public void release() {
132     super.release();
133     markup = null;
134     accessKey = null;
135     image = null;
136     label = null;
137     disabled = null;
138   }
139 }