001 // Copyright 2004, 2005 The Apache Software Foundation 002 // 003 // Licensed under the Apache License, Version 2.0 (the "License"); 004 // you may not use this file except in compliance with the License. 005 // You may obtain a copy of the License at 006 // 007 // http://www.apache.org/licenses/LICENSE-2.0 008 // 009 // Unless required by applicable law or agreed to in writing, software 010 // distributed under the License is distributed on an "AS IS" BASIS, 011 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 012 // See the License for the specific language governing permissions and 013 // limitations under the License. 014 015 package org.apache.tapestry.engine; 016 017 import org.apache.hivemind.Location; 018 import org.apache.tapestry.IComponent; 019 import org.apache.tapestry.INamespace; 020 import org.apache.tapestry.IPage; 021 import org.apache.tapestry.IRequestCycle; 022 import org.apache.tapestry.ITemplateComponent; 023 import org.apache.tapestry.spec.IComponentSpecification; 024 025 /** 026 * Interface exposed to components as they are loaded by the page loader. 027 * 028 * @see IComponent#finishLoad(IRequestCycle, IPageLoader, 029 * org.apache.tapestry.spec.IComponentSpecification) 030 * @author Howard Lewis Ship 031 */ 032 033 public interface IPageLoader 034 { 035 /** 036 * Invoked to create an implicit component (one which is defined in the containing component's 037 * template, rather that in the containing component's specification). 038 * 039 * @see org.apache.tapestry.services.impl.ComponentTemplateLoaderImpl 040 * @since 3.0 041 */ 042 043 public IComponent createImplicitComponent(IRequestCycle cycle, IComponent container, String componentId, 044 String componentType, Location location); 045 046 /** 047 * Invoked by the {@link IPageSource}to load a specific page. This method is not reentrant. The 048 * page is immediately attached to the {@link IEngine engine}. 049 * 050 * @param name 051 * the simple (unqualified) name of the page to load 052 * @param namespace 053 * from which the page is to be loaded (used when resolving components embedded by 054 * the page) 055 * @param cycle 056 * the request cycle the page is initially loaded for (this is used to define the 057 * locale of the new page, and provide access to the corect specification source, 058 * etc.). 059 * @param specification 060 * the specification for the page 061 */ 062 063 public IPage loadPage(String name, INamespace namespace, IRequestCycle cycle, IComponentSpecification specification); 064 065 /** 066 * Invoked by a component (from within its 067 * {@link IComponent#finishLoad(IRequestCycle, IPageLoader, IComponentSpecification)}method) to 068 * load the template for the component. This will result in new components being created, and 069 * the "outers" of the component being updated. 070 * 071 * @see ITemplateComponent 072 * @since 4.0 073 */ 074 public void loadTemplateForComponent(IRequestCycle cycle, ITemplateComponent component); 075 }