KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > util > explorer > plugin > java > reflect > ClassVisibilityConfigAction


1 /*====================================================================
2
3 Objectweb Explorer Framework
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): Jerome Moroy, Philippe Merle.
23 Contributor(s): ______________________________________.
24
25 ====================================================================*/

26
27 package org.objectweb.util.explorer.plugin.java.reflect;
28
29 import org.objectweb.util.explorer.api.MenuItem;
30 import org.objectweb.util.explorer.api.MenuItemTreeView;
31 import org.objectweb.util.explorer.api.TreeView;
32 import org.objectweb.util.explorer.swing.gui.api.DialogAction;
33 import org.objectweb.util.explorer.swing.gui.api.DialogBox;
34 import org.objectweb.util.explorer.swing.gui.lib.DefaultDialogBox;
35
36
37 /**
38  * This action allows you to configure the visibility on a class.
39  *
40  * @author <a HREF="mailto:Philippe.Merle@lifl.fr">Philippe Merle</a>,
41  * <a HREF="mailto:Jerome.Moroy@lifl.fr">Jérôme Moroy</a>
42  *
43  * @version 0.1
44  */

45 public class ClassVisibilityConfigAction
46     implements MenuItem, DialogAction
47 {
48
49     //==================================================================
50
//
51
// Internal states.
52
//
53
//==================================================================
54

55     protected Class JavaDoc class_;
56
57     protected ClassVisibilityBox classVisibilityConfig_;
58
59     //==================================================================
60
//
61
// Constructor.
62
//
63
//==================================================================
64

65     //==================================================================
66
//
67
// Internal methods.
68
//
69
//==================================================================
70

71     //==================================================================
72
//
73
// Public methods for MenuItem interface
74
//
75
//==================================================================
76

77     /* (non-Javadoc)
78      * @see org.objectweb.util.explorer.api.MenuItem#getStatus(org.objectweb.util.explorer.api.TreeView)
79      */

80     public int getStatus(TreeView treeView) {
81         return MenuItem.ENABLED_STATUS;
82     }
83
84     /* (non-Javadoc)
85      * @see org.objectweb.util.explorer.api.MenuItem#actionPerformed(org.objectweb.util.explorer.api.MenuItemTreeView)
86      */

87     public void actionPerformed(MenuItemTreeView treeView)
88         throws Exception JavaDoc {
89     
90         class_ = (Class JavaDoc)treeView.getSelectedObject();
91         
92         ClassVisibilityConfig config = (ClassVisibilityConfig)ClassVisibility.config_.get(class_.getName());
93         if(config == null)
94             config = ClassVisibility.createNewDefaultConfig();
95
96         classVisibilityConfig_ = new ClassVisibilityBox(config);
97             
98         DialogBox dialog = new DefaultDialogBox("Class visibility");
99         dialog.addElementBox(classVisibilityConfig_);
100         dialog.setValidateAction(this);
101         dialog.show();
102
103     }
104
105     //==================================================================
106
//
107
// Public method for DialogAction interface.
108
//
109
//==================================================================
110

111     /* (non-Javadoc)
112      * @see org.objectweb.util.explorer.swing.gui.api.DialogAction#executeAction()
113      */

114     public void executeAction() throws Exception JavaDoc {
115         ClassVisibility.config_.put(class_.getName(), classVisibilityConfig_.getConfig());
116     }
117
118 }
Popular Tags