Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
   *
   * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved.
   *
   * The contents of this file are subject to the terms of either the GNU
   * General Public License Version 2 only ("GPL") or the Common Development
   * and Distribution License("CDDL") (collectively, the "License").  You
   * may not use this file except in compliance with the License.  You can
  * obtain a copy of the License at
  * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
  * or packager/legal/LICENSE.txt.  See the License for the specific
  * language governing permissions and limitations under the License.
  *
  * When distributing the software, include this License Header Notice in each
  * file and include the License file at packager/legal/LICENSE.txt.
  *
  * GPL Classpath Exception:
  * Oracle designates this particular file as subject to the "Classpath"
  * exception as provided by Oracle in the GPL Version 2 section of the License
  * file that accompanied this code.
  *
  * Modifications:
  * If applicable, add the following below the License Header, with the fields
  * enclosed by brackets [] replaced by your own identifying information:
  * "Portions Copyright [year] [name of copyright owner]"
  *
  * Contributor(s):
  * If you wish your version of this file to be governed by only the CDDL or
  * only the GPL Version 2, indicate your decision by adding "[Contributor]
  * elects to include this software in this distribution under the [CDDL or GPL
  * Version 2] license."  If you don't indicate a single choice of license, a
  * recipient has the option to distribute your version of this file under
  * either the CDDL, the GPL Version 2 or to extend the choice of license to
  * its licensees as provided above.  However, if you add GPL Version 2 code
  * and therefore, elected the GPL Version 2 license, then the option applies
  * only if the new code is made subject to such option by the copyright
  * holder.
  */
 
 package javax.faces.view.facelets;
 

Public base class for markup element instances that map to javax.faces.component.UIComponent instances in the view.

The implementation must guarantee that the apply() method is overridden and takes the following actions, in this order. These actions must only happen the first time this facelet is applied for each user. Subsequent applications must take no action.

  1. The UIComponent represented by this element is created with the appropriate Application.createComponent() method.

  2. Each attribute specified in the markup is correctly applied to the component instance, as specified in the VDLDocs for this element.

  3. If project stage is #javax.faces.application.ProjectStage.Development, Put the javax.faces.view.Location for this element into the component attribute Map under the key given by the value of the symbolic constant javax.faces.component.UIComponent.VIEW_LOCATION_KEY.

  4. Set the id of the component. If the id is specified manually by the page author, that value must be set as the id. Otherwise, the closest ancestor component that is an instance of javax.faces.component.UniqueIdVendor must be located and its javax.faces.component.UniqueIdVendor.createUniqueId(javax.faces.context.FacesContext,java.lang.String) method must be called to derive the id. If no such instance can be found, call javax.faces.component.UIViewRoot.createUniqueId() to derive the id.

  5. The rendererType property of the component is set properly.

  6. onComponentCreated(javax.faces.view.facelets.FaceletContext,javax.faces.component.UIComponent,javax.faces.component.UIComponent) is called.

  7. javax.faces.component.UIComponent.pushComponentToEL(javax.faces.context.FacesContext,javax.faces.component.UIComponent) is called on the newly created component.

  8. The next handler in the facelet chain is applied. This will cause the component to be populated with children.

  9. The component is added to its parent in the view.

  10. javax.faces.component.UIComponent.popComponentFromEL(javax.faces.context.FacesContext) is called on the newly created component.

  11. Call javax.faces.component.UIComponent.markInitialState().

Since:
2.0
public class ComponentHandler extends DelegatingMetaTagHandler {
    
    private TagHandlerDelegate helper = null;
    private ComponentConfig componentConfig = null;

    

Leverage the TagHandlerDelegateFactory provided by the implementation to create an instance of TagHandlerDelegate designed for use with ComponentHandler.

Since:
2.0
 
    public ComponentHandler(ComponentConfig config) {
        super(config);
        this. = config;
    }
    
    @Override
        if (null == ) {
             = .createComponentHandlerDelegate(this);
        }
        return ;
    }
    
        return this.;
    }
    
    
    

This method is guaranteed to be called after the component has been created but before it has been populated with children.

Parameters:
ctx the FaceletContext for this view execution
c the UIComponent that has just been created.
parent the parent UIComponent of the component represented by this element instance.
Since:
2.0
    public void onComponentCreated(FaceletContext ctxUIComponent c
            UIComponent parent) {
        
    }
    
    

This method is guaranteed to be called after the component has been populated with children.

Parameters:
ctx the FaceletContext for this view execution
c the UIComponent that has just been populated with children.
parent the parent UIComponent of the component represented by this element instance.
Since:
2.0
    public void onComponentPopulated(FaceletContext ctxUIComponent c
            UIComponent parent) {
        
    }
    
    

Determine if the passed component is not null and if it's new to the tree. This operation can be used for determining if attributes should be wired to the component.

Parameters:
component the component you wish to modify
Since:
2.0
    public static boolean isNew(UIComponent component) {
        
        UIComponent c = component;
        if (c != null) {
            UIComponent parent = c.getParent();
            if (parent != null) {
                if (UIComponent.isCompositeComponent(parent)) {
                    c = parent;
                }
            }
            return c.getParent() == null;
        } else {
            return false;
        }
    }
    
    
New to GrepCode? Check out our FAQ X