1 18 package org.netbeans.modules.changelog.wizard; 19 20 24 25 import org.openide.util.*; 26 import javax.swing.event.*; 27 import javax.swing.*; 28 import org.netbeans.modules.changelog.*; 29 30 31 public class FilterPanel extends javax.swing.JPanel { 32 33 34 public FilterPanel() { 35 initComponents(); 36 putClientProperty ("WizardPanel_contentSelectedIndex", new Integer (0)); String [] comboValues = new String [4]; 38 comboValues[0] = NbBundle.getBundle(FilterPanel.class).getString("FilterPanel.Substring"); 39 comboValues[2] = NbBundle.getBundle(FilterPanel.class).getString("FilterPanel.AllWords"); 40 comboValues[3] = NbBundle.getBundle(FilterPanel.class).getString("FilterPanel.SomeWords"); 41 comboValues[1] = NbBundle.getBundle(FilterPanel.class).getString("FilterPanel.RegExp"); 42 DefaultComboBoxModel model = new DefaultComboBoxModel(comboValues); 43 comMessage.setModel(model); 44 String [] comboValues2 = new String [2]; 45 comboValues2[0] = NbBundle.getBundle(FilterPanel.class).getString("FilterPanel.Substring"); 46 comboValues2[1] = NbBundle.getBundle(FilterPanel.class).getString("FilterPanel.RegExp"); 47 comFilePattern.setModel(new DefaultComboBoxModel(comboValues2)); 48 49 } 50 51 56 private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; 58 59 lblDate = new javax.swing.JLabel (); 60 txDate = new javax.swing.JTextField (); 61 lblUser = new javax.swing.JLabel (); 62 txUser = new javax.swing.JTextField (); 63 lblRevision = new javax.swing.JLabel (); 64 txRevision = new javax.swing.JTextField (); 65 lblMessage = new javax.swing.JLabel (); 66 txMessage = new javax.swing.JTextField (); 67 comMessage = new javax.swing.JComboBox (); 68 lblDateFormat = new javax.swing.JLabel (); 69 lRevisionRange = new javax.swing.JLabel (); 70 lblFilePattern = new javax.swing.JLabel (); 71 txFilePattern = new javax.swing.JTextField (); 72 comFilePattern = new javax.swing.JComboBox (); 73 74 setLayout(new java.awt.GridBagLayout ()); 75 76 setMinimumSize(new java.awt.Dimension (400, 200)); 77 setPreferredSize(new java.awt.Dimension (600, 300)); 78 getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/changelog/wizard/Bundle").getString("ACSN_FilterPanel")); 79 getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/changelog/wizard/Bundle").getString("ACSD_FilterPanel")); 80 lblDate.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/changelog/wizard/Bundle").getString("ACS_lblDate_mnc").charAt(0)); 81 lblDate.setLabelFor(txDate); 82 lblDate.setText(org.openide.util.NbBundle.getBundle(FilterPanel.class).getString("FilterPanel.lblStatDate.text")); 83 gridBagConstraints = new java.awt.GridBagConstraints (); 84 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 85 gridBagConstraints.insets = new java.awt.Insets (12, 12, 0, 0); 86 add(lblDate, gridBagConstraints); 87 88 txDate.setColumns(40); 89 txDate.setMinimumSize(new java.awt.Dimension (100, 17)); 90 gridBagConstraints = new java.awt.GridBagConstraints (); 91 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 92 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 93 gridBagConstraints.weightx = 0.5; 94 gridBagConstraints.insets = new java.awt.Insets (12, 6, 0, 0); 95 add(txDate, gridBagConstraints); 96 txDate.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/changelog/wizard/Bundle").getString("ACSD_txDate")); 97 98 lblUser.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/changelog/wizard/Bundle").getString("ACS_lblUser_mnc").charAt(0)); 99 lblUser.setLabelFor(txUser); 100 lblUser.setText(org.openide.util.NbBundle.getBundle(FilterPanel.class).getString("FilterPanel.lblUser.text")); 101 gridBagConstraints = new java.awt.GridBagConstraints (); 102 gridBagConstraints.gridx = 0; 103 gridBagConstraints.gridy = 2; 104 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 105 gridBagConstraints.insets = new java.awt.Insets (6, 12, 0, 0); 106 add(lblUser, gridBagConstraints); 107 108 txUser.setColumns(10); 109 txUser.setMinimumSize(new java.awt.Dimension (100, 17)); 110 gridBagConstraints = new java.awt.GridBagConstraints (); 111 gridBagConstraints.gridx = 1; 112 gridBagConstraints.gridy = 2; 113 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 114 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 115 gridBagConstraints.insets = new java.awt.Insets (6, 6, 0, 0); 116 add(txUser, gridBagConstraints); 117 txUser.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/changelog/wizard/Bundle").getString("ACSD_txUser")); 118 119 lblRevision.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/changelog/wizard/Bundle").getString("ACS_lblRevision_mnc").charAt(0)); 120 lblRevision.setLabelFor(txRevision); 121 lblRevision.setText(org.openide.util.NbBundle.getBundle(FilterPanel.class).getString("FilterPanel.lblBranch.text")); 122 gridBagConstraints = new java.awt.GridBagConstraints (); 123 gridBagConstraints.gridx = 0; 124 gridBagConstraints.gridy = 3; 125 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 126 gridBagConstraints.insets = new java.awt.Insets (6, 12, 0, 0); 127 add(lblRevision, gridBagConstraints); 128 129 txRevision.setColumns(10); 130 txRevision.setMinimumSize(new java.awt.Dimension (100, 17)); 131 gridBagConstraints = new java.awt.GridBagConstraints (); 132 gridBagConstraints.gridx = 1; 133 gridBagConstraints.gridy = 3; 134 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 135 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 136 gridBagConstraints.insets = new java.awt.Insets (6, 6, 0, 0); 137 add(txRevision, gridBagConstraints); 138 txRevision.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/changelog/wizard/Bundle").getString("ACSD_txRevision")); 139 140 lblMessage.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/changelog/wizard/Bundle").getString("ACS_lblMessage_mnc").charAt(0)); 141 lblMessage.setLabelFor(txMessage); 142 lblMessage.setText(org.openide.util.NbBundle.getBundle(FilterPanel.class).getString("FilterPanel.lblMessage.text")); 143 gridBagConstraints = new java.awt.GridBagConstraints (); 144 gridBagConstraints.gridx = 0; 145 gridBagConstraints.gridy = 5; 146 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 147 gridBagConstraints.insets = new java.awt.Insets (6, 12, 6, 0); 148 add(lblMessage, gridBagConstraints); 149 150 txMessage.setColumns(10); 151 txMessage.setMinimumSize(new java.awt.Dimension (100, 17)); 152 gridBagConstraints = new java.awt.GridBagConstraints (); 153 gridBagConstraints.gridx = 1; 154 gridBagConstraints.gridy = 5; 155 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 156 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 157 gridBagConstraints.insets = new java.awt.Insets (6, 6, 6, 0); 158 add(txMessage, gridBagConstraints); 159 txMessage.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/changelog/wizard/Bundle").getString("ACSD_txMessage")); 160 161 comMessage.setPreferredSize(new java.awt.Dimension (250, 27)); 162 gridBagConstraints = new java.awt.GridBagConstraints (); 163 gridBagConstraints.gridx = 2; 164 gridBagConstraints.gridy = 5; 165 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 166 gridBagConstraints.weightx = 0.5; 167 gridBagConstraints.insets = new java.awt.Insets (6, 6, 5, 11); 168 add(comMessage, gridBagConstraints); 169 comMessage.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/changelog/wizard/Bundle").getString("ACSD_comMessage")); 170 171 lblDateFormat.setText(org.openide.util.NbBundle.getBundle(FilterPanel.class).getString("FilterPanel.lblDateFormat.text")); 172 gridBagConstraints = new java.awt.GridBagConstraints (); 173 gridBagConstraints.gridx = 0; 174 gridBagConstraints.gridy = 1; 175 gridBagConstraints.gridwidth = 2; 176 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 177 gridBagConstraints.insets = new java.awt.Insets (6, 12, 6, 0); 178 add(lblDateFormat, gridBagConstraints); 179 180 lRevisionRange.setText(org.openide.util.NbBundle.getBundle(FilterPanel.class).getString("FilterPanel.lblRevisionRange.text")); 181 gridBagConstraints = new java.awt.GridBagConstraints (); 182 gridBagConstraints.gridx = 0; 183 gridBagConstraints.gridy = 4; 184 gridBagConstraints.gridwidth = 2; 185 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 186 gridBagConstraints.insets = new java.awt.Insets (6, 12, 6, 0); 187 add(lRevisionRange, gridBagConstraints); 188 189 lblFilePattern.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/changelog/wizard/Bundle").getString("ACS_lblFilePattern_mnc").charAt(0)); 190 lblFilePattern.setLabelFor(txFilePattern); 191 lblFilePattern.setText(org.openide.util.NbBundle.getBundle(FilterPanel.class).getString("FilterPanel.lblFilePattern.text")); 192 gridBagConstraints = new java.awt.GridBagConstraints (); 193 gridBagConstraints.gridx = 0; 194 gridBagConstraints.gridy = 6; 195 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 196 gridBagConstraints.weighty = 0.5; 197 gridBagConstraints.insets = new java.awt.Insets (6, 12, 12, 0); 198 add(lblFilePattern, gridBagConstraints); 199 200 gridBagConstraints = new java.awt.GridBagConstraints (); 201 gridBagConstraints.gridx = 1; 202 gridBagConstraints.gridy = 6; 203 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 204 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 205 gridBagConstraints.weightx = 0.5; 206 gridBagConstraints.insets = new java.awt.Insets (6, 6, 12, 0); 207 add(txFilePattern, gridBagConstraints); 208 txFilePattern.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/changelog/wizard/Bundle").getString("ACSD_txFilePattern")); 209 210 comFilePattern.setPreferredSize(new java.awt.Dimension (250, 27)); 211 gridBagConstraints = new java.awt.GridBagConstraints (); 212 gridBagConstraints.gridx = 2; 213 gridBagConstraints.gridy = 6; 214 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 215 gridBagConstraints.weightx = 0.5; 216 gridBagConstraints.weighty = 0.5; 217 gridBagConstraints.insets = new java.awt.Insets (6, 6, 11, 11); 218 add(comFilePattern, gridBagConstraints); 219 comFilePattern.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/changelog/wizard/Bundle").getString("ACSD_comFilePattern")); 220 221 } 223 224 private javax.swing.JLabel lblMessage; 226 private javax.swing.JLabel lblDateFormat; 227 private javax.swing.JTextField txUser; 228 private javax.swing.JTextField txDate; 229 private javax.swing.JTextField txMessage; 230 private javax.swing.JTextField txFilePattern; 231 private javax.swing.JLabel lblFilePattern; 232 private javax.swing.JComboBox comMessage; 233 private javax.swing.JLabel lblRevision; 234 private javax.swing.JLabel lblDate; 235 private javax.swing.JLabel lblUser; 236 private javax.swing.JTextField txRevision; 237 private javax.swing.JComboBox comFilePattern; 238 private javax.swing.JLabel lRevisionRange; 239 241 242 public static class Panel implements org.openide.WizardDescriptor.Panel { 243 244 245 private FilterPanel panel; 246 private String name; 247 248 249 public Panel (String name) { 250 this.name = name; 251 } 252 253 256 public synchronized java.awt.Component getComponent() { 257 if (this.panel == null) { 258 this.panel = new FilterPanel(); 259 this.panel.setName (name); 260 } 261 return this.panel; 262 } 263 264 268 public HelpCtx getHelp() { 269 return new HelpCtx(this.getClass()); 270 } 271 272 276 public void addChangeListener(ChangeListener l) { 277 } 278 279 282 public void removeChangeListener(ChangeListener l) { 283 } 284 285 286 public boolean isValid() { 287 return true; 288 } 289 290 299 public void storeSettings(Object settings) { 300 if (settings instanceof ChangeLogProcessor) { 301 ChangeLogProcessor proces = (ChangeLogProcessor)settings; 302 FilterPanel p = (FilterPanel) this.getComponent(); 303 if (p.txMessage.getText() != null && p.txMessage.getText().length() > 0) { 304 proces.setMessageFilter(p.comMessage.getSelectedIndex(), p.txMessage.getText()); 305 } 306 else { 307 proces.setMessageFilter(ChangeLogProcessor.MESSAGE_FILTER_SUBSTRING, null); 308 } 309 if (p.txFilePattern.getText() != null && p.txFilePattern.getText().length() > 0) { 310 proces.setFileFilter(p.comFilePattern.getSelectedIndex(), p.txFilePattern.getText()); 311 } 312 else { 313 proces.setFileFilter(ChangeLogProcessor.FILE_FILTER_SUBSTRING, null); 314 } 315 316 if (p.txUser.getText() != null & p.txUser.getText().length() > 0) 317 proces.setUser(p.txUser.getText()); 318 else proces.setUser(null); 319 320 if (p.txRevision.getText() != null & p.txRevision.getText().length() > 0) 321 proces.setRevisionRange(p.txRevision.getText()); 322 else proces.setRevisionRange(null); 323 if (p.txDate.getText() != null & p.txDate.getText().length() > 0) 324 proces.setDateRange(p.txDate.getText()); 325 else proces.setDateRange(null); 326 } 327 } 328 329 336 public void readSettings(Object settings) { 337 if (settings instanceof ChangeLogProcessor) { 338 ChangeLogProcessor proces = (ChangeLogProcessor)settings; 339 FilterPanel p = (FilterPanel) this.getComponent(); 340 if (proces.getRevisionRange() != null) 341 p.txRevision.setText(proces.getRevisionRange()); 342 if (proces.getDateRange() != null) 343 p.txDate.setText(proces.getDateRange()); 344 if (proces.getUser() != null) { 345 p.txUser.setText(proces.getUser()); 346 } 347 if (proces.getMessageFilter() != null) { 348 p.txMessage.setText(proces.getMessageFilter()); 349 p.comMessage.setSelectedIndex(proces.getMessageFilterType()); 350 } 351 if (proces.getFileFilter() != null) { 352 p.txFilePattern.setText(proces.getFileFilter()); 353 p.comFilePattern.setSelectedIndex(proces.getFileFilterType()); 354 } 355 } 356 } 357 } 358 359 } 360 | Popular Tags |