KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > columba > mail > gui > table > model > MessageNode


1 //The contents of this file are subject to the Mozilla Public License Version 1.1
2
//(the "License"); you may not use this file except in compliance with the
3
//License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
4
//
5
//Software distributed under the License is distributed on an "AS IS" basis,
6
//WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
7
//for the specific language governing rights and
8
//limitations under the License.
9
//
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 JavaDoc;
19
20 import javax.swing.tree.DefaultMutableTreeNode JavaDoc;
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 JavaDoc implements IMessageNode {
32     protected Object JavaDoc uid;
33
34     
35     protected boolean hasRecentChildren;
36
37     public MessageNode(Object JavaDoc header, Object JavaDoc uid) {
38         super(header);
39
40         this.uid = uid;
41     }
42
43     public List JavaDoc getVector() {
44         return children;
45     }
46
47     public void setUid(Object JavaDoc uid) {
48         this.uid = uid;
49     }
50
51     public Object JavaDoc getUid() {
52         return uid;
53     }
54
55     public IColumbaHeader getHeader() {
56         return (ColumbaHeader) getUserObject();
57     }
58
59     public static Object JavaDoc[] toUidArray(Object JavaDoc[] nodes) {
60         if (nodes[0] instanceof MessageNode) {
61             Object JavaDoc[] newUidList = new Object JavaDoc[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 }
Popular Tags