KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > project > ui > SimpleTargetChooserPanelGUI


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.project.ui;
21
22 import java.awt.Component JavaDoc;
23 import java.awt.event.ActionListener JavaDoc;
24 import java.io.File JavaDoc;
25 import java.text.MessageFormat JavaDoc;
26 import java.util.ArrayList JavaDoc;
27 import java.util.Iterator JavaDoc;
28 import java.util.List JavaDoc;
29 import javax.swing.DefaultComboBoxModel JavaDoc;
30 import javax.swing.JLabel JavaDoc;
31 import javax.swing.JList JavaDoc;
32 import javax.swing.ListCellRenderer JavaDoc;
33 import javax.swing.event.ChangeEvent JavaDoc;
34 import javax.swing.event.ChangeListener JavaDoc;
35 import javax.swing.event.DocumentListener JavaDoc;
36 import org.netbeans.api.project.Project;
37 import org.netbeans.api.project.ProjectUtils;
38 import org.netbeans.api.project.SourceGroup;
39 import org.netbeans.api.project.Sources;
40 import org.netbeans.spi.project.support.GenericSources;
41 import org.openide.awt.Mnemonics;
42 import org.openide.filesystems.FileObject;
43 import org.openide.filesystems.FileUtil;
44 import org.openide.loaders.DataObject;
45 import org.openide.loaders.DataObjectNotFoundException;
46 import org.openide.util.NbBundle;
47
48 /**
49  *
50  * @author phrebejk
51  */

