KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > openccm > packaging > CCMSplitPane


1 /*====================================================================
2
3 OpenCCM: The Open CORBA Component Model Platform
4 Copyright (C) 2000-2004 INRIA - USTL - LIFL - GOAL
5 Contact: openccm@objectweb.org
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or any later version.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with this library; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 USA
21
22 Initial developer(s): Christophe Contreras
23 Contributor(s): ___________________________________________________.
24
25 ====================================================================*/

26
27 package org.objectweb.openccm.packaging;
28
29 /**
30  * This is the split panel for CCM Packaging and Assembly tools
31  *
32  * @author <a HREF="mailto:Christophe.Contreras@lifl.fr">Christophe Contreras</a>
33  *
34  */

35 public class CCMSplitPane
36      extends org.objectweb.apollon.gui.ApollonSplitPane
37 {
38     // ==================================================================
39
//
40
// Internal state.
41
//
42
// ==================================================================
43

44     // ==================================================================
45
//
46
// Constructors.
47
//
48
// ==================================================================
49

50     /**
51      * The default constructor.
52      */

53     public
54     CCMSplitPane()
55     {
56         super();
57
58         // Register a CCM entity resolver for CAD, CCD, CSD and CPF beans
59
org.objectweb.openccm.descriptor.EntityResolver.setCCMResolver();
60     }
61
62     // ==================================================================
63
//
64
// Internal methods.
65
//
66
// ==================================================================
67

68     /**
69      * scans an instance for known and identified elements
70      * (componentfiles and instantiations in CAD
71      * , implementations in CSD)
72      *
73      * @param Bean instance the instance to scan
74      */

75     private void
76     store_ccm_elements(org.objectweb.apollon.framework.Bean instance, String JavaDoc filename)
77     {
78         // gets the type of instance
79
if (filename.endsWith(".cad")
80             || filename.endsWith(".CAD"))
81         {
82             // the instance is an assembly
83
org.objectweb.openccm.descriptor.componentassembly.beans.ComponentassemblyBean
84              assembly_instance
85              = (org.objectweb.openccm.descriptor.componentassembly.beans.ComponentassemblyBean)
86                 instance;
87
88                 // adds its id to this list
89
CCMIdRefsSingleton.getInstance().addAssembly(assembly_instance);
90         }
91
92         if (filename.endsWith(".csd")
93             || filename.endsWith(".CSD"))
94         {
95             // this instance is a software package descriptor
96
org.objectweb.openccm.descriptor.softpkg.beans.SoftpkgBean
97              software_instance
98              = (org.objectweb.openccm.descriptor.softpkg.beans.SoftpkgBean)
99                 instance;
100
101                 // adds its id to this list
102
CCMIdRefsSingleton.getInstance().addPackage(software_instance);
103         }
104     }
105
106     // ==================================================================
107
//
108
// Public methods.
109
//
110
// ==================================================================
111

112     /**
113      * calls super add_to_tree method
114      * and scans the instance for identified elements
115      *
116      */

117     public void
118     add_instance_to_tree(org.objectweb.apollon.framework.Bean instance, java.io.File JavaDoc file)
119     {
120         super.add_instance_to_tree(instance, file);
121
122         this.store_ccm_elements(instance,file.getName());
123
124 /*
125         if (file.getName().endsWith(".cad")
126             || file.getName().endsWith(".CAD"))
127         {
128             // the instance is an assembly
129             org.objectweb.openccm.descriptor.componentassembly.beans.ComponentassemblyBean
130              assembly_instance
131              = (org.objectweb.openccm.descriptor.componentassembly.beans.ComponentassemblyBean)
132                 instance;
133
134             if (assembly_instance.getComponentfiles() != null)
135             {
136                 java.util.List csd_list
137                  = assembly_instance.getComponentfiles().getComponentfileList();
138
139                 for (java.util.Iterator i = csd_list.iterator() ; i.hasNext() ; )
140                 {
141                     org.objectweb.openccm.descriptor.componentassembly.Componentfile csd
142                      = (org.objectweb.openccm.descriptor.componentassembly.Componentfile)
143                         i.next();
144
145                     if (csd.getFileinarchive() != null
146                         && csd.getFileinarchive().getLink() == null)
147                     {
148                         //gets the frame
149                         org.objectweb.apollon.gui.ApollonFrame calling_frame
150                             = (org.objectweb.apollon.gui.ApollonFrame)
151                                 this.getRootPane().getParent();
152
153                         calling_frame.open_file(
154                             new java.io.File(
155                                 csd.getFileinarchive().getName()
156                                 )
157                             );
158
159                     }
160                 }
161             }
162         }
163 */

164     }
165
166     /**
167      * calls super save method for an entry
168      * and scans the instances for identified elements
169      *
170      */

171     public void
172     save_tree_entry(org.objectweb.util.browser.api.Entry tree_entry)
173     {
174         super.save_tree_entry(tree_entry);
175
176         this.store_ccm_elements(
177             (org.objectweb.apollon.framework.Bean)
178                 ((org.objectweb.apollon.framework.Context)
179                     tree_entry.getValue()
180                         ).getSource()
181             ,(String JavaDoc) tree_entry.getName()
182             );
183     }
184 }
185
Popular Tags