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  package org.apache.myfaces.view.facelets.tag.composite;
20  
21  import java.io.IOException;
22  import java.util.logging.Level;
23  import java.util.logging.Logger;
24  
25  import jakarta.faces.component.UIComponent;
26  import jakarta.faces.view.facelets.FaceletContext;
27  import jakarta.faces.view.facelets.TagConfig;
28  import jakarta.faces.view.facelets.TagHandler;
29  
30  import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFFaceletTag;
31  
32  /**
33   * @author Leonardo Uribe (latest modification by $Author$)
34   * @version $Revision$ $Date$
35   */
36  @JSFFaceletTag(name="composite:extension")
37  public class ExtensionHandler extends TagHandler
38  {
39  
40      private static final Logger log = Logger.getLogger(ExtensionHandler.class.getName());
41      
42      public ExtensionHandler(TagConfig config)
43      {
44          super(config);
45      }
46  
47      public void apply(FaceletContext ctx, UIComponent parent)
48              throws IOException
49      {
50          // TODO: In theory the xml data inside this tag should be saved,
51          // but the spec does not say where and how this should be done.
52          // For now we just prevent execute any handler inside this tag.
53          // As soon JSR-276 is available, some behavior for this tag
54          // should be added.
55          CompositeComponentBeanInfo beanInfo = 
56              (CompositeComponentBeanInfo) parent.getAttributes()
57              .get(UIComponent.BEANINFO_KEY);
58          
59          if (beanInfo == null)
60          {
61              if (log.isLoggable(Level.SEVERE))
62              {
63                  log.severe("Cannot find composite bean descriptor UIComponent.BEANINFO_KEY ");
64              }
65              return;
66          }
67          
68          //BeanDescriptor beanDescriptor = beanInfo.getBeanDescriptor();
69      }
70  
71  }