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-2003 Sun
 * Microsystems, Inc. All Rights Reserved.
 */

package org.netbeans.modules.cvsclient.editors;

import javax.accessibility.*;

/**
 *
 * @author  mk104111
 */
public class StatesStringArrayCustomEditor extends javax.swing.JPanel {

    private StatesStringArrayEditor editor;

    /** Creates new form StatesStringArrayCustomEditor */
    public StatesStringArrayCustomEditor(StatesStringArrayEditor sac) {
        initComponents();
        initAccessibility();
        lblConflict.setLabelFor(txConflict);
        lblHasHidden.setLabelFor(txHasHidden);
        lblLocAdded.setLabelFor(txLocAdded);
        lblLocModified.setLabelFor(txLocModified);
        lblLocRemoved.setLabelFor(txLocRemoved);
        lblLocal.setLabelFor(txLocal);
        lblNeedsCheckout.setLabelFor(txNeedsCheckout);
        lblNeedsMerge.setLabelFor(txNeedsMerge);
        lblNeedsPatch.setLabelFor(txNeedsPatch);
        lblNotInSynch.setLabelFor(txNotInSynch);
        lblUnknown.setLabelFor(txUnknown);
        lblUptodate.setLabelFor(txUptodate);
        editor = sac;
        loadStates(editor.getStringArray());
        java.awt.event.ActionListener listen = new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent event) {
                saveStates();
            }
        };
        txConflict.addActionListener(listen);
        txHasHidden.addActionListener(listen);
        txLocAdded.addActionListener(listen);
        txLocModified.addActionListener(listen);
        txLocRemoved.addActionListener(listen);
        txLocal.addActionListener(listen);
        txNeedsCheckout.addActionListener(listen);
        txNeedsMerge.addActionListener(listen);
        txNeedsPatch.addActionListener(listen);
        txNotInSynch.addActionListener(listen);
        txUnknown.addActionListener(listen);
        txUptodate.addActionListener(listen);
        java.awt.event.FocusListener focusListen = new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                saveStates();
            }
        };
        txConflict.addFocusListener(focusListen);
        txHasHidden.addFocusListener(focusListen);
        txLocAdded.addFocusListener(focusListen);
        txLocModified.addFocusListener(focusListen);
        txLocRemoved.addFocusListener(focusListen);
        txLocal.addFocusListener(focusListen);
        txNeedsCheckout.addFocusListener(focusListen);
        txNeedsMerge.addFocusListener(focusListen);
        txNeedsPatch.addFocusListener(focusListen);
        txNotInSynch.addFocusListener(focusListen);
        txUnknown.addFocusListener(focusListen);
        txUptodate.addFocusListener(focusListen);
    }

    /** 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;

        lblLocal = new javax.swing.JLabel();
        lblLocModified = new javax.swing.JLabel();
        lblLocAdded = new javax.swing.JLabel();
        lblLocRemoved = new javax.swing.JLabel();
        lblNeedsPatch = new javax.swing.JLabel();
        lblUptodate = new javax.swing.JLabel();
        lblNeedsCheckout = new javax.swing.JLabel();
        lblUnknown = new javax.swing.JLabel();
        lblHasHidden = new javax.swing.JLabel();
        lblNotInSynch = new javax.swing.JLabel();
        lblConflict = new javax.swing.JLabel();
        lblNeedsMerge = new javax.swing.JLabel();
        txLocal = new javax.swing.JTextField();
        txUptodate = new javax.swing.JTextField();
        txLocModified = new javax.swing.JTextField();
        txNeedsCheckout = new javax.swing.JTextField();
        txLocAdded = new javax.swing.JTextField();
        txNeedsPatch = new javax.swing.JTextField();
        txLocRemoved = new javax.swing.JTextField();
        txNeedsMerge = new javax.swing.JTextField();
        txUnknown = new javax.swing.JTextField();
        txConflict = new javax.swing.JTextField();
        txNotInSynch = new javax.swing.JTextField();
        txHasHidden = new javax.swing.JTextField();
        jSeparator1 = new javax.swing.JSeparator();

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

        lblLocal.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/cvsclient/editors/Bundle").getString("StatesStringArrayCustomEditor.local"));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 0);
        add(lblLocal, gridBagConstraints);

        lblLocModified.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/cvsclient/editors/Bundle").getString("StatesStringArrayCustomEditor.locModified"));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 0);
        add(lblLocModified, gridBagConstraints);

        lblLocAdded.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/cvsclient/editors/Bundle").getString("StatesStringArrayCustomEditor.locAdded"));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 0);
        add(lblLocAdded, gridBagConstraints);

        lblLocRemoved.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/cvsclient/editors/Bundle").getString("StatesStringArrayCustomEditor.locRemoved"));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 0);
        add(lblLocRemoved, gridBagConstraints);

        lblNeedsPatch.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/cvsclient/editors/Bundle").getString("StatesStringArrayCustomEditor.needsPatch"));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 2;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 0);
        add(lblNeedsPatch, gridBagConstraints);

        lblUptodate.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/cvsclient/editors/Bundle").getString("StatesStringArrayCustomEditor.uptodate"));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 2;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 0);
        add(lblUptodate, gridBagConstraints);

        lblNeedsCheckout.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/cvsclient/editors/Bundle").getString("StatesStringArrayCustomEditor.needsCheckout"));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 2;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 0);
        add(lblNeedsCheckout, gridBagConstraints);

        lblUnknown.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/cvsclient/editors/Bundle").getString("StatesStringArrayCustomEditor.unknown"));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 4;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 0);
        add(lblUnknown, gridBagConstraints);

        lblHasHidden.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/cvsclient/editors/Bundle").getString("StatesStringArrayCustomEditor.hasHidden"));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 6;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 0);
        add(lblHasHidden, gridBagConstraints);

        lblNotInSynch.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/cvsclient/editors/Bundle").getString("StatesStringArrayCustomEditor.notInSynch"));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 6;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 0);
        add(lblNotInSynch, gridBagConstraints);

        lblConflict.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/cvsclient/editors/Bundle").getString("StatesStringArrayCustomEditor.conflict"));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 2;
        gridBagConstraints.gridy = 4;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 0);
        add(lblConflict, gridBagConstraints);

        lblNeedsMerge.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/cvsclient/editors/Bundle").getString("StatesStringArrayCustomEditor.needsMerge"));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 2;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 0);
        add(lblNeedsMerge, gridBagConstraints);

        txLocal.setMinimumSize(new java.awt.Dimension(40, 21));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 6);
        add(txLocal, gridBagConstraints);

        txUptodate.setMinimumSize(new java.awt.Dimension(40, 21));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 3;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 6);
        add(txUptodate, gridBagConstraints);

        txLocModified.setMinimumSize(new java.awt.Dimension(40, 21));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 6);
        add(txLocModified, gridBagConstraints);

        txNeedsCheckout.setMinimumSize(new java.awt.Dimension(40, 21));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 3;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 6);
        add(txNeedsCheckout, gridBagConstraints);

        txLocAdded.setMinimumSize(new java.awt.Dimension(40, 21));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 6);
        add(txLocAdded, gridBagConstraints);

        txNeedsPatch.setMinimumSize(new java.awt.Dimension(40, 21));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 3;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 6);
        add(txNeedsPatch, gridBagConstraints);

        txLocRemoved.setMinimumSize(new java.awt.Dimension(40, 21));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 6);
        add(txLocRemoved, gridBagConstraints);

        txNeedsMerge.setMinimumSize(new java.awt.Dimension(40, 21));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 3;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 6);
        add(txNeedsMerge, gridBagConstraints);

        txUnknown.setMinimumSize(new java.awt.Dimension(40, 21));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 4;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 6);
        add(txUnknown, gridBagConstraints);

        txConflict.setMinimumSize(new java.awt.Dimension(40, 21));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 3;
        gridBagConstraints.gridy = 4;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 6);
        add(txConflict, gridBagConstraints);

        txNotInSynch.setMinimumSize(new java.awt.Dimension(40, 21));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 7;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 6);
        add(txNotInSynch, gridBagConstraints);

        txHasHidden.setMinimumSize(new java.awt.Dimension(40, 21));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 7;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 6);
        add(txHasHidden, gridBagConstraints);

        jSeparator1.setOrientation(javax.swing.SwingConstants.VERTICAL);
        jSeparator1.setMinimumSize(new java.awt.Dimension(40, 10));
        jSeparator1.setPreferredSize(new java.awt.Dimension(40, 10));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 5;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.gridheight = 5;
        gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL;
        gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 6);
        add(jSeparator1, gridBagConstraints);

    }//GEN-END:initComponents


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextField txLocal;
    private javax.swing.JLabel lblLocRemoved;
    private javax.swing.JLabel lblNeedsPatch;
    private javax.swing.JTextField txNeedsCheckout;
    private javax.swing.JLabel lblLocModified;
    private javax.swing.JLabel lblNotInSynch;
    private javax.swing.JLabel lblLocAdded;
    private javax.swing.JTextField txLocRemoved;
    private javax.swing.JLabel lblNeedsMerge;
    private javax.swing.JLabel lblConflict;
    private javax.swing.JTextField txUptodate;
    private javax.swing.JTextField txNeedsPatch;
    private javax.swing.JTextField txLocAdded;
    private javax.swing.JTextField txNotInSynch;
    private javax.swing.JTextField txLocModified;
    private javax.swing.JLabel lblUnknown;
    private javax.swing.JTextField txHasHidden;
    private javax.swing.JTextField txUnknown;
    private javax.swing.JLabel lblNeedsCheckout;
    private javax.swing.JTextField txNeedsMerge;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JLabel lblUptodate;
    private javax.swing.JTextField txConflict;
    private javax.swing.JLabel lblLocal;
    private javax.swing.JLabel lblHasHidden;
    // End of variables declaration//GEN-END:variables

    private void saveStates () {
        String [] value = new String [12];
        value[0] = txLocal.getText();
        value[1] = txLocModified.getText();
        value[2] = txLocAdded.getText();
        value[3] = txLocRemoved.getText();
        value[4] = txUnknown.getText();
        value[5] = txUptodate.getText();
        value[6] = txNeedsCheckout.getText();
        value[7] = txNeedsMerge.getText();
        value[8] = txNeedsPatch.getText();
        value[9] = txNotInSynch.getText();
        value[10] = txConflict.getText();
        value[11] = txHasHidden.getText();
        editor.setStringArray (value);
    }
    
    private void loadStates(String[] states) {
        loadValue(states, 0, txLocal);
        loadValue(states, 1, txLocModified);
        loadValue(states, 2, txLocAdded);
        loadValue(states, 3, txLocRemoved);
        loadValue(states, 4, txUnknown);
        loadValue(states, 5, txUptodate);
        loadValue(states, 6, txNeedsCheckout);
        loadValue(states, 7, txNeedsMerge);
        loadValue(states, 8, txNeedsPatch);
        loadValue(states, 9, txNotInSynch);
        loadValue(states, 10, txConflict);
        loadValue(states, 11, txHasHidden);
    }
    
    private void loadValue(String[] states, int index, javax.swing.JTextField field) {
        if (states == null || states.length < index) {
            field.setText(""); // NOI18N
        } else {
            if (states[index] == null) {
                field.setText(""); // NOI18N
            } else {
                field.setText(states[index]);
            }
        }
    }
    
    private static final java.util.ResourceBundle bundle = org.openide.util.NbBundle.getBundle(StatesStringArrayCustomEditor.class); //NOI18N
    
    private void initAccessibility() {
        
        AccessibleContext context = this.getAccessibleContext();
        context.setAccessibleDescription(bundle.getString("ACSD_StatesStringArrayCustomEditor"));
        
        context = txConflict.getAccessibleContext();
        context.setAccessibleDescription(bundle.getString("ACSD_StatesStringArrayCustomEditor.txConflict"));
        context = txHasHidden.getAccessibleContext();
        context.setAccessibleDescription(bundle.getString("ACSD_StatesStringArrayCustomEditor.txHasHidden"));
        context = txLocAdded.getAccessibleContext();
        context.setAccessibleDescription(bundle.getString("ACSD_StatesStringArrayCustomEditor.txLocAdded"));
        context = txLocModified.getAccessibleContext();
        context.setAccessibleDescription(bundle.getString("ACSD_StatesStringArrayCustomEditor.txLocModified"));
        context = txLocRemoved.getAccessibleContext();
        context.setAccessibleDescription(bundle.getString("ACSD_StatesStringArrayCustomEditor.txLocRemoved"));
        context = txLocal.getAccessibleContext();
        context.setAccessibleDescription(bundle.getString("ACSD_StatesStringArrayCustomEditor.txLocal"));
        context = txNeedsCheckout.getAccessibleContext();
        context.setAccessibleDescription(bundle.getString("ACSD_StatesStringArrayCustomEditor.txNeedsCheckout"));
        context = txNeedsMerge.getAccessibleContext();
        context.setAccessibleDescription(bundle.getString("ACSD_StatesStringArrayCustomEditor.txNeedsMerge"));
        context = txNeedsPatch.getAccessibleContext();
        context.setAccessibleDescription(bundle.getString("ACSD_StatesStringArrayCustomEditor.txNeedsPatch"));
        context = txNotInSynch.getAccessibleContext();
        context.setAccessibleDescription(bundle.getString("ACSD_StatesStringArrayCustomEditor.txNotInSynch"));
        context = txUnknown.getAccessibleContext();
        context.setAccessibleDescription(bundle.getString("ACSD_StatesStringArrayCustomEditor.txUnknown"));
        context = txUptodate.getAccessibleContext();
        context.setAccessibleDescription(bundle.getString("ACSD_StatesStringArrayCustomEditor.txUptodate"));
        
    
    }
    
}
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

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.