1 19 package org.netbeans.modules.subversion.ui.properties; 20 21 import java.util.prefs.PreferenceChangeEvent ; 22 import java.util.prefs.PreferenceChangeListener ; 23 import javax.swing.event.TableModelEvent ; 24 import javax.swing.event.TableModelListener ; 25 import org.netbeans.modules.subversion.SvnModuleConfig; 26 import org.netbeans.modules.versioning.util.ListenersSupport; 27 28 32 public class PropertiesPanel extends javax.swing.JPanel implements PreferenceChangeListener , TableModelListener { 33 34 private static final Object EVENT_SETTINGS_CHANGED = new Object (); 35 private PropertiesTable propertiesTable; 36 private ListenersSupport listenerSupport = new ListenersSupport(this); 37 38 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 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 e) { 69 listenerSupport.fireVersioningEvent(EVENT_SETTINGS_CHANGED); 70 } 71 72 77 private void initComponents() { 79 80 jLabel2 = new javax.swing.JLabel (); 81 jLabel1 = new javax.swing.JLabel (); 82 propsPanel = new javax.swing.JPanel (); 83 jScrollPane1 = new javax.swing.JScrollPane (); 84 jSeparator1 = new javax.swing.JSeparator (); 85 86 jLabel2.setText(org.openide.util.NbBundle.getMessage(PropertiesPanel.class, "PropertiesPanel.jLabel2.text")); 88 jLabel1.setText(org.openide.util.NbBundle.getMessage(PropertiesPanel.class, "PropertiesPanel.jLabel1.text")); 90 btnBrowse.setText(org.openide.util.NbBundle.getMessage(PropertiesPanel.class, "PropertiesPanel.btnBrowse.text")); 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")); btnRefresh.setMaximumSize(new java.awt.Dimension (75, 23)); 109 btnRefresh.setMinimumSize(new java.awt.Dimension (75, 23)); 110 111 btnRemove.setText(org.openide.util.NbBundle.getMessage(PropertiesPanel.class, "PropertiesPanel.btnRemove.text")); 113 btnAdd.setText(org.openide.util.NbBundle.getMessage(PropertiesPanel.class, "PropertiesPanel.btnAdd.text")); btnAdd.setMaximumSize(new java.awt.Dimension (75, 23)); 115 btnAdd.setMinimumSize(new java.awt.Dimension (75, 23)); 116 117 cbxRecursively.setText(org.openide.util.NbBundle.getMessage(PropertiesPanel.class, "PropertiesPanel.cbxRecursively.text")); cbxRecursively.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); 119 cbxRecursively.setMargin(new java.awt.Insets (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 [] {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 } 181 182 final javax.swing.JButton btnAdd = new javax.swing.JButton (); 184 final javax.swing.JButton btnBrowse = new javax.swing.JButton (); 185 final javax.swing.JButton btnRefresh = new javax.swing.JButton (); 186 final javax.swing.JButton btnRemove = new javax.swing.JButton (); 187 final javax.swing.JCheckBox cbxRecursively = new javax.swing.JCheckBox (); 188 final javax.swing.JComboBox comboName = new javax.swing.JComboBox (); 189 private javax.swing.JLabel jLabel1; 190 private javax.swing.JLabel jLabel2; 191 private javax.swing.JScrollPane jScrollPane1; 192 private javax.swing.JSeparator jSeparator1; 193 public javax.swing.JPanel propsPanel; 194 final javax.swing.JTextArea txtAreaValue = new javax.swing.JTextArea (); 195 197 } 198 | Popular Tags |