KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opencms > workplace > CmsWorkplaceView


1 /*
2  * File : $Source: /usr/local/cvs/opencms/src/org/opencms/workplace/CmsWorkplaceView.java,v $
3  * Date : $Date: 2005/06/23 11:11:33 $
4  * Version: $Revision: 1.10 $
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;
33
34 /**
35  * Contains the data of a single workplace view.<p>
36  *
37  * @author Alexander Kandzior
38  *
39  * @version $Revision: 1.10 $
40  *
41  * @since 6.0.0
42  */

43 public class CmsWorkplaceView implements Comparable JavaDoc {
44
45     /** The localization key of this view. */
46     private String JavaDoc m_key;
47
48     /** The sort order of the view. */
49     private Float JavaDoc m_order;
50
51     /** The URI of the OpenCms VFS resource (folder) of the view. */
52     private String JavaDoc m_uri;
53
54     /**
55      * Creates a new workplace view.<p>
56      *
57      * @param key the localization key for the display name of the view
58      * @param uri of the view page in the OpenCms VFS
59      * @param order the sort order of the view
60      */

61     public CmsWorkplaceView(String JavaDoc key, String JavaDoc uri, Float JavaDoc order) {
62
63         m_key = key;
64         m_uri = uri;
65         m_order = order;
66     }
67
68     /**
69      * @see java.lang.Comparable#compareTo(java.lang.Object)
70      */

71     public int compareTo(Object JavaDoc obj) {
72
73         if (obj == this) {
74             return 0;
75         }
76         if (obj instanceof CmsWorkplaceView) {
77             return m_order.compareTo(((CmsWorkplaceView)obj).getOrder());
78         }
79         return 0;
80     }
81
82     /**
83      * @see java.lang.Object#equals(java.lang.Object)
84      */

85     public boolean equals(Object JavaDoc obj) {
86
87         if (obj == this) {
88             return true;
89         }
90         if (obj instanceof CmsWorkplaceView) {
91             return ((CmsWorkplaceView)obj).m_uri.equals(m_uri);
92         }
93         return false;
94     }
95
96     /**
97      * Returns the localization key for the display name of this view .<p>
98      *
99      * @return the localization key
100      */

101     public String JavaDoc getKey() {
102
103         return m_key;
104     }
105
106     /**
107      * Returns the sort order of this view.<p>
108      *
109      * @return the sort order of this view
110      */

111     public Float JavaDoc getOrder() {
112
113         return m_order;
114     }
115
116     /**
117      * Returns the OpenCms VFS uri of this view.<p>
118      *
119      * @return the uri
120      */

121     public String JavaDoc getUri() {
122
123         return m_uri;
124     }
125
126     /**
127      * @see java.lang.Object#hashCode()
128      */

129     public int hashCode() {
130
131         return getUri().hashCode();
132     }
133 }
Popular Tags