52 public class SimpleTargetChooserPanelGUI extends javax.swing.JPanel JavaDoc implements ActionListener JavaDoc, DocumentListener JavaDoc {
53   
54     /** prefered dimmension of the panels */
55     private static final java.awt.Dimension JavaDoc PREF_DIM = new java.awt.Dimension JavaDoc (500, 340);
56     
57     private static final String JavaDoc NEW_FILE_PREFIX =
58         NbBundle.getMessage( SimpleTargetChooserPanelGUI.class, "LBL_SimpleTargetChooserPanelGUI_NewFilePrefix" ); // NOI18N
59

60     private final ListCellRenderer JavaDoc CELL_RENDERER = new GroupCellRenderer();
61         
62     private Project project;
63     private String JavaDoc expectedExtension;
64     private final List JavaDoc<ChangeListener JavaDoc> listeners = new ArrayList JavaDoc<ChangeListener JavaDoc>();
65     private SourceGroup[] folders;
66     private boolean isFolder;
67     
68     /** Creates new form SimpleTargetChooserGUI */
69     public SimpleTargetChooserPanelGUI( Project project, SourceGroup[] folders, Component JavaDoc bottomPanel, boolean isFolder ) {
70         this.project = project;
71         this.folders=folders;
72         this.isFolder = isFolder;
73         initComponents();
74         
75         locationComboBox.setRenderer( CELL_RENDERER );
76         
77         if ( bottomPanel != null ) {
78             bottomPanelContainer.add( bottomPanel, java.awt.BorderLayout.CENTER );
79         }
80         initValues( null, null );
81         
82         browseButton.addActionListener( this );
83         locationComboBox.addActionListener( this );
84         documentNameTextField.getDocument().addDocumentListener( this );
85         folderTextField.getDocument().addDocumentListener( this );
86         
87         setName (NbBundle.getMessage(SimpleTargetChooserPanelGUI.class, "LBL_SimpleTargetChooserPanel_Name")); // NOI18N
88
}
89     
90     public void initValues( FileObject template, FileObject preselectedFolder ) {
91         initValues(template, preselectedFolder, null);
92     }
93     
94     public void initValues( FileObject template, FileObject preselectedFolder, String JavaDoc documentName ) {
95         assert project != null;
96         
97         projectTextField.setText(ProjectUtils.getInformation(project).getDisplayName());
98         
99         Sources sources = ProjectUtils.getSources( project );
100                         
101         folders = sources.getSourceGroups( Sources.TYPE_GENERIC );
102         
103         if ( folders.length < 2 ) {
104             // one source group i.e. hide Location
105
locationLabel.setVisible( false );
106             locationComboBox.setVisible( false );
107         }
108         else {
109             // more source groups user needs to select location
110
locationLabel.setVisible( true );
111             locationComboBox.setVisible( true );
112             
113         }
114         
115         locationComboBox.setModel( new DefaultComboBoxModel JavaDoc( folders ) );
116         // Guess the group we want to create the file in
117
SourceGroup preselectedGroup = getPreselectedGroup( folders, preselectedFolder );
118         locationComboBox.setSelectedItem( preselectedGroup );
119         // Create OS dependent relative name
120
folderTextField.setText( getRelativeNativeName( preselectedGroup.getRootFolder(), preselectedFolder ) );
121         
122         String JavaDoc ext = template == null ? "" : template.getExt(); // NOI18N
123
expectedExtension = ext.length() == 0 ? "" : "." + ext; // NOI18N
124

125         String JavaDoc displayName = null;
126         try {
127             if (template != null) {
128                 DataObject templateDo = DataObject.find (template);
129                 displayName = templateDo.getNodeDelegate ().getDisplayName ();
130             }
131         } catch (DataObjectNotFoundException ex) {
132             displayName = template.getName ();
133         }
134         putClientProperty ("NewFileWizard_Title", displayName);// NOI18N
135

136         if (template != null) {
137             if (documentName == null) {
138                 documentName = NEW_FILE_PREFIX + template.getName ();
139             }
140             documentNameTextField.setText (documentName);
141             documentNameTextField.selectAll ();
142         }
143         
144         if (isFolder) {
145             Mnemonics.setLocalizedText(jLabel3, NbBundle.getMessage(SimpleTargetChooserPanelGUI.class, "LBL_TargetChooser_FolderName_Label")); // NOI18N
146
Mnemonics.setLocalizedText(jLabel2, NbBundle.getMessage(SimpleTargetChooserPanelGUI.class, "LBL_TargetChooser_ParentFolder_Label")); // NOI18N
147
Mnemonics.setLocalizedText(jLabel4, NbBundle.getMessage(SimpleTargetChooserPanelGUI.class, "LBL_TargetChooser_CreatedFolder_Label")); // NOI18N
148
} else {
149             Mnemonics.setLocalizedText(jLabel3, NbBundle.getMessage(SimpleTargetChooserPanelGUI.class, "LBL_TargetChooser_FileName_Label")); // NOI18N
150
Mnemonics.setLocalizedText(jLabel2, NbBundle.getMessage(SimpleTargetChooserPanelGUI.class, "LBL_TargetChooser_Folder_Label")); // NOI18N
151
Mnemonics.setLocalizedText(jLabel4, NbBundle.getMessage(SimpleTargetChooserPanelGUI.class, "LBL_TargetChooser_CreatedFile_Label")); // NOI18N
152
}
153     }
154     
155     public SourceGroup getTargetGroup() {
156         return (SourceGroup)locationComboBox.getSelectedItem();
157     }
158         
159     public String JavaDoc getTargetFolder() {
160         
161         String JavaDoc folderName = folderTextField.getText().trim();
162         
163         if ( folderName.length() == 0 ) {
164             return null;
165         }
166         else {
167             return folderName.replace( File.separatorChar, '/' ); // NOI18N
168
}
169     }
170     
171     public String JavaDoc getTargetName() {
172         
173         String JavaDoc text = documentNameTextField.getText().trim();
174         
175         if ( text.length() == 0 ) {
176             return null;
177         }
178         else {
179             return text;
180         }
181     }
182     
183         
184     public java.awt.Dimension JavaDoc getPreferredSize() {
185         return PREF_DIM;
186     }
187     
188     public synchronized void addChangeListener(ChangeListener JavaDoc l) {
189         listeners.add(l);
190     }
191     
192     public synchronized void removeChangeListener(ChangeListener JavaDoc l) {
193         listeners.remove(l);
194     }
195     
196     private void fireChange() {
197         ChangeEvent JavaDoc e = new ChangeEvent JavaDoc(this);
198         List JavaDoc<ChangeListener JavaDoc> templist;
199         synchronized (this) {
200             templist = new ArrayList JavaDoc<ChangeListener JavaDoc> (listeners);
201         }
202     for (ChangeListener JavaDoc l: templist) {
203             l.stateChanged(e);
204         }
205     }
206         
207     /** This method is called from within the constructor to
208      * initialize the form.
209      * WARNING: Do NOT modify this code. The content of this method is
210      * always regenerated by the Form Editor.
211      */

212     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
213
private void initComponents() {
214         java.awt.GridBagConstraints JavaDoc gridBagConstraints;
215
216         jPanel1 = new javax.swing.JPanel JavaDoc();
217         jLabel3 = new javax.swing.JLabel JavaDoc();
218         documentNameTextField = new javax.swing.JTextField JavaDoc();
219         jLabel1 = new javax.swing.JLabel JavaDoc();
220         projectTextField = new javax.swing.JTextField JavaDoc();
221         locationLabel = new javax.swing.JLabel JavaDoc();
222         locationComboBox = new javax.swing.JComboBox JavaDoc();
223         jLabel2 = new javax.swing.JLabel JavaDoc();
224         folderTextField = new javax.swing.JTextField JavaDoc();
225         browseButton = new javax.swing.JButton JavaDoc();
226         jLabel4 = new javax.swing.JLabel JavaDoc();
227         fileTextField = new javax.swing.JTextField JavaDoc();
228         targetSeparator = new javax.swing.JSeparator JavaDoc();
229         bottomPanelContainer = new javax.swing.JPanel JavaDoc();
230
231         setLayout(new java.awt.GridBagLayout JavaDoc());
232
233         jPanel1.setLayout(new java.awt.GridBagLayout JavaDoc());
234
235         jLabel3.setLabelFor(documentNameTextField);
236         org.openide.awt.Mnemonics.setLocalizedText(jLabel3, org.openide.util.NbBundle.getMessage(SimpleTargetChooserPanelGUI.class, "LBL_TargetChooser_FileName_Label")); // NOI18N
237
gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
238         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
239         jPanel1.add(jLabel3, gridBagConstraints);
240         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
241         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
242         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
243         gridBagConstraints.weightx = 1.0;
244         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 6, 0, 0);
245         jPanel1.add(documentNameTextField, gridBagConstraints);
246         documentNameTextField.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(SimpleTargetChooserPanelGUI.class).getString("AD_documentNameTextField")); // NOI18N
247

