01: //The contents of this file are subject to the Mozilla Public License Version 1.1
02: //(the "License"); you may not use this file except in compliance with the
03: //License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
04: //
05: //Software distributed under the License is distributed on an "AS IS" basis,
06: //WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
07: //for the specific language governing rights and
08: //limitations under the License.
09: //
10: //The Original Code is "The Columba Project"
11: //
12: //The Initial Developers of the Original Code are Frederik Dietz and Timo Stich.
13: //Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
14: //
15: //All Rights Reserved.
16: package org.columba.mail.gui.table.model;
17:
18: import java.util.List;
19:
20: import javax.swing.tree.DefaultMutableTreeNode;
21:
22: import org.columba.mail.gui.table.IMessageNode;
23: import org.columba.mail.message.ColumbaHeader;
24: import org.columba.mail.message.IColumbaHeader;
25:
26: /**
27: * Title: Description: Copyright: Copyright (c) 2001 Company:
28: *
29: * @author @version 1.0
30: */
31: public class MessageNode extends DefaultMutableTreeNode implements
32: IMessageNode {
33: protected Object uid;
34:
35: protected boolean hasRecentChildren;
36:
37: public MessageNode(Object header, Object uid) {
38: super (header);
39:
40: this .uid = uid;
41: }
42:
43: public List getVector() {
44: return children;
45: }
46:
47: public void setUid(Object uid) {
48: this .uid = uid;
49: }
50:
51: public Object getUid() {
52: return uid;
53: }
54:
55: public IColumbaHeader getHeader() {
56: return (ColumbaHeader) getUserObject();
57: }
58:
59: public static Object[] toUidArray(Object[] nodes) {
60: if (nodes[0] instanceof MessageNode) {
61: Object[] newUidList = new Object[nodes.length];
62:
63: for (int i = 0; i < nodes.length; i++) {
64: newUidList[i] = ((MessageNode) nodes[i]).getUid();
65:
66: //System.out.println("node=" + newUidList[i]);
67: }
68:
69: return newUidList;
70: } else {
71: return nodes;
72: }
73: }
74:
75: /**
76: * Returns the hasRecentChildren.
77: *
78: * @return boolean
79: */
80: public boolean isHasRecentChildren() {
81: return hasRecentChildren;
82: }
83:
84: /**
85: * Sets the hasRecentChildren.
86: *
87: * @param hasRecentChildren
88: * The hasRecentChildren to set
89: */
90: public void setHasRecentChildren(boolean hasRecentChildren) {
91: this.hasRecentChildren = hasRecentChildren;
92: }
93: }
|