KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > editor > BaseImageTokenID


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.editor;
21
22 /**
23 * Token-id with the fixed token image. The image text is provided
24 * in constructor and can be retrieved by <tt>getImage()</tt>.
25 *
26 * @author Miloslav Metelka
27 * @version 1.00
28 */

29
30 public class BaseImageTokenID extends BaseTokenID implements ImageTokenID {
31
32     private final String JavaDoc image;
33
34     /** Construct new imag-token-id if the name is the same as the image. */
35     public BaseImageTokenID(String JavaDoc nameAndImage) {
36         this(nameAndImage, nameAndImage);
37     }
38
39     public BaseImageTokenID(String JavaDoc name, String JavaDoc image) {
40         super(name);
41         this.image = image;
42     }
43
44     public BaseImageTokenID(String JavaDoc nameAndImage, int numericID) {
45         this(nameAndImage, numericID, nameAndImage);
46     }
47
48     public BaseImageTokenID(String JavaDoc name, int numericID, String JavaDoc image) {
49         super(name, numericID);
50         this.image = image;
51     }
52
53     public BaseImageTokenID(String JavaDoc nameAndImage, TokenCategory category) {
54         this(nameAndImage, category, nameAndImage);
55     }
56
57     public BaseImageTokenID(String JavaDoc name, TokenCategory category, String JavaDoc image) {
58         super(name, category);
59         this.image = image;
60     }
61
62     public BaseImageTokenID(String JavaDoc nameAndImage, int numericID, TokenCategory category) {
63         this(nameAndImage, numericID, category, nameAndImage);
64     }
65
66     public BaseImageTokenID(String JavaDoc name, int numericID, TokenCategory category, String JavaDoc image) {
67         super(name, numericID, category);
68         this.image = image;
69     }
70
71     public String JavaDoc getImage() {
72         return image;
73     }
74
75     public String JavaDoc toString() {
76         return super.toString() + ", image='" + getImage() + "'"; // NOI18N
77
}
78
79 }
80
Popular Tags