View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  
20  package org.apache.myfaces.tobago.internal.taglib.extension;
21  import org.apache.myfaces.tobago.component.UIExtensionPanel;
22  import org.apache.myfaces.tobago.component.UIPanel;
23  import org.apache.myfaces.tobago.internal.taglib.TobagoELTag;
24  import org.slf4j.Logger;
25  import org.slf4j.LoggerFactory;
26  
27  import javax.faces.application.Application;
28  import javax.faces.component.UIComponent;
29  import javax.faces.context.FacesContext;
30  
31  
32  public final class ExtensionPanelTag extends TobagoELTag {
33    private static final Logger LOG = LoggerFactory.getLogger(ExtensionPanelTag.class);
34    private javax.el.ValueExpression  markup;
35    private javax.el.ValueExpression  tip;
36  
37    @Override
38    public String getComponentType() {
39      return UIExtensionPanel.COMPONENT_TYPE;
40    }
41    @Override
42    public String getRendererType() {
43      return "Panel";
44    }
45  
46    @Override
47    protected void setProperties(final UIComponent uiComponent) {
48      super.setProperties(uiComponent);
49      final UIPanel component = (UIPanel) uiComponent;
50      final FacesContext context = FacesContext.getCurrentInstance();
51      final Application application = context.getApplication();
52      if (markup != null) {
53        if (!markup.isLiteralText()) {
54          component.setValueExpression("markup", markup);
55        } else {
56          component.setMarkup(org.apache.myfaces.tobago.context.Markup.valueOf(markup.getExpressionString()));
57        }
58      }
59      if (tip != null) {
60        component.setValueExpression("tip", tip);
61      }
62  
63    }
64  
65    public javax.el.ValueExpression getMarkup() {
66      return markup;
67    }
68  
69    public void setMarkup(final javax.el.ValueExpression markup) {
70      this.markup = markup;
71    }
72  
73    public javax.el.ValueExpression getTip() {
74      return tip;
75    }
76  
77    public void setTip(final javax.el.ValueExpression tip) {
78      this.tip = tip;
79    }
80  
81    @Override
82    public void release() {
83      super.release();
84      markup = null;
85      tip = null;
86    }
87  }