org.netbeans.modules.mercurial.options.PropertiesPanel Maven / Gradle / Ivy
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.netbeans.modules.mercurial.options;
import java.util.prefs.PreferenceChangeEvent;
import java.util.prefs.PreferenceChangeListener;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
import org.netbeans.modules.mercurial.HgModuleConfig;
import org.netbeans.modules.mercurial.options.PropertiesTable;
import org.netbeans.modules.versioning.util.ListenersSupport;
/**
*
* @author Peter Pis
*/
public class PropertiesPanel extends javax.swing.JPanel implements PreferenceChangeListener, TableModelListener {
private static final Object EVENT_SETTINGS_CHANGED = new Object();
private PropertiesTable propertiesTable;
private ListenersSupport listenerSupport = new ListenersSupport(this);
/** Creates new form PropertiesPanel */
public PropertiesPanel() {
initComponents();
}
public javax.swing.JTextArea getTxtAreaValue() {
return txtAreaValue;
}
public javax.swing.JComboBox getComboName() {
return comboName;
}
public javax.swing.JButton getBtnAdd() {
return btnAdd;
}
public javax.swing.JButton getBtnRemove() {
return btnRemove;
}
public void setPropertiesTable(PropertiesTable propertiesTable){
this.propertiesTable = propertiesTable;
}
public void addNotify() {
super.addNotify();
HgModuleConfig.getDefault().getPreferences().addPreferenceChangeListener(this);
propertiesTable.getTableModel().addTableModelListener(this);
listenerSupport.fireVersioningEvent(EVENT_SETTINGS_CHANGED);
txtAreaValue.selectAll();
}
public void removeNotify() {
propertiesTable.getTableModel().removeTableModelListener(this);
HgModuleConfig.getDefault().getPreferences().removePreferenceChangeListener(this);
super.removeNotify();
}
public void preferenceChange(PreferenceChangeEvent evt) {
if (evt.getKey().startsWith(HgModuleConfig.PROP_COMMIT_EXCLUSIONS)) {
propertiesTable.dataChanged();
listenerSupport.fireVersioningEvent(EVENT_SETTINGS_CHANGED);
}
}
public void tableChanged(TableModelEvent e) {
listenerSupport.fireVersioningEvent(EVENT_SETTINGS_CHANGED);
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// //GEN-BEGIN:initComponents
private void initComponents() {
jLabel2 = new javax.swing.JLabel();
jLabel1 = new javax.swing.JLabel();
propsPanel = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
labelForTable = new javax.swing.JLabel();
jLabel2.setLabelFor(comboName);
org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(PropertiesPanel.class, "PropertiesPanel.jLabel2.text")); // NOI18N
jLabel1.setLabelFor(txtAreaValue);
org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(PropertiesPanel.class, "PropertiesPanel.jLabel1.text")); // NOI18N
javax.swing.GroupLayout propsPanelLayout = new javax.swing.GroupLayout(propsPanel);
propsPanel.setLayout(propsPanelLayout);
propsPanelLayout.setHorizontalGroup(
propsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 462, Short.MAX_VALUE)
);
propsPanelLayout.setVerticalGroup(
propsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 99, Short.MAX_VALUE)
);
txtAreaValue.setColumns(20);
txtAreaValue.setRows(5);
jScrollPane1.setViewportView(txtAreaValue);
txtAreaValue.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(PropertiesPanel.class, "ACSD_txtAreaValue")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(btnRemove, org.openide.util.NbBundle.getMessage(PropertiesPanel.class, "PropertiesPanel.btnRemove.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(btnAdd, org.openide.util.NbBundle.getMessage(PropertiesPanel.class, "PropertiesPanel.btnAdd.text")); // NOI18N
btnAdd.setMaximumSize(new java.awt.Dimension(75, 23));
btnAdd.setMinimumSize(new java.awt.Dimension(75, 23));
org.openide.awt.Mnemonics.setLocalizedText(labelForTable, org.openide.util.NbBundle.getMessage(PropertiesPanel.class, "jLabel3.txt")); // NOI18N
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(propsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2)
.addComponent(btnAdd, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(labelForTable)
.addComponent(jLabel1))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(comboName, javax.swing.GroupLayout.Alignment.LEADING, 0, 307, Short.MAX_VALUE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 307, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnRemove)))))
.addContainerGap())
);
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {btnAdd, btnRemove});
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(comboName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel1)
.addGap(99, 99, 99)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnAdd, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btnRemove))
.addGap(26, 26, 26)
.addComponent(labelForTable))
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 25, Short.MAX_VALUE)
.addComponent(propsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
);
btnRemove.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(PropertiesPanel.class, "ACSD_btnRemove")); // NOI18N
btnAdd.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(PropertiesPanel.class, "ACSD_btnAdd")); // NOI18N
}// //GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
final javax.swing.JButton btnAdd = new javax.swing.JButton();
final javax.swing.JButton btnRemove = new javax.swing.JButton();
final javax.swing.JComboBox comboName = new javax.swing.JComboBox();
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JScrollPane jScrollPane1;
public javax.swing.JLabel labelForTable;
public javax.swing.JPanel propsPanel;
final javax.swing.JTextArea txtAreaValue = new javax.swing.JTextArea();
// End of variables declaration//GEN-END:variables
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy