KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > versioning > system > cvss > options > CvsOptionsPanel


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-2007 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 package org.netbeans.modules.versioning.system.cvss.options;
20
21 import org.netbeans.modules.versioning.util.StringSelector;
22 import org.openide.util.NbBundle;
23
24 import javax.swing.*;
25 import java.util.*;
26
27 /**
28  * UI panel for CVS settings.
29  *
30  * @author Maros Sandor
31  */

32 class CvsOptionsPanel extends javax.swing.JPanel JavaDoc {
33     
34     /** Creates new form CvsOptionsPanel */
35     public CvsOptionsPanel() {
36         initComponents();
37         refreshComponents();
38     }
39     
40     private void refreshComponents() {
41         wrapCharCount.setEnabled(wrapCommitMessages.isSelected());
42     }
43     
44     public JCheckBox getExcludeNewFiles() {
45         return excludeNewFiles;
46     }
47
48     public JTextField getStatusLabelFormat() {
49         return statusLabelFormat;
50     }
51
52     public JButton getStatusVarsBrowse() {
53         return statusVarsBrowse;
54     }
55
56     public JTextField getWrapCharCount() {
57         return wrapCharCount;
58     }
59
60     public JCheckBox getWrapCommitMessages() {
61         return wrapCommitMessages;
62     }
63
64     /** This method is called from within the constructor to
65      * initialize the form.
66      * WARNING: Do NOT modify this code. The content of this method is
67      * always regenerated by the Form Editor.
68      */

69     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
70
private void initComponents() {
71
72         jLabel1 = new javax.swing.JLabel JavaDoc();
73         statusLabelFormat = new javax.swing.JTextField JavaDoc();
74         excludeNewFiles = new javax.swing.JCheckBox JavaDoc();
75         statusVarsBrowse = new javax.swing.JButton JavaDoc();
76         wrapCommitMessages = new javax.swing.JCheckBox JavaDoc();
77         wrapCharCount = new javax.swing.JTextField JavaDoc();
78
79         jLabel1.setLabelFor(statusLabelFormat);
80         org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(CvsOptionsPanel.class, "CvsOptionsPanel.jLabel1.text")); // NOI18N
81

82         statusLabelFormat.setText(org.openide.util.NbBundle.getMessage(CvsOptionsPanel.class, "CvsOptionsPanel.statusLabelFormat.text")); // NOI18N
83

84         excludeNewFiles.setBackground(new java.awt.Color JavaDoc(255, 255, 255));
85         org.openide.awt.Mnemonics.setLocalizedText(excludeNewFiles, org.openide.util.NbBundle.getMessage(CvsOptionsPanel.class, "CvsOptionsPanel.excludeNewFiles.text")); // NOI18N
86
excludeNewFiles.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
87         excludeNewFiles.setMargin(new java.awt.Insets JavaDoc(0, 0, 0, 0));
88         excludeNewFiles.addActionListener(new java.awt.event.ActionListener JavaDoc() {
89             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
90                 excludeNewFilesActionPerformed(evt);
91             }
92         });
93
94         org.openide.awt.Mnemonics.setLocalizedText(statusVarsBrowse, org.openide.util.NbBundle.getMessage(CvsOptionsPanel.class, "CvsOptionsPanel.statusVarsBrowse.text")); // NOI18N
95
statusVarsBrowse.addActionListener(new java.awt.event.ActionListener JavaDoc() {
96             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
97                 statusVarsBrowseActionPerformed(evt);
98             }
99         });
100
101         wrapCommitMessages.setBackground(new java.awt.Color JavaDoc(255, 255, 255));
102         org.openide.awt.Mnemonics.setLocalizedText(wrapCommitMessages, org.openide.util.NbBundle.getMessage(CvsOptionsPanel.class, "CvsOptionsPanel.wrapCommitMessages.text")); // NOI18N
103
wrapCommitMessages.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
104         wrapCommitMessages.setMargin(new java.awt.Insets JavaDoc(0, 0, 0, 0));
105         wrapCommitMessages.addActionListener(new java.awt.event.ActionListener JavaDoc() {
106             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
107                 wrapCommitMessagesActionPerformed(evt);
108             }
109         });
110
111         wrapCharCount.setColumns(4);
112         wrapCharCount.setText(org.openide.util.NbBundle.getMessage(CvsOptionsPanel.class, "CvsOptionsPanel.wrapCharCount.text")); // NOI18N
113

114         org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
115         this.setLayout(layout);
116         layout.setHorizontalGroup(
117             layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
118             .add(layout.createSequentialGroup()
119                 .addContainerGap()
120                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
121                     .add(layout.createSequentialGroup()
122                         .add(jLabel1)
123                         .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
124                         .add(statusLabelFormat, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE)
125                         .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
126                         .add(statusVarsBrowse))
127                     .add(layout.createSequentialGroup()
128                         .add(wrapCommitMessages)
129                         .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
130                         .add(wrapCharCount, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 55, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
131                     .add(excludeNewFiles)))
132         );
133         layout.setVerticalGroup(
134             layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
135             .add(layout.createSequentialGroup()
136                 .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
137                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
138                     .add(jLabel1)
139                     .add(statusVarsBrowse)
140                     .add(statusLabelFormat, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
141                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
142                 .add(excludeNewFiles)
143                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
144                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
145                     .add(wrapCommitMessages)
146                     .add(wrapCharCount, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
147         );
148     }// </editor-fold>//GEN-END:initComponents
149

150     private void wrapCommitMessagesActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_wrapCommitMessagesActionPerformed
151
refreshComponents();
152     }//GEN-LAST:event_wrapCommitMessagesActionPerformed
153

154     private void statusVarsBrowseActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_statusVarsBrowseActionPerformed
155
List<String JavaDoc> formatVars = new ArrayList<String JavaDoc>();
156         formatVars.add(NbBundle.getMessage(CvsOptionsPanel.class, "LBL_FormatVariable_1"));
157         formatVars.add(NbBundle.getMessage(CvsOptionsPanel.class, "LBL_FormatVariable_2"));
158         formatVars.add(NbBundle.getMessage(CvsOptionsPanel.class, "LBL_FormatVariable_3"));
159         formatVars.add(NbBundle.getMessage(CvsOptionsPanel.class, "LBL_FormatVariable_4"));
160         String JavaDoc newVariable = StringSelector.select(NbBundle.getMessage(CvsOptionsPanel.class, "LBL_FormatVariable_Title"),
161                                                    NbBundle.getMessage(CvsOptionsPanel.class, "LBL_FormatVariable_Prompt"),
162                                                    formatVars);
163         if (newVariable != null) {
164             statusLabelFormat.replaceSelection(newVariable.substring(0, newVariable.lastIndexOf('}') + 1));
165         }
166     }//GEN-LAST:event_statusVarsBrowseActionPerformed
167

168     private void excludeNewFilesActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_excludeNewFilesActionPerformed
169
// TODO add your handling code here:
170
}//GEN-LAST:event_excludeNewFilesActionPerformed
171

172     
173     // Variables declaration - do not modify//GEN-BEGIN:variables
174
private javax.swing.JCheckBox JavaDoc excludeNewFiles;
175     private javax.swing.JLabel JavaDoc jLabel1;
176     private javax.swing.JTextField JavaDoc statusLabelFormat;
177     private javax.swing.JButton JavaDoc statusVarsBrowse;
178     private javax.swing.JTextField JavaDoc wrapCharCount;
179     private javax.swing.JCheckBox JavaDoc wrapCommitMessages;
180     // End of variables declaration//GEN-END:variables
181

182 }
183
Popular Tags