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;
 
 import java.util.List;

The contract that a view declaration language must implement to interact with the JSF runtime. An implementation of this class must be thread-safe.

Instances of this class are application scoped and must be obtained from the ViewDeclarationLanguageFactory.

Since:
2.0
 
 public abstract class ViewDeclarationLanguage {

    

Identifier for the JSP view declaration language.

Since:
2.1
 
     public final static String JSP_VIEW_DECLARATION_LANGUAGE_ID =
         "java.faces.JSP";

    

Identifier for the Facelets view declaration language.

Since:
2.1
 
     public final static String FACELETS_VIEW_DECLARATION_LANGUAGE_ID =
         "java.faces.Facelets";

    

Return a reference to the component metadata for the composite component represented by the argument componentResource, or null if the metadata cannot be found. See section JSF.7.6.2 for the specification of the default implementation. JSP implementations must throw UnsupportedOperationException.

Parameters:
context The FacesContext for this request.
componentResource The Resource that represents the component.
Throws:
java.lang.NullPointerException if any of the arguments are null.
javax.faces.FacesException if there is an error in obtaining the metadata
java.lang.UnsupportedOperationException if this is a JSP VDL implementation.
Since:
2.0
    public abstract BeanInfo getComponentMetadata(FacesContext contextResource componentResource);


    

Return a reference to the view metadata for the view represented by the argument viewId, or null if the metadata cannot be found. See section JSF.7.6.2 for the specification of the default implementation. Facelets for JSF 2 implementation must return non-null. JSP implementations must return null.

Parameters:
context The FacesContext for this request.
viewId the view id from whith to extract the metadata
Throws:
java.lang.NullPointerException if any of the arguments are null.
javax.faces.FacesException if there is an error in obtaining the metadata
Since:
2.0
    public abstract ViewMetadata getViewMetadata(FacesContext contextString viewId);


    

Take implementation specific action to discover a Resource given the argument componentResource. See section JSF.7.6.2 for the specification of the default implementation. JSP implementations must throw UnsupportedOperationException.

Parameters:
context The FacesContext for this request.
componentResource The Resource that represents the component.
Throws:
java.lang.NullPointerException if any of the arguments are null.
javax.faces.FacesException if there is an error in obtaining the script component resource
java.lang.UnsupportedOperationException if this is a JSP VDL implementation.
Since:
2.0
    public abstract Resource getScriptComponentResource(FacesContext context,
                                                        Resource componentResource);
    
    
    

Create a UIViewRoot from the VDL contained in the artifact referenced by the argument viewId. See section JSF.7.6.2 for the specification of the default implementation.

Parameters:
context the FacesContext for this request.
viewId the identifier of an artifact that contains the VDL syntax that describes this view.
Throws:
java.lang.NullPointerException if any of the arguments are null
Since:
2.0
    public abstract UIViewRoot createView(FacesContext context,
                                 String viewId);
    
    

Restore a UIViewRoot from a previously created view. See section JSF.7.6.2 for the specification of the default implementation.

Parameters:
context the FacesContext for this request.
viewId the identifier for a previously rendered view.
Throws:
java.lang.NullPointerException if any of the arguments are null
    public abstract UIViewRoot restoreView(FacesContext contextString viewId);


    

Assuming the component metadata for argument topLevelComponent has been made available by an earlier call to getComponentMetadata(javax.faces.context.FacesContext,javax.faces.application.Resource), leverage the component metadata for the purpose of re-targeting attached objects from the top level composite component to the individual AttachedObjectTarget instances inside the composite component. This method must be called by the ViewDeclarationLanguage implementation when creating the UIComponent tree when a composite component usage is encountered.

An algorithm semantically equivalent to the following must be implemented.

The implementation must support retargeting attached objects from the top level compsite component to targets that are composite and non-composite components.

An implementation is provided that will throw UnsupportedOperationException. A Faces implementation compliant with version 2.0 and beyond of the specification must override this method.

Parameters:
context the FacesContext for this request.
topLevelComponent The UIComponent in the view to which the attached objects must be attached. This UIComponent must have its component metadata already associated and available from via the JavaBeans API.
Throws:
java.lang.NullPointerException if any of the arguments are null.
Since:
2.0
    public void retargetAttachedObjects(FacesContext context,
                                        UIComponent topLevelComponent,
                                        List<AttachedObjectHandlerhandlers)  {
        
        // no-op
    }


    

Assuming the component metadata for argument topLevelComponent has been made available by an earlier call to getComponentMetadata(javax.faces.context.FacesContext,javax.faces.application.Resource), leverage the component metadata for the purpose of re-targeting any method expressions from the top level component to the appropriate inner component. For each attribute that is a MethodExpression (as indicated by the presence of a "method-signature" attribute and the absence of a "type" attribute), the following action must be taken:

An implementation is provided that will throw UnsupportedOperationException. A Faces implementation compliant with version 2.0 and beyond of the specification must override this method.

Parameters:
context the FacesContext for this request.
topLevelComponent The UIComponent in the view to which the attached objects must be attached. This UIComponent must have its component metadata already associated and available from via the JavaBeans API.
Throws:
java.lang.NullPointerException if context or topLevelComponent is null.
Since:
2.0
    public void retargetMethodExpressions(FacesContext context,
                                          UIComponent topLevelComponent) {
        // no-op
        
    }

    

Take any actions specific to this VDL implementation to cause the argument UIViewRoot which must have been created via a call to createView(javax.faces.context.FacesContext,java.lang.String), to be populated with children.

The Facelets implementation must insure that markup comprising the view must be executed, with the javax.faces.component.UIComponent instances in the view being encountered in the same depth-first order as in other lifecycle methods defined on UIComponent, and added to the view (but not rendered) during the traversal. The runtime must guarantee that the view must be fully populated before any of the following happen.

If the root is already populated with children, the view must still be re-built, but care must be taken to ensure that the existing components are correctly paired up with their VDL counterparts in the VDL page. Also, any system events that would normally be generated during the adding or removing of components from the view must be temporarily disabled during the creation of the view and then re-enabled when the view has been built.

Parameters:
context the FacesContext for this request
root the UIViewRoot to populate with children using techniques specific to this VDL implementation.
    public abstract void buildView(FacesContext contextUIViewRoot root)
    throws IOException;

    
    

Render a view rooted at argumentview. See section JSF.7.6.2 for the specification of the default implementation.

Parameters:
context the FacesContext for this request.
view the UIViewRoot from an early call to createView(javax.faces.context.FacesContext,java.lang.String) or restoreView(javax.faces.context.FacesContext,java.lang.String).
Throws:
java.lang.NullPointerException if any of the arguments are null
    public abstract void renderView(FacesContext context,
                                    UIViewRoot view)
    throws IOException;
    
    

For implementations that want to control the implementation of state saving and restoring, the StateManagementStrategy allows them to do so. Returning null indicates that the implementation wishes the runtime to handle the state saving and restoring. Implementations that provide the VDL for Facelets for JSF 2.0 and later must return non-null from this method.

Since:
2.0
 
            String viewId);


    

Tests whether a physical resource corresponding to the specified viewId exists.

The default implementation uses ExternalContext.getResource() to locate the physical resource.

Parameters:
context The FacesContext for this request.
viewId the view id to test
Since:
2.1
    
    public boolean viewExists(FacesContext context
                              String viewId) {
       try {
           return context.getExternalContext().getResource(viewId) != null;
       } catch (MalformedURLException e) {
           if (.isLoggable(.)) {
               .log(.,
                          e.toString(),
                          e);
           }
       }
       return false;
    }

    

Returns a non-null String that can be used to identify this view declaration language.

The default implementation returns the fully qualified class name of the view declaration language implementation. Subclasses may override to provide a more meaningful id.

Since:
2.1
    public String getId() {
        return getClass().getName();
    }
    private static final Logger LOGGER =
          Logger.getLogger("javax.faces.view""javax.faces.LogStrings");
New to GrepCode? Check out our FAQ X