001: /*
002: * Copyright (C) 2001, 2002 Robert MacGrogan
003: *
004: * This library is free software; you can redistribute it and/or
005: * modify it under the terms of the GNU Lesser General Public
006: * License as published by the Free Software Foundation; either
007: * version 2.1 of the License, or (at your option) any later version.
008: *
009: * This library is distributed in the hope that it will be useful,
010: * but WITHOUT ANY WARRANTY; without even the implied warranty of
011: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012: * Lesser General Public License for more details.
013: *
014: * You should have received a copy of the GNU Lesser General Public
015: * License along with this library; if not, write to the Free Software
016: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
017: *
018: *
019: * $Archive: SourceJammer$
020: * $FileName: FileNodeInfo.java$
021: * $FileID: 4119$
022: *
023: * Last change:
024: * $AuthorName: Rob MacGrogan$
025: * $Date: 4/25/03 1:18 AM$
026: * $Comment: Implement clone methods.$
027: */
028: package org.sourcejammer.client.gui.conf;
029:
030: import java.util.ArrayList;
031:
032: import org.sourcejammer.client.gui.ProjectTreeNode;
033: import org.sourcejammer.client.gui.dialog.FileNode;
034: import org.sourcejammer.project.view.NodeInfo;
035: import org.sourcejammer.util.SJDate;
036:
037: /**
038: * Title: $FileName: FileNodeInfo.java$
039: * @version $VerNum: 3$
040: * @author $AuthorName: Rob MacGrogan$<br><br>
041: *
042: * $Description: Wrapper for NodeInfo. Adds info about sync state of file.$<br>
043: * $KeyWordsOff: $<br>
044: */
045: public class FileNodeInfo extends NodeInfo {
046:
047: public static final int IN_SYNC = 0;
048: public static final int OUT_OF_SYNC = 1;
049: public static final int NOT_IN_ARCHIVE = 2;
050: public static final int NOT_ON_LOCAL = 3;
051: public static final int UNKNOWN = 4;
052:
053: public static final String UNKNOWN_STRING = " ";
054: public static final String IN_SYNC_STRING = "= ";
055: public static final String OUT_OF_SYNC_STRING = "! ";
056: public static final String NOT_IN_ARCHIVE_STRING = "^ ";
057: public static final String NOT_ON_LOCAL_STRING = "v ";
058:
059: private static final ArrayList STRING_ICONS;
060: static {
061: ArrayList temp = new ArrayList();
062: temp.add(IN_SYNC_STRING);
063: temp.add(OUT_OF_SYNC_STRING);
064: temp.add(NOT_IN_ARCHIVE_STRING);
065: temp.add(NOT_ON_LOCAL_STRING);
066: temp.add(UNKNOWN_STRING);
067: STRING_ICONS = temp;
068: }
069:
070: private NodeInfo parent = null;
071: private int localRemoteSyncState = IN_SYNC;
072: private ProjectTreeNode parentTreeNode = null;
073:
074: public FileNodeInfo(NodeInfo parent) {
075: this .parent = parent;
076: }
077:
078: /**
079: * @see org.sourcejammer.project.Node#childCount()
080: */
081: public int childCount() {
082: return parent.childCount();
083: }
084:
085: /**
086: * @see java.lang.Comparable#compareTo(Object)
087: */
088: public int compareTo(Object arg0) {
089: return parent.compareTo(arg0);
090: }
091:
092: /**
093: * @see org.sourcejammer.project.view.NodeInfo#getCheckedOutDate()
094: */
095: public SJDate getCheckedOutDate() {
096: return parent.getCheckedOutDate();
097: }
098:
099: /**
100: * @see org.sourcejammer.project.view.NodeInfo#getCheckedOutToPath()
101: */
102: public String getCheckedOutToPath() {
103: return parent.getCheckedOutToPath();
104: }
105:
106: /**
107: * @see org.sourcejammer.project.view.NodeInfo#getCheckedOutToUser()
108: */
109: public String getCheckedOutToUser() {
110: return parent.getCheckedOutToUser();
111: }
112:
113: /**
114: * @see org.sourcejammer.project.view.NodeInfo#getCreatedDate()
115: */
116: public SJDate getCreatedDate() {
117: return parent.getCreatedDate();
118: }
119:
120: /**
121: * @see org.sourcejammer.project.view.NodeInfo#getCreatedUser()
122: */
123: public String getCreatedUser() {
124: return parent.getCreatedUser();
125: }
126:
127: /**
128: * @see org.sourcejammer.project.view.NodeInfo#getFileType()
129: */
130: public int getFileType() {
131: return parent.getFileType();
132: }
133:
134: /**
135: * @see org.sourcejammer.project.view.NodeInfo#getHasChildren()
136: */
137: public boolean getHasChildren() {
138: return parent.getHasChildren();
139: }
140:
141: /**
142: * @see org.sourcejammer.project.view.NodeInfo#getLatestVerUniqueID()
143: */
144: public long getLatestVerUniqueID() {
145: return parent.getLatestVerUniqueID();
146: }
147:
148: /**
149: * @see org.sourcejammer.project.view.NodeInfo#getModifiedDate()
150: */
151: public SJDate getModifiedDate() {
152: return parent.getModifiedDate();
153: }
154:
155: /**
156: * @see org.sourcejammer.project.Node#getNodeName()
157: */
158: public String getNodeName() {
159: return parent.getNodeName();
160: }
161:
162: /**
163: * @see org.sourcejammer.project.view.NodeInfo#getNodeType()
164: */
165: public int getNodeType() {
166: return parent.getNodeType();
167: }
168:
169: /**
170: * @see org.sourcejammer.project.view.NodeInfo#getNumVersions()
171: */
172: public int getNumVersions() {
173: return parent.getNumVersions();
174: }
175:
176: /**
177: * @see org.sourcejammer.project.view.NodeInfo#getParentID()
178: */
179: public long getParentID() {
180: return parent.getParentID();
181: }
182:
183: /**
184: * @see org.sourcejammer.project.view.NodeInfo#getSourceSizeInBytes()
185: */
186: public long getSourceSizeInBytes() {
187: return parent.getSourceSizeInBytes();
188: }
189:
190: /**
191: * @see org.sourcejammer.project.Node#getUniqueID()
192: */
193: public long getUniqueID() {
194: return parent.getUniqueID();
195: }
196:
197: /**
198: * @see org.sourcejammer.project.view.NodeInfo#isCheckedOut()
199: */
200: public boolean isCheckedOut() {
201: return parent.isCheckedOut();
202: }
203:
204: /**
205: * @see org.sourcejammer.project.view.NodeInfo#isPlaceHolder()
206: */
207: public boolean isPlaceHolder() {
208: return parent.isPlaceHolder();
209: }
210:
211: /**
212: * @see org.sourcejammer.project.Node#isShared()
213: */
214: public boolean isShared() {
215: return parent.isShared();
216: }
217:
218: /**
219: * @see org.sourcejammer.project.view.NodeInfo#setCheckedOut(boolean)
220: */
221: public void setCheckedOut(boolean b) {
222: parent.setCheckedOut(b);
223: }
224:
225: /**
226: * @see org.sourcejammer.project.view.NodeInfo#setCheckedOutDate(SJDate)
227: */
228: public void setCheckedOutDate(SJDate d) {
229: parent.setCheckedOutDate(d);
230: }
231:
232: /**
233: * @see org.sourcejammer.project.view.NodeInfo#setCheckedOutToPath(String)
234: */
235: public void setCheckedOutToPath(String s) {
236: parent.setCheckedOutToPath(s);
237: }
238:
239: /**
240: * @see org.sourcejammer.project.view.NodeInfo#setCheckedOutToUser(String)
241: */
242: public void setCheckedOutToUser(String s) {
243: parent.setCheckedOutToUser(s);
244: }
245:
246: /**
247: * @see org.sourcejammer.project.view.NodeInfo#setChildCount(int)
248: */
249: public void setChildCount(int i) {
250: parent.setChildCount(i);
251: }
252:
253: /**
254: * @see org.sourcejammer.project.view.NodeInfo#setCreatedDate(SJDate)
255: */
256: public void setCreatedDate(SJDate d) {
257: parent.setCreatedDate(d);
258: }
259:
260: /**
261: * @see org.sourcejammer.project.view.NodeInfo#setCreatedUser(String)
262: */
263: public void setCreatedUser(String s) {
264: parent.setCreatedUser(s);
265: }
266:
267: /**
268: * @see org.sourcejammer.project.view.NodeInfo#setFileType(int)
269: */
270: public void setFileType(int i) {
271: parent.setFileType(i);
272: }
273:
274: /**
275: * @see org.sourcejammer.project.view.NodeInfo#setHasChildren(boolean)
276: */
277: public void setHasChildren(boolean b) {
278: parent.setHasChildren(b);
279: }
280:
281: /**
282: * @see org.sourcejammer.project.view.NodeInfo#setLatestVerUniqueID(long)
283: */
284: public void setLatestVerUniqueID(long latestVerUniqueID) {
285: parent.setLatestVerUniqueID(latestVerUniqueID);
286: }
287:
288: /**
289: * @see org.sourcejammer.project.view.NodeInfo#setModifiedDate(SJDate)
290: */
291: public void setModifiedDate(SJDate d) {
292: parent.setModifiedDate(d);
293: }
294:
295: /**
296: * @see org.sourcejammer.project.view.NodeInfo#setNodeName(String)
297: */
298: public void setNodeName(String s) {
299: parent.setNodeName(s);
300: }
301:
302: /**
303: * @see org.sourcejammer.project.view.NodeInfo#setNodeType(int)
304: */
305: public void setNodeType(int i) {
306: parent.setNodeType(i);
307: }
308:
309: /**
310: * @see org.sourcejammer.project.view.NodeInfo#setNumVersions(int)
311: */
312: public void setNumVersions(int i) {
313: parent.setNumVersions(i);
314: }
315:
316: /**
317: * @see org.sourcejammer.project.view.NodeInfo#setParentID(long)
318: */
319: public void setParentID(long l) {
320: parent.setParentID(l);
321: }
322:
323: /**
324: * @see org.sourcejammer.project.view.NodeInfo#setPlaceHolder(boolean)
325: */
326: public void setPlaceHolder(boolean b) {
327: parent.setPlaceHolder(b);
328: }
329:
330: /**
331: * @see org.sourcejammer.project.view.NodeInfo#setShared(boolean)
332: */
333: public void setShared(boolean b) {
334: parent.setShared(b);
335: }
336:
337: /**
338: * @see org.sourcejammer.project.view.NodeInfo#setSourceSizeInBytes(long)
339: */
340: public void setSourceSizeInBytes(long l) {
341: parent.setSourceSizeInBytes(l);
342: }
343:
344: /**
345: * @see org.sourcejammer.project.view.NodeInfo#setUniqueID(long)
346: */
347: public void setUniqueID(long l) {
348: parent.setUniqueID(l);
349: }
350:
351: /**
352: * @see java.lang.Object#toString()
353: */
354: public String toString() {
355: return parent.toString();
356: }
357:
358: /**
359: * Returns the localRemoteSyncState.
360: * @return int
361: */
362: public int getLocalRemoteSyncState() {
363: return localRemoteSyncState;
364: }
365:
366: /**
367: * Sets the localRemoteSyncState.
368: * @param localRemoteSyncState The localRemoteSyncState to set
369: */
370: public void setLocalRemoteSyncState(int localRemoteSyncState) {
371: this .localRemoteSyncState = localRemoteSyncState;
372: }
373:
374: public String getLocalRemoteString() {
375: return (String) STRING_ICONS.get(this .localRemoteSyncState);
376: }
377:
378: /**
379: * Returns the parentTreeNode.
380: * @return ProjectTreeNode
381: */
382: public ProjectTreeNode getParentTreeNode() {
383: return parentTreeNode;
384: }
385:
386: /**
387: * Sets the parentTreeNode.
388: * @param parentTreeNode The parentTreeNode to set
389: */
390: public void setParentTreeNode(ProjectTreeNode parentTreeNode) {
391: this .parentTreeNode = parentTreeNode;
392: }
393:
394: public NodeInfo cloneNodeInfo() {
395: NodeInfo clone = null;
396: try {
397: clone = (NodeInfo) clone();
398: } catch (CloneNotSupportedException ex) {
399: }
400: return clone;
401: }
402:
403: /**
404: * @see java.lang.Object#clone()
405: */
406: protected Object clone() throws CloneNotSupportedException {
407: NodeInfo newParent = parent.cloneNodeInfo();
408: FileNodeInfo newFlNd = new FileNodeInfo(newParent);
409: newFlNd.localRemoteSyncState = this.localRemoteSyncState;
410: newFlNd.parentTreeNode = this.parentTreeNode;
411: return newFlNd;
412: }
413:
414: }
|