Source Code Cross Referenced for AddToPaletteVisualPanel2.java in  » IDE-Netbeans » vmd.analyzer » org » netbeans » modules » vmd » midp » palette » wizard » 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.midp.palette.wizard 
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-2006 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:         */package org.netbeans.modules.vmd.midp.palette.wizard;
041:
042:        import org.openide.util.NbBundle;
043:
044:        import javax.swing.*;
045:        import java.util.*;
046:        import java.util.List;
047:        import java.awt.*;
048:
049:        /**
050:         * @author David Kaspar
051:         */
052:        public final class AddToPaletteVisualPanel2 extends JPanel {
053:
054:            private Collection<ComponentInstaller.Item> items;
055:
056:            public AddToPaletteVisualPanel2() {
057:                initComponents();
058:                list.setCellRenderer(new ItemRenderer());
059:            }
060:
061:            public String getName() {
062:                return NbBundle.getMessage(AddToPaletteVisualPanel2.class,
063:                        "TITLE_SelectClasses"); // NOI18N
064:            }
065:
066:            public void setItems(Collection<ComponentInstaller.Item> items) {
067:                this .items = items;
068:                reload();
069:            }
070:
071:            public void reload() {
072:                final ArrayList<ComponentInstaller.Item> lst;
073:                if (cLibraries.isSelected())
074:                    lst = new ArrayList<ComponentInstaller.Item>(items);
075:                else {
076:                    lst = new ArrayList<ComponentInstaller.Item>();
077:                    for (ComponentInstaller.Item item : items)
078:                        if (item.isInSource())
079:                            lst.add(item);
080:                }
081:                Collections.sort(lst,
082:                        new Comparator<ComponentInstaller.Item>() {
083:                            public int compare(ComponentInstaller.Item o1,
084:                                    ComponentInstaller.Item o2) {
085:                                return o1.getFQN().compareTo(o2.getFQN());
086:                            }
087:                        });
088:                list.setModel(new AbstractListModel() {
089:                    public int getSize() {
090:                        return lst.size();
091:                    }
092:
093:                    public Object getElementAt(int i) {
094:                        return lst.get(i);
095:                    }
096:                });
097:                if (lst.size() > 0)
098:                    list.setSelectionInterval(0, lst.size() - 1);
099:            }
100:
101:            public List<ComponentInstaller.Item> getSelectedItems() {
102:                ArrayList<ComponentInstaller.Item> lst = new ArrayList<ComponentInstaller.Item>();
103:                for (Object o : list.getSelectedValues())
104:                    lst.add((ComponentInstaller.Item) o);
105:                return lst;
106:            }
107:
108:            /** This method is called from within the constructor to
109:             * initialize the form.
110:             * WARNING: Do NOT modify this code. The content of this method is
111:             * always regenerated by the Form Editor.
112:             */
113:            // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
114:            private void initComponents() {
115:
116:                jLabel1 = new javax.swing.JLabel();
117:                jScrollPane1 = new javax.swing.JScrollPane();
118:                list = new javax.swing.JList();
119:                bSelectAll = new javax.swing.JButton();
120:                bDeselectAll = new javax.swing.JButton();
121:                cLibraries = new javax.swing.JCheckBox();
122:
123:                org.openide.awt.Mnemonics.setLocalizedText(jLabel1, NbBundle
124:                        .getMessage(AddToPaletteVisualPanel2.class,
125:                                "LBL_FoundClasses")); // NOI18N
126:
127:                jScrollPane1.setViewportView(list);
128:
129:                org.openide.awt.Mnemonics.setLocalizedText(bSelectAll, NbBundle
130:                        .getMessage(AddToPaletteVisualPanel2.class,
131:                                "LBL_SelectAll")); // NOI18N
132:                bSelectAll
133:                        .addActionListener(new java.awt.event.ActionListener() {
134:                            public void actionPerformed(
135:                                    java.awt.event.ActionEvent evt) {
136:                                bSelectAllActionPerformed(evt);
137:                            }
138:                        });
139:
140:                org.openide.awt.Mnemonics.setLocalizedText(bDeselectAll,
141:                        NbBundle.getMessage(AddToPaletteVisualPanel2.class,
142:                                "LBL_DeselectAll")); // NOI18N
143:                bDeselectAll
144:                        .addActionListener(new java.awt.event.ActionListener() {
145:                            public void actionPerformed(
146:                                    java.awt.event.ActionEvent evt) {
147:                                bDeselectAllActionPerformed(evt);
148:                            }
149:                        });
150:
151:                org.openide.awt.Mnemonics.setLocalizedText(cLibraries, NbBundle
152:                        .getMessage(AddToPaletteVisualPanel2.class,
153:                                "LBL_ShowAll")); // NOI18N
154:                cLibraries.setMargin(new java.awt.Insets(0, 0, 0, 0));
155:                cLibraries
156:                        .addActionListener(new java.awt.event.ActionListener() {
157:                            public void actionPerformed(
158:                                    java.awt.event.ActionEvent evt) {
159:                                cLibrariesActionPerformed(evt);
160:                            }
161:                        });
162:
163:                org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(
164:                        this );
165:                this .setLayout(layout);
166:                layout
167:                        .setHorizontalGroup(layout
168:                                .createParallelGroup(
169:                                        org.jdesktop.layout.GroupLayout.LEADING)
170:                                .add(
171:                                        layout
172:                                                .createSequentialGroup()
173:                                                .addContainerGap()
174:                                                .add(
175:                                                        layout
176:                                                                .createParallelGroup(
177:                                                                        org.jdesktop.layout.GroupLayout.LEADING)
178:                                                                .add(
179:                                                                        layout
180:                                                                                .createSequentialGroup()
181:                                                                                .add(
182:                                                                                        jScrollPane1,
183:                                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
184:                                                                                        337,
185:                                                                                        Short.MAX_VALUE)
186:                                                                                .addContainerGap())
187:                                                                .add(
188:                                                                        layout
189:                                                                                .createSequentialGroup()
190:                                                                                .add(
191:                                                                                        jLabel1)
192:                                                                                .addContainerGap(
193:                                                                                        29,
194:                                                                                        Short.MAX_VALUE))
195:                                                                .add(
196:                                                                        org.jdesktop.layout.GroupLayout.TRAILING,
197:                                                                        layout
198:                                                                                .createSequentialGroup()
199:                                                                                .add(
200:                                                                                        bSelectAll)
201:                                                                                .addPreferredGap(
202:                                                                                        org.jdesktop.layout.LayoutStyle.RELATED)
203:                                                                                .add(
204:                                                                                        bDeselectAll)
205:                                                                                .add(
206:                                                                                        10,
207:                                                                                        10,
208:                                                                                        10))
209:                                                                .add(cLibraries))));
210:                layout
211:                        .setVerticalGroup(layout
212:                                .createParallelGroup(
213:                                        org.jdesktop.layout.GroupLayout.LEADING)
214:                                .add(
215:                                        layout
216:                                                .createSequentialGroup()
217:                                                .addContainerGap()
218:                                                .add(jLabel1)
219:                                                .addPreferredGap(
220:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
221:                                                .add(
222:                                                        jScrollPane1,
223:                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
224:                                                        180, Short.MAX_VALUE)
225:                                                .addPreferredGap(
226:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
227:                                                .add(cLibraries)
228:                                                .addPreferredGap(
229:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
230:                                                .add(
231:                                                        layout
232:                                                                .createParallelGroup(
233:                                                                        org.jdesktop.layout.GroupLayout.BASELINE)
234:                                                                .add(
235:                                                                        bDeselectAll)
236:                                                                .add(bSelectAll))
237:                                                .addContainerGap()));
238:
239:                jLabel1.getAccessibleContext().setAccessibleName(
240:                        org.openide.util.NbBundle.getMessage(
241:                                AddToPaletteVisualPanel2.class,
242:                                "ACCESSIBLE_NAME_jLabel1")); // NOI18N
243:                jLabel1.getAccessibleContext().setAccessibleDescription(
244:                        org.openide.util.NbBundle.getMessage(
245:                                AddToPaletteVisualPanel2.class,
246:                                "ACCESSIBLE_DESCRIPTION_jLabel1")); // NOI18N
247:                bSelectAll.getAccessibleContext().setAccessibleName(
248:                        org.openide.util.NbBundle.getMessage(
249:                                AddToPaletteVisualPanel2.class,
250:                                "ACCESSIBLE_NAME_bSelectAll")); // NOI18N
251:                bSelectAll.getAccessibleContext().setAccessibleDescription(
252:                        org.openide.util.NbBundle.getMessage(
253:                                AddToPaletteVisualPanel2.class,
254:                                "ACCESSIBLE_DESCRIPTION_bSelectAll")); // NOI18N
255:                bDeselectAll.getAccessibleContext().setAccessibleName(
256:                        org.openide.util.NbBundle.getMessage(
257:                                AddToPaletteVisualPanel2.class,
258:                                "ACCESSIBLE_NAME_bDesceletAll")); // NOI18N
259:                bDeselectAll.getAccessibleContext().setAccessibleDescription(
260:                        org.openide.util.NbBundle.getMessage(
261:                                AddToPaletteVisualPanel2.class,
262:                                "ACCESSIBLE_DESCRIPTION_bDesceletAll")); // NOI18N
263:                cLibraries.getAccessibleContext().setAccessibleName(
264:                        org.openide.util.NbBundle.getMessage(
265:                                AddToPaletteVisualPanel2.class,
266:                                "ACCESSIBLE_NAME_jCheckBox")); // NOI18N
267:                cLibraries.getAccessibleContext().setAccessibleDescription(
268:                        org.openide.util.NbBundle.getMessage(
269:                                AddToPaletteVisualPanel2.class,
270:                                "ACCESSIBLE_DESCRIPTION_jCheckBox")); // NOI18N
271:            }// </editor-fold>//GEN-END:initComponents
272:
273:            private void cLibrariesActionPerformed(
274:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cLibrariesActionPerformed
275:                reload();
276:            }//GEN-LAST:event_cLibrariesActionPerformed
277:
278:            private void bDeselectAllActionPerformed(
279:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bDeselectAllActionPerformed
280:                list.setSelectedIndices(new int[0]);
281:            }//GEN-LAST:event_bDeselectAllActionPerformed
282:
283:            private void bSelectAllActionPerformed(
284:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bSelectAllActionPerformed
285:                int size = list.getModel().getSize();
286:                if (size > 0)
287:                    list.setSelectionInterval(0, size - 1);
288:            }//GEN-LAST:event_bSelectAllActionPerformed
289:
290:            // Variables declaration - do not modify//GEN-BEGIN:variables
291:            private javax.swing.JButton bDeselectAll;
292:            private javax.swing.JButton bSelectAll;
293:            private javax.swing.JCheckBox cLibraries;
294:            private javax.swing.JLabel jLabel1;
295:            private javax.swing.JScrollPane jScrollPane1;
296:            private javax.swing.JList list;
297:
298:            // End of variables declaration//GEN-END:variables
299:
300:            private static class ItemRenderer extends DefaultListCellRenderer {
301:
302:                public Component getListCellRendererComponent(JList list,
303:                        Object value, int index, boolean isSelected,
304:                        boolean cellHasFocus) {
305:                    return super .getListCellRendererComponent(list,
306:                            ((ComponentInstaller.Item) value).getFQN(), index,
307:                            isSelected, cellHasFocus);
308:                }
309:
310:            }
311:
312:        }
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.