248         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
249         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
250         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
251         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 24, 0);
252         add(jPanel1, gridBagConstraints);
253
254         jLabel1.setLabelFor(projectTextField);
255         org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(SimpleTargetChooserPanelGUI.class, "LBL_TargetChooser_Project_Label")); // NOI18N
256
gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
257         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
258         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 6, 0);
259         add(jLabel1, gridBagConstraints);
260
261         projectTextField.setEditable(false);
262         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
263         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
264         gridBagConstraints.weightx = 1.0;
265         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 6, 6, 0);
266         add(projectTextField, gridBagConstraints);
267         projectTextField.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(SimpleTargetChooserPanelGUI.class).getString("AD_projectTextField")); // NOI18N
268

269         locationLabel.setLabelFor(locationComboBox);
270         org.openide.awt.Mnemonics.setLocalizedText(locationLabel, org.openide.util.NbBundle.getMessage(SimpleTargetChooserPanelGUI.class, "LBL_TargetChooser_Location_Label")); // NOI18N
271
gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
272         gridBagConstraints.gridy = 2;
273         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
274         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 5, 0);
275         add(locationLabel, gridBagConstraints);
276         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
277         gridBagConstraints.gridy = 2;
278         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
279         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
280         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 6, 5, 0);
281         add(locationComboBox, gridBagConstraints);
282         locationComboBox.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(SimpleTargetChooserPanelGUI.class).getString("AD_locationComboBox")); // NOI18N
283

284         jLabel2.setLabelFor(folderTextField);
285         org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(SimpleTargetChooserPanelGUI.class, "LBL_TargetChooser_Folder_Label")); // NOI18N
286
gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
287         gridBagConstraints.gridx = 0;
288         gridBagConstraints.gridy = 3;
289         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
290         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 12, 0);
291         add(jLabel2, gridBagConstraints);
292         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
293         gridBagConstraints.gridy = 3;
294         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
295         gridBagConstraints.weightx = 1.0;
296         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 6, 12, 0);
297         add(folderTextField, gridBagConstraints);
298         folderTextField.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(SimpleTargetChooserPanelGUI.class).getString("AD_folderTextField")); // NOI18N
299

