Source Code Cross Referenced for InspectorUI.java in  » IDE-Netbeans » vmd.analyzer » org » netbeans » modules » vmd » inspector » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Netbeans » vmd.analyzer » org.netbeans.modules.vmd.inspector 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *                 Sun Public License Notice
003:         *
004:         * The contents of this file are subject to the Sun Public License
005:         * Version 1.0 (the "License"). You may not use this file except in
006:         * compliance with the License. A copy of the License is available at
007:         * http://www.sun.com/
008:         *
009:         * The Original Code is NetBeans. The Initial Developer of the Original
010:         * Code is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
011:         * Microsystems, Inc. All Rights Reserved.
012:
013:        If you wish your version of this file to be governed by only the CDDL
014:        or only the GPL Version 2, indicate your decision by adding
015:        "[Contributor] elects to include this software in this distribution
016:        under the [CDDL or GPL Version 2] license." If you do not indicate a
017:        single choice of license, a recipient has the option to distribute
018:        your version of this file under either the CDDL, the GPL Version 2 or
019:        to extend the choice of license to its licensees as provided above.
020:        However, if you add GPL Version 2 code and therefore, elected the GPL
021:        Version 2 license, then the option applies only if the new code is
022:        made subject to such option by the copyright holder.
023:
024:        If you wish your version of this file to be governed by only the CDDL
025:        or only the GPL Version 2, indicate your decision by adding
026:        "[Contributor] elects to include this software in this distribution
027:        under the [CDDL or GPL Version 2] license." If you do not indicate a
028:        single choice of license, a recipient has the option to distribute
029:        your version of this file under either the CDDL, the GPL Version 2 or
030:        to extend the choice of license to its licensees as provided above.
031:        However, if you add GPL Version 2 code and therefore, elected the GPL
032:        Version 2 license, then the option applies only if the new code is
033:        made subject to such option by the copyright holder.
034:         */
035:
036:        package org.netbeans.modules.vmd.inspector;
037:
038:        import java.awt.BorderLayout;
039:        import java.awt.Color;
040:        import java.beans.PropertyChangeEvent;
041:        import java.beans.PropertyChangeListener;
042:        import java.lang.ref.WeakReference;
043:        import java.util.Collection;
044:        import javax.swing.Action;
045:        import javax.swing.JMenu;
046:        import javax.swing.JMenuItem;
047:        import org.netbeans.modules.vmd.api.model.DesignComponent;
048:        import org.netbeans.modules.vmd.api.model.DesignDocument;
049:        import org.openide.util.actions.Presenter;
050:        import org.openide.explorer.ExplorerManager;
051:        import org.openide.explorer.ExplorerUtils;
052:        import org.openide.explorer.view.BeanTreeView;
053:        import org.openide.nodes.Node;
054:        import org.openide.util.WeakSet;
055:        import org.openide.windows.TopComponent;
056:
057:        /**
058:         *
059:         * @author Karol Harezlak
060:         */
061:
062:        final class InspectorUI extends TopComponent implements 
063:                ExplorerManager.Provider, PropertyChangeListener,
064:                Presenter.Popup {
065:
066:            static final String INSPECTOR_UI_ID = "InspectorUI"; //NOI18N
067:            private transient ExplorerManager explorerManager;
068:            private volatile transient boolean lockSelectionSetting;
069:            private transient BeanTreeView inspectorBeanTreeView;
070:            private transient WeakReference<DesignDocument> document;
071:
072:            InspectorUI(DesignDocument document) {
073:                lockSelectionSetting = false;
074:                explorerManager = new ExplorerManager();
075:                explorerManager.addPropertyChangeListener(this );
076:                initComponents();
077:                lockSelectionSetting = false;
078:                associateLookup(ExplorerUtils.createLookup(explorerManager,
079:                        getActionMap()));
080:                this .document = new WeakReference<DesignDocument>(document);
081:            }
082:
083:            private void initComponents() {
084:                inspectorBeanTreeView = new InspectorBeanTreeView(
085:                        explorerManager);
086:                inspectorBeanTreeView.setRootVisible(false);
087:                setLayout(new BorderLayout());
088:                add(inspectorBeanTreeView, BorderLayout.CENTER);
089:                setBackground(Color.WHITE);
090:            }
091:
092:            public ExplorerManager getExplorerManager() {
093:                return explorerManager;
094:            }
095:
096:            public synchronized void propertyChange(PropertyChangeEvent evt) {
097:                if (!ExplorerManager.PROP_SELECTED_NODES.equals(evt
098:                        .getPropertyName())) {
099:                    return;
100:                }
101:                if (explorerManager.getSelectedNodes().length < 1) {
102:                    return;
103:                }
104:                if (document == null || document.get() == null) {
105:                    return;
106:                }
107:                final DesignDocument d = document.get();
108:                if (d.getTransactionManager().isAccess())
109:                    return;
110:                d.getTransactionManager().writeAccess(new Runnable() {
111:
112:                    public void run() {
113:                        if (lockSelectionSetting) {
114:                            return;
115:                        }
116:                        try {
117:                            lockSelectionSetting = true;
118:                            Node[] selectedNodes = explorerManager
119:                                    .getSelectedNodes();
120:                            WeakSet<DesignComponent> selectedComponents = new WeakSet<DesignComponent>();
121:                            for (Node node : selectedNodes) {
122:                                if (node instanceof  InspectorFolderNode) {
123:                                    Long componentID = ((InspectorFolderNode) node)
124:                                            .getComponentID();
125:                                    DesignComponent component = componentID == null ? null
126:                                            : d.getComponentByUID(componentID);
127:                                    if (component != null) {
128:                                        selectedComponents.add(component);
129:                                    }
130:                                }
131:                            }
132:                            d.setSelectedComponents(
133:                                    InspectorUI.INSPECTOR_UI_ID,
134:                                    selectedComponents);
135:                        } finally {
136:                            lockSelectionSetting = false;
137:                        }
138:                    }
139:                });
140:            }
141:
142:            void expandNodes(
143:                    final Collection<InspectorFolderWrapper> foldersToUpdate) {
144:                if (foldersToUpdate == null) {
145:                    return;
146:                }
147:                for (InspectorFolderWrapper wrapper : foldersToUpdate) {
148:                    InspectorFolderNode node = wrapper.getNode();
149:                    if (node != null) {
150:                        inspectorBeanTreeView.expandNode(node);
151:                    }
152:                }
153:            }
154:
155:            synchronized void setRootNode(final Node rootNode) {
156:                getExplorerManager().setRootContext(rootNode);
157:                revalidate();
158:                repaint();
159:            }
160:
161:            public void activeComponentsChanged(
162:                    Collection<DesignComponent> activeComponents) {
163:            }
164:
165:            @Override
166:            public Action[] getActions() {
167:                return new Action[0];
168:            }
169:
170:            public JMenuItem getPopupPresenter() {
171:                return new JMenu("menu"); //NOI18N
172:            }
173:
174:            @Override
175:            public int getPersistenceType() {
176:                return TopComponent.PERSISTENCE_NEVER;
177:            }
178:
179:            @Override
180:            protected void componentActivated() {
181:                super .componentActivated();
182:                ExplorerUtils.activateActions(explorerManager, true);
183:            }
184:
185:            @Override
186:            protected void componentDeactivated() {
187:                super .componentDeactivated();
188:                ExplorerUtils.activateActions(explorerManager, false);
189:            }
190:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.