KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > openccm > explorer > DCI > DCIInstallDescriptor


1 /*===========================================================================
2 ObjectWeb Naming Context Framework
3 Copyright (C) 2002 USTL - LIFL - GOAL
4 Contact: architecture@objectweb.org
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or 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 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
17 License along with this library; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19 USA
20
21 Initial developer(s): Briclet Frederic
22 Contributor(s): ______________________________________.
23
24 ===========================================================================*/

25
26 package org.objectweb.openccm.explorer.DCI;
27
28 import java.awt.Component JavaDoc;
29 import java.awt.event.ActionEvent JavaDoc;
30
31 import javax.swing.JOptionPane JavaDoc;
32 import javax.swing.JScrollPane JavaDoc;
33
34 import org.objectweb.util.explorer.api.MenuItem;
35 import org.objectweb.util.explorer.api.MenuItemTreeView;
36 import org.objectweb.util.explorer.api.TreeView;
37
38 /**
39  * This action install an assembly with the specified descriptor
40  *
41  * @author <a HREF="mailto:Jerome.Moroy@lifl.fr">Jerome Moroy</a>
42  * @version 0.1
43  */

44 public class DCIInstallDescriptor
45   implements MenuItem
46 {
47
48     /* (non-Javadoc)
49      * @see org.objectweb.util.explorer.api.MenuItem#getStatus(org.objectweb.util.explorer.api.TreeView)
50      */

51     public int getStatus(TreeView treeView){
52         return MenuItem.ENABLED_STATUS;
53     }
54
55     /* (non-Javadoc)
56      * @see org.objectweb.util.explorer.api.MenuItem#actionPerformed(org.objectweb.util.explorer.api.MenuItemTreeView)
57      */

58     public void actionPerformed(MenuItemTreeView e) throws Exception JavaDoc {
59         org.ist.coach.DCI.DCIDeployment dciDeployment=
60             (org.ist.coach.DCI.DCIDeployment)e.getSelectedObject();
61
62         javax.swing.JPanel JavaDoc pan = new javax.swing.JPanel JavaDoc();
63         javax.swing.JTextArea JavaDoc description =new javax.swing.JTextArea JavaDoc(30,30);
64
65         javax.swing.JScrollPane JavaDoc areaScrollPane = new javax.swing.JScrollPane JavaDoc(description);
66         areaScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
67         areaScrollPane.setPreferredSize(new java.awt.Dimension JavaDoc(300,300));
68         pan.add(areaScrollPane);
69         int result =
70             javax.swing
71             .JOptionPane
72             .showOptionDialog(
73                               (Component JavaDoc)((ActionEvent JavaDoc)e.getEvent()).getSource(),
74                               pan,
75                               "Install a descriptor",
76                               JOptionPane.OK_CANCEL_OPTION,
77                               JOptionPane.PLAIN_MESSAGE,
78                               null,
79                               null,
80                               null);
81         //if(result==1)
82
dciDeployment.install_with_descriptor(description.getText());
83         
84     }
85
86 }
87
Popular Tags