1 19 20 package org.netbeans.modules.j2ee.persistence.wizard; 21 22 import java.awt.Component ; 23 import java.io.IOException ; 24 import java.util.ArrayList ; 25 import java.util.Collections ; 26 import java.util.Comparator ; 27 import java.util.HashSet ; 28 import java.util.List ; 29 import java.util.Set ; 30 import javax.swing.AbstractListModel ; 31 import javax.swing.JLabel ; 32 import javax.swing.JList ; 33 import javax.swing.ListCellRenderer ; 34 import javax.swing.ListModel ; 35 import javax.swing.event.ChangeEvent ; 36 import javax.swing.event.ChangeListener ; 37 import javax.swing.event.ListSelectionEvent ; 38 import javax.swing.event.ListSelectionListener ; 39 import org.netbeans.api.project.Project; 40 import org.netbeans.modules.j2ee.persistence.api.PersistenceScope; 41 import org.netbeans.modules.j2ee.persistence.dd.ORMMetadata; 42 import org.netbeans.modules.j2ee.persistence.wizard.unit.PersistenceUnitWizardPanel.TableGeneration; 43 import org.netbeans.modules.j2ee.persistence.dd.PersistenceMetadata; 44 import org.netbeans.modules.j2ee.persistence.dd.PersistenceUtils; 45 import org.netbeans.modules.j2ee.persistence.api.metadata.orm.Entity; 46 import org.netbeans.modules.j2ee.persistence.api.metadata.orm.EntityMappings; 47 import org.netbeans.modules.j2ee.persistence.dd.persistence.model_1_0.Persistence; 48 import org.netbeans.modules.j2ee.persistence.dd.persistence.model_1_0.PersistenceUnit; 49 import org.netbeans.modules.j2ee.persistence.provider.ProviderUtil; 50 import org.netbeans.modules.j2ee.persistence.wizard.fromdb.ChangeSupport; 51 import org.netbeans.spi.project.ui.templates.support.Templates; 52 import org.openide.ErrorManager; 53 import org.openide.WizardDescriptor; 54 import org.openide.filesystems.FileObject; 55 import org.openide.util.NbBundle; 56 import org.openide.util.RequestProcessor; 57 58 62 public class PersistenceClientEntitySelectionVisual extends javax.swing.JPanel { 63 64 private WizardDescriptor wizard; 65 private ChangeSupport changeSupport = new ChangeSupport(this); 66 private Project project; 67 boolean waitingForScan; 68 boolean waitingForEntities; 69 private List <EntityMappings> waitForMappings = new ArrayList <EntityMappings>(); 70 private PersistenceUnit persistenceUnit; 71 74 75 76 77 public PersistenceClientEntitySelectionVisual(String name, WizardDescriptor wizard) { 78 setName(name); 79 this.wizard = wizard; 80 initComponents(); 81 ListSelectionListener selectionListener = new ListSelectionListener () { 82 public void valueChanged(ListSelectionEvent e) { 83 updateButtons(); 84 } 85 }; 86 listAvailable.getSelectionModel().addListSelectionListener(selectionListener); 87 listSelected.getSelectionModel().addListSelectionListener(selectionListener); 88 } 89 90 95 public PersistenceUnit getPersistenceUnit() { 96 return persistenceUnit; 97 } 98 99 private void initComponents() { 101 jScrollPane1 = new javax.swing.JScrollPane (); 102 listAvailable = new javax.swing.JList (); 103 jScrollPane2 = new javax.swing.JScrollPane (); 104 listSelected = new javax.swing.JList (); 105 cbAddRelated = new javax.swing.JCheckBox (); 106 labelAvailableEntities = new javax.swing.JLabel (); 107 panelButtons = new javax.swing.JPanel (); 108 buttonRemove = new javax.swing.JButton (); 109 buttonAdd = new javax.swing.JButton (); 110 buttonAddAll = new javax.swing.JButton (); 111 buttonRemoveAll = new javax.swing.JButton (); 112 labelSelectedEntities = new javax.swing.JLabel (); 113 createPUButton = new javax.swing.JButton (); 114 115 listAvailable.setCellRenderer(ENTITY_LIST_RENDERER); 116 jScrollPane1.setViewportView(listAvailable); 117 listAvailable.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/persistence/wizard/Bundle").getString("LBL_AvailableEntitiesList")); 118 listAvailable.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/persistence/wizard/Bundle").getString("ACSD_AvailableEntitiesList")); 119 120 listSelected.setCellRenderer(ENTITY_LIST_RENDERER); 121 jScrollPane2.setViewportView(listSelected); 122 listSelected.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/persistence/wizard/Bundle").getString("LBL_SelectedEntitiesList")); 123 listSelected.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/persistence/wizard/Bundle").getString("ACSD_SelectedEntitiesList")); 124 125 cbAddRelated.setMnemonic(org.openide.util.NbBundle.getMessage(PersistenceClientEntitySelectionVisual.class, "MNE_InludeRelated").charAt(0)); 126 cbAddRelated.setSelected(true); 127 cbAddRelated.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/persistence/wizard/Bundle").getString("LBL_IncludeReferenced")); 128 cbAddRelated.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); 129 cbAddRelated.setMargin(new java.awt.Insets (0, 0, 0, 0)); 130 cbAddRelated.addActionListener(new java.awt.event.ActionListener () { 131 public void actionPerformed(java.awt.event.ActionEvent evt) { 132 cbAddRelatedActionPerformed(evt); 133 } 134 }); 135 136 cbAddRelated.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/persistence/wizard/Bundle").getString("LBL_IncludeReferencedCheckbox")); 137 cbAddRelated.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/persistence/wizard/Bundle").getString("ACSD_IncludeReferencedCheckbox")); 138 139 labelAvailableEntities.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/persistence/wizard/Bundle").getString("MNE_AvailableEntityClasses").charAt(0)); 140 labelAvailableEntities.setLabelFor(listAvailable); 141 labelAvailableEntities.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/persistence/wizard/Bundle").getString("LBL_AvailableEntities")); 142 143 buttonRemove.setMnemonic(org.openide.util.NbBundle.getMessage(PersistenceClientEntitySelectionVisual.class, "MNE_Remove").charAt(0)); 144 buttonRemove.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/persistence/wizard/Bundle").getString("LBL_Remove")); 145 buttonRemove.setActionCommand("< &Remove"); 146 buttonRemove.addActionListener(new java.awt.event.ActionListener () { 147 public void actionPerformed(java.awt.event.ActionEvent evt) { 148 buttonRemoveActionPerformed(evt); 149 } 150 }); 151 152 buttonAdd.setMnemonic(org.openide.util.NbBundle.getMessage(PersistenceClientEntitySelectionVisual.class, "MNE_Add").charAt(0)); 153 buttonAdd.setText(org.openide.util.NbBundle.getMessage(PersistenceClientEntitySelectionVisual.class, "LBL_Add")); 154 buttonAdd.setActionCommand("&Add >"); 155 buttonAdd.addActionListener(new java.awt.event.ActionListener () { 156 public void actionPerformed(java.awt.event.ActionEvent evt) { 157 buttonAddActionPerformed(evt); 158 } 159 }); 160 161 buttonAddAll.setMnemonic(org.openide.util.NbBundle.getMessage(PersistenceClientEntitySelectionVisual.class, "MNE_AddAll").charAt(0)); 162 buttonAddAll.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/persistence/wizard/Bundle").getString("LBL_AddAll")); 163 buttonAddAll.setActionCommand("Add A&ll >>"); 164 buttonAddAll.addActionListener(new java.awt.event.ActionListener () { 165 public void actionPerformed(java.awt.event.ActionEvent evt) { 166 buttonAddAllActionPerformed(evt); 167 } 168 }); 169 170 buttonRemoveAll.setMnemonic(org.openide.util.NbBundle.getMessage(PersistenceClientEntitySelectionVisual.class, "MNE_RemoveAll").charAt(0)); 171 buttonRemoveAll.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/persistence/wizard/Bundle").getString("LBL_RemoveAll")); 172 buttonRemoveAll.setActionCommand("<< Re&moveAll"); 173 buttonRemoveAll.addActionListener(new java.awt.event.ActionListener () { 174 public void actionPerformed(java.awt.event.ActionEvent evt) { 175 buttonRemoveAllActionPerformed(evt); 176 } 177 }); 178 179 org.jdesktop.layout.GroupLayout panelButtonsLayout = new org.jdesktop.layout.GroupLayout(panelButtons); 180 panelButtons.setLayout(panelButtonsLayout); 181 panelButtonsLayout.setHorizontalGroup( 182 panelButtonsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 183 .add(panelButtonsLayout.createSequentialGroup() 184 .addContainerGap() 185 .add(panelButtonsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 186 .add(org.jdesktop.layout.GroupLayout.TRAILING, buttonAdd, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 124, Short.MAX_VALUE) 187 .add(org.jdesktop.layout.GroupLayout.TRAILING, buttonRemove, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 124, Short.MAX_VALUE) 188 .add(org.jdesktop.layout.GroupLayout.TRAILING, buttonRemoveAll, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 124, Short.MAX_VALUE) 189 .add(org.jdesktop.layout.GroupLayout.TRAILING, buttonAddAll, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 124, Short.MAX_VALUE)) 190 .addContainerGap()) 191 ); 192 panelButtonsLayout.setVerticalGroup( 193 panelButtonsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 194 .add(panelButtonsLayout.createSequentialGroup() 195 .add(67, 67, 67) 196 .add(buttonAdd) 197 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 198 .add(buttonRemove) 199 .add(20, 20, 20) 200 .add(buttonAddAll) 201 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 202 .add(buttonRemoveAll) 203 .addContainerGap(103, Short.MAX_VALUE)) 204 ); 205 206 labelSelectedEntities.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/persistence/wizard/Bundle").getString("MNE_SelectedEntityClasses").charAt(0)); 207 labelSelectedEntities.setLabelFor(listSelected); 208 labelSelectedEntities.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/persistence/wizard/Bundle").getString("LBL_SelectedEntities")); 209 210 createPUButton.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/persistence/wizard/Bundle").getString("MNE_CreatePersistenceUnit").charAt(0)); 211 createPUButton.setText(org.openide.util.NbBundle.getMessage(PersistenceClientEntitySelectionVisual.class, "LBL_CreatePersistenceUnit")); 212 createPUButton.addActionListener(new java.awt.event.ActionListener () { 213 public void actionPerformed(java.awt.event.ActionEvent evt) { 214 createPUButtonActionPerformed(evt); 215 } 216 }); 217 218 createPUButton.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/persistence/wizard/Bundle").getString("LBL_CreatePersistenceUnitButton")); 219 createPUButton.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/persistence/wizard/Bundle").getString("ACSD_CreatePersistenceUnitButton")); 220 221 org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); 222 this.setLayout(layout); 223 layout.setHorizontalGroup( 224 layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 225 .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup() 226 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 227 .add(layout.createSequentialGroup() 228 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 229 .add(labelAvailableEntities) 230 .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 206, Short.MAX_VALUE)) 231 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 232 .add(panelButtons, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 233 .add(0, 0, 0)) 234 .add(layout.createSequentialGroup() 235 .add(createPUButton) 236 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED))) 237 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 238 .add(cbAddRelated) 239 .add(labelSelectedEntities) 240 .add(jScrollPane2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 198, Short.MAX_VALUE)) 241 .addContainerGap()) 242 ); 243 layout.setVerticalGroup( 244 layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 245 .add(layout.createSequentialGroup() 246 .addContainerGap() 247 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 248 .add(labelSelectedEntities) 249 .add(labelAvailableEntities)) 250 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 251 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 252 .add(jScrollPane2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 294, Short.MAX_VALUE) 253 .add(panelButtons, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 254 .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 294, Short.MAX_VALUE)) 255 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 256 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) 257 .add(layout.createSequentialGroup() 258 .add(cbAddRelated) 259 .add(31, 31, 31)) 260 .add(layout.createSequentialGroup() 261 .add(createPUButton) 262 .addContainerGap()))) 263 ); 264 } 266 private void cbAddRelatedActionPerformed(java.awt.event.ActionEvent evt) { listSelected.clearSelection(); 268 listAvailable.clearSelection(); 269 271 changeSupport.fireChange(); 272 } 274 private void createPUButtonActionPerformed(java.awt.event.ActionEvent evt) { persistenceUnit = Util.buildPersistenceUnitUsingWizard(project, null, TableGeneration.CREATE); 276 if (persistenceUnit != null){ 277 updatePersistenceUnitButton(); 278 changeSupport.fireChange(); 281 } 282 } 284 private void buttonRemoveAllActionPerformed(java.awt.event.ActionEvent evt) { listSelected.clearSelection(); 287 updateButtons(); 288 changeSupport.fireChange(); 289 } 291 private void buttonAddAllActionPerformed(java.awt.event.ActionEvent evt) { listAvailable.clearSelection(); 294 updateButtons(); 295 changeSupport.fireChange(); 296 } 298 private void buttonRemoveActionPerformed(java.awt.event.ActionEvent evt) { Object selected[] = listSelected.getSelectedValues(); 300 Set <Entity> sel = new HashSet <Entity>(); 301 for (int i = 0; i < selected.length; i++) { 302 sel.add((Entity) selected[i]); 303 } 304 listSelected.clearSelection(); 306 updateButtons(); 307 308 changeSupport.fireChange(); 309 } 311 private void buttonAddActionPerformed(java.awt.event.ActionEvent evt) { Object selected[] = listAvailable.getSelectedValues(); 313 Set <Entity> sel = new HashSet <Entity>(); 314 for (int i = 0; i < selected.length; i++) { 315 sel.add((Entity) selected[i]); 316 } 317 listAvailable.clearSelection(); 319 updateButtons(); 320 321 changeSupport.fireChange(); 322 } 324 325 private javax.swing.JButton buttonAdd; 327 private javax.swing.JButton buttonAddAll; 328 private javax.swing.JButton buttonRemove; 329 private javax.swing.JButton buttonRemoveAll; 330 private javax.swing.JCheckBox cbAddRelated; 331 private javax.swing.JButton createPUButton; 332 private javax.swing.JScrollPane jScrollPane1; 333 private javax.swing.JScrollPane jScrollPane2; 334 private javax.swing.JLabel labelAvailableEntities; 335 private javax.swing.JLabel labelSelectedEntities; 336 private javax.swing.JList listAvailable; 337 private javax.swing.JList listSelected; 338 private javax.swing.JPanel panelButtons; 339 341 public void addChangeListener(ChangeListener listener) { 342 changeSupport.addChangeListener(listener); 343 } 344 345 boolean valid(WizardDescriptor wizard) { 346 if (createPUButton.isVisible()) { 348 wizard.putProperty("WizardPanel_errorMessage", NbBundle.getMessage(PersistenceClientEntitySelectionVisual.class, "ERR_NoPersistenceUnit")); 349 return false; 350 } 351 352 if (false){ 355 if (!waitingForScan) { 356 waitingForScan = true; 357 RequestProcessor.Task task = RequestProcessor.getDefault().create(new Runnable () { 358 public void run() { 359 waitingForScan = false; 362 changeSupport.fireChange(); 363 updateButtons(); 364 } 365 }); 366 wizard.putProperty("WizardPanel_errorMessage", NbBundle.getMessage(PersistenceClientEntitySelectionVisual.class, "scanning-in-progress")); 367 task.schedule(0); 368 } 369 return false; 370 } 371 372 if(ORMMetadata.getDefault().isScanInProgress()) { 373 if (!waitingForEntities) { 374 waitingForEntities = true; 375 RequestProcessor.Task task = RequestProcessor.getDefault().create(new Runnable () { 376 public void run() { 377 ORMMetadata.getDefault().waitScanFinished(); 378 synchronized (this) { 379 waitForMappings.clear(); 382 } 383 waitingForEntities = false; 384 changeSupport.fireChange(); 385 updateButtons(); 386 } 387 }); 388 wizard.putProperty("WizardPanel_errorMessage", NbBundle.getMessage(PersistenceClientEntitySelectionVisual.class, "scanning-in-progress")); 389 task.schedule(0); 390 } 391 return false; 392 } else { 393 synchronized (this) { 394 if (waitForMappings.size() > 0) { 395 waitForMappings.clear(); 397 updateButtons(); 398 } 399 } 400 } 401 if (listSelected.getModel().getSize() == 0) { 402 wizard.putProperty("WizardPanel_errorMessage", 403 NbBundle.getMessage(PersistenceClientEntitySelectionVisual.class, "MSG_NoEntityClassesSelected")); 404 return false; 405 } 406 wizard.putProperty("WizardPanel_errorMessage", " "); return true; 408 } 409 410 void read(WizardDescriptor settings) { 411 project = Templates.getProject(settings); 412 synchronized (this) { 414 waitForMappings.clear(); 415 if (getPersistenceUnit() == null){ 416 } else { 419 } 423 } 424 List <Entity> entites = (List <Entity>) settings.getProperty(WizardProperties.ENTITY_CLASS); 432 if (entites == null) { 433 entites = new ArrayList (); 434 } 435 437 updateButtons(); 438 updatePersistenceUnitButton(); 439 } 440 441 void store(WizardDescriptor settings) { 442 ListModel model = listSelected.getModel(); 443 if (model instanceof EntityListModel) { 444 EntityListModel elm = (EntityListModel) model; 445 settings.putProperty(WizardProperties.ENTITY_CLASS, elm.getEntityClasses()); 446 } 447 } 448 449 private void updateButtons() { 450 buttonAdd.setEnabled(listAvailable.getSelectedValues().length > 0); 451 buttonRemove.setEnabled(listSelected.getSelectedValues().length > 0); 453 } 455 456 public void updatePersistenceUnitButton() { 457 boolean visible = getPersistenceUnit() == null; 458 if (ProviderUtil.isValidServerInstanceOrNone(project) && visible) { 459 PersistenceScope scopes[] = PersistenceUtils.getPersistenceScopes(project); 460 for (int i = 0; i < scopes.length; i++) { 461 FileObject persistenceXml = scopes[i].getPersistenceXml(); 462 if (persistenceXml != null) { 463 try { 464 Persistence persistence = PersistenceMetadata.getDefault().getRoot(persistenceXml); 465 if (persistence.getPersistenceUnit().length > 0) { 467 visible = false; 468 break; 469 } 470 } catch (IOException ex) { 471 ErrorManager.getDefault().notify(ex); 472 } 473 } 474 } 475 } 476 createPUButton.setVisible(visible); 477 } 478 479 private static final class EntityComparator implements Comparator <Entity> { 480 public int compare(Entity o1, Entity o2) { 481 return o1.getName().compareTo(o2.getName()); 482 } 483 } 484 private static final EntityComparator ENTITY_COMPARATOR = new EntityComparator(); 485 private final ListCellRenderer ENTITY_LIST_RENDERER = new EntityListCellRenderer(); 486 487 private class EntityListModel extends AbstractListModel implements ChangeListener { 488 private List <Entity> entities = new ArrayList <Entity>(); 490 private boolean available; 491 492 EntityListModel( Object entityClosure, boolean available) { 494 this.available = available; 496 refresh(); 498 } 499 500 public int getSize() { 501 return entities.size(); 502 } 503 504 public Object getElementAt(int index) { 505 return entities.get(index); 506 } 507 508 public List <Entity> getEntityClasses() { 509 return entities; 510 } 511 512 public void stateChanged(ChangeEvent e) { 513 refresh(); 514 } 515 516 private void refresh() { 517 int oldSize = getSize(); 518 Collections.sort(entities, ENTITY_COMPARATOR); 520 fireContentsChanged(this, 0, Math.max(oldSize, getSize())); 521 } 522 } 523 524 private final class EntityListCellRenderer extends JLabel implements ListCellRenderer { 525 public EntityListCellRenderer() { 526 setOpaque(true); 527 } 528 public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { 529 String text = null; 530 if (value instanceof Entity) { 531 text = ((Entity) value).getClass2(); 532 if (text != null) { 533 String simpleName = Util.simpleClassName(text); 534 String packageName = text.length() > simpleName.length() ? text.substring(0, text.length() - simpleName.length() -1 ) : "<default package>"; 535 text = simpleName + " (" + packageName + ")"; 536 } else { 537 ErrorManager.getDefault().log(ErrorManager.INFORMATIONAL, "Entity:" + value + " returns null from getClass2(); see IZ 80024"); } 539 } 540 if (text == null) { 541 text = value.toString(); 542 } 543 if (isSelected) { 544 setBackground(list.getSelectionBackground()); 545 setForeground(list.getSelectionForeground()); 546 } else { 547 setBackground(list.getBackground()); 548 setForeground(list.getForeground()); 549 } 550 setFont(list.getFont()); 552 setText(text); 553 return this; 554 } 555 } 556 } 557 | Popular Tags |