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
015package org.apache.tapestry.parse;
016
017import 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
025public interface ITemplateParserDelegate
026{
027    /**
028     * Returns true if the component id is valid, false if the component id is not recognized.
029     */
030
031    public 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     * @throws org.apache.tapestry.ApplicationRuntimeException
038     *             if no such component exists
039     */
040
041    public boolean getAllowBody(String componentId, Location location);
042
043    /**
044     * Used with implicit components to determine if the component allows a body or not.
045     * 
046     * @param libraryId
047     *            the specified library id, possibly null
048     * @param type
049     *            the component type
050     * @throws org.apache.tapestry.ApplicationRuntimeException
051     *             if the specification cannot be found
052     * @since 3.0
053     */
054
055    public boolean getAllowBody(String libraryId, String type, Location location);
056
057    /**
058     * Returns the name of the attribute used to indicate a component. The default is "jwcid", but
059     * this can be overriden in a number of ways.
060     */
061
062    public String getComponentAttributeName();
063}