|
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-2000 Sun * Microsystems, Inc. All Rights Reserved. */ package org.netbeans.modules.javacvs.customizers; import java.util.*; import org.openide.util.*; import org.netbeans.lib.cvsclient.command.status.StatusCommand; import org.netbeans.lib.cvsclient.command.Command; import org.netbeans.modules.javacvs.FsStatus; import java.beans.Customizer; import javax.accessibility.*; /** * Customizer for the CvsStatus command. * @author mkleint * @version */ public class StatusParamInput extends javax.swing.JPanel implements Customizer { /** Creates new form StatusParamInput */ private FsStatus statusCommand; private List commandList; private CustomizerPropChangeSupport support; public StatusParamInput() { initComponents(); initAccessibility(); if (support == null) { support = new CustomizerPropChangeSupport(this); } cbLocal.setMnemonic(bundle.getString("StatusParamInput.cbLocal.mnemonic").charAt(0)); //NOI18N cbIncludeTags.setMnemonic(bundle.getString("StatusParamInput.cbIncludeTags.mnemonic").charAt(0)); //NOI18N java.awt.event.ActionListener actionList = new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { setData(); } }; cbIncludeTags.addActionListener(actionList); cbLocal.addActionListener(actionList); } /** 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 FormEditor. */ private void initComponents() {//GEN-BEGIN:initComponents java.awt.GridBagConstraints gridBagConstraints; cbIncludeTags = new javax.swing.JCheckBox(); cbLocal = new javax.swing.JCheckBox(); setLayout(new java.awt.GridBagLayout()); cbIncludeTags.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/javacvs/customizers/Bundle").getString("StatusParamInput.cbIncludeTags.text")); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(12, 12, 0, 11); add(cbIncludeTags, gridBagConstraints); cbLocal.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/javacvs/customizers/Bundle").getString("StatusParamInput.cbLocal.text")); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 12, 11, 11); add(cbLocal, gridBagConstraints); }//GEN-END:initComponents protected void setData() { if (commandList != null) { Iterator it = commandList.iterator(); FsStatus fsCheck = null; while (it.hasNext()) { fsCheck = (FsStatus)it.next(); setData(fsCheck); } if (fsCheck != null) { support.firePropertyChange(fsCheck); } } else { setData(statusCommand); support.firePropertyChange(statusCommand); } } protected void setData(FsStatus command) { if (command != null) { command.setRecursive(!cbLocal.isSelected()); command.setIncludeTags(cbIncludeTags.isSelected()); } } protected void getData(FsStatus command) { cbLocal.setSelected(!command.isRecursive()); cbIncludeTags.setSelected(command.isIncludeTags()); support.firePropertyChange(command); } /** * The Customizer's setObject method. However the customizer accepts both the * FsStatus instance and a list of FsStatus instances. In case of a list, * it loads switches from the first comand in row, however sets all the instances. */ public void setObject(java.lang.Object obj) { if (obj instanceof FsStatus) { statusCommand = (FsStatus)obj; getData(statusCommand); commandList = null; } if (obj instanceof List) { commandList = (List)obj; statusCommand = null; if (commandList.size() > 0) { FsStatus add = (FsStatus)commandList.get(0); getData(add); } } } public void removePropertyChangeListener(java.beans.PropertyChangeListener propertyChangeListener) { if (support == null) { support = new CustomizerPropChangeSupport(this); } support.removePropertyChangeListener(propertyChangeListener); } public void addPropertyChangeListener(java.beans.PropertyChangeListener propertyChangeListener) { if (support == null) { support = new CustomizerPropChangeSupport(this); } support.addPropertyChangeListener(propertyChangeListener); } protected void firePropertyChange(java.lang.String str, java.lang.Object obj, java.lang.Object obj2) { if (support == null) { support = new CustomizerPropChangeSupport(this); } support.firePropertyChange(str, obj, obj2); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JCheckBox cbIncludeTags; private javax.swing.JCheckBox cbLocal; // End of variables declaration//GEN-END:variables private static final java.util.ResourceBundle bundle = NbBundle.getBundle(StatusParamInput.class); //NOI18N private void initAccessibility() { AccessibleContext context = this.getAccessibleContext(); context.setAccessibleDescription(bundle.getString("ACSD_StatusParamInput")); context = cbLocal.getAccessibleContext(); context.setAccessibleDescription(bundle.getString("ACSD_StatusParamInput.cbLocal")); context = cbIncludeTags.getAccessibleContext(); context.setAccessibleDescription(bundle.getString("ACSD_StatusParamInput.cbIncludeTags")); } } |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 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.