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 javax.faces.component.UIComponent;
26  import javax.faces.view.facelets.FaceletContext;
27  import javax.faces.view.facelets.TagConfig;
28  import javax.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: jakobk $)
34   * @version $Revision: 960906 $ $Date: 2010-07-06 09:45:40 -0500 (Tue, 06 Jul 2010) $
35   */
36  @JSFFaceletTag(name="composite:extension")
37  public class ExtensionHandler extends TagHandler
38  {
39  
40      //private static final Log log = LogFactory.getLog(ExtensionHandler.class);
41      private static final Logger log = Logger.getLogger(ExtensionHandler.class.getName());
42      
43      public ExtensionHandler(TagConfig config)
44      {
45          super(config);
46      }
47  
48      public void apply(FaceletContext ctx, UIComponent parent)
49              throws IOException
50      {
51          // TODO: In theory the xml data inside this tag should be saved,
52          // but the spec does not say where and how this should be done.
53          // For now we just prevent execute any handler inside this tag.
54          // As soon JSR-276 is available, some behavior for this tag
55          // should be added.
56          CompositeComponentBeanInfo beanInfo = 
57              (CompositeComponentBeanInfo) parent.getAttributes()
58              .get(UIComponent.BEANINFO_KEY);
59          
60          if (beanInfo == null)
61          {
62              if (log.isLoggable(Level.SEVERE))
63              {
64                  log.severe("Cannot find composite bean descriptor UIComponent.BEANINFO_KEY ");
65              }
66              return;
67          }
68          
69          //BeanDescriptor beanDescriptor = beanInfo.getBeanDescriptor();
70      }
71  
72  }