001: /*
002: * File : $Source: /usr/local/cvs/opencms/src/org/opencms/workplace/CmsWorkplaceView.java,v $
003: * Date : $Date: 2008-02-27 12:05:45 $
004: * Version: $Revision: 1.12 $
005: *
006: * This library is part of OpenCms -
007: * the Open Source Content Management System
008: *
009: * Copyright (c) 2002 - 2008 Alkacon Software GmbH (http://www.alkacon.com)
010: *
011: * This library is free software; you can redistribute it and/or
012: * modify it under the terms of the GNU Lesser General Public
013: * License as published by the Free Software Foundation; either
014: * version 2.1 of the License, or (at your option) any later version.
015: *
016: * This library is distributed in the hope that it will be useful,
017: * but WITHOUT ANY WARRANTY; without even the implied warranty of
018: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
019: * Lesser General Public License for more details.
020: *
021: * For further information about Alkacon Software GmbH, please see the
022: * company website: http://www.alkacon.com
023: *
024: * For further information about OpenCms, please see the
025: * project website: http://www.opencms.org
026: *
027: * You should have received a copy of the GNU Lesser General Public
028: * License along with this library; if not, write to the Free Software
029: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
030: */
031:
032: package org.opencms.workplace;
033:
034: /**
035: * Contains the data of a single workplace view.<p>
036: *
037: * @author Alexander Kandzior
038: *
039: * @version $Revision: 1.12 $
040: *
041: * @since 6.0.0
042: */
043: public class CmsWorkplaceView implements Comparable {
044:
045: /** The localization key of this view. */
046: private String m_key;
047:
048: /** The sort order of the view. */
049: private Float m_order;
050:
051: /** The URI of the OpenCms VFS resource (folder) of the view. */
052: private String m_uri;
053:
054: /**
055: * Creates a new workplace view.<p>
056: *
057: * @param key the localization key for the display name of the view
058: * @param uri of the view page in the OpenCms VFS
059: * @param order the sort order of the view
060: */
061: public CmsWorkplaceView(String key, String uri, Float order) {
062:
063: m_key = key;
064: m_uri = uri;
065: m_order = order;
066: }
067:
068: /**
069: * @see java.lang.Comparable#compareTo(java.lang.Object)
070: */
071: public int compareTo(Object obj) {
072:
073: if (obj == this ) {
074: return 0;
075: }
076: if (obj instanceof CmsWorkplaceView) {
077: return m_order.compareTo(((CmsWorkplaceView) obj)
078: .getOrder());
079: }
080: return 0;
081: }
082:
083: /**
084: * @see java.lang.Object#equals(java.lang.Object)
085: */
086: public boolean equals(Object obj) {
087:
088: if (obj == this ) {
089: return true;
090: }
091: if (obj instanceof CmsWorkplaceView) {
092: return ((CmsWorkplaceView) obj).m_uri.equals(m_uri);
093: }
094: return false;
095: }
096:
097: /**
098: * Returns the localization key for the display name of this view .<p>
099: *
100: * @return the localization key
101: */
102: public String getKey() {
103:
104: return m_key;
105: }
106:
107: /**
108: * Returns the sort order of this view.<p>
109: *
110: * @return the sort order of this view
111: */
112: public Float getOrder() {
113:
114: return m_order;
115: }
116:
117: /**
118: * Returns the OpenCms VFS uri of this view.<p>
119: *
120: * @return the uri
121: */
122: public String getUri() {
123:
124: return m_uri;
125: }
126:
127: /**
128: * @see java.lang.Object#hashCode()
129: */
130: public int hashCode() {
131:
132: return getUri().hashCode();
133: }
134: }
|