1 19 20 package org.netbeans.modules.junit.wizards; 21 22 import java.awt.FlowLayout ; 23 import java.awt.GridBagConstraints ; 24 import java.awt.GridBagLayout ; 25 import java.awt.Insets ; 26 import java.util.ResourceBundle ; 27 import javax.accessibility.AccessibleContext ; 28 import javax.swing.BorderFactory ; 29 import javax.swing.Box ; 30 import javax.swing.BoxLayout ; 31 import javax.swing.JLabel ; 32 import javax.swing.JPanel ; 33 import javax.swing.JTextField ; 34 import javax.swing.UIManager ; 35 import javax.swing.border.CompoundBorder ; 36 import javax.swing.border.EmptyBorder ; 37 import javax.swing.border.MatteBorder ; 38 import org.netbeans.api.project.Project; 39 import org.netbeans.api.project.ProjectUtils; 40 import org.netbeans.modules.junit.SizeRestrictedPanel; 41 import org.openide.awt.Mnemonics; 42 import org.openide.explorer.view.BeanTreeView; 43 import org.openide.explorer.view.TreeView; 44 import org.openide.loaders.DataObject; 45 import org.openide.util.NbBundle; 46 47 51 public class ClassChooserPanel extends JPanel { 52 53 54 private JLabel lblProjectName; 55 56 private JTextField tfClassToTest; 57 58 private JTextField tfTestClass; 59 60 private JTextField tfTestFile; 61 62 63 ClassChooserPanel(Project project) { 64 super(); 65 66 67 String projectName = ProjectUtils.getInformation(project) 68 .getDisplayName(); 69 70 71 ResourceBundle bundle = NbBundle.getBundle(ClassChooserPanel.class); 72 73 JLabel lblProject = new JLabel (); 74 JLabel lblClassToTest = new JLabel (); 75 JLabel lblTestClass = new JLabel (); 76 JLabel lblTestFile = new JLabel (); 77 78 Mnemonics.setLocalizedText(lblProject, 79 bundle.getString("LBL_Project")); Mnemonics.setLocalizedText(lblClassToTest, 81 bundle.getString("LBL_ClassToTest")); Mnemonics.setLocalizedText(lblTestClass, 83 bundle.getString("LBL_TestClass")); Mnemonics.setLocalizedText(lblTestFile, 85 bundle.getString("LBL_TestFile")); 87 lblProjectName = new JLabel (projectName); 88 tfClassToTest = new JTextField (); 89 tfTestClass = new JTextField (); 90 tfTestFile = new JTextField (); 91 92 tfClassToTest.setEditable(false); 93 tfTestClass.setEditable(false); 94 tfTestFile.setEditable(false); 95 96 lblProject.setLabelFor(lblProjectName); 97 lblClassToTest.setLabelFor(tfClassToTest); 98 lblTestClass.setLabelFor(tfTestClass); 99 lblTestFile.setLabelFor(tfTestFile); 100 101 TreeView treeView = new BeanTreeView(); 102 treeView.setBorder(BorderFactory.createEmptyBorder()); 103 104 AccessibleContext accessCtx; 105 accessCtx = treeView.getAccessibleContext(); 106 accessCtx.setAccessibleName( 107 bundle.getString("AD_Name_ChooseClassToTest")); accessCtx.setAccessibleDescription( 109 bundle.getString("AD_Descr_ChooseClassToTest")); 112 113 JPanel projectNamePanel = new SizeRestrictedPanel(false, true); 114 projectNamePanel.setLayout(new FlowLayout (FlowLayout.LEADING, 12, 0)); 115 projectNamePanel.add(lblProject); 116 projectNamePanel.add(lblProjectName); 117 projectNamePanel.setBorder(new CompoundBorder ( 118 new MatteBorder (0, 0, 1, 0, 119 UIManager.getDefaults() 120 .getColor("Label.foreground")), new EmptyBorder (0, 0, 12, 0))); 122 123 JPanel selectionInfoPanel = new SizeRestrictedPanel(false, true); 124 setLayout(new GridBagLayout ()); 125 126 GridBagConstraints gbc = new GridBagConstraints (); 127 gbc.anchor = GridBagConstraints.WEST; 128 129 gbc.gridy = 0; 130 131 gbc.weightx = 0.0f; 132 gbc.insets = new Insets (0, 0, 6, 12); 133 selectionInfoPanel.add(lblClassToTest, gbc); 134 135 gbc.weightx = 1.0f; 136 gbc.insets = new Insets (0, 0, 6, 0); 137 selectionInfoPanel.add(tfClassToTest, gbc); 138 139 gbc.gridy++; 140 141 gbc.weightx = 0.0f; 142 gbc.insets = new Insets (0, 0, 6, 12); 143 selectionInfoPanel.add(lblTestClass, gbc); 144 145 gbc.weightx = 1.0f; 146 gbc.insets = new Insets (0, 0, 6, 0); 147 selectionInfoPanel.add(tfTestClass, gbc); 148 149 gbc.gridy++; 150 151 gbc.weightx = 0.0f; 152 gbc.insets = new Insets (0, 0, 0, 12); 153 selectionInfoPanel.add(lblTestFile, gbc); 154 155 gbc.weightx = 1.0f; 156 gbc.insets = new Insets (0, 0, 0, 0); 157 selectionInfoPanel.add(tfTestFile, gbc); 158 159 setLayout(new BoxLayout (this, BoxLayout.Y_AXIS)); 160 add(projectNamePanel); 161 add(Box.createVerticalStrut(18)); 162 add(treeView); 163 add(Box.createVerticalStrut(12)); 164 add(selectionInfoPanel); 165 } 166 167 169 DataObject[] getSelectedClasses() { 170 return null; 172 } 173 174 } 175 | Popular Tags |