KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > bluecubs > xinco > client > XincoMutableTreeNode


1 /**
2  *Copyright 2004 blueCubs.com
3  *
4  *Licensed under the Apache License, Version 2.0 (the "License");
5  *you may not use this file except in compliance with the License.
6  *You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  *Unless required by applicable law or agreed to in writing, software
11  *distributed under the License is distributed on an "AS IS" BASIS,
12  *WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *See the License for the specific language governing permissions and
14  *limitations under the License.
15  *
16  *************************************************************
17  * This project supports the blueCubs vision of giving back
18  * to the community in exchange for free software!
19  * More information on: http://www.bluecubs.org
20  *************************************************************
21  *
22  * Name: XincoMutableTreeNode
23  *
24  * Description: tree node on client side
25  *
26  * Original Author: Alexander Manes
27  * Date: 2004
28  *
29  * Modifications:
30  *
31  * Who? When? What?
32  * - - -
33  *
34  *************************************************************
35  */

36
37 package com.bluecubs.xinco.client;
38
39 import javax.swing.tree.DefaultMutableTreeNode JavaDoc;
40
41 import com.bluecubs.xinco.core.*;
42
43 public class XincoMutableTreeNode extends DefaultMutableTreeNode JavaDoc {
44     
45     public XincoMutableTreeNode(Object JavaDoc o) {
46         super(o);
47     }
48     
49     public String JavaDoc toString() {
50         String JavaDoc s = null;
51         String JavaDoc status = null;
52         if (this.getUserObject() != null) {
53             if (this.getUserObject().getClass() == XincoCoreNode.class) {
54                 s = ((XincoCoreNode)this.getUserObject()).getDesignation();
55                 if (s == null) { s = super.toString(); }
56                 status = new String JavaDoc("");
57                 if (((XincoCoreNode)this.getUserObject()).getStatus_number() == 2) {
58                     status = new String JavaDoc(" | -");
59                 }
60                 if (((XincoCoreNode)this.getUserObject()).getStatus_number() == 3) {
61                     status = new String JavaDoc(" | ->");
62                 }
63                 return "" + s + " (" + ((XincoCoreNode)this.getUserObject()).getXinco_core_language().getSign() + status + ")";
64             }
65             if (this.getUserObject().getClass() == XincoCoreData.class) {
66                 s = ((XincoCoreData)this.getUserObject()).getDesignation();
67                 if (s == null) { s = super.toString(); }
68                 status = new String JavaDoc("");
69                 if (((XincoCoreData)this.getUserObject()).getStatus_number() == 2) {
70                     status = new String JavaDoc(" | -");
71                 }
72                 if (((XincoCoreData)this.getUserObject()).getStatus_number() == 3) {
73                     status = new String JavaDoc(" | ->");
74                 }
75                 if (((XincoCoreData)this.getUserObject()).getStatus_number() == 4) {
76                     status = new String JavaDoc(" | X");
77                 }
78                 if (((XincoCoreData)this.getUserObject()).getStatus_number() == 5) {
79                     status = new String JavaDoc(" | WWW");
80                 }
81                 return "" + s + " (" + ((XincoCoreData)this.getUserObject()).getXinco_core_data_type().getDesignation() + " | " + ((XincoCoreData)this.getUserObject()).getXinco_core_language().getSign() + status + ")";
82             }
83         }
84         return super.toString();
85     }
86
87 }
88
Popular Tags