Removed unused ServeAction.
[nbgit.git] / src / org / netbeans / modules / git / ui / properties / PropertiesPanel.java
blob4f82a1628d631a253fe892e682a280d8263258c9
1 /*
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
4 * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
6 * The contents of this file are subject to the terms of either the GNU
7 * General Public License Version 2 only ("GPL") or the Common
8 * Development and Distribution License("CDDL") (collectively, the
9 * "License"). You may not use this file except in compliance with the
10 * License. You can obtain a copy of the License at
11 * http://www.netbeans.org/cddl-gplv2.html
12 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
13 * specific language governing permissions and limitations under the
14 * License. When distributing the software, include this License Header
15 * Notice in each file and include the License file at
16 * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
17 * particular file as subject to the "Classpath" exception as provided
18 * by Sun in the GPL Version 2 section of the License file that
19 * accompanied this code. If applicable, add the following below the
20 * License Header, with the fields enclosed by brackets [] replaced by
21 * your own identifying information:
22 * "Portions Copyrighted [year] [name of copyright owner]"
24 * Contributor(s):
26 * The Original Software is NetBeans. The Initial Developer of the Original
27 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
28 * Microsystems, Inc. All Rights Reserved.
29 * Portions Copyright 2008 Alexander Coles (Ikonoklastik Productions).
31 * If you wish your version of this file to be governed by only the CDDL
32 * or only the GPL Version 2, indicate your decision by adding
33 * "[Contributor] elects to include this software in this distribution
34 * under the [CDDL or GPL Version 2] license." If you do not indicate a
35 * single choice of license, a recipient has the option to distribute
36 * your version of this file under either the CDDL, the GPL Version 2 or
37 * to extend the choice of license to its licensees as provided above.
38 * However, if you add GPL Version 2 code and therefore, elected the GPL
39 * Version 2 license, then the option applies only if the new code is
40 * made subject to such option by the copyright holder.
42 package org.netbeans.modules.git.ui.properties;
44 import java.util.prefs.PreferenceChangeEvent;
45 import java.util.prefs.PreferenceChangeListener;
46 import javax.swing.event.TableModelEvent;
47 import javax.swing.event.TableModelListener;
48 import org.netbeans.modules.git.GitModuleConfig;
49 import org.netbeans.modules.versioning.util.ListenersSupport;
51 /**
53 * @author Peter Pis
55 public class PropertiesPanel extends javax.swing.JPanel implements PreferenceChangeListener, TableModelListener {
57 private static final Object EVENT_SETTINGS_CHANGED = new Object();
58 private PropertiesTable propertiesTable;
59 private ListenersSupport listenerSupport = new ListenersSupport(this);
61 /** Creates new form PropertiesPanel */
62 public PropertiesPanel() {
63 initComponents();
66 public javax.swing.JTextArea getTxtAreaValue() {
67 return txtAreaValue;
70 public void setPropertiesTable(PropertiesTable propertiesTable){
71 this.propertiesTable = propertiesTable;
74 @Override
75 public void addNotify() {
76 super.addNotify();
77 GitModuleConfig.getDefault().getPreferences().addPreferenceChangeListener(this);
78 propertiesTable.getTableModel().addTableModelListener(this);
79 listenerSupport.fireVersioningEvent(EVENT_SETTINGS_CHANGED);
80 txtAreaValue.selectAll();
83 @Override
84 public void removeNotify() {
85 propertiesTable.getTableModel().removeTableModelListener(this);
86 GitModuleConfig.getDefault().getPreferences().removePreferenceChangeListener(this);
87 super.removeNotify();
90 public void preferenceChange(PreferenceChangeEvent evt) {
91 if (evt.getKey().startsWith(GitModuleConfig.PROP_COMMIT_EXCLUSIONS)) {
92 propertiesTable.dataChanged();
93 listenerSupport.fireVersioningEvent(EVENT_SETTINGS_CHANGED);
97 public void tableChanged(TableModelEvent e) {
98 listenerSupport.fireVersioningEvent(EVENT_SETTINGS_CHANGED);
101 /** This method is called from within the constructor to
102 * initialize the form.
103 * WARNING: Do NOT modify this code. The content of this method is
104 * always regenerated by the Form Editor.
106 // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
107 private void initComponents() {
109 jLabel1 = new javax.swing.JLabel();
110 propsPanel = new javax.swing.JPanel();
111 jScrollPane1 = new javax.swing.JScrollPane();
112 labelForTable = new javax.swing.JLabel();
114 jLabel1.setLabelFor(txtAreaValue);
115 org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(PropertiesPanel.class, "PropertiesPanel.jLabel1.text")); // NOI18N
117 org.jdesktop.layout.GroupLayout propsPanelLayout = new org.jdesktop.layout.GroupLayout(propsPanel);
118 propsPanel.setLayout(propsPanelLayout);
119 propsPanelLayout.setHorizontalGroup(
120 propsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
121 .add(0, 460, Short.MAX_VALUE)
123 propsPanelLayout.setVerticalGroup(
124 propsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
125 .add(0, 111, Short.MAX_VALUE)
128 txtAreaValue.setColumns(20);
129 txtAreaValue.setRows(1);
130 jScrollPane1.setViewportView(txtAreaValue);
131 txtAreaValue.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(PropertiesPanel.class, "ACSD_txtAreaValue")); // NOI18N
133 org.openide.awt.Mnemonics.setLocalizedText(labelForTable, org.openide.util.NbBundle.getMessage(PropertiesPanel.class, "jLabel3.txt")); // NOI18N
135 org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
136 this.setLayout(layout);
137 layout.setHorizontalGroup(
138 layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
139 .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
140 .addContainerGap()
141 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
142 .add(org.jdesktop.layout.GroupLayout.LEADING, jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 460, Short.MAX_VALUE)
143 .add(org.jdesktop.layout.GroupLayout.LEADING, labelForTable)
144 .add(org.jdesktop.layout.GroupLayout.LEADING, jLabel1)
145 .add(org.jdesktop.layout.GroupLayout.LEADING, propsPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
146 .addContainerGap())
148 layout.setVerticalGroup(
149 layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
150 .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
151 .addContainerGap()
152 .add(labelForTable)
153 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
154 .add(propsPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
155 .add(22, 22, 22)
156 .add(jLabel1)
157 .add(18, 18, 18)
158 .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 32, Short.MAX_VALUE)
159 .addContainerGap())
161 }// </editor-fold>//GEN-END:initComponents
164 // Variables declaration - do not modify//GEN-BEGIN:variables
165 private javax.swing.JLabel jLabel1;
166 private javax.swing.JScrollPane jScrollPane1;
167 public javax.swing.JLabel labelForTable;
168 public javax.swing.JPanel propsPanel;
169 final javax.swing.JTextArea txtAreaValue = new javax.swing.JTextArea();
170 // End of variables declaration//GEN-END:variables