KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > util > browser > core > popup > ItemProperty


1 /*===========================================================================
2
3 ObjectWeb Naming Context Framework
4 Copyright (C) 2002 USTL - LIFL - GOAL
5 Contact: architecture@objectweb.org
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or any later version.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with this library; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 USA
21
22 Initial developer(s): Philippe Merle, Jerome Moroy.
23 Contributor(s): ______________________________________.
24
25 ===========================================================================*/

26
27 package org.objectweb.util.browser.core.popup;
28
29 import javax.swing.KeyStroke JavaDoc;
30
31 import org.objectweb.util.browser.api.IconProvider;
32
33 /**
34  * Contains the data of one item of a popup menu.
35  *
36  * @author <a HREF="mailto:Jerome.Moroy@lifl.fr">Jerome Moroy</a>
37  * @version 0.1
38  */

39 public class ItemProperty {
40     
41     // ==================================================================
42
//
43
// Internal state.
44
//
45
// ==================================================================
46

47     /** The label of the item. */
48     protected String JavaDoc label_;
49
50     /** The name of the class containing the action. */
51     protected String JavaDoc className_;
52
53     /** Specifies if this item must be visible by children at the tree level. */
54     protected boolean treeChildVisible_;
55
56     /** Specifies if this item must be visible by children at the type level. */
57     protected boolean typeChildVisible_;
58
59     /** Provides the icon for the object. */
60     protected IconProvider iconProvider_;
61
62     /** The associated KeyStroke. */
63     protected KeyStroke JavaDoc keyStroke_;
64     
65     /** The mnemonic character */
66     protected Character JavaDoc mnemonic_;
67
68     // ==================================================================
69
//
70
// Constructors.
71
//
72
// ==================================================================
73

74     /**
75      * Default constructor.
76      * Equivalent to ItemProperty (label,className,false,true).
77      *
78      * @param label The label of the item
79      * @param className The name of the class containing the action
80      */

81     public ItemProperty(String JavaDoc label, String JavaDoc className) {
82         this(label, className, false, true);
83     }
84
85     /**
86      * Default constructor
87      * @param label The label of the item
88      * @param className The name of the class containing the action
89      * @param treeChildVisible Specifies if this item must be visible by children at the tree level
90      * @param typeChildVisible Specifies if this item must be visible by children at the type level
91      */

92     public ItemProperty(String JavaDoc label, String JavaDoc className, boolean treeChildVisible, boolean typeChildVisible) {
93         this(label,className,treeChildVisible,typeChildVisible,null, null, null);
94     }
95
96     /**
97      * Default constructor
98      * @param label The label of the item
99      * @param className The name of the class containing the action
100      * @param treeChildVisible Specifies if this item must be visible by children at the tree level
101      * @param typeChildVisible Specifies if this item must be visible by children at the type level
102      * @param iconProvider Provides the icon to represent the object.
103      */

104     public ItemProperty(String JavaDoc label, String JavaDoc className, boolean treeChildVisible, boolean typeChildVisible, IconProvider iconProvider, KeyStroke JavaDoc keyStroke, Character JavaDoc mnemonic) {
105         label_ = label;
106         className_ = className;
107         treeChildVisible_ = treeChildVisible;
108         typeChildVisible_ = typeChildVisible;
109         if(iconProvider!=null)
110             iconProvider_ = iconProvider;
111         keyStroke_ = keyStroke;
112         mnemonic_ = mnemonic;
113     }
114
115     // ==================================================================
116
//
117
// Internal methods.
118
//
119
// ==================================================================
120

121     // ==================================================================
122
//
123
// Public methods.
124
//
125
// ==================================================================
126

127     /**
128      * Returns the label of the item.
129      * @return The label of the item
130      */

131     public String JavaDoc getLabel() {
132         return label_;
133     }
134
135     /**
136      * Returns the name of the class containing the action.
137      * @return The name of the class to instanciate.
138      */

139     public String JavaDoc getClassName() {
140         return className_;
141     }
142
143     /**
144      * Specifies if this item must be visible by children at the tree level.
145      * @return true if this item must be visible by children at the tree level
146      */

147     public boolean isTreeChildVisible() {
148         return treeChildVisible_;
149     }
150
151     /**
152      * Specifies if this item must be visible by children at the type level.
153      * @return true if this item must be visible by children at the type level
154      */

155     public boolean isTypeChildVisible() {
156         return typeChildVisible_;
157     }
158     
159     /**
160      * Returns the icon provider for this item.
161      * @return The iconProvider to use.
162      */

163     public IconProvider getIconProvider() {
164         return iconProvider_;
165     }
166     
167     /**
168      * Returns the keyStroke defined for this item.
169      * @return The associated keyStroke.
170      */

171     public KeyStroke JavaDoc getKeyStroke() {
172         return keyStroke_;
173     }
174     
175     /**
176      *
177      * @return
178      */

179     public Character JavaDoc getMnemonic() {
180         return mnemonic_;
181     }
182 }
183
Popular Tags