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 java.util.Map;
018    
019    import org.apache.hivemind.Location;
020    
021    /**
022     * A Factory used by {@link org.apache.tapestry.parse.TemplateParser} to create
023     * {@link org.apache.tapestry.parse.TemplateToken} objects.
024     * 
025     * <p>
026     * This class is extended by Spindle - the Eclipse Plugin for Tapestry.
027     * </p>
028     * 
029     * @author glongman@intelligentworks.com
030     * @since 3.0
031     */
032    public class TemplateTokenFactory
033    {
034    
035        public OpenToken createOpenToken(String tagName, String jwcId, String type,
036                Location location)
037        {
038            return new OpenToken(tagName, jwcId, type, location);
039        }
040    
041        public CloseToken createCloseToken(String tagName, Location location)
042        {
043            return new CloseToken(tagName, location);
044        }
045    
046        public TextToken createTextToken(char[] templateData, int blockStart, int end, Location templateLocation)
047        {
048            return new TextToken(templateData, blockStart, end, templateLocation);
049        }
050    
051        public LocalizationToken createLocalizationToken(String tagName, String localizationKey, 
052                boolean raw, Map attributes, Location startLocation)
053        {
054            return new LocalizationToken(tagName, localizationKey, raw, attributes, startLocation);
055        }
056    }