KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jacorb > ir > gui > typesystem > remote > IRNode


1 /*
2  * JacORB - a free Java ORB
3  *
4  * Copyright (C) 1999-2004 Gerald Brose
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the Free
18  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19  *
20  */

21 package org.jacorb.ir.gui.typesystem.remote;
22
23  
24 import org.omg.CORBA.*;
25 import java.util.*;
26 import javax.swing.tree.*;
27  
28 public abstract class IRNode
29     extends org.jacorb.ir.gui.typesystem.TypeSystemNode
30 {
31     protected org.omg.CORBA.IRObject JavaDoc irObject;
32     private TypeCode typeCode;
33     private String JavaDoc versionString = "";
34     protected String JavaDoc repositoryID = "";
35
36     /**
37      * Dient nur dem Durchreichen des Konstruktor-Aufrufs an Oberklasse
38      */

39
40     protected IRNode ( ) {
41     super();
42     }
43
44     /**
45      * @param irObject org.omg.CORBA.IRObject
46      */

47
48     protected IRNode ( IRObject irObject)
49     {
50     super();
51     setIRObject(irObject);
52         // System.out.println(this.toString()); System.out.flush();
53
}
54
55     /**
56      * @return java.lang.String[]
57      */

58
59     public String JavaDoc[] allowedToAdd()
60     {
61     return null;
62     }
63
64     /**
65      * @return java.lang.String
66      */

67
68     public String JavaDoc description()
69     {
70     String JavaDoc result = super.description();
71     result = result + "\nVersion:\t" + versionString + "\nRepository ID:\t" + repositoryID;
72     return result;
73     
74     }
75
76     /**
77      * @return java.lang.String
78      */

79
80     public String JavaDoc getAbsoluteName()
81     {
82     if (absoluteName!=null && !absoluteName.equals(""))
83         {
84             return absoluteName;
85     }
86     else
87         {
88             return name;
89     }
90     }
91
92     /**
93      * @return org.omg.CORBA.TypeCode
94      */

95     public TypeCode getTypeCode()
96     {
97     return typeCode;
98     }
99
100     /**
101      * Referenz auf dazugehöriges IRObject setzen.(kann null sein, z.B. bei StructMember)
102      * Holt außerdem den name() des IRObject, wenn es ein Contained Objekt ist
103      * @param irobj org.omg.CORBA.IRObject
104      */

105
106     protected void setIRObject(org.omg.CORBA.IRObject JavaDoc irobj)
107     {
108     this.irObject = irobj;
109     Contained contained;
110         try
111         {
112             contained = ContainedHelper.narrow((org.omg.CORBA.Object JavaDoc)irobj);
113             setName(contained.name());
114             setAbsoluteName(contained.absolute_name());
115             versionString = contained.version();
116             repositoryID = contained.id();
117         }
118         catch( org.omg.CORBA.BAD_PARAM JavaDoc bp )
119         {
120             // narrow failed
121
}
122
123         try
124         {
125             IDLType idlType = IDLTypeHelper.narrow((org.omg.CORBA.Object JavaDoc)irobj);
126             typeCode = idlType.type();
127
128             // mithilfe des TypeCodes könnten wir uns bei IDLTypes eigentlich ein
129
// paar Remote Method Invocations sparen (es steckt einiges schon im TypeCode);
130
// außerdem ließe sich vielleicht der Code zum Auslesen
131
// der members bei struct etc. vereinfachen.
132
// Alle anderen Klassen haben übrigens auch eine TypeCode
133
// type() oder result() Operation!
134
}
135         catch( org.omg.CORBA.BAD_PARAM JavaDoc bp )
136         {
137             // narrow failed
138
}
139     }
140 }
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
Popular Tags