|
What this is
Other links
The source code
/*
* Sun Public License Notice
*
* The contents of this file are subject to the Sun Public License
* Version 1.0 (the "License"). You may not use this file except in
* compliance with the License. A copy of the License is available at
* http://www.sun.com/
*
* The Original Code is NetBeans. The Initial Developer of the Original
* Code is Sun Microsystems, Inc. Portions Copyright 1997-2004 Sun
* Microsystems, Inc. All Rights Reserved.
*/
package org.netbeans.modules.vcs.advanced.conditioned;
import org.openide.explorer.propertysheet.editors.EnhancedCustomPropertyEditor;
import org.openide.util.NbBundle;
/**
* The editor of pair of conditions.
*
* @author Martin Entlicher
*/
public class IfUnlessConditionPanel extends javax.swing.JPanel implements EnhancedCustomPropertyEditor {
private IfUnlessCondition iuc;
/** Creates new form IfUnlessConditionPanel */
public IfUnlessConditionPanel(IfUnlessCondition iuc, String[] possibleConditionNames) {
this.iuc = iuc;
initComponents();
fillPossibleConditions(possibleConditionNames);
ifComboBox.setSelectedItem(iuc.getIf());
unlessComboBox.setSelectedItem(iuc.getUnless());
}
/** 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.
*/
private void initComponents() {//GEN-BEGIN:initComponents
java.awt.GridBagConstraints gridBagConstraints;
infoLabel = new javax.swing.JLabel();
jPanel1 = new javax.swing.JPanel();
ifLabel = new javax.swing.JLabel();
ifComboBox = new javax.swing.JComboBox();
unlessLabel = new javax.swing.JLabel();
unlessComboBox = new javax.swing.JComboBox();
setLayout(new java.awt.GridBagLayout());
getAccessibleContext().setAccessibleName(NbBundle.getBundle("org/netbeans/modules/vcs/advanced/conditioned/Bundle").getString("ACS_IfUnlessConditonPanel"));
getAccessibleContext().setAccessibleDescription(NbBundle.getBundle("org/netbeans/modules/vcs/advanced/conditioned/Bundle").getString("ACSD_IfUnlessConditionPanel"));
infoLabel.setText(org.openide.util.NbBundle.getMessage(IfUnlessConditionPanel.class, "IfUnlessConditionPanel.title"));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.insets = new java.awt.Insets(12, 12, 0, 11);
add(infoLabel, gridBagConstraints);
jPanel1.setLayout(new java.awt.GridBagLayout());
ifLabel.setDisplayedMnemonic(NbBundle.getBundle("org/netbeans/modules/vcs/advanced/conditioned/Bundle").getString("ACS_IfUnlessConditionPanel.ifLabel_mnc").charAt(0));
ifLabel.setLabelFor(ifComboBox);
ifLabel.setText(org.openide.util.NbBundle.getMessage(IfUnlessConditionPanel.class, "IfUnlessConditionPanel.if"));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 6);
jPanel1.add(ifLabel, gridBagConstraints);
ifLabel.getAccessibleContext().setAccessibleDescription(NbBundle.getBundle("org/netbeans/modules/vcs/advanced/conditioned/Bundle").getString("ACSD_IfUnlessConditionPanel.ifLabel"));
ifComboBox.setEditable(true);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.weightx = 1.0;
jPanel1.add(ifComboBox, gridBagConstraints);
ifComboBox.getAccessibleContext().setAccessibleName(NbBundle.getBundle("org/netbeans/modules/vcs/advanced/conditioned/Bundle").getString("ACS_IfUnlessConditionPanel.ifCB"));
ifComboBox.getAccessibleContext().setAccessibleDescription(NbBundle.getBundle("org/netbeans/modules/vcs/advanced/conditioned/Bundle").getString("ACSD_IfUnlessConditionPanel.ifCB"));
unlessLabel.setDisplayedMnemonic(NbBundle.getBundle("org/netbeans/modules/vcs/advanced/conditioned/Bundle").getString("ACS_IfUnlessConditionPanel.unlessLabel_mnc").charAt(0));
unlessLabel.setLabelFor(unlessComboBox);
unlessLabel.setText(org.openide.util.NbBundle.getMessage(IfUnlessConditionPanel.class, "IfUnlessConditionPanel.ifNot"));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridy = 1;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 6);
jPanel1.add(unlessLabel, gridBagConstraints);
unlessLabel.getAccessibleContext().setAccessibleDescription(NbBundle.getBundle("org/netbeans/modules/vcs/advanced/conditioned/Bundle").getString("ACSD_IfUnlessConditionPanel.unlessLabel"));
unlessComboBox.setEditable(true);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridy = 1;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.weightx = 1.0;
jPanel1.add(unlessComboBox, gridBagConstraints);
unlessComboBox.getAccessibleContext().setAccessibleName(NbBundle.getBundle("org/netbeans/modules/vcs/advanced/conditioned/Bundle").getString("ACS_IfUnlessConditionPanel.unlessCB"));
unlessComboBox.getAccessibleContext().setAccessibleDescription(NbBundle.getBundle("org/netbeans/modules/vcs/advanced/conditioned/Bundle").getString("ACSD_IfUnlessConditionPanel.unlessCB"));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridy = 1;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.insets = new java.awt.Insets(12, 12, 11, 11);
add(jPanel1, gridBagConstraints);
}//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JComboBox ifComboBox;
private javax.swing.JLabel ifLabel;
private javax.swing.JLabel infoLabel;
private javax.swing.JPanel jPanel1;
private javax.swing.JComboBox unlessComboBox;
private javax.swing.JLabel unlessLabel;
// End of variables declaration//GEN-END:variables
private void fillPossibleConditions(String[] possibleConditionNames) {
infoLabel.setVisible(false);
for (int i = 0; i < possibleConditionNames.length; i++) {
ifComboBox.addItem(possibleConditionNames[i]);
unlessComboBox.addItem(possibleConditionNames[i]);
}
}
public IfUnlessCondition getCondition() {
iuc.setIf((String) ifComboBox.getSelectedItem());
iuc.setUnless((String) unlessComboBox.getSelectedItem());
return iuc;
}
public Object getPropertyValue() throws IllegalStateException {
return getCondition();
}
}
|
| ... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.