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.parse;
016    
017    import org.apache.hivemind.Location;
018    
019    /**
020     * Provides a {@link TemplateParser}with additional information about dynamic components.
021     * 
022     * @author Howard Lewis Ship
023     */
024    
025    public interface ITemplateParserDelegate
026    {
027        /**
028         * Returns true if the component id is valid, false if the component id is not recognized.
029         */
030    
031        boolean getKnownComponent(String componentId);
032    
033        /**
034         * Returns true if the specified component allows a body, false otherwise. The parser uses this
035         * information to determine if it should ignore the body of a tag.
036         */
037    
038        boolean getAllowBody(String componentId, Location location);
039    
040        /**
041         * Used with implicit components to determine if the component allows a body or not.
042         * 
043         * @param libraryId
044         *            the specified library id, possibly null
045         * @param type
046         *            the component type
047         * @since 3.0
048         */
049    
050        boolean getAllowBody(String libraryId, String type, Location location);
051    
052        /**
053         * Returns the name of the attribute used to indicate a component. The default is "jwcid", but
054         * this can be overriden in a number of ways.
055         */
056    
057        String getComponentAttributeName();
058    }