1 19 20 package org.netbeans.modules.apisupport.project.ui.platform; 21 22 import java.awt.EventQueue ; 23 import javax.swing.DefaultListModel ; 24 import javax.swing.JPanel ; 25 import javax.swing.ListModel ; 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 36 final class NbPlatformCustomizerModules extends JPanel { 37 38 39 NbPlatformCustomizerModules() { 40 initComponents(); 41 initAccessibility(); 42 } 43 44 void setPlatform(final NbPlatform plaf) { 45 moduleList.setModel(createWaitModel()); 46 RequestProcessor.getDefault().post(new Runnable () { 47 public void run() { 48 final ModuleEntry[] modules = plaf.getModules(); 49 EventQueue.invokeLater(new Runnable () { 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 ()); 60 } 61 62 67 private void initComponents() { 69 java.awt.GridBagConstraints gridBagConstraints; 70 71 moduleLabel = new javax.swing.JLabel (); 72 moduleSP = new javax.swing.JScrollPane (); 73 moduleList = new javax.swing.JList (); 74 75 setLayout(new java.awt.GridBagLayout ()); 76 77 setBorder(new javax.swing.border.EmptyBorder (new java.awt.Insets (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 (); 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 (); 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 102 private javax.swing.JLabel moduleLabel; 104 private javax.swing.JList moduleList; 105 private javax.swing.JScrollPane moduleSP; 106 108 private void initAccessibility() { 109 moduleList.getAccessibleContext().setAccessibleDescription(getMessage("ACS_CTL_moduleList")); 110 } 111 112 private String getMessage(String key) { 113 return NbBundle.getMessage(NbPlatformCustomizerJavadoc.class, key); 114 } 115 116 private ListModel createWaitModel() { 117 DefaultListModel waitModel = new DefaultListModel (); 118 waitModel.addElement(NbBundle.getMessage( 119 NbPlatformCustomizerModules.class, "LBL_PleaseWait")); return waitModel; 121 } 122 123 } 124 | Popular Tags |