KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > refactoring > vcs > CheckoutPanel


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.refactoring.vcs;
21
22 import java.awt.Component JavaDoc;
23 import java.util.Collection JavaDoc;
24 import javax.swing.DefaultListCellRenderer JavaDoc;
25 import javax.swing.JList JavaDoc;
26 import org.openide.filesystems.FileObject;
27 import org.openide.filesystems.FileUtil;
28
29 /**
30  *
31  * @author Jan Becicka
32  */

33 public class CheckoutPanel extends javax.swing.JPanel JavaDoc {
34
35     /**
36      * Creates new form CheckoutPanel
37      *
38      */

39     public CheckoutPanel(Collection JavaDoc files) {
40         initComponents();
41         fileList.setListData(files.toArray());
42         fileList.setCellRenderer(new DefaultListCellRenderer JavaDoc() {
43                 public Component JavaDoc getListCellRendererComponent(
44                         JList JavaDoc list,
45                         Object JavaDoc value,
46                         int index,
47                         boolean isSelected,
48                         boolean cellHasFocus)
49                   {
50                     super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
51                     setText("<html>" + ((FileObject) value).getNameExt() + " <font color=#707070>(" + FileUtil.getFileDisplayName((FileObject) value) + ")</font></html>"); //NOI18N
52
return this;
53                 }
54                 
55                 
56         });
57     }
58     
59     /** This method is called from within the constructor to
60      * initialize the form.
61      * WARNING: Do NOT modify this code. The content of this method is
62      * always regenerated by the Form Editor.
63      */

64     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
65
private void initComponents() {
66         topLabel = new javax.swing.JLabel JavaDoc();
67         progressBar = new javax.swing.JProgressBar JavaDoc();
68         scrollPane = new javax.swing.JScrollPane JavaDoc();
69         fileList = new javax.swing.JList JavaDoc();
70
71         setLayout(new java.awt.BorderLayout JavaDoc(0, 6));
72
73         setBorder(new javax.swing.border.EmptyBorder JavaDoc(new java.awt.Insets JavaDoc(12, 12, 11, 11)));
74         org.openide.awt.Mnemonics.setLocalizedText(topLabel, org.openide.util.NbBundle.getMessage(CheckoutPanel.class, "LBL_FilesToUpdate"));
75         add(topLabel, java.awt.BorderLayout.NORTH);
76
77         add(progressBar, java.awt.BorderLayout.SOUTH);
78
79         scrollPane.setViewportView(fileList);
80
81         add(scrollPane, java.awt.BorderLayout.CENTER);
82
83     }
84     // </editor-fold>//GEN-END:initComponents
85

86     
87     // Variables declaration - do not modify//GEN-BEGIN:variables
88
private javax.swing.JList JavaDoc fileList;
89     private javax.swing.JProgressBar JavaDoc progressBar;
90     private javax.swing.JScrollPane JavaDoc scrollPane;
91     private javax.swing.JLabel JavaDoc topLabel;
92     // End of variables declaration//GEN-END:variables
93

94 }
95
Popular Tags