KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > apisupport > project > ui > platform > NbPlatformCustomizerModules


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.apisupport.project.ui.platform;
21
22 import java.awt.EventQueue JavaDoc;
23 import javax.swing.DefaultListModel JavaDoc;
24 import javax.swing.JPanel JavaDoc;
25 import javax.swing.ListModel JavaDoc;
26 import org.netbeans.modules.apisupport.project.universe.ModuleEntry;
27 import org.netbeans.modules.apisupport.project.universe.NbPlatform;
28 import org.openide.util.NbBundle;
29 import org.openide.util.RequestProcessor;
30
31 /**
32  * Represents <em>Modules</em> tab in the NetBeans platforms customizer.
33  *
34  * @author Martin Krauskopf
35  */

36 final class NbPlatformCustomizerModules extends JPanel JavaDoc {
37     
38     /** Creates new form NbPlatformCustomizerModules */
39     NbPlatformCustomizerModules() {
40         initComponents();
41         initAccessibility();
42     }
43     
44     void setPlatform(final NbPlatform plaf) {
45         moduleList.setModel(createWaitModel());
46         RequestProcessor.getDefault().post(new Runnable JavaDoc() {
47             public void run() {
48                 final ModuleEntry[] modules = plaf.getModules();
49                 EventQueue.invokeLater(new Runnable JavaDoc() {
50                     public void run() {
51                         moduleList.setModel(new PlatformComponentFactory.ModuleEntryListModel(modules));
52                     }
53                 });
54             }
55         });
56     }
57     
58     void reset() {
59         moduleList.setModel(new DefaultListModel JavaDoc());
60     }
61     
62     /** This method is called from within the constructor to
63      * initialize the form.
64      * WARNING: Do NOT modify this code. The content of this method is
65      * always regenerated by the Form Editor.
66      */

67     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
68
private void initComponents() {
69         java.awt.GridBagConstraints JavaDoc gridBagConstraints;
70
71         moduleLabel = new javax.swing.JLabel JavaDoc();
72         moduleSP = new javax.swing.JScrollPane JavaDoc();
73         moduleList = new javax.swing.JList JavaDoc();
74
75         setLayout(new java.awt.GridBagLayout JavaDoc());
76
77         setBorder(new javax.swing.border.EmptyBorder JavaDoc(new java.awt.Insets JavaDoc(12, 12, 12, 12)));
78         moduleLabel.setLabelFor(moduleList);
79         org.openide.awt.Mnemonics.setLocalizedText(moduleLabel, org.openide.util.NbBundle.getMessage(NbPlatformCustomizerModules.class, "LBL_PlatformModules"));
80         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
81         gridBagConstraints.gridx = 0;
82         gridBagConstraints.gridy = 0;
83         gridBagConstraints.gridwidth = 2;
84         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
85         add(moduleLabel, gridBagConstraints);
86
87         moduleList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
88         moduleSP.setViewportView(moduleList);
89
90         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
91         gridBagConstraints.gridx = 0;
92         gridBagConstraints.gridy = 1;
93         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
94         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
95         gridBagConstraints.weightx = 1.0;
96         gridBagConstraints.weighty = 1.0;
97         add(moduleSP, gridBagConstraints);
98
99     }
100     // </editor-fold>//GEN-END:initComponents
101

102     // Variables declaration - do not modify//GEN-BEGIN:variables
103
private javax.swing.JLabel JavaDoc moduleLabel;
104     private javax.swing.JList JavaDoc moduleList;
105     private javax.swing.JScrollPane JavaDoc moduleSP;
106     // End of variables declaration//GEN-END:variables
107

108     private void initAccessibility() {
109         moduleList.getAccessibleContext().setAccessibleDescription(getMessage("ACS_CTL_moduleList"));
110     }
111     
112     private String JavaDoc getMessage(String JavaDoc key) {
113         return NbBundle.getMessage(NbPlatformCustomizerJavadoc.class, key);
114     }
115     
116     private ListModel JavaDoc createWaitModel() {
117         DefaultListModel JavaDoc waitModel = new DefaultListModel JavaDoc();
118         waitModel.addElement(NbBundle.getMessage(
119                 NbPlatformCustomizerModules.class, "LBL_PleaseWait")); // NOI18N
120
return waitModel;
121     }
122     
123 }
124
Popular Tags