KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tapestry > parse > LocalizationToken


1 // Copyright 2004, 2005 The Apache Software Foundation
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
// http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14

15 package org.apache.tapestry.parse;
16
17 import java.util.Map JavaDoc;
18
19 import org.apache.hivemind.Location;
20
21 /**
22  * Represents localized text from the template.
23  *
24  * @see TokenType#LOCALIZATION
25  *
26  * @author Howard Lewis Ship
27  * @since 3.0
28  *
29  **/

30
31 public class LocalizationToken extends TemplateToken
32 {
33     private String JavaDoc _tag;
34     private String JavaDoc _key;
35     private boolean _raw;
36     private Map JavaDoc _attributes;
37     
38     /**
39      * Creates a new token.
40      *
41      *
42      * @param tag the tag of the element from the template
43      * @param key the localization key specified
44      * @param raw if true, then the localized value contains markup that should not be escaped
45      * @param attributes any additional attributes (beyond those used to define key and raw)
46      * that were specified. This value is retained, not copied.
47      * @param location location of the tag which defines this token
48      *
49      **/

50     
51     public LocalizationToken(String JavaDoc tag, String JavaDoc key, boolean raw, Map JavaDoc attributes, Location location)
52     {
53         super(TokenType.LOCALIZATION, location);
54         
55         _tag = tag;
56         _key = key;
57         _raw = raw;
58         _attributes = attributes;
59     }
60     
61     /**
62      * Returns any attributes for the token, which may be null. Do not modify
63      * the return value.
64      *
65      **/

66     
67     public Map JavaDoc getAttributes()
68     {
69         return _attributes;
70     }
71
72     public boolean isRaw()
73     {
74         return _raw;
75     }
76
77     public String JavaDoc getTag()
78     {
79         return _tag;
80     }
81
82     public String JavaDoc getKey()
83     {
84         return _key;
85     }
86 }
87
Popular Tags