001: /*
002: * Copyright (c) 2000, Jacob Smullyan.
003: *
004: * This is part of SkunkDAV, a WebDAV client. See http://skunkdav.sourceforge.net/
005: * for the latest version.
006: *
007: * SkunkDAV is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU General Public License as published
009: * by the Free Software Foundation; either version 2, or (at your option)
010: * any later version.
011: *
012: * SkunkDAV is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * General Public License for more details.
016: *
017: * You should have received a copy of the GNU General Public License
018: * along with SkunkDAV; see the file COPYING. If not, write to the Free
019: * Software Foundation, 59 Temple Place - Suite 330, Boston, MA
020: * 02111-1307, USA.
021: */
022:
023: package org.skunk.dav.client.gui;
024:
025: import java.io.Serializable;
026: import org.skunk.dav.client.DAVConstants;
027: import org.skunk.dav.client.DAVProperty;
028: import org.skunk.dav.client.Lock;
029:
030: public class DAVTableHeader implements Serializable {
031: static final long serialVersionUID = -817320207861899526L;
032: private String davElement;
033: private String title;
034: private Class daClass;
035: private transient DAVProperty davProp;
036: public static final String TABLE_HEADER_SUFFIX = "_hdr";
037:
038: public static DAVTableHeader FILE_NAME = new DAVTableHeader(
039: DAVConstants.HREF_ELEM);
040: public static DAVTableHeader CREATION_DATE = new DAVTableHeader(
041: DAVConstants.CREATIONDATE_PROP);
042: public static DAVTableHeader DISPLAY_NAME = new DAVTableHeader(
043: DAVConstants.DISPLAYNAME_PROP);
044: public static DAVTableHeader CONTENT_LANGUAGE = new DAVTableHeader(
045: DAVConstants.GETCONTENTLANGUAGE_PROP);
046: public static DAVTableHeader CONTENT_LENGTH = new DAVTableHeader(
047: DAVConstants.GETCONTENTLENGTH_PROP);
048: public static DAVTableHeader CONTENT_TYPE = new DAVTableHeader(
049: DAVConstants.GETCONTENTTYPE_PROP);
050: public static DAVTableHeader ETAG = new DAVTableHeader(
051: DAVConstants.GETETAG_PROP);
052: public static DAVTableHeader LAST_MODIFIED = new DAVTableHeader(
053: DAVConstants.GETLASTMODIFIED_PROP);
054: public static DAVTableHeader EXECUTABLE = new DAVTableHeader(
055: DAVConstants.EXECUTABLE_PROP);
056: public static DAVTableHeader LOCKTOKEN = new DAVTableHeader(
057: DAVConstants.LOCKTOKEN_ELEM);
058: public static DAVTableHeader LOCKTYPE = new DAVTableHeader(
059: DAVConstants.LOCKTYPE_ELEM);
060: public static DAVTableHeader LOCKSCOPE = new DAVTableHeader(
061: DAVConstants.LOCKSCOPE_ELEM);
062: public static DAVTableHeader OWNER = new DAVTableHeader(
063: DAVConstants.OWNER_ELEM);
064: public static DAVTableHeader LOCK = new DAVTableHeader(
065: DAVConstants.LOCKDISCOVERY_PROP);
066: public static DAVTableHeader RESOURCETYPE = new DAVTableHeader(
067: DAVConstants.RESOURCETYPE_PROP);
068:
069: public String toString() {
070: return title;
071: }
072:
073: private DAVTableHeader(String davElement) {
074: this .davElement = davElement;
075: this .title = ResourceManager.getMessage(davElement
076: + TABLE_HEADER_SUFFIX, davElement);
077: if (davElement.equals(DAVConstants.GETCONTENTLENGTH_PROP))
078: daClass = Number.class;
079: else if (davElement.equals(DAVConstants.LOCKDISCOVERY_PROP))
080: daClass = Lock.class;
081: else
082: daClass = String.class;
083: }
084:
085: public DAVProperty getDAVProperty() {
086: if (davProp == null) {
087: davProp = DAVProperty.getCanonicalProperty(davElement);
088: }
089: return davProp;
090: }
091:
092: public Class getRenderingClass() {
093: return daClass;
094: }
095:
096: public boolean equals(Object otherObject) {
097: if (otherObject instanceof DAVTableHeader)
098: return this .toString().equals(otherObject.toString());
099: return false;
100: }
101:
102: }
103:
104: /* $Log: DAVTableHeader.java,v $
105: /* Revision 1.12 2001/01/05 08:01:12 smulloni
106: /* changes to the connection gui for the Explorer; added depth configurability to
107: /* propfind in the jpython test script; added an experimental "allprop" system
108: /* property which affects the propfind query type
109: /*
110: /* Revision 1.11 2000/12/19 22:36:05 smulloni
111: /* adjustments to preamble.
112: /*
113: /* Revision 1.10 2000/12/03 23:53:26 smulloni
114: /* added license and copyright preamble to java files.
115: /*
116: /* Revision 1.9 2000/11/10 22:40:05 smullyan
117: /* added icon to table for resource type; fixes to copy and move; disabling of
118: /* menu items that are inappropriate.
119: /*
120: /* Revision 1.8 2000/11/09 23:34:55 smullyan
121: /* log added to every Java file, with the help of python. Lock stealing
122: /* implemented, and treatment of locks made more robust.
123: /* */
|