KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opencms > workplace > explorer > CmsExplorerContextMenuItem


1 /*
2  * File : $Source: /usr/local/cvs/opencms/src/org/opencms/workplace/explorer/CmsExplorerContextMenuItem.java,v $
3  * Date : $Date: 2005/06/27 23:22:20 $
4  * Version: $Revision: 1.9 $
5  *
6  * This library is part of OpenCms -
7  * the Open Source Content Mananagement System
8  *
9  * Copyright (c) 2005 Alkacon Software GmbH (http://www.alkacon.com)
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public
13  * License as published by the Free Software Foundation; either
14  * version 2.1 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * Lesser General Public License for more details.
20  *
21  * For further information about Alkacon Software GmbH, please see the
22  * company website: http://www.alkacon.com
23  *
24  * For further information about OpenCms, please see the
25  * project website: http://www.opencms.org
26  *
27  * You should have received a copy of the GNU Lesser General Public
28  * License along with this library; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30  */

31
32 package org.opencms.workplace.explorer;
33
34 /**
35  * Provides information about a single context menu item for a resource type in the OpenCms explorer view.<p>
36  *
37  * An item can be a context menu entry or a separator line.<p>
38  *
39  * @author Andreas Zahner
40  *
41  * @version $Revision: 1.9 $
42  *
43  * @since 6.0.0
44  */

45 public class CmsExplorerContextMenuItem implements Comparable JavaDoc {
46
47     /** The name for an entry type. */
48     public static final String JavaDoc TYPE_ENTRY = "entry";
49     
50     /** The name for a separator type. */
51     public static final String JavaDoc TYPE_SEPARATOR = "separator";
52
53     private String JavaDoc m_key;
54     private Integer JavaDoc m_order;
55     private String JavaDoc m_rules;
56     private String JavaDoc m_target;
57     private String JavaDoc m_type;
58     private String JavaDoc m_uri;
59
60     /**
61      * Constructor that creates a single context menu entry with all necessary information.<p>
62      * @param type the item type (entry oder separator)
63      * @param key the key for localization
64      * @param uri the URI of the dialog
65      * @param rules the set of display rules
66      * @param target the frame target of the entry (e.g. "_top")
67      * @param order the order of the item
68      */

69     public CmsExplorerContextMenuItem(
70         String JavaDoc type,
71         String JavaDoc key,
72         String JavaDoc uri,
73         String JavaDoc rules,
74         String JavaDoc target,
75         Integer JavaDoc order) {
76
77         m_type = type;
78         m_key = key;
79         m_uri = uri;
80         m_rules = rules;
81         m_order = order;
82         m_target = target;
83     }
84
85     /**
86      * @see java.lang.Object#clone()
87      */

88     public Object JavaDoc clone() {
89
90         return new CmsExplorerContextMenuItem(m_type, m_key, m_uri, m_rules, m_target, m_order);
91     }
92
93     /**
94      * @see java.lang.Comparable#compareTo(java.lang.Object)
95      */

96     public int compareTo(Object JavaDoc obj) {
97
98         if (obj == this) {
99             return 0;
100         }
101         if (obj instanceof CmsExplorerContextMenuItem) {
102             return m_order.compareTo(((CmsExplorerContextMenuItem)obj).m_order);
103         }
104         return 0;
105     }
106
107     /**
108      * @see java.lang.Object#equals(java.lang.Object)
109      */

110     public boolean equals(Object JavaDoc obj) {
111
112         if (obj == this) {
113             return true;
114         }
115         if (obj instanceof CmsExplorerContextMenuItem) {
116             return ((CmsExplorerContextMenuItem)obj).m_uri.equals(m_uri);
117         }
118         return false;
119     }
120
121     /**
122      * Returns the key for localization.<p>
123      *
124      * @return the key for localization
125      */

126     public String JavaDoc getKey() {
127
128         return m_key;
129     }
130
131     /**
132      * Returns the sort order of this item.<p>
133      *
134      * @return the sort order of this item
135      */

136     public Integer JavaDoc getOrder() {
137
138         return m_order;
139     }
140
141     /**
142      * Returns the set of display rules.<p>
143      *
144      * @return the set of display rules
145      */

146     public String JavaDoc getRules() {
147
148         return m_rules;
149     }
150
151     /**
152      * Returns the frame target of the current item.<p>
153      *
154      * @return the frame target of the current item
155      */

156     public String JavaDoc getTarget() {
157
158         return m_target;
159     }
160
161     /**
162      * Returns the type of the current item.<p>
163      *
164      * @return the type of the current item
165      */

166     public String JavaDoc getType() {
167
168         return m_type;
169     }
170
171     /**
172      * Returns the dialog URI of the current item.<p>
173      *
174      * @return the dialog URI of the current item
175      */

176     public String JavaDoc getUri() {
177
178         return m_uri;
179     }
180
181     /**
182      * @see java.lang.Object#hashCode()
183      */

184     public int hashCode() {
185
186         return getUri().hashCode();
187     }
188
189     /**
190      * Sets the key for localization.<p>
191      *
192      * @param key the key for localization
193      */

194     public void setKey(String JavaDoc key) {
195
196         m_key = key;
197     }
198
199     /**
200      * Returns the sort order of this item.<p>
201      *
202      * @param order the sort order of this item
203      */

204     public void setOrder(Integer JavaDoc order) {
205
206         m_order = order;
207     }
208
209     /**
210      * Sets the set of display rules.<p>
211      *
212      * @param rules the set of display rules
213      */

214     public void setRules(String JavaDoc rules) {
215
216         m_rules = rules;
217     }
218
219     /**
220      * Sets the frame target of the current item.<p>
221      *
222      * @param target the frame target of the current item
223      */

224     public void setTarget(String JavaDoc target) {
225
226         m_target = target;
227     }
228
229     /**
230      * Sets the type of the current item.<p>
231      *
232      * @param type the type of the current item
233      */

234     public void setType(String JavaDoc type) {
235
236         m_type = type;
237     }
238
239     /**
240      * Sets the dialog URI of the current item.<p>
241      *
242      * @param uri the dialog URI of the current item
243      */

244     public void setUri(String JavaDoc uri) {
245
246         m_uri = uri;
247     }
248 }
Popular Tags