Source Code Cross Referenced for AgentPanel.java in  » IDE-Netbeans » jmx » org » netbeans » modules » jmx » agentwizard » 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 » jmx » org.netbeans.modules.jmx.agentwizard 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003:         *
004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005:         *
006:         * The contents of this file are subject to the terms of either the GNU
007:         * General Public License Version 2 only ("GPL") or the Common
008:         * Development and Distribution License("CDDL") (collectively, the
009:         * "License"). You may not use this file except in compliance with the
010:         * License. You can obtain a copy of the License at
011:         * http://www.netbeans.org/cddl-gplv2.html
012:         * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013:         * specific language governing permissions and limitations under the
014:         * License.  When distributing the software, include this License Header
015:         * Notice in each file and include the License file at
016:         * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
017:         * particular file as subject to the "Classpath" exception as provided
018:         * by Sun in the GPL Version 2 section of the License file that
019:         * accompanied this code. If applicable, add the following below the
020:         * License Header, with the fields enclosed by brackets [] replaced by
021:         * your own identifying information:
022:         * "Portions Copyrighted [year] [name of copyright owner]"
023:         *
024:         * Contributor(s):
025:         *
026:         * The Original Software is NetBeans. The Initial Developer of the Original
027:         * Software is Sun Microsystems, Inc. Portions Copyright 2004-2005 Sun
028:         * Microsystems, Inc. All Rights Reserved.
029:         *
030:         * If you wish your version of this file to be governed by only the CDDL
031:         * or only the GPL Version 2, indicate your decision by adding
032:         * "[Contributor] elects to include this software in this distribution
033:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
034:         * single choice of license, a recipient has the option to distribute
035:         * your version of this file under either the CDDL, the GPL Version 2 or
036:         * to extend the choice of license to its licensees as provided above.
037:         * However, if you add GPL Version 2 code and therefore, elected the GPL
038:         * Version 2 license, then the option applies only if the new code is
039:         * made subject to such option by the copyright holder.
040:         */
041:        package org.netbeans.modules.jmx.agentwizard;
042:
043:        import java.awt.Component;
044:        import java.util.ResourceBundle;
045:        import javax.swing.event.*;
046:
047:        import org.openide.WizardDescriptor;
048:        import org.openide.util.HelpCtx;
049:        import org.openide.util.NbBundle;
050:        import org.openide.awt.Mnemonics;
051:
052:        import org.netbeans.api.project.Project;
053:        import org.netbeans.spi.project.ui.templates.support.Templates;
054:
055:        import org.netbeans.modules.jmx.WizardConstants;
056:        import org.netbeans.modules.jmx.GenericWizardPanel;
057:
058:        import org.netbeans.modules.jmx.runtime.J2SEProjectType;
059:
060:        /**
061:         *
062:         * Class handling the graphical part of the standard Agent wizard panel
063:         *
064:         */
065:        public class AgentPanel extends javax.swing.JPanel {
066:
067:            private AgentWizardPanel wiz;
068:            private ResourceBundle bundle;
069:            private static WizardDescriptor wizDesc;
070:            private boolean agentNameSelected = false;
071:            private boolean updateNameRunning = false;
072:            private boolean mainSelected = false;
073:            private boolean mainClassSelected = false;
074:            private boolean codeExampleSelected = false;
075:
076:            /**
077:             * Create the wizard panel component and set up some basic properties.
078:             * @param wiz <CODE>WizardDescriptor</CODE> a wizard
079:             */
080:            public AgentPanel(AgentWizardPanel wiz) {
081:                this .wiz = wiz;
082:                bundle = NbBundle.getBundle(JMXAgentIterator.class);
083:                initComponents();
084:
085:                Mnemonics.setLocalizedText(mainJCheckBox, bundle
086:                        .getString("LBL_chkMain.text"));//NOI18N
087:                Mnemonics.setLocalizedText(codeExampleJCheckBox, bundle
088:                        .getString("LBL_chkCodeExample.text"));//NOI18N
089:                Mnemonics.setLocalizedText(mainClassJCheckBox, bundle
090:                        .getString("LBL_chkMainClass.text"));//NOI18N
091:
092:                // init flags
093:                codeExampleSelected = codeExampleJCheckBox.isSelected();
094:                mainSelected = mainJCheckBox.isSelected();
095:                mainClassSelected = mainClassJCheckBox.isSelected();
096:
097:                // Provide a name in the title bar.
098:                setName(NbBundle
099:                        .getMessage(AgentPanel.class, "LBL_Agent_Panel")); //NOI18N
100:
101:                // Accessibility
102:                mainJCheckBox.getAccessibleContext().setAccessibleName(
103:                        bundle.getString("ACCESS_CREATE_MAIN_METHOD"));// NOI18N
104:                mainJCheckBox
105:                        .getAccessibleContext()
106:                        .setAccessibleDescription(
107:                                bundle
108:                                        .getString("ACCESS_CREATE_MAIN_METHOD_DESCRIPTION"));// NOI18N
109:
110:                mainClassJCheckBox.getAccessibleContext().setAccessibleName(
111:                        bundle.getString("ACCESS_SET_MAIN_CLASS"));// NOI18N
112:                mainClassJCheckBox
113:                        .getAccessibleContext()
114:                        .setAccessibleDescription(
115:                                bundle
116:                                        .getString("ACCESS_SET_MAIN_CLASS_DESCRIPTION"));// NOI18N
117:
118:                codeExampleJCheckBox.getAccessibleContext().setAccessibleName(
119:                        bundle.getString("ACCESS_GENERATE_SAMPLE"));// NOI18N
120:                codeExampleJCheckBox
121:                        .getAccessibleContext()
122:                        .setAccessibleDescription(
123:                                bundle
124:                                        .getString("ACCESS_GENERATE_SAMPLE_DESCRIPTION"));// NOI18N
125:            }
126:
127:            private static boolean shouldEnableMainProjectClass() {
128:                Project project = Templates.getProject(wizDesc);
129:                return J2SEProjectType.isProjectTypeSupported(project);
130:            }
131:
132:            /** This method is called from within the constructor to
133:             * initialize the form.
134:             * WARNING: Do NOT modify this code. The content of this method is
135:             * always regenerated by the Form Editor.
136:             */
137:            // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
138:            private void initComponents() {
139:                agentOptionsPanel = new javax.swing.JPanel();
140:                mainJCheckBox = new javax.swing.JCheckBox();
141:                mainClassJCheckBox = new javax.swing.JCheckBox();
142:                codeExampleJCheckBox = new javax.swing.JCheckBox();
143:
144:                setLayout(new java.awt.BorderLayout());
145:
146:                agentOptionsPanel.setLayout(new javax.swing.BoxLayout(
147:                        agentOptionsPanel, javax.swing.BoxLayout.Y_AXIS));
148:
149:                mainJCheckBox.setSelected(true);
150:                mainJCheckBox.setName("agentMainMethodCheckBox");
151:                mainJCheckBox
152:                        .addActionListener(new java.awt.event.ActionListener() {
153:                            public void actionPerformed(
154:                                    java.awt.event.ActionEvent evt) {
155:                                mainJCheckBoxActionPerformed(evt);
156:                            }
157:                        });
158:
159:                agentOptionsPanel.add(mainJCheckBox);
160:
161:                mainClassJCheckBox.setSelected(true);
162:                mainClassJCheckBox.setName("mainClass");
163:                agentOptionsPanel.add(mainClassJCheckBox);
164:
165:                codeExampleJCheckBox.setSelected(true);
166:                codeExampleJCheckBox.setName("agentSampleCodeCheckBox");
167:                codeExampleJCheckBox
168:                        .addActionListener(new java.awt.event.ActionListener() {
169:                            public void actionPerformed(
170:                                    java.awt.event.ActionEvent evt) {
171:                                codeExampleJCheckBoxActionPerformed(evt);
172:                            }
173:                        });
174:
175:                agentOptionsPanel.add(codeExampleJCheckBox);
176:
177:                add(agentOptionsPanel, java.awt.BorderLayout.CENTER);
178:
179:            }
180:
181:            // </editor-fold>//GEN-END:initComponents
182:
183:            private void codeExampleJCheckBoxActionPerformed(
184:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_codeExampleJCheckBoxActionPerformed
185:                codeExampleSelected = codeExampleJCheckBox.isSelected();
186:            }//GEN-LAST:event_codeExampleJCheckBoxActionPerformed
187:
188:            private void mainJCheckBoxActionPerformed(
189:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mainJCheckBoxActionPerformed
190:                mainSelected = mainJCheckBox.isSelected();
191:
192:                mainClassJCheckBox.setEnabled(mainSelected
193:                        && shouldEnableMainProjectClass());
194:
195:                if (!mainSelected) {
196:                    mainClassSelected = mainClassJCheckBox.isSelected();
197:                    mainClassJCheckBox.setSelected(false);
198:
199:                } else {
200:                    mainClassJCheckBox.setSelected(mainClassSelected);
201:                }
202:
203:            }//GEN-LAST:event_mainJCheckBoxActionPerformed
204:
205:            // Variables declaration - do not modify//GEN-BEGIN:variables
206:            private javax.swing.JPanel agentOptionsPanel;
207:            private javax.swing.JCheckBox codeExampleJCheckBox;
208:            private javax.swing.JCheckBox mainClassJCheckBox;
209:            private javax.swing.JCheckBox mainJCheckBox;
210:
211:            // End of variables declaration//GEN-END:variables
212:
213:            /**
214:             *
215:             * Class handling the standard Agent wizard panel
216:             *
217:             */
218:            public static class AgentWizardPanel extends GenericWizardPanel {
219:                private AgentPanel panel = null;
220:
221:                /**
222:                 * Returns the agent panel.
223:                 * @return <CODE>Component</CODE> the agent panel
224:                 */
225:                public Component getComponent() {
226:                    return getPanel();
227:                }
228:
229:                private AgentPanel getPanel() {
230:                    if (panel == null) {
231:                        panel = new AgentPanel(this );
232:                    }
233:                    return panel;
234:                }
235:
236:                /**
237:                 * Returns if the main method generation is selected.
238:                 * @return <CODE>boolean</CODE> true if main method generation is selected
239:                 */
240:                public boolean isMainSelected() {
241:                    return getPanel().mainSelected;
242:                }
243:
244:                /**
245:                 * Returns if the set as main class is selected.
246:                 * @return <CODE>boolean</CODE> true if set as main class is selected
247:                 */
248:                public boolean isMainClassSelected() {
249:                    return getPanel().mainClassJCheckBox.isSelected();
250:                }
251:
252:                /**
253:                 * Returns if source code hints is selected.
254:                 * @return <CODE>boolean</CODE> true if source code hints is selected.
255:                 */
256:                public boolean isCodeExampleSelected() {
257:                    return getPanel().codeExampleSelected;
258:                }
259:
260:                /**
261:                 * This method is called when a step is loaded.
262:                 * @param settings <CODE>Object</CODE> an object containing the wizard informations.
263:                 */
264:                public void readSettings(Object settings) {
265:                    wizDesc = (WizardDescriptor) settings;
266:                    if (!shouldEnableMainProjectClass())
267:                        getPanel().mainClassJCheckBox.setEnabled(false);
268:                }
269:
270:                /**
271:                 * This method is called when the user quit a step.
272:                 * @param settings <CODE>Object</CODE> an object containing the wizard informations.
273:                 */
274:                public void storeSettings(Object settings) {
275:                    WizardDescriptor wiz = (WizardDescriptor) settings;
276:
277:                    wiz.putProperty(
278:                            WizardConstants.PROP_AGENT_MAIN_METHOD_SELECTED,
279:                            new Boolean(isMainSelected()));
280:                    wiz.putProperty(
281:                            WizardConstants.PROP_AGENT_MAIN_CLASS_SELECTED,
282:                            new Boolean(isMainClassSelected()));
283:                    wiz.putProperty(
284:                            WizardConstants.PROP_AGENT_SAMPLE_CODE_SELECTED,
285:                            new Boolean(isCodeExampleSelected()));
286:                }
287:
288:                /**
289:                 * Returns the corresponding help context.
290:                 * @return <CODE>HelpCtx</CODE> the corresponding help context.
291:                 */
292:                public HelpCtx getHelp() {
293:                    return new HelpCtx("tutorial"); //NOI18N
294:                }
295:
296:            }
297:
298:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.