alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

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;

/**
 * Represents the Diff command switches in GUI.
 * @author  mkleint
 */

import java.util.*;
import javax.swing.*;
import org.openide.util.NbBundle;

import org.netbeans.modules.javacvs.FsDiff;
import org.netbeans.lib.cvsclient.command.diff.*;
import org.netbeans.lib.cvsclient.command.*;
import java.beans.Customizer;
import javax.accessibility.*;

public class DiffParamInput extends javax.swing.JPanel implements Customizer {
    
    private static final String K_NONE = NbBundle.getBundle(DiffParamInput.class).getString("DiffParamInput.NoSubstitution"); //NOI18N
    private static final String K_BINARY = NbBundle.getBundle(DiffParamInput.class).getString("DiffParamInput.BinarySubst"); //NOI18N
    private static final String K_KEYWORD_VALUE = NbBundle.getBundle(DiffParamInput.class).getString("DiffParamInput.KeywordValueSubst"); //NOI18N
    private static final String K_KEYWORD_VALUE_LOCKER = NbBundle.getBundle(DiffParamInput.class).getString("DiffParamInput.KeywordValueLockerSubst"); //NOI18N
    private static final String K_KEYWORD = NbBundle.getBundle(DiffParamInput.class).getString("DiffParamInput.Keyword"); //NOI18N
    private static final String K_VALUE = NbBundle.getBundle(DiffParamInput.class).getString("DiffParamInput.Value"); //NOI18N
    private static final String K_OLD = NbBundle.getBundle(DiffParamInput.class).getString("DiffParamInput.Old"); //NOI18N
    
    private Object[] comboValues = new Object[] { K_NONE, K_BINARY, K_KEYWORD_VALUE,
    K_KEYWORD_VALUE_LOCKER, K_KEYWORD, K_VALUE, K_OLD} ;
    
    private String[] cvsValues = new String[] { null, "b", "kv", "kvl", "k", "v", "o" }; //NOI18N
    
    private FsDiff diffCommand;
    private List commandList;
    private CustomizerPropChangeSupport support;
    
    private boolean performNoSettingOfData;
    
