Source Code Cross Referenced for IcanproCustomizer.java in  » IDE-Netbeans » bpel » org » netbeans » modules » bpel » project » ui » customizer » 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 » bpel » org.netbeans.modules.bpel.project.ui.customizer 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * The contents of this file are subject to the terms of the Common Development
003:         * and Distribution License (the License). You may not use this file except in
004:         * compliance with the License.
005:         * 
006:         * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
007:         * or http://www.netbeans.org/cddl.txt.
008:         * 
009:         * When distributing Covered Code, include this CDDL Header Notice in each file
010:         * and include the License file at http://www.netbeans.org/cddl.txt.
011:         * If applicable, add the following below the CDDL Header, with the fields
012:         * enclosed by brackets [] replaced by your own identifying information:
013:         * "Portions Copyrighted [year] [name of copyright owner]"
014:         * 
015:         * The Original Software is NetBeans. The Initial Developer of the Original
016:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
017:         * Microsystems, Inc. All Rights Reserved.
018:         */
019:
020:        package org.netbeans.modules.bpel.project.ui.customizer;
021:
022:        import java.awt.BorderLayout;
023:        import java.awt.Component;
024:        import java.awt.Dimension;
025:        import java.awt.GridBagConstraints;
026:        import java.beans.PropertyChangeEvent;
027:        import java.beans.PropertyChangeListener;
028:        import java.beans.PropertyVetoException;
029:        import java.util.Arrays;
030:        import java.util.Collection;
031:        import java.util.Collections;
032:        import java.util.ResourceBundle;
033:
034:        import javax.swing.JLabel;
035:        import javax.swing.JPanel;
036:        import javax.swing.tree.TreeSelectionModel;
037:
038:        import org.openide.explorer.ExplorerManager;
039:        import org.openide.explorer.view.BeanTreeView;
040:        import org.openide.nodes.AbstractNode;
041:        import org.openide.nodes.Children;
042:        import org.openide.nodes.Node;
043:        import org.openide.util.NbBundle;
044:
045:        import org.openide.util.HelpCtx;
046:        import org.netbeans.modules.compapp.projects.base.ui.customizer.IcanproProjectProperties;
047:
048:        public class IcanproCustomizer extends javax.swing.JPanel implements 
049:                HelpCtx.Provider {
050:
051:            private Component currentCustomizer;
052:
053:            private GridBagConstraints fillConstraints;
054:
055:            private IcanproProjectProperties webProperties;
056:
057:            /** Creates new form WebCustomizer */
058:            public IcanproCustomizer(IcanproProjectProperties webProperties) {
059:                initComponents();
060:                this .getAccessibleContext().setAccessibleDescription(
061:                        NbBundle.getMessage(IcanproCustomizer.class,
062:                                "ACS_Customize_A11YDesc")); //NOI18N
063:
064:                this .webProperties = webProperties;
065:                //this.wm = wm;
066:
067:                fillConstraints = new GridBagConstraints();
068:                fillConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
069:                fillConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
070:                fillConstraints.fill = java.awt.GridBagConstraints.BOTH;
071:                fillConstraints.weightx = 1.0;
072:                fillConstraints.weighty = 1.0;
073:
074:                categoryPanel.add(new CategoryView(
075:                        createRootNode(webProperties)), fillConstraints);
076:
077:            }
078:
079:            public HelpCtx getHelpCtx() {
080:                return new HelpCtx(IcanproCustomizer.class);
081:            }
082:
083:            /** This method is called from within the constructor to
084:             * initialize the form.
085:             * WARNING: Do NOT modify this code. The content of this method is
086:             * always regenerated by the Form Editor.
087:             */
088:            // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
089:            private void initComponents() {
090:                java.awt.GridBagConstraints gridBagConstraints;
091:
092:                categoryPanel = new javax.swing.JPanel();
093:                customizerPanel = new javax.swing.JPanel();
094:
095:                setLayout(new java.awt.GridBagLayout());
096:
097:                setPreferredSize(new java.awt.Dimension(750, 450));
098:                categoryPanel.setLayout(new java.awt.GridBagLayout());
099:
100:                categoryPanel.setBorder(javax.swing.BorderFactory
101:                        .createEtchedBorder());
102:                categoryPanel.setMinimumSize(new java.awt.Dimension(220, 4));
103:                categoryPanel.setPreferredSize(new java.awt.Dimension(220, 4));
104:                gridBagConstraints = new java.awt.GridBagConstraints();
105:                gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
106:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
107:                gridBagConstraints.weighty = 1.0;
108:                gridBagConstraints.insets = new java.awt.Insets(8, 8, 8, 8);
109:                add(categoryPanel, gridBagConstraints);
110:
111:                customizerPanel.setLayout(new java.awt.GridBagLayout());
112:
113:                gridBagConstraints = new java.awt.GridBagConstraints();
114:                gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
115:                gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
116:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
117:                gridBagConstraints.weightx = 1.0;
118:                gridBagConstraints.weighty = 1.0;
119:                gridBagConstraints.insets = new java.awt.Insets(8, 4, 8, 8);
120:                add(customizerPanel, gridBagConstraints);
121:
122:            }// </editor-fold>//GEN-END:initComponents
123:
124:            // Variables declaration - do not modify//GEN-BEGIN:variables
125:            private javax.swing.JPanel categoryPanel;
126:            private javax.swing.JPanel customizerPanel;
127:
128:            // End of variables declaration//GEN-END:variables
129:
130:            // Private innerclasses ----------------------------------------------------
131:
132:            private class CategoryView extends JPanel implements 
133:                    ExplorerManager.Provider, HelpCtx.Provider {
134:
135:                private ExplorerManager manager;
136:                private BeanTreeView btv;
137:
138:                CategoryView(Node rootNode) {
139:
140:                    // See #36315
141:                    manager = new ExplorerManager();
142:
143:                    setLayout(new BorderLayout());
144:
145:                    Dimension size = new Dimension(220, 4);
146:                    btv = new BeanTreeView(); // Add the BeanTreeView
147:                    btv
148:                            .setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
149:                    btv.setPopupAllowed(false);
150:                    btv.setRootVisible(false);
151:                    btv.setDefaultActionAllowed(false);
152:                    btv.setMinimumSize(size);
153:                    btv.setPreferredSize(size);
154:                    btv.setMaximumSize(size);
155:                    this .add(btv, BorderLayout.CENTER);
156:                    manager.setRootContext(rootNode);
157:                    manager
158:                            .addPropertyChangeListener(new ManagerChangeListener());
159:                    selectFirstNode();
160:                    btv.expandAll();
161:
162:                    btv.getAccessibleContext().setAccessibleName(
163:                            NbBundle.getMessage(IcanproCustomizer.class,
164:                                    "ACS_CustomizeTree_A11YName")); //NOI18N
165:                    btv.getAccessibleContext().setAccessibleDescription(
166:                            NbBundle.getMessage(IcanproCustomizer.class,
167:                                    "ACS_CustomizeTree_A11YDesc")); //NOI18N
168:                }
169:
170:                public HelpCtx getHelpCtx() {
171:                    return new HelpCtx(IcanproCustomizer.class);
172:                }
173:
174:                public ExplorerManager getExplorerManager() {
175:                    return manager;
176:                }
177:
178:                public void addNotify() {
179:                    super .addNotify();
180:                    btv.expandAll();
181:                }
182:
183:                private void selectFirstNode() {
184:
185:                    Children ch = manager.getRootContext().getChildren();
186:                    if (ch != null) {
187:                        Node nodes[] = ch.getNodes();
188:
189:                        if (nodes != null && nodes.length > 0) {
190:                            try {
191:                                manager
192:                                        .setSelectedNodes(new Node[] { nodes[0] });
193:                            } catch (PropertyVetoException e) {
194:                                // No node will be selected
195:                            }
196:                        }
197:                    }
198:
199:                }
200:
201:                /** Listens to selection change and shows the customizers as
202:                 *  panels
203:                 */
204:
205:                private class ManagerChangeListener implements 
206:                        PropertyChangeListener {
207:
208:                    public void propertyChange(PropertyChangeEvent evt) {
209:                        if (evt.getSource() != manager) {
210:                            return;
211:                        }
212:
213:                        if (ExplorerManager.PROP_SELECTED_NODES.equals(evt
214:                                .getPropertyName())) {
215:                            Node nodes[] = manager.getSelectedNodes();
216:                            if (nodes == null || nodes.length <= 0) {
217:                                return;
218:                            }
219:                            Node node = nodes[0];
220:
221:                            if (currentCustomizer != null) {
222:                                customizerPanel.remove(currentCustomizer);
223:                            }
224:                            if (node.hasCustomizer()) {
225:                                currentCustomizer = node.getCustomizer();
226:
227:                                if (currentCustomizer instanceof  Panel) {
228:                                    ((Panel) currentCustomizer).initValues();
229:                                }
230:
231:                                /*
232:                                if ( currentCustomizer instanceof javax.swing.JComponent ) {
233:                                    ((javax.swing.JComponent)currentCustomizer).setPreferredSize( new java.awt.Dimension( 600, 0 ) );
234:                                }
235:                                 */
236:                                customizerPanel.add(currentCustomizer,
237:                                        fillConstraints);
238:                                customizerPanel.validate();
239:                                customizerPanel.repaint();
240:
241:                            } else {
242:                                currentCustomizer = null;
243:                            }
244:
245:                            return;
246:                        }
247:                    }
248:                }
249:            }
250:
251:            // Private methods ---------------------------------------------------------
252:
253:            private static Node createRootNode(
254:                    IcanproProjectProperties webProperties) {
255:                String ICON_FOLDER = "org/netbeans/modules/bpel/project/ui/resources/";
256:                ResourceBundle bundle = NbBundle
257:                        .getBundle(IcanproCustomizer.class);
258:
259:                /* Add Service Reference */
260:                /** Comment out EJB-WS */
261:                /*
262:                ConfigurationDescription serviceRefDescriptions[] = new ConfigurationDescription[] {
263:                    new ConfigurationDescription(
264:                        "ServiceRef",
265:                        // TBD i18N bundle.getString( "LBL_Config_Run" ), 
266:                        "EJB-WS",
267:                        ICON_FOLDER + "defaultCategory", // "run", // NOI18N
268:                        new CustomizerJarContent(webProperties),
269:                        null ),
270:                };
271:                 */
272:                /** End Comment out EJB-WS */
273:
274:                /* starts  ConfigurationDescription buildDescriptions[] = new ConfigurationDescription[] {
275:                       new ConfigurationDescription(
276:                           "Build",
277:                           bundle.getString( "LBL_Config_Build" ), // NOI18N
278:                           ICON_FOLDER + "defaultCategory", // "build", // NOI18N
279:                           new CustomizerCompile(webProperties),
280:                           null ), ends */
281:                /*
282:                new ConfigurationDescription(
283:                    "Jar",
284:                    bundle.getString( "LBL_Config_Jar" ), // NOI18N
285:                    ICON_FOLDER + "defaultCategory", // "jar", // NOI18N
286:                    new CustomizerWar(webProperties),
287:                    null ),
288:                //B            new ConfigurationDescription(
289:                //B                "Javadoc",
290:                //B                bundle.getString( "LBL_Config_Javadoc" ), // NOI18N
291:                //B                ICON_FOLDER + "javadoc", // NOI18N
292:                //B                new CustomizerJavadoc(webProperties),
293:                //B                null ),
294:                 */
295:                //starts & ends};
296:                /*
297:                //=======Start of IcanPro==============================================//
298:                ConfigurationDescription runDescriptions[] = new ConfigurationDescription[] {
299:                    new ConfigurationDescription(
300:                        "Run",
301:                        bundle.getString( "LBL_Config_Run" ), // NOI18N
302:                        ICON_FOLDER + "defaultCategory", // "run", // NOI18N
303:                        new CustomizerRun(webProperties),
304:                        null ),
305:                };
306:                //=======End of IcanPro================================================//
307:                 */
308:                ConfigurationDescription descriptions[] = new ConfigurationDescription[] { new ConfigurationDescription(
309:                        "General", bundle.getString("LBL_Config_General"), // NOI18N
310:                        ICON_FOLDER + "defaultCategory", // "icanproProjectIcon", // NOI18N
311:                        new CustomizerGeneral(webProperties), null),
312:                /** Comment out EJB-WS */
313:                /*        
314:                
315:                new ConfigurationDescription(
316:                    "ServiceRef",
317:                    "Service Reference", //TBD i18N
318:                    ICON_FOLDER + "defaultCategory", // "general", // NOI18N
319:                    createEmptyLabel( null ),
320:                    serviceRefDescriptions)    
321:                 */
322:                /** End Comment out EJB-WS **/
323:
324:                /*                null ),
325:                 new ConfigurationDescription(
326:                 "BuildCategoty",
327:                 "Build",
328:                 ICON_FOLDER + "defaultCategory", // "general", // NOI18N
329:                 createEmptyLabel( null ),*/
330:                //starts & ends  buildDescriptions ),
331:                //                null) // replace for start & ends
332:                /*
333:                //=======Start of IcanPro==========================================//
334:                new ConfigurationDescription(
335:                    "RunCategoty",
336:                    "Run",
337:                    ICON_FOLDER + "run", // NOI18N
338:                    createEmptyLabel( null ),
339:                    runDescriptions )
340:                //=======End of IcanPro============================================//
341:                 */
342:                };
343:
344:                ConfigurationDescription rootDescription = new ConfigurationDescription(
345:                        "InvisibleRoot", "InvisibleRoot", null, null,
346:                        descriptions); // NOI18N
347:
348:                return new ConfigurationNode(rootDescription);
349:
350:            }
351:
352:            // Private meyhods ---------------------------------------------------------
353:
354:            // XXX Remove when all panels have some options
355:
356:            private static javax.swing.JLabel createEmptyLabel(String text) {
357:
358:                JLabel label;
359:                if (text == null) {
360:                    label = new JLabel();
361:                } else {
362:                    label = new JLabel(text);
363:                    label.setHorizontalAlignment(JLabel.CENTER);
364:                }
365:
366:                return label;
367:            }
368:
369:            // Private innerclasses ----------------------------------------------------
370:
371:            /** Class describing the configuration node. Prototype of the
372:             *  configuration node.
373:             */
374:            private static class ConfigurationDescription {
375:
376:                private String name;
377:                private String displayName;
378:                private String iconBase;
379:                private Component customizer;
380:                private ConfigurationDescription[] children;
381:
382:                // XXX Add Node.Properties
383:
384:                ConfigurationDescription(String name, String displayName,
385:                        String iconBase, Component customizer,
386:                        ConfigurationDescription[] children) {
387:
388:                    this .name = name;
389:                    this .displayName = displayName;
390:                    this .iconBase = iconBase;
391:                    this .customizer = customizer;
392:                    this .children = children;
393:                }
394:
395:            }
396:
397:            /** Node to be used for configuration
398:             */
399:            private static class ConfigurationNode extends AbstractNode {
400:
401:                private Component customizer;
402:
403:                public ConfigurationNode(ConfigurationDescription description) {
404:                    super (description.children == null ? Children.LEAF
405:                            : new ConfigurationChildren(description.children));
406:                    setName(description.name);
407:                    setDisplayName(description.displayName);
408:                    if (description.iconBase != null) {
409:                        setIconBase(description.iconBase);
410:                    }
411:                    this .customizer = description.customizer;
412:                }
413:
414:                public boolean hasCustomizer() {
415:                    return true;
416:                }
417:
418:                public Component getCustomizer() {
419:                    return customizer;
420:                }
421:
422:            }
423:
424:            /** Children used for configuration
425:             */
426:            private static class ConfigurationChildren extends Children.Keys {
427:
428:                private Collection descriptions;
429:
430:                public ConfigurationChildren(
431:                        ConfigurationDescription[] descriptions) {
432:                    this .descriptions = Arrays.asList(descriptions);
433:                }
434:
435:                // Children.Keys impl --------------------------------------------------
436:
437:                public void addNotify() {
438:                    setKeys(descriptions);
439:                }
440:
441:                public void removeNotify() {
442:                    setKeys(Collections.EMPTY_LIST);
443:                }
444:
445:                protected Node[] createNodes(Object key) {
446:                    return new Node[] { new ConfigurationNode(
447:                            (ConfigurationDescription) key) };
448:                }
449:            }
450:
451:            static interface Panel {
452:
453:                public void initValues();
454:
455:            }
456:
457:        }
w__w_w._ja_v___a_2_s_.___c__o__m__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.