Source Code Cross Referenced for NameIconLocationPanel.java in  » IDE-Netbeans » api » org » netbeans » modules » apisupport » project » ui » wizard » action » 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 » api » org.netbeans.modules.apisupport.project.ui.wizard.action 
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 1997-2007 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:
042:        package org.netbeans.modules.apisupport.project.ui.wizard.action;
043:
044:        import java.awt.Component;
045:        import java.io.File;
046:        import java.util.HashSet;
047:        import java.util.Iterator;
048:        import java.util.Set;
049:        import javax.swing.JFileChooser;
050:        import javax.swing.JTextField;
051:        import javax.swing.event.DocumentEvent;
052:        import javax.swing.event.DocumentListener;
053:        import javax.swing.text.JTextComponent;
054:        import org.netbeans.api.project.ProjectUtils;
055:        import org.netbeans.modules.apisupport.project.CreatedModifiedFiles;
056:        import org.netbeans.modules.apisupport.project.ui.UIUtil;
057:        import org.netbeans.modules.apisupport.project.ui.wizard.BasicWizardIterator;
058:        import org.openide.WizardDescriptor;
059:        import org.openide.util.HelpCtx;
060:        import org.openide.util.NbBundle;
061:        import org.openide.util.Utilities;
062:
063:        /**
064:         * The thrid panel in the <em>New Action Wizard</em>.
065:         *
066:         * @author Martin Krauskopf
067:         */
068:        final class NameIconLocationPanel extends BasicWizardIterator.Panel {
069:
070:            private static final String ENTER_LABEL = getMessage("CTL_EnterLabel");
071:            private static final String NONE_LABEL = getMessage("CTL_None");
072:
073:            private final DataModel data;
074:            private final DocumentListener updateListener;
075:
076:            private String smallIconPath;
077:            private String largeIconPath;
078:
079:            /** Creates new NameIconLocationPanel */
080:            public NameIconLocationPanel(final WizardDescriptor setting,
081:                    final DataModel data) {
082:                super (setting);
083:                this .data = data;
084:                initComponents();
085:                initAccessibility();
086:                if (data.getPackageName() != null) {
087:                    packageName.setSelectedItem(data.getPackageName());
088:                }
089:                putClientProperty("NewFileWizard_Title",
090:                        getMessage("LBL_ActionWizardTitle"));
091:                className.select(0, className.getText().length());
092:                updateListener = new UIUtil.DocumentAdapter() {
093:                    public void insertUpdate(DocumentEvent e) {
094:                        updateData();
095:                    }
096:                };
097:            }
098:
099:            private void addListeners() {
100:                className.getDocument().addDocumentListener(updateListener);
101:                displayName.getDocument().addDocumentListener(updateListener);
102:                Component editorComp = packageName.getEditor()
103:                        .getEditorComponent();
104:                if (editorComp instanceof  JTextComponent) {
105:                    ((JTextComponent) editorComp).getDocument()
106:                            .addDocumentListener(updateListener);
107:                }
108:            }
109:
110:            private void removeListeners() {
111:                className.getDocument().removeDocumentListener(updateListener);
112:                displayName.getDocument()
113:                        .removeDocumentListener(updateListener);
114:                Component editorComp = packageName.getEditor()
115:                        .getEditorComponent();
116:                if (editorComp instanceof  JTextComponent) {
117:                    ((JTextComponent) editorComp).getDocument()
118:                            .removeDocumentListener(updateListener);
119:                }
120:            }
121:
122:            protected String getPanelName() {
123:                return getMessage("LBL_NameIconLocation_Title");
124:            }
125:
126:            protected void storeToDataModel() {
127:                removeListeners();
128:                storeBaseData();
129:            }
130:
131:            protected void readFromDataModel() {
132:                updateData();
133:                addListeners();
134:            }
135:
136:            private void updateData() {
137:                storeBaseData();
138:                if (checkValidity()) {
139:                    CreatedModifiedFiles files = data.getCreatedModifiedFiles();
140:                    createdFiles.setText(UIUtil.generateTextAreaContent(files
141:                            .getCreatedPaths()));
142:                    modifiedFiles.setText(UIUtil.generateTextAreaContent(files
143:                            .getModifiedPaths()));
144:                }
145:            }
146:
147:            /** Data needed to compute CMF. ClassName, packageName, icon. */
148:            private void storeBaseData() {
149:                data.setClassName(getClassName());
150:                data.setPackageName(packageName.getEditor().getItem()
151:                        .toString());
152:                data.setIconPath(smallIconPath);
153:                data.setLargeIconPath(largeIconPath);
154:                data.setDisplayName(displayName.getText());
155:            }
156:
157:            private String getIconPath() {
158:                return icon.getText().equals(NONE_LABEL) ? null : icon
159:                        .getText();
160:            }
161:
162:            private boolean checkValidity() {
163:                String pName = packageName.getEditor().getItem() == null ? ""
164:                        : packageName.getEditor().getItem().toString().trim();
165:                if (!Utilities.isJavaIdentifier(getClassName())) {
166:                    setError(getMessage("MSG_ClassNameMustBeValidJavaIdentifier"));
167:                } else if (getDisplayName().equals("")
168:                        || getDisplayName().equals(ENTER_LABEL)) {
169:                    setError(getMessage("MSG_DisplayNameMustBeEntered"));
170:                } else if (pName.length() == 0
171:                        || !UIUtil.isValidPackageName(pName)) {
172:                    setError(getMessage("ERR_Package_Invalid"));
173:                } else if (classAlreadyExists()) {
174:                    setError(getMessage("MSG_ClassAlreadyExists"));
175:                } else if (data.isToolbarEnabled() && getIconPath() == null) {
176:                    setError(getMessage("MSG_IconRequiredForToolbar"));
177:                } else {
178:                    markValid();
179:                    checkIconValidity();
180:                    return true;
181:                }
182:                return false;
183:            }
184:
185:            private void checkIconValidity() {
186:                if (smallIconPath == null) {
187:                    setWarning(UIUtil.getNoIconSelectedWarning(16, 16));
188:                } else if (!UIUtil.isValidIcon(new File(smallIconPath), 16, 16)) {
189:                    setWarning(UIUtil.getIconDimensionWarning(new File(
190:                            smallIconPath), 16, 16));
191:                } else if (data.isToolbarEnabled() && largeIconPath == null) {
192:                    File smallIconFile = new File(smallIconPath);
193:                    assert smallIconFile.getParentFile() != null;
194:                    String name = getName(smallIconFile);
195:                    String ext = getExt(smallIconFile);
196:                    StringBuffer sb = new StringBuffer();
197:                    sb.append(name).append("24"); // NOI18N
198:                    if (ext != null) {
199:                        sb.append('.').append(ext);
200:                    }
201:                    setWarning(NbBundle.getMessage(NameIconLocationPanel.class,
202:                            "MSG_NoLargeIconSelected", sb.toString(),
203:                            smallIconFile.getParent())); // NOI18N
204:                }
205:            }
206:
207:            private static String getName(final File smallIconFile) {
208:                String name = smallIconFile.getName();
209:                int i = name.lastIndexOf('.');
210:                return (i <= 0) ? name : name.substring(0, i);
211:            }
212:
213:            private static String getExt(final File smallIconFile) {
214:                String name = smallIconFile.getName();
215:                int i = name.lastIndexOf('.') + 1;
216:                return ((i <= 1) || (i == name.length())) ? "" : name
217:                        .substring(i);
218:            }
219:
220:            private static Set<File> getPossibleIcons(final String iconPath) {
221:                File icon = new File(iconPath);
222:                String[] resultSuffixes = { "16", "24", "" }; // NOI18N
223:                Set<File> results = new HashSet<File>();
224:                String iconName = icon.getName();
225:                int idx = iconName.lastIndexOf('.');
226:                String name = (idx != -1) ? iconName.substring(0, idx)
227:                        : iconName;
228:                String extension = (idx != -1) ? iconName.substring(idx + 1)
229:                        : null;
230:                boolean hasSuffix = (name.endsWith("24"))
231:                        || (name.endsWith("16"));//NOI18N
232:                name = hasSuffix ? name.substring(0, name.length() - 2) : name;
233:                for (int i = 0; i < resultSuffixes.length; i++) {
234:                    String resultSuffix = resultSuffixes[i];
235:                    String resultName = name + resultSuffix;
236:                    if (extension != null) {
237:                        resultName = resultName + '.' + extension;
238:                    }
239:                    File f = new File(icon.getParentFile(), resultName);
240:                    if (f.exists()) {
241:                        results.add(f);
242:                    }
243:                }
244:                return results;
245:            }
246:
247:            private boolean classAlreadyExists() {
248:                return data.classExists();
249:            }
250:
251:            private String getDisplayName() {
252:                return displayName.getText().trim();
253:            }
254:
255:            private String getClassName() {
256:                return className.getText().trim();
257:            }
258:
259:            protected HelpCtx getHelp() {
260:                return new HelpCtx(NameIconLocationPanel.class);
261:            }
262:
263:            private static String getMessage(String key) {
264:                return NbBundle.getMessage(NameIconLocationPanel.class, key);
265:            }
266:
267:            /** This method is called from within the constructor to
268:             * initialize the form.
269:             * WARNING: Do NOT modify this code. The content of this method is
270:             * always regenerated by the Form Editor.
271:             */
272:            // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
273:            private void initComponents() {
274:                java.awt.GridBagConstraints gridBagConstraints;
275:
276:                classNameTxt = new javax.swing.JLabel();
277:                className = new javax.swing.JTextField();
278:                displayNameTxt = new javax.swing.JLabel();
279:                displayName = new javax.swing.JTextField();
280:                iconTxt = new javax.swing.JLabel();
281:                icon = new javax.swing.JTextField();
282:                iconButton = new javax.swing.JButton();
283:                projectTxt = new javax.swing.JLabel();
284:                project = new JTextField(ProjectUtils.getInformation(
285:                        data.getProject()).getDisplayName());
286:                packageNameTxt = new javax.swing.JLabel();
287:                packageName = UIUtil.createPackageComboBox(data
288:                        .getSourceRootGroup());
289:                createdFilesTxt = new javax.swing.JLabel();
290:                createdFiles = new javax.swing.JTextArea();
291:                modifiedFilesTxt = new javax.swing.JLabel();
292:                modifiedFiles = new javax.swing.JTextArea();
293:
294:                setLayout(new java.awt.GridBagLayout());
295:
296:                classNameTxt.setLabelFor(className);
297:                org.openide.awt.Mnemonics.setLocalizedText(classNameTxt,
298:                        org.openide.util.NbBundle.getMessage(
299:                                NameIconLocationPanel.class, "LBL_ClassName"));
300:                gridBagConstraints = new java.awt.GridBagConstraints();
301:                gridBagConstraints.gridx = 0;
302:                gridBagConstraints.gridy = 0;
303:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
304:                gridBagConstraints.insets = new java.awt.Insets(0, 0, 6, 12);
305:                add(classNameTxt, gridBagConstraints);
306:
307:                className.setText(org.openide.util.NbBundle.getMessage(
308:                        NameIconLocationPanel.class, "CTL_SampleClassName"));
309:                gridBagConstraints = new java.awt.GridBagConstraints();
310:                gridBagConstraints.gridx = 1;
311:                gridBagConstraints.gridy = 0;
312:                gridBagConstraints.gridwidth = 2;
313:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
314:                gridBagConstraints.weightx = 1.0;
315:                gridBagConstraints.insets = new java.awt.Insets(0, 0, 6, 0);
316:                add(className, gridBagConstraints);
317:
318:                displayNameTxt.setLabelFor(displayName);
319:                org.openide.awt.Mnemonics
320:                        .setLocalizedText(displayNameTxt,
321:                                org.openide.util.NbBundle.getMessage(
322:                                        NameIconLocationPanel.class,
323:                                        "LBL_DisplayName"));
324:                gridBagConstraints = new java.awt.GridBagConstraints();
325:                gridBagConstraints.gridx = 0;
326:                gridBagConstraints.gridy = 1;
327:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
328:                gridBagConstraints.insets = new java.awt.Insets(0, 0, 6, 12);
329:                add(displayNameTxt, gridBagConstraints);
330:
331:                displayName.setText(org.openide.util.NbBundle.getMessage(
332:                        NameIconLocationPanel.class, "CTL_EnterLabel"));
333:                gridBagConstraints = new java.awt.GridBagConstraints();
334:                gridBagConstraints.gridx = 1;
335:                gridBagConstraints.gridy = 1;
336:                gridBagConstraints.gridwidth = 2;
337:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
338:                gridBagConstraints.weightx = 1.0;
339:                gridBagConstraints.insets = new java.awt.Insets(0, 0, 6, 0);
340:                add(displayName, gridBagConstraints);
341:
342:                iconTxt.setLabelFor(icon);
343:                org.openide.awt.Mnemonics.setLocalizedText(iconTxt,
344:                        org.openide.util.NbBundle.getMessage(
345:                                NameIconLocationPanel.class, "LBL_Icon"));
346:                gridBagConstraints = new java.awt.GridBagConstraints();
347:                gridBagConstraints.gridx = 0;
348:                gridBagConstraints.gridy = 2;
349:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
350:                gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 12);
351:                add(iconTxt, gridBagConstraints);
352:
353:                icon.setEditable(false);
354:                icon.setText(org.openide.util.NbBundle.getMessage(
355:                        NameIconLocationPanel.class, "CTL_None"));
356:                gridBagConstraints = new java.awt.GridBagConstraints();
357:                gridBagConstraints.gridx = 1;
358:                gridBagConstraints.gridy = 2;
359:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
360:                gridBagConstraints.weightx = 1.0;
361:                gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 0);
362:                add(icon, gridBagConstraints);
363:
364:                org.openide.awt.Mnemonics
365:                        .setLocalizedText(iconButton, org.openide.util.NbBundle
366:                                .getMessage(NameIconLocationPanel.class,
367:                                        "LBL_Icon_Browse"));
368:                iconButton
369:                        .addActionListener(new java.awt.event.ActionListener() {
370:                            public void actionPerformed(
371:                                    java.awt.event.ActionEvent evt) {
372:                                iconButtonActionPerformed(evt);
373:                            }
374:                        });
375:
376:                gridBagConstraints = new java.awt.GridBagConstraints();
377:                gridBagConstraints.gridx = 2;
378:                gridBagConstraints.gridy = 2;
379:                gridBagConstraints.insets = new java.awt.Insets(12, 12, 0, 0);
380:                add(iconButton, gridBagConstraints);
381:
382:                projectTxt.setLabelFor(project);
383:                org.openide.awt.Mnemonics
384:                        .setLocalizedText(projectTxt, org.openide.util.NbBundle
385:                                .getMessage(NameIconLocationPanel.class,
386:                                        "LBL_ProjectName"));
387:                gridBagConstraints = new java.awt.GridBagConstraints();
388:                gridBagConstraints.gridx = 0;
389:                gridBagConstraints.gridy = 3;
390:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
391:                gridBagConstraints.insets = new java.awt.Insets(18, 0, 6, 12);
392:                add(projectTxt, gridBagConstraints);
393:
394:                project.setEditable(false);
395:                gridBagConstraints = new java.awt.GridBagConstraints();
396:                gridBagConstraints.gridx = 1;
397:                gridBagConstraints.gridy = 3;
398:                gridBagConstraints.gridwidth = 2;
399:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
400:                gridBagConstraints.weightx = 1.0;
401:                gridBagConstraints.insets = new java.awt.Insets(18, 0, 6, 0);
402:                add(project, gridBagConstraints);
403:
404:                packageNameTxt.setLabelFor(packageName);
405:                org.openide.awt.Mnemonics
406:                        .setLocalizedText(packageNameTxt,
407:                                org.openide.util.NbBundle.getMessage(
408:                                        NameIconLocationPanel.class,
409:                                        "LBL_PackageName"));
410:                gridBagConstraints = new java.awt.GridBagConstraints();
411:                gridBagConstraints.gridx = 0;
412:                gridBagConstraints.gridy = 4;
413:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
414:                gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 12);
415:                add(packageNameTxt, gridBagConstraints);
416:
417:                packageName.setEditable(true);
418:                gridBagConstraints = new java.awt.GridBagConstraints();
419:                gridBagConstraints.gridx = 1;
420:                gridBagConstraints.gridy = 4;
421:                gridBagConstraints.gridwidth = 2;
422:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
423:                gridBagConstraints.weightx = 1.0;
424:                add(packageName, gridBagConstraints);
425:
426:                createdFilesTxt.setLabelFor(createdFiles);
427:                org.openide.awt.Mnemonics.setLocalizedText(createdFilesTxt,
428:                        org.openide.util.NbBundle
429:                                .getMessage(NameIconLocationPanel.class,
430:                                        "LBL_CreatedFiles"));
431:                gridBagConstraints = new java.awt.GridBagConstraints();
432:                gridBagConstraints.gridx = 0;
433:                gridBagConstraints.gridy = 5;
434:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
435:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
436:                gridBagConstraints.weighty = 0.5;
437:                gridBagConstraints.insets = new java.awt.Insets(36, 0, 6, 12);
438:                add(createdFilesTxt, gridBagConstraints);
439:
440:                createdFiles.setBackground(javax.swing.UIManager.getDefaults()
441:                        .getColor("Label.background"));
442:                createdFiles.setColumns(20);
443:                createdFiles.setEditable(false);
444:                createdFiles.setRows(5);
445:                createdFiles.setBorder(null);
446:                gridBagConstraints = new java.awt.GridBagConstraints();
447:                gridBagConstraints.gridx = 1;
448:                gridBagConstraints.gridy = 5;
449:                gridBagConstraints.gridwidth = 2;
450:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
451:                gridBagConstraints.weightx = 1.0;
452:                gridBagConstraints.weighty = 0.5;
453:                gridBagConstraints.insets = new java.awt.Insets(36, 0, 6, 0);
454:                add(createdFiles, gridBagConstraints);
455:
456:                modifiedFilesTxt.setLabelFor(modifiedFiles);
457:                org.openide.awt.Mnemonics.setLocalizedText(modifiedFilesTxt,
458:                        org.openide.util.NbBundle.getMessage(
459:                                NameIconLocationPanel.class,
460:                                "LBL_ModifiedFiles"));
461:                gridBagConstraints = new java.awt.GridBagConstraints();
462:                gridBagConstraints.gridx = 0;
463:                gridBagConstraints.gridy = 6;
464:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
465:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
466:                gridBagConstraints.weighty = 0.5;
467:                gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 12);
468:                add(modifiedFilesTxt, gridBagConstraints);
469:
470:                modifiedFiles.setBackground(javax.swing.UIManager.getDefaults()
471:                        .getColor("Label.background"));
472:                modifiedFiles.setColumns(20);
473:                modifiedFiles.setEditable(false);
474:                modifiedFiles.setRows(5);
475:                modifiedFiles.setToolTipText("modifiedFilesValue");
476:                modifiedFiles.setBorder(null);
477:                gridBagConstraints = new java.awt.GridBagConstraints();
478:                gridBagConstraints.gridx = 1;
479:                gridBagConstraints.gridy = 6;
480:                gridBagConstraints.gridwidth = 2;
481:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
482:                gridBagConstraints.weightx = 1.0;
483:                gridBagConstraints.weighty = 0.5;
484:                add(modifiedFiles, gridBagConstraints);
485:
486:            }
487:
488:            // </editor-fold>//GEN-END:initComponents
489:
490:            private void iconButtonActionPerformed(
491:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_iconButtonActionPerformed
492:                JFileChooser chooser = UIUtil
493:                        .getIconFileChooser(icon.getText());
494:                int ret = chooser.showDialog(this , getMessage("LBL_Select"));
495:                if (ret == JFileChooser.APPROVE_OPTION) {
496:                    File iconFile = chooser.getSelectedFile();
497:                    icon.setText(iconFile.getAbsolutePath());
498:                    {
499:                        Set<File> allFiles = getPossibleIcons(getIconPath());
500:                        assert allFiles.contains(iconFile);
501:                        allFiles.remove(iconFile);
502:                        boolean isIconSmall = UIUtil.isValidIcon(iconFile, 16,
503:                                16);
504:
505:                        File secondIcon = null;
506:                        boolean isSecondIconSmall = false;
507:                        for (Iterator<File> it = allFiles.iterator(); it
508:                                .hasNext()
509:                                && !isSecondIconSmall;) {
510:                            File f = it.next();
511:                            isSecondIconSmall = (isIconSmall) ? UIUtil
512:                                    .isValidIcon(f, 24, 24) : UIUtil
513:                                    .isValidIcon(f, 16, 16);
514:                            if (isSecondIconSmall) {
515:                                secondIcon = f;
516:                                break;
517:                            }
518:                        }
519:
520:                        if (secondIcon != null) {
521:                            smallIconPath = (isIconSmall) ? iconFile
522:                                    .getAbsolutePath() : secondIcon
523:                                    .getAbsolutePath();
524:                            largeIconPath = (isIconSmall) ? secondIcon
525:                                    .getAbsolutePath() : iconFile
526:                                    .getAbsolutePath();
527:                        } else {
528:                            smallIconPath = iconFile.getAbsolutePath();
529:                            largeIconPath = null;
530:                        }
531:
532:                    }
533:                    updateData();
534:                }
535:            }//GEN-LAST:event_iconButtonActionPerformed
536:
537:            // Variables declaration - do not modify//GEN-BEGIN:variables
538:            private javax.swing.JTextField className;
539:            private javax.swing.JLabel classNameTxt;
540:            private javax.swing.JTextArea createdFiles;
541:            private javax.swing.JLabel createdFilesTxt;
542:            private javax.swing.JTextField displayName;
543:            private javax.swing.JLabel displayNameTxt;
544:            private javax.swing.JTextField icon;
545:            private javax.swing.JButton iconButton;
546:            private javax.swing.JLabel iconTxt;
547:            private javax.swing.JTextArea modifiedFiles;
548:            private javax.swing.JLabel modifiedFilesTxt;
549:            private javax.swing.JComboBox packageName;
550:            private javax.swing.JLabel packageNameTxt;
551:            private javax.swing.JTextField project;
552:            private javax.swing.JLabel projectTxt;
553:
554:            // End of variables declaration//GEN-END:variables
555:
556:            private void initAccessibility() {
557:                this .getAccessibleContext().setAccessibleDescription(
558:                        getMessage("ACS_NameAndLocationPanel"));
559:                className.getAccessibleContext().setAccessibleDescription(
560:                        getMessage("ACS_CTL_ClassName"));
561:                createdFiles.getAccessibleContext().setAccessibleDescription(
562:                        getMessage("ACS_CTL_CreatedFiles"));
563:                displayName.getAccessibleContext().setAccessibleDescription(
564:                        getMessage("ACS_CTL_DisplayName"));
565:                icon.getAccessibleContext().setAccessibleDescription(
566:                        getMessage("ACS_CTL_Icon"));
567:                iconButton.getAccessibleContext().setAccessibleDescription(
568:                        getMessage("ACS_CTL_IconButton"));
569:                modifiedFiles.getAccessibleContext().setAccessibleDescription(
570:                        getMessage("ACS_CTL_ModifiedFiles"));
571:                packageName.getAccessibleContext().setAccessibleDescription(
572:                        getMessage("ACS_CTL_PackageName"));
573:                project.getAccessibleContext().setAccessibleDescription(
574:                        getMessage("ACS_CTL_Project"));
575:            }
576:
577:        }
w___w_w__.__j__a__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.