    /** Creates new form DiffParamInput */
    public DiffParamInput() {
        initComponents();
        initAccessibility();
        if (support == null) {
            support = new CustomizerPropChangeSupport(this);
        }
        cbLocal.setMnemonic(bundle.getString("DiffParamInput.cbLocal.mnemonic").charAt(0)); //NOI18N
        cbUnified.setMnemonic(bundle.getString("DiffParamInput.cbUnified.mnemonic").charAt(0)); //NOI18N
        cbContext.setMnemonic(bundle.getString("DiffParamInput.cbContext.mnemonic").charAt(0)); //NOI18N
        cbIgnoreAll.setMnemonic(bundle.getString("DiffParamInput.cbIgnoreAll.mnemonic").charAt(0)); //NOI18N
        cbIgnoreBlank.setMnemonic(bundle.getString("DiffParamInput.cbIgnoreBlank.mnemonic").charAt(0)); //NOI18N
        cbIgnoreCase.setMnemonic(bundle.getString("DiffParamInput.cbIgnoreCase.mnemonic").charAt(0)); //NOI18N
        cbIgnoreSpaceChange.setMnemonic(bundle.getString("DiffParamInput.cbIgnoreSpaceChange.mnemonic").charAt(0)); //NOI18N
        lblDate1.setDisplayedMnemonic(bundle.getString("DiffParamInput.lblDate1.mnemonic").charAt(0)); //NOI18N
        lblDate1.setLabelFor(txDate1);
        lblDate2.setDisplayedMnemonic(bundle.getString("DiffParamInput.lblDate2.mnemonic").charAt(0)); //NOI18N
        lblDate2.setLabelFor(txDate2);
        lblKeyword.setDisplayedMnemonic(bundle.getString("DiffParamInput.lblKeyword.mnemonic").charAt(0)); //NOI18N
        lblKeyword.setLabelFor(comKeyword);
        lblRevision1.setDisplayedMnemonic(bundle.getString("DiffParamInput.lblRevision1.mnemonic").charAt(0)); //NOI18N
        lblRevision1.setLabelFor(txRevision1);
        lblRevision2.setDisplayedMnemonic(bundle.getString("DiffParamInput.lblRevision2.mnemonic").charAt(0)); //NOI18N
        lblRevision2.setLabelFor(txRevision2);
        
        comKeyword.setModel(new DefaultComboBoxModel(comboValues));
        comKeyword.setSelectedIndex(0);
        java.awt.event.ActionListener actionList = new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                setData();
            }
        };
        cbLocal.addActionListener(actionList);
        cbUnified.addActionListener(actionList);
        cbContext.addActionListener(actionList);
        cbIgnoreAll.addActionListener(actionList);
        cbIgnoreBlank.addActionListener(actionList);
        cbIgnoreCase.addActionListener(actionList);
        cbIgnoreSpaceChange.addActionListener(actionList);
        txDate1.addActionListener(actionList);
        txDate2.addActionListener(actionList);
        txRevision1.addActionListener(actionList);
        txRevision2.addActionListener(actionList);
        comKeyword.addActionListener(actionList);
        
        java.awt.event.FocusAdapter focusList = new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                setData();
            }
        };
        javax.swing.event.DocumentListener docList = new javax.swing.event.DocumentListener() {
                public void insertUpdate(javax.swing.event.DocumentEvent e) {
                    if (!performNoSettingOfData) {
                        setData();
                    }
                }
                public void removeUpdate(javax.swing.event.DocumentEvent e) {
                    if (!performNoSettingOfData) {
                        setData();
                    }

                }
                public void changedUpdate(javax.swing.event.DocumentEvent e) {
                    if (!performNoSettingOfData) {
                        setData();
                    }
                }
        };
  
        txDate1.addFocusListener(focusList);
        txDate2.addFocusListener(focusList);
        txRevision1.addFocusListener(focusList);
        txRevision2.addFocusListener(focusList);
        txDate1.getDocument().addDocumentListener(docList);
        txDate2.getDocument().addDocumentListener(docList);
        txRevision1.getDocument().addDocumentListener(docList);
        txRevision2.getDocument().addDocumentListener(docList);
        
        performNoSettingOfData = false;
    }
    
    /** 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;

        cbLocal = new javax.swing.JCheckBox();
        lblKeyword = new javax.swing.JLabel();
        comKeyword = new javax.swing.JComboBox();
        jPanel1 = new javax.swing.JPanel();
        lblRevision1 = new javax.swing.JLabel();
        txRevision1 = new javax.swing.JTextField();
        lblDate1 = new javax.swing.JLabel();
        txDate1 = new javax.swing.JTextField();
        lblRevision2 = new javax.swing.JLabel();
        txRevision2 = new javax.swing.JTextField();
        lblDate2 = new javax.swing.JLabel();
        txDate2 = new javax.swing.JTextField();
        jPanel2 = new javax.swing.JPanel();
        cbIgnoreAll = new javax.swing.JCheckBox();
        cbIgnoreBlank = new javax.swing.JCheckBox();
        cbIgnoreCase = new javax.swing.JCheckBox();
        cbIgnoreSpaceChange = new javax.swing.JCheckBox();
        cbContext = new javax.swing.JCheckBox();
        cbUnified = new javax.swing.JCheckBox();

        setLayout(new java.awt.GridBagLayout());

        cbLocal.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/javacvs/customizers/Bundle").getString("DiffParamInput.cbLocal.text"));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(12, 12, 0, 11);
        add(cbLocal, gridBagConstraints);

        lblKeyword.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/javacvs/customizers/Bundle").getString("DiffParamInput.lblKeyword.text"));
        lblKeyword.setLabelFor(comKeyword);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(12, 12, 0, 0);
        add(lblKeyword, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.weightx = 0.5;
        gridBagConstraints.insets = new java.awt.Insets(12, 12, 0, 11);
        add(comKeyword, gridBagConstraints);

        jPanel1.setLayout(new java.awt.GridBagLayout());

        lblRevision1.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/javacvs/customizers/Bundle").getString("DiffParamInput.lblRevision1.text"));
        lblRevision1.setLabelFor(txRevision1);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        jPanel1.add(lblRevision1, gridBagConstraints);

        txRevision1.setColumns(8);
        txRevision1.setPreferredSize(new java.awt.Dimension(88, 20));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.ipadx = 30;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 0);
        jPanel1.add(txRevision1, gridBagConstraints);

        lblDate1.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/javacvs/customizers/Bundle").getString("DiffParamInput.lblDate1.text"));
        lblDate1.setLabelFor(txDate1);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 2;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(0, 24, 0, 0);
        jPanel1.add(lblDate1, gridBagConstraints);

        txDate1.setToolTipText(java.util.ResourceBundle.getBundle("org/netbeans/modules/javacvs/customizers/Bundle").getString("DiffParamInput.txDate.tooltip"));
        txDate1.setColumns(8);
        txDate1.setPreferredSize(new java.awt.Dimension(88, 20));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 3;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.ipadx = 30;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 0);
        jPanel1.add(txDate1, gridBagConstraints);

        lblRevision2.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/javacvs/customizers/Bundle").getString("DiffParamInput.lblRevision2.text"));
        lblRevision2.setLabelFor(txRevision2);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(5, 0, 0, 0);
        jPanel1.add(lblRevision2, gridBagConstraints);

        txRevision2.setColumns(8);
        txRevision2.setPreferredSize(new java.awt.Dimension(88, 20));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.ipadx = 30;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(5, 12, 0, 0);
        jPanel1.add(txRevision2, gridBagConstraints);

        lblDate2.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/javacvs/customizers/Bundle").getString("DiffParamInput.lblDate2.text"));
        lblDate2.setLabelFor(txDate2);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 2;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(5, 24, 0, 0);
        jPanel1.add(lblDate2, gridBagConstraints);

        txDate2.setToolTipText(java.util.ResourceBundle.getBundle("org/netbeans/modules/javacvs/customizers/Bundle").getString("DiffParamInput.txDate.tooltip"));
        txDate2.setColumns(8);
        txDate2.setPreferredSize(new java.awt.Dimension(88, 20));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 3;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.ipadx = 30;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 12, 0, 0);
        jPanel1.add(txDate2, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
        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(jPanel1, gridBagConstraints);

        jPanel2.setLayout(new java.awt.GridBagLayout());

        cbIgnoreAll.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/javacvs/customizers/Bundle").getString("DiffParamInput.cbIgnoreAll.text"));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(12, 12, 0, 0);
        jPanel2.add(cbIgnoreAll, gridBagConstraints);

        cbIgnoreBlank.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/javacvs/customizers/Bundle").getString("DiffParamInput.cbIgnoreBlank.text"));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(12, 12, 0, 11);
        jPanel2.add(cbIgnoreBlank, gridBagConstraints);

        cbIgnoreCase.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/javacvs/customizers/Bundle").getString("DiffParamInput.cbIgnoreCase.text"));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 0);
        jPanel2.add(cbIgnoreCase, gridBagConstraints);

        cbIgnoreSpaceChange.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/javacvs/customizers/Bundle").getString("DiffParamInput.cbIgnoreSpaceChange.text"));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 11);
        jPanel2.add(cbIgnoreSpaceChange, gridBagConstraints);

        cbContext.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/javacvs/customizers/Bundle").getString("DiffParamInput.cbContext.text"));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(0, 12, 11, 0);
        jPanel2.add(cbContext, gridBagConstraints);

        cbUnified.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/javacvs/customizers/Bundle").getString("DiffParamInput.cbUnified.text"));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(0, 12, 11, 11);
        jPanel2.add(cbUnified, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.weighty = 1.0;
        add(jPanel2, gridBagConstraints);

    }//GEN-END:initComponents
    
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextField txRevision2;
    private javax.swing.JTextField txRevision1;
    private javax.swing.JLabel lblDate2;
    private javax.swing.JLabel lblDate1;
    private javax.swing.JCheckBox cbContext;
    private javax.swing.JCheckBox cbIgnoreCase;
    private javax.swing.JTextField txDate2;
    private javax.swing.JCheckBox cbUnified;
    private javax.swing.JTextField txDate1;
    private javax.swing.JLabel lblKeyword;
    private javax.swing.JCheckBox cbIgnoreBlank;
    private javax.swing.JLabel lblRevision2;
    private javax.swing.JLabel lblRevision1;
    private javax.swing.JComboBox comKeyword;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JCheckBox cbIgnoreAll;
    private javax.swing.JCheckBox cbIgnoreSpaceChange;
    private javax.swing.JCheckBox cbLocal;
    // End of variables declaration//GEN-END:variables
    
    private static final java.util.ResourceBundle bundle = NbBundle.getBundle(DiffParamInput.class);   //NOI18N
    
    private void initAccessibility() {
                 
        AccessibleContext context = this.getAccessibleContext();
        context.setAccessibleDescription(bundle.getString("ACSD_DiffParamInput"));
        
        context = cbLocal.getAccessibleContext();
        context.setAccessibleDescription(bundle.getString("ACSD_DiffParamInput.cbLocal"));
        
        context = cbIgnoreAll.getAccessibleContext();
        context.setAccessibleDescription(bundle.getString("ACSD_DiffParamInput.cbIgnoreAll"));
        
        context = cbIgnoreBlank.getAccessibleContext();
        context.setAccessibleDescription(bundle.getString("ACSD_DiffParamInput.cbIgnoreBlank"));
        
        context = cbIgnoreCase.getAccessibleContext();
        context.setAccessibleDescription(bundle.getString("ACSD_DiffParamInput.cbIgnoreCase"));
        
        context = cbIgnoreSpaceChange.getAccessibleContext();
        context.setAccessibleDescription(bundle.getString("ACSD_DiffParamInput.cbIgnoreSpaceChange"));
        
        context = cbContext.getAccessibleContext();
        context.setAccessibleDescription(bundle.getString("ACSD_DiffParamInput.cbContext"));
        
        context = cbUnified.getAccessibleContext();
        context.setAccessibleDescription(bundle.getString("ACSD_DiffParamInput.cbUnified"));
        
        context = txRevision1.getAccessibleContext();
        context.setAccessibleDescription(bundle.getString("ACSD_DiffParamInput.txRevision1"));
        
        context = txRevision2.getAccessibleContext();
        context.setAccessibleDescription(bundle.getString("ACSD_DiffParamInput.txRevision2"));
 
        context = txDate1.getAccessibleContext();
        context.setAccessibleDescription(bundle.getString("ACSD_DiffParamInput.txDate1"));
        
        context = txDate2.getAccessibleContext();
        context.setAccessibleDescription(bundle.getString("ACSD_DiffParamInput.txDate2"));

        context = comKeyword.getAccessibleContext();
        context.setAccessibleDescription(bundle.getString("ACSD_DiffParamInput.comKeyword"));
        
    }
    
    protected void setData() {
        if (commandList != null) {
            Iterator it = commandList.iterator();
            FsDiff fsCheck = null;
            while (it.hasNext()) {
                fsCheck = (FsDiff)it.next();
                setData(fsCheck);
            }
            if (fsCheck != null) {
                support.firePropertyChange(fsCheck);
            }
        } else {
            setData(diffCommand);
            support.firePropertyChange(diffCommand);
        }
    }
    
    protected void setData(FsDiff diffCom) {
        if (diffCom == null) return;
        diffCom.setKeywordSubst(cvsValues[comKeyword.getSelectedIndex()]);
        diffCom.setRecursive(!cbLocal.isSelected());
        diffCom.setIgnoreAllWhitespace(cbIgnoreAll.isSelected());
        diffCom.setIgnoreBlankLines(cbIgnoreBlank.isSelected());
        diffCom.setIgnoreCase(cbIgnoreCase.isSelected());
        diffCom.setIgnoreSpaceChange(cbIgnoreSpaceChange.isSelected());
        diffCom.setContextDiff(cbContext.isSelected());
        diffCom.setUnifiedDiff(cbUnified.isSelected());
        // revisions + dates .. TODO
        String rev1 = txRevision1.getText().trim();
        String rev2 = txRevision2.getText().trim();
        String dat1 = txDate1.getText().trim();
        String dat2 = txDate2.getText().trim();
        if (rev1.length() > 0) {
            diffCom.setRevision1(rev1);
        } else {
            diffCom.setRevision1(null);
        }
        if (rev2.length() > 0) {
            diffCom.setRevision2(rev2);
        } else {
            diffCom.setRevision2(null);
        }
        if (dat1.length() > 0) {
            diffCom.setBeforeDate1(dat1);
        } else {
            diffCom.setBeforeDate1(null);
        }
        if (dat2.length() > 0) {
            diffCom.setBeforeDate2(dat2);
        } else {
            diffCom.setBeforeDate2(null);
        }
    }
    
    protected void getData(FsDiff diffCom) {
        if (diffCom == null) return;
        performNoSettingOfData = true;
        cbLocal.setSelected(!diffCom.isRecursive());
        cbContext.setSelected(diffCom.isContextDiff());
        cbUnified.setSelected(diffCom.isUnifiedDiff());
        cbIgnoreAll.setSelected(diffCom.isIgnoreAllWhitespace());
        cbIgnoreBlank.setSelected(diffCom.isIgnoreBlankLines());
        cbIgnoreCase.setSelected(diffCom.isIgnoreCase());
        cbIgnoreSpaceChange.setSelected(diffCom.isIgnoreSpaceChange());
        // set revisions + dates.
        txRevision1.setText(diffCom.getRevision1());
        txRevision2.setText(diffCom.getRevision2());
        txDate1.setText(diffCom.getBeforeDate1());
        txDate2.setText(diffCom.getBeforeDate2());
        for (int index = 0; index < cvsValues.length; index++) {
            if (cvsValues[index] == null) {
                if (diffCom.getKeywordSubst() == null || diffCom.getKeywordSubst().equals("")) { //NOI18N
                    comKeyword.setSelectedIndex(index);
                    break;
                }
            }
            else {
                if (cvsValues[index].equals(diffCom.getKeywordSubst())) {
                    comKeyword.setSelectedIndex(index);
                    break;
                }
            }
        }
        support.firePropertyChange(diffCom);
        performNoSettingOfData = false;
    }
    
    
    /**
     * The Customizer's setObject method. However the customizer accepts both the
     * FsDiff instance and a list of FsDiff 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 FsDiff) {
            diffCommand = (FsDiff)obj;
            getData(diffCommand);
            commandList = null;
        }
        if (obj instanceof List) {
            commandList = (List)obj;
            diffCommand = null;
            if (commandList.size() > 0) {
                FsDiff check = (FsDiff)commandList.get(0);
                getData(check);
            }
        }
    }
    
    
    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);
    }
    
}
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

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.