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

/*
 * ListenerPanelVisualPanel.java
 *
 * Created on February 19, 2002
 */

package org.netbeans.modules.web.dd.wizards;

import org.openide.util.NbBundle;
import org.netbeans.modules.web.api.webmodule.WebModule;

/** A single panel for a wizard - the GUI portion.
 *
 * @author  mk115033
 */
public class ListenerVisualPanel extends javax.swing.JPanel {
    
    /** The wizard panel descriptor associated with this GUI panel.
     * If you need to fire state changes or something similar, you can
     * use this handle to do so.
     */
    private ListenerPanel wizardPanel;
    /** Create the wizard panel and set up some basic properties. */
    public ListenerVisualPanel(ListenerPanel wizardPanel, String j2eeVersion) {
        this.wizardPanel=wizardPanel;
        initComponents();
        // Provide a name in the title bar.
        setName(NbBundle.getMessage(ListenerVisualPanel.class, "TITLE_listenerWizardPanel"));
        /*
        // Optional: provide a special description for this pane.
        // You must have turned on WizardDescriptor.WizardPanel_helpDisplayed
        // (see descriptor in standard iterator template for an example of this).
        try {
            putClientProperty ("WizardPanel_helpURL", // NOI18N
                new URL ("nbresloc:/org/netbeans/modules/web/dd/wizards/ListenerPanelVisualHelp.html")); // NOI18N
        } catch (MalformedURLException mfue) {
            throw new IllegalStateException (mfue.toString ());
        }
         */
        // a11y part
        getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(ListenerVisualPanel.class, "A11Y_DESC_listenerPanel"));
        jCheckBox1.getAccessibleContext().setAccessibleName(jCheckBox1.getText());
        cb1.getAccessibleContext().setAccessibleName(cb1.getText());
        cb2.getAccessibleContext().setAccessibleName(cb2.getText());
        cb3.getAccessibleContext().setAccessibleName(cb3.getText());
        cb4.getAccessibleContext().setAccessibleName(cb4.getText());
        
