KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > subversion > ui > properties > PropertiesPanel


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 package org.netbeans.modules.subversion.ui.properties;
20
21 import java.util.prefs.PreferenceChangeEvent JavaDoc;
22 import java.util.prefs.PreferenceChangeListener JavaDoc;
23 import javax.swing.event.TableModelEvent JavaDoc;
24 import javax.swing.event.TableModelListener JavaDoc;
25 import org.netbeans.modules.subversion.SvnModuleConfig;
26 import org.netbeans.modules.versioning.util.ListenersSupport;
27
28 /**
29  *
30  * @author Peter Pis
31  */

32 public class PropertiesPanel extends javax.swing.JPanel JavaDoc implements PreferenceChangeListener JavaDoc, TableModelListener JavaDoc {
33
34     private static final Object JavaDoc EVENT_SETTINGS_CHANGED = new Object JavaDoc();
35     private PropertiesTable propertiesTable;
36     private ListenersSupport listenerSupport = new ListenersSupport(this);
37     
38     /** Creates new form PropertiesPanel */
39     public PropertiesPanel() {
40         initComponents();
41     }
42     
43     void setPropertiesTable(PropertiesTable propertiesTable){
44         this.propertiesTable = propertiesTable;
45     }
46     
47     public void addNotify() {
48         super.addNotify();
49         SvnModuleConfig.getDefault().getPreferences().addPreferenceChangeListener(this);
50         propertiesTable.getTableModel().addTableModelListener(this);
51         listenerSupport.fireVersioningEvent(EVENT_SETTINGS_CHANGED);
52         txtAreaValue.selectAll();
53     }
54
55     public void removeNotify() {
56         propertiesTable.getTableModel().removeTableModelListener(this);
57         SvnModuleConfig.getDefault().getPreferences().removePreferenceChangeListener(this);
58         super.removeNotify();
59     }
60     
61     public void preferenceChange(PreferenceChangeEvent JavaDoc evt) {
62         if (evt.getKey().startsWith(SvnModuleConfig.PROP_COMMIT_EXCLUSIONS)) {
63             propertiesTable.dataChanged();
64             listenerSupport.fireVersioningEvent(EVENT_SETTINGS_CHANGED);
65         }
66     }
67
68     public void tableChanged(TableModelEvent JavaDoc e) {
69         listenerSupport.fireVersioningEvent(EVENT_SETTINGS_CHANGED);
70     }
71     
72     /** This method is called from within the constructor to
73      * initialize the form.
74      * WARNING: Do NOT modify this code. The content of this method is
75      * always regenerated by the Form Editor.
76      */

77     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
78
private void initComponents() {
79
80         jLabel2 = new javax.swing.JLabel JavaDoc();
81         jLabel1 = new javax.swing.JLabel JavaDoc();
82         propsPanel = new javax.swing.JPanel JavaDoc();
83         jScrollPane1 = new javax.swing.JScrollPane JavaDoc();
84         jSeparator1 = new javax.swing.JSeparator JavaDoc();
85
86         jLabel2.setText(org.openide.util.NbBundle.getMessage(PropertiesPanel.class, "PropertiesPanel.jLabel2.text")); // NOI18N
87

88         jLabel1.setText(org.openide.util.NbBundle.getMessage(PropertiesPanel.class, "PropertiesPanel.jLabel1.text")); // NOI18N
89

90         btnBrowse.setText(org.openide.util.NbBundle.getMessage(PropertiesPanel.class, "PropertiesPanel.btnBrowse.text")); // NOI18N
91

92         org.jdesktop.layout.GroupLayout propsPanelLayout = new org.jdesktop.layout.GroupLayout(propsPanel);
93         propsPanel.setLayout(propsPanelLayout);
94         propsPanelLayout.setHorizontalGroup(
95             propsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
96             .add(0, 421, Short.MAX_VALUE)
97         );
98         propsPanelLayout.setVerticalGroup(
99             propsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
100             .add(0, 101, Short.MAX_VALUE)
101         );
102
103         txtAreaValue.setColumns(20);
104         txtAreaValue.setRows(5);
105         jScrollPane1.setViewportView(txtAreaValue);
106
107         btnRefresh.setText(org.openide.util.NbBundle.getMessage(PropertiesPanel.class, "PropertiesPanel.btnRefresh.text")); // NOI18N
108
btnRefresh.setMaximumSize(new java.awt.Dimension JavaDoc(75, 23));
109         btnRefresh.setMinimumSize(new java.awt.Dimension JavaDoc(75, 23));
110
111         btnRemove.setText(org.openide.util.NbBundle.getMessage(PropertiesPanel.class, "PropertiesPanel.btnRemove.text")); // NOI18N
112

113         btnAdd.setText(org.openide.util.NbBundle.getMessage(PropertiesPanel.class, "PropertiesPanel.btnAdd.text")); // NOI18N
114
btnAdd.setMaximumSize(new java.awt.Dimension JavaDoc(75, 23));
115         btnAdd.setMinimumSize(new java.awt.Dimension JavaDoc(75, 23));
116
117         cbxRecursively.setText(org.openide.util.NbBundle.getMessage(PropertiesPanel.class, "PropertiesPanel.cbxRecursively.text")); // NOI18N
118
cbxRecursively.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
119         cbxRecursively.setMargin(new java.awt.Insets JavaDoc(0, 0, 0, 0));
120
121         org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
122         this.setLayout(layout);
123         layout.setHorizontalGroup(
124             layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
125             .add(layout.createSequentialGroup()
126                 .addContainerGap()
127                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
128                     .add(jSeparator1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 421, Short.MAX_VALUE)
129                     .add(jLabel1)
130                     .add(layout.createSequentialGroup()
131                         .add(jLabel2)
132                         .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
133                         .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
134                             .add(org.jdesktop.layout.GroupLayout.LEADING, comboName, 0, 315, Short.MAX_VALUE)
135                             .add(btnBrowse)
136                             .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup()
137                                 .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 315, Short.MAX_VALUE)
138                                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)))
139                         .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED))
140                     .add(propsPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
141                     .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
142                         .add(btnAdd, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
143                         .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
144                         .add(cbxRecursively)
145                         .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 73, Short.MAX_VALUE)
146                         .add(btnRemove)
147                         .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
148                         .add(btnRefresh, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
149                 .addContainerGap())
150         );
151
152         layout.linkSize(new java.awt.Component JavaDoc[] {btnAdd, btnBrowse, btnRefresh, btnRemove}, org.jdesktop.layout.GroupLayout.HORIZONTAL);
153
154         layout.setVerticalGroup(
155             layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
156             .add(layout.createSequentialGroup()
157                 .addContainerGap()
158                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
159                     .add(jLabel2)
160                     .add(comboName, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
161                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
162                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
163                     .add(jLabel1)
164                     .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
165                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
166                 .add(btnBrowse)
167                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
168                 .add(jSeparator1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 10, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
169                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
170                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
171                     .add(btnRefresh, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
172                     .add(btnRemove)
173                     .add(btnAdd, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
174                     .add(cbxRecursively))
175                 .add(14, 14, 14)
176                 .add(propsPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
177                 .addContainerGap())
178         );
179     }// </editor-fold>//GEN-END:initComponents
180

181     
182     // Variables declaration - do not modify//GEN-BEGIN:variables
183
final javax.swing.JButton JavaDoc btnAdd = new javax.swing.JButton JavaDoc();
184     final javax.swing.JButton JavaDoc btnBrowse = new javax.swing.JButton JavaDoc();
185     final javax.swing.JButton JavaDoc btnRefresh = new javax.swing.JButton JavaDoc();
186     final javax.swing.JButton JavaDoc btnRemove = new javax.swing.JButton JavaDoc();
187     final javax.swing.JCheckBox JavaDoc cbxRecursively = new javax.swing.JCheckBox JavaDoc();
188     final javax.swing.JComboBox JavaDoc comboName = new javax.swing.JComboBox JavaDoc();
189     private javax.swing.JLabel JavaDoc jLabel1;
190     private javax.swing.JLabel JavaDoc jLabel2;
191     private javax.swing.JScrollPane JavaDoc jScrollPane1;
192     private javax.swing.JSeparator JavaDoc jSeparator1;
193     public javax.swing.JPanel JavaDoc propsPanel;
194     final javax.swing.JTextArea JavaDoc txtAreaValue = new javax.swing.JTextArea JavaDoc();
195     // End of variables declaration//GEN-END:variables
196

197 }
198
Popular Tags