300         org.openide.awt.Mnemonics.setLocalizedText(browseButton, org.openide.util.NbBundle.getMessage(SimpleTargetChooserPanelGUI.class, "LBL_TargetChooser_Browse_Button")); // NOI18N
301
gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
302         gridBagConstraints.gridy = 3;
303         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
304         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 6, 12, 0);
305         add(browseButton, gridBagConstraints);
306         browseButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(SimpleTargetChooserPanelGUI.class).getString("AD_browseButton")); // NOI18N
307

308         jLabel4.setLabelFor(fileTextField);
309         org.openide.awt.Mnemonics.setLocalizedText(jLabel4, org.openide.util.NbBundle.getMessage(SimpleTargetChooserPanelGUI.class, "LBL_TargetChooser_CreatedFile_Label")); // NOI18N
310
gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
311         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
312         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 12, 0);
313         add(jLabel4, gridBagConstraints);
314
315         fileTextField.setEditable(false);
316         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
317         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
318         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
319         gridBagConstraints.weightx = 1.0;
320         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 6, 12, 0);
321         add(fileTextField, gridBagConstraints);
322         fileTextField.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(SimpleTargetChooserPanelGUI.class).getString("AD_fileTextField")); // NOI18N
323

324         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
325         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
326         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
327         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 12, 0);
328         add(targetSeparator, gridBagConstraints);
329
330         bottomPanelContainer.setLayout(new java.awt.BorderLayout JavaDoc());
331         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
332         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
333         gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
334         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
335         gridBagConstraints.weighty = 1.0;
336         add(bottomPanelContainer, gridBagConstraints);
337
338         getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(SimpleTargetChooserPanelGUI.class).getString("AD_SimpleTargetChooserPanelGUI")); // NOI18N
339
}// </editor-fold>//GEN-END:initComponents
340

341     
342     
343     // Variables declaration - do not modify//GEN-BEGIN:variables
344
private javax.swing.JPanel JavaDoc bottomPanelContainer;
345     private javax.swing.JButton JavaDoc browseButton;
346     private javax.swing.JTextField JavaDoc documentNameTextField;
347     private javax.swing.JTextField JavaDoc fileTextField;
348     private javax.swing.JTextField JavaDoc folderTextField;
349     private javax.swing.JLabel JavaDoc jLabel1;
350     private javax.swing.JLabel JavaDoc jLabel2;
351     private javax.swing.JLabel JavaDoc jLabel3;
352     private javax.swing.JLabel JavaDoc jLabel4;
353     private javax.swing.JPanel JavaDoc jPanel1;
354     private javax.swing.JComboBox JavaDoc locationComboBox;
355     private javax.swing.JLabel JavaDoc locationLabel;
356     private javax.swing.JTextField JavaDoc projectTextField;
357     private javax.swing.JSeparator JavaDoc targetSeparator;
358     // End of variables declaration//GEN-END:variables
359

360     private SourceGroup getPreselectedGroup( SourceGroup[] groups, FileObject folder ) {
361         for( int i = 0; folder != null && i < groups.length; i++ ) {
362             if( FileUtil.isParentOf( groups[i].getRootFolder(), folder )
363                 || groups[i].getRootFolder().equals(folder)) {
364                 return groups[i];
365             }
366         }
367         return groups[0];
368     }
369     
370     private String JavaDoc getRelativeNativeName( FileObject root, FileObject folder ) {
371         if (root == null) {
372             throw new NullPointerException JavaDoc("null root passed to getRelativeNativeName"); // NOI18N
373
}
374         
375         String JavaDoc path;
376         
377         if (folder == null) {
378             path = ""; // NOI18N
379
}
380         else {
381             path = FileUtil.getRelativePath( root, folder );
382         }
383         
384         return path == null ? "" : path.replace( '/', File.separatorChar ); // NOI18N
385
}
386     
387     private void updateCreatedFolder() {
388         
389         FileObject root = ((SourceGroup)locationComboBox.getSelectedItem()).getRootFolder();
390             
391         String JavaDoc folderName = folderTextField.getText().trim();
392         String JavaDoc documentName = documentNameTextField.getText().trim();
393         
394         String JavaDoc createdFileName = FileUtil.getFileDisplayName( root ) +
395             ( folderName.startsWith("/") || folderName.startsWith( File.separator ) ? "" : "/" ) + // NOI18N
396
folderName +
397             ( folderName.endsWith("/") || folderName.endsWith( File.separator ) || folderName.length() == 0 ? "" : "/" ) + // NOI18N
398
documentName + expectedExtension;
399             
400         fileTextField.setText( createdFileName.replace( '/', File.separatorChar ) ); // NOI18N
401

402         fireChange();
403     }
404     
405    
406     // ActionListener implementation -------------------------------------------
407

