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.vcscore.search;

import org.openide.util.NbBundle;

import java.beans.*;
/**
 *
 * @author  Martin Entlicher
 * @version 
 */
public class VcsSearchCustomizer extends javax.swing.JPanel implements Customizer {

    VcsSearchType peer;

    public static final long serialVersionUID = 23757326789765789L;

    /** Creates new customizer VcsSearchCustomizer */
    public VcsSearchCustomizer() {
        initComponents ();
        localizeComponents();
        initAccessibility();
    }
    
    private void initAccessibility() {
        findExceptCheckBox.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/vcscore/search/Bundle").getString("ACS_VcsSearchCustomizer.findExceptCheckBox.text"));
        statusList.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/vcscore/search/Bundle").getString("ACSN_VcsSearchCustomizer.statusList.text"));
        statusList.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/vcscore/search/Bundle").getString("ACSD_VcsSearchCustomizer.statusList.text"));
    }
    
    /** 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;

        jScrollPane1 = new javax.swing.JScrollPane();
        statusList = new javax.swing.JList();
        findExceptCheckBox = new javax.swing.JCheckBox();

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

        setBorder(new javax.swing.border.TitledBorder(""));
        statusList.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseReleased(java.awt.event.MouseEvent evt) {
                statusListMouseReleased(evt);
            }
        });

        jScrollPane1.setViewportView(statusList);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(8, 8, 8, 8);
        add(jScrollPane1, gridBagConstraints);

        findExceptCheckBox.setMnemonic((java.util.ResourceBundle.getBundle("org/netbeans/modules/vcscore/search/Bundle").getString("VcsSearchCustomizer.findExceptCheckBox.text_mnem")).charAt(0));
        findExceptCheckBox.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/vcscore/search/Bundle").getString("VcsSearchCustomizer.findExceptCheckBox.text"));
        findExceptCheckBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                findExceptCheckBoxActionPerformed(evt);
            }
        });

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridy = 1;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(0, 8, 0, 8);
        add(findExceptCheckBox, gridBagConstraints);

    }//GEN-END:initComponents

  private void statusListMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_statusListMouseReleased
// Add your handling code here:
    peer.setStatusIndexes(statusList.getSelectedIndices());
  }//GEN-LAST:event_statusListMouseReleased

  private void findExceptCheckBoxActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_findExceptCheckBoxActionPerformed
// Add your handling code here:
    peer.setMatchExcept(findExceptCheckBox.isSelected());
  }//GEN-LAST:event_findExceptCheckBoxActionPerformed

    private void localizeComponents() {
        javax.swing.border.TitledBorder border = (javax.swing.border.TitledBorder) this.getBorder();
        border.setTitle(NbBundle.getBundle(VcsSearchType.class).getString ("VcsSearchCustomizer.findExceptCheckBox.borderTitle"));
    }

    private void fillStatuses(String[] statuses) {
        javax.swing.DefaultListModel listModel = new javax.swing.DefaultListModel();
        for(int i = 0; i < statuses.length; i++) {
            listModel.addElement(statuses[i]);
        }
        statusList.setModel(listModel);
    }


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JList statusList;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JCheckBox findExceptCheckBox;
    // End of variables declaration//GEN-END:variables

    public void setObject(final Object obj) {
        peer = (VcsSearchType) obj;
        //statusTextField.setText(peer.getMatchStatus());
        findExceptCheckBox.setSelected(peer.getMatchExcept());
        fillStatuses(peer.getStatuses());
        if (peer.getStatusIndexes() != null) {
            statusList.setSelectedIndices(peer.getStatusIndexes());
            peer.setStatusIndexes(statusList.getSelectedIndices());
            // hack to put peer in the right state..
        }
    }

    public void addPropertyChangeListener(final java.beans.PropertyChangeListener p1) {
    }

    public void removePropertyChangeListener(final java.beans.PropertyChangeListener p1) {
    }

}
... 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.