        // disable request listeners in j2ee1.3
        if (WebModule.J2EE_13_LEVEL.equals(j2eeVersion)) {
            cb5.setEnabled(false);
            cb6.setEnabled(false);
        }
    }
    
    public java.awt.Dimension getPreferredSize() {
        return PageIterator.PREF_SIZE;
    }
    
    /** 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;

        jCheckBox1 = new javax.swing.JCheckBox();
        jPanel2 = new javax.swing.JPanel();
        labSelectionTitle = new javax.swing.JLabel();
        labDescription = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        description = new javax.swing.JTextArea();
        jPanel3 = new javax.swing.JPanel();
        cb1 = new javax.swing.JCheckBox();
        cb2 = new javax.swing.JCheckBox();
        cb3 = new javax.swing.JCheckBox();
        cb4 = new javax.swing.JCheckBox();
        cb5 = new javax.swing.JCheckBox();
        cb6 = new javax.swing.JCheckBox();
        jPanel1 = new javax.swing.JPanel();

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

        setPreferredSize(new java.awt.Dimension(450, 250));
        setRequestFocusEnabled(false);
        jCheckBox1.setMnemonic(org.openide.util.NbBundle.getMessage(ListenerVisualPanel.class, "LBL_addToDD_Mnem").charAt(0));
        jCheckBox1.setSelected(true);
        jCheckBox1.setText(org.openide.util.NbBundle.getMessage(ListenerVisualPanel.class, "LBL_addtodd"));
        jCheckBox1.setMargin(new java.awt.Insets(0, 2, 0, 2));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 0);
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.weightx = 1.0;
        add(jCheckBox1, gridBagConstraints);
        jCheckBox1.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(ListenerVisualPanel.class, "A11Y_DESC_addListenerToDD"));

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

        labSelectionTitle.setText(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("TTL_listenerSelection"));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        jPanel2.add(labSelectionTitle, gridBagConstraints);

        labDescription.setDisplayedMnemonic(org.openide.util.NbBundle.getMessage(ListenerVisualPanel.class, "A11Y_Description_mnem").charAt(0));
        labDescription.setText(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("LBL_description"));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 0);
        jPanel2.add(labDescription, gridBagConstraints);

        jScrollPane1.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
        description.setEditable(false);
        description.setLineWrap(true);
        description.setText(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("TTT_contextListener"));
        description.setWrapStyleWord(true);
        description.setBorder(new javax.swing.border.EmptyBorder(new java.awt.Insets(2, 2, 2, 2)));
        description.setFocusable(false);
        description.setOpaque(false);
        jScrollPane1.setViewportView(description);
        description.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("LBL_description"));
        description.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(ListenerVisualPanel.class, "A11Y_DESC_Description"));

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 0);
        gridBagConstraints.weightx = 1.0;
        jPanel2.add(jScrollPane1, gridBagConstraints);

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

        jPanel3.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0)));
        cb1.setMnemonic(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("LBL_ContextListener_Mnemonic").charAt(0));
        cb1.setSelected(true);
        cb1.setText(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("LBL_contextListener"));
        cb1.setToolTipText(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("TTT_contextListener"));
        cb1.setMargin(new java.awt.Insets(0, 2, 0, 2));
        cb1.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                cb1StateChanged(evt);
            }
        });
        cb1.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                cb1FocusGained(evt);
            }
        });

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        jPanel3.add(cb1, gridBagConstraints);
        cb1.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("LBL_contextListener"));
        cb1.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("TTT_contextListener"));

        cb2.setMnemonic(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("LBL_ContextAttrListener_Mnemonic").charAt(0));
        cb2.setText(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("LBL_contextAttrListener"));
        cb2.setToolTipText(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("TTT_contextAttrListener"));
        cb2.setMargin(new java.awt.Insets(0, 2, 0, 2));
        cb2.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                cb2StateChanged(evt);
            }
        });
        cb2.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                cb2FocusGained(evt);
            }
        });

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        jPanel3.add(cb2, gridBagConstraints);
        cb2.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("LBL_contextAttrListener"));
        cb2.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("TTT_contextAttrListener"));

        cb3.setMnemonic(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("LBL_SessionListener_Mnemonic").charAt(0));
        cb3.setText(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("LBL_sessionListener"));
        cb3.setToolTipText(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("TTT_sessionListener"));
        cb3.setMargin(new java.awt.Insets(0, 2, 0, 2));
        cb3.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                cb3StateChanged(evt);
            }
        });
        cb3.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                cb3FocusGained(evt);
            }
        });

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        jPanel3.add(cb3, gridBagConstraints);
        cb3.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("LBL_sessionListener"));
        cb3.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("TTT_sessionListener"));

        cb4.setMnemonic(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("LBL_SessionAttrListener_Mnemonic").charAt(0));
        cb4.setText(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("LBL_sessionAttrListener"));
        cb4.setToolTipText(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("TTT_sessionAttrListener"));
        cb4.setMargin(new java.awt.Insets(0, 2, 0, 2));
        cb4.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                cb4StateChanged(evt);
            }
        });
        cb4.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                cb4FocusGained(evt);
            }
        });

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        jPanel3.add(cb4, gridBagConstraints);
        cb4.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("LBL_sessionAttrListener"));
        cb4.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("TTT_sessionAttrListener"));

        cb5.setMnemonic(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("LBL_RequestListener_Mnemonic").charAt(0));
        cb5.setText(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("LBL_RequestListener"));
        cb5.setToolTipText(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("TTT_requestListener"));
        cb5.setMargin(new java.awt.Insets(0, 2, 0, 2));
        cb5.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                cb5FocusGained(evt);
            }
        });
        cb5.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                cb5ItemStateChanged(evt);
            }
        });

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 4;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        jPanel3.add(cb5, gridBagConstraints);
        cb5.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("LBL_RequestListener"));
        cb5.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("TTT_requestListener"));

        cb6.setMnemonic(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("LBL_RequestAttrListener_Mnemonic").charAt(0));
        cb6.setText(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("LBL_RequestAttrListener"));
        cb6.setToolTipText(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("TTT_requestAttrListener"));
        cb6.setMargin(new java.awt.Insets(0, 2, 0, 2));
        cb6.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                cb6FocusGained(evt);
            }
        });
        cb6.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                cb6ItemStateChanged(evt);
            }
        });

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 5;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        jPanel3.add(cb6, gridBagConstraints);
        cb6.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("LBL_RequestAttrListener"));
        cb6.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(ListenerVisualPanel.class).getString("TTT_requestAttrListener"));

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        jPanel2.add(jPanel3, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.weightx = 1.0;
        add(jPanel2, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weighty = 1.0;
        add(jPanel1, gridBagConstraints);

    }//GEN-END:initComponents

    private void cb6ItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cb6ItemStateChanged
        // TODO add your handling code here:
        wizardPanel.fireChangeEvent();
    }//GEN-LAST:event_cb6ItemStateChanged

    private void cb5ItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cb5ItemStateChanged
        // TODO add your handling code here:
        wizardPanel.fireChangeEvent();
    }//GEN-LAST:event_cb5ItemStateChanged

    private void cb6FocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_cb6FocusGained
        // TODO add your handling code here:
        description.setText(NbBundle.getMessage(ListenerVisualPanel.class,"TTT_requestAttrListener"));
    }//GEN-LAST:event_cb6FocusGained

    private void cb5FocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_cb5FocusGained
        // TODO add your handling code here:
        description.setText(NbBundle.getMessage(ListenerVisualPanel.class,"TTT_requestListener"));
    }//GEN-LAST:event_cb5FocusGained

    private void cb4FocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_cb4FocusGained
        // TODO add your handling code here:
        description.setText(NbBundle.getMessage(ListenerVisualPanel.class,"TTT_sessionAttrListener"));
    }//GEN-LAST:event_cb4FocusGained

    private void cb3FocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_cb3FocusGained
        // TODO add your handling code here:
        description.setText(NbBundle.getMessage(ListenerVisualPanel.class,"TTT_sessionListener"));
    }//GEN-LAST:event_cb3FocusGained

    private void cb2FocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_cb2FocusGained
        // TODO add your handling code here:
        description.setText(NbBundle.getMessage(ListenerVisualPanel.class,"TTT_contextAttrListener"));
    }//GEN-LAST:event_cb2FocusGained

    private void cb1FocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_cb1FocusGained
        // TODO add your handling code here:
        description.setText(NbBundle.getMessage(ListenerVisualPanel.class,"TTT_contextListener"));
    }//GEN-LAST:event_cb1FocusGained

    private void cb3StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_cb3StateChanged
        // TODO add your handling code here:
        wizardPanel.fireChangeEvent();
    }//GEN-LAST:event_cb3StateChanged

    private void cb2StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_cb2StateChanged
        // TODO add your handling code here:
        wizardPanel.fireChangeEvent();
    }//GEN-LAST:event_cb2StateChanged

    private void cb1StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_cb1StateChanged
        // TODO add your handling code here:
        wizardPanel.fireChangeEvent();
    }//GEN-LAST:event_cb1StateChanged

    private void cb4StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_cb4StateChanged
        // TODO add your handling code here:
        wizardPanel.fireChangeEvent();
    }//GEN-LAST:event_cb4StateChanged
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JCheckBox cb1;
    private javax.swing.JCheckBox cb2;
    private javax.swing.JCheckBox cb3;
    private javax.swing.JCheckBox cb4;
    private javax.swing.JCheckBox cb5;
    private javax.swing.JCheckBox cb6;
    private javax.swing.JTextArea description;
    private javax.swing.JCheckBox jCheckBox1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JLabel labDescription;
    private javax.swing.JLabel labSelectionTitle;
    // End of variables declaration//GEN-END:variables

    private static final long serialVersionUID = 8091384420711061719L;    
    
    boolean createElementInDD (){
        return jCheckBox1.isSelected();
    }
    
    boolean isContextListener() {return cb1.isSelected();}
    
    boolean isContextAttrListener() {return cb2.isSelected();}
    
    boolean isSessionListener() {return cb3.isSelected();}
    
    boolean isSessionAttrListener() {return cb4.isSelected();}
    
    boolean isRequestListener() {return cb5.isSelected();}
    
    boolean isRequestAttrListener() {return cb6.isSelected();}
}
... 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.