408     public void actionPerformed(java.awt.event.ActionEvent JavaDoc e) {
409         if ( browseButton == e.getSource() ) {
410             FileObject fo=null;
411             // Show the browse dialog
412

413             SourceGroup group = (SourceGroup)locationComboBox.getSelectedItem();
414             
415             fo = BrowseFolders.showDialog( new SourceGroup[] { group },
416                                            project,
417                                            folderTextField.getText().replace( File.separatorChar, '/' ) ); // NOI18N
418

419             if ( fo != null && fo.isFolder() ) {
420                 String JavaDoc relPath = FileUtil.getRelativePath( group.getRootFolder(), fo );
421                 folderTextField.setText( relPath.replace( '/', File.separatorChar ) ); // NOI18N
422
}
423         }
424         else if ( locationComboBox == e.getSource() ) {
425             updateCreatedFolder();
426         }
427     }
428     
429     // DocumentListener implementation -----------------------------------------
430

431     public void changedUpdate(javax.swing.event.DocumentEvent JavaDoc e) {
432         updateCreatedFolder();
433     }
434     
435     public void insertUpdate(javax.swing.event.DocumentEvent JavaDoc e) {
436         updateCreatedFolder();
437     }
438     
439     public void removeUpdate(javax.swing.event.DocumentEvent JavaDoc e) {
440         updateCreatedFolder();
441     }
442     
443     
444     // Rendering of the location combo box -------------------------------------
445

446     private class GroupCellRenderer extends JLabel JavaDoc implements ListCellRenderer JavaDoc {
447     
448         public GroupCellRenderer() {
449             setOpaque( true );
450         }
451         
452         public Component JavaDoc getListCellRendererComponent( JList JavaDoc list, Object JavaDoc value, int index, boolean isSelected, boolean cellHasFocus ) {
453             if (value instanceof SourceGroup) {
454                 SourceGroup group = (SourceGroup)value;
455                 String JavaDoc projectDisplayName = ProjectUtils.getInformation( project ).getDisplayName();
456                 String JavaDoc groupDisplayName = group.getDisplayName();
457                 if ( projectDisplayName.equals( groupDisplayName ) ) {
458                     setText( groupDisplayName );
459                 }
460                 else {
461                     setText( MessageFormat.format( PhysicalView.GroupNode.GROUP_NAME_PATTERN,
462                         new Object JavaDoc[] { groupDisplayName, projectDisplayName, group.getRootFolder().getName() } ) );
463                     /*
464                     setText( MessageFormat.format(
465                         NbBundle.getMessage( SimpleTargetChooserPanelGUI.class, "FMT_TargetChooser_GroupProjectNameBadge" ), // NOI18N
466                         new Object[] { groupDisplayName, projectDisplayName } ) );
467                     */

468                 }
469                 
470                 setIcon( group.getIcon( false ) );
471             }
472             else {
473                 setText( value.toString () );
474                 setIcon( null );
475             }
476             if ( isSelected ) {
477                 setBackground(list.getSelectionBackground());
478                 setForeground(list.getSelectionForeground());
479             }
480             else {
481                 setBackground(list.getBackground());
482                 setForeground(list.getForeground());
483              
484             }
485             return this;
486         }
487                 
488     }
489 }
490
Popular Tags