KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > tests > j2eeserver > plugin > jsr88 > ui > EarConfigBeanPanel


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 /*
21  * EarConfigBeanPanel.java
22  *
23  * Created on March 21, 2003, 1:22 PM
24  */

25
26 package org.netbeans.tests.j2eeserver.plugin.jsr88.ui;
27
28 import java.beans.PropertyChangeListener JavaDoc;
29 import java.beans.PropertyChangeEvent JavaDoc;
30 import javax.enterprise.deploy.spi.DConfigBean JavaDoc;
31 import javax.enterprise.deploy.spi.DConfigBeanRoot JavaDoc;
32 import org.netbeans.tests.j2eeserver.plugin.jsr88.EarConfigBean;
33
34 /**
35  *
36  * @author Jeri Lockhart
37  */

38 public class EarConfigBeanPanel extends javax.swing.JPanel JavaDoc implements PropertyChangeListener JavaDoc {
39     EarConfigBean bean = null;
40
41     /** Creates new form EarConfigBeanPanel */
42     public EarConfigBeanPanel(DConfigBean JavaDoc bean) {
43         this.bean = (EarConfigBean)bean;
44         initComponents();
45         initComponentsMore();
46     }
47
48     private void initComponentsMore() {
49         secLevTxt.setText(bean.getSecurityLevel());
50         sessParamTxt.setText(bean.getSessionParam());
51         bean.addPropertyChangeListener(this);
52     }
53
54     /** This method is called from within the constructor to
55      * initialize the form.
56      * WARNING: Do NOT modify this code. The content of this method is
57      * always regenerated by the Form Editor.
58      */

59     private void initComponents() {//GEN-BEGIN:initComponents
60
java.awt.GridBagConstraints JavaDoc gridBagConstraints;
61
62         jLabel1 = new javax.swing.JLabel JavaDoc();
63         secLevTxt = new javax.swing.JTextField JavaDoc();
64         jLabel2 = new javax.swing.JLabel JavaDoc();
65         sessParamTxt = new javax.swing.JTextField JavaDoc();
66
67         setLayout(new java.awt.GridBagLayout JavaDoc());
68
69         jLabel1.setText("Security Level:");
70         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
71         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
72         gridBagConstraints.insets = new java.awt.Insets JavaDoc(11, 11, 0, 0);
73         add(jLabel1, gridBagConstraints);
74
75         secLevTxt.addActionListener(new java.awt.event.ActionListener JavaDoc() {
76             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
77                 secLevTxtActionPerformed(evt);
78             }
79         });
80
81         secLevTxt.addFocusListener(new java.awt.event.FocusAdapter JavaDoc() {
82             public void focusLost(java.awt.event.FocusEvent JavaDoc evt) {
83                 secLevTxtFocusLost(evt);
84             }
85         });
86
87         secLevTxt.addKeyListener(new java.awt.event.KeyAdapter JavaDoc() {
88             public void keyTyped(java.awt.event.KeyEvent JavaDoc evt) {
89                 secLevTxtKeyTyped(evt);
90             }
91         });
92
93         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
94         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
95         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
96         gridBagConstraints.weightx = 0.2;
97         gridBagConstraints.insets = new java.awt.Insets JavaDoc(11, 11, 0, 11);
98         add(secLevTxt, gridBagConstraints);
99
100         jLabel2.setText("Session Param:");
101         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
102         gridBagConstraints.gridx = 0;
103         gridBagConstraints.gridy = 1;
104         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
105         gridBagConstraints.insets = new java.awt.Insets JavaDoc(11, 11, 11, 0);
106         add(jLabel2, gridBagConstraints);
107
108         sessParamTxt.addActionListener(new java.awt.event.ActionListener JavaDoc() {
109             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
110                 sessParamTxtActionPerformed(evt);
111             }
112         });
113
114         sessParamTxt.addFocusListener(new java.awt.event.FocusAdapter JavaDoc() {
115             public void focusLost(java.awt.event.FocusEvent JavaDoc evt) {
116                 sessParamTxtFocusLost(evt);
117             }
118         });
119
120         sessParamTxt.addKeyListener(new java.awt.event.KeyAdapter JavaDoc() {
121             public void keyTyped(java.awt.event.KeyEvent JavaDoc evt) {
122                 sessParamTxtKeyTyped(evt);
123             }
124         });
125
126         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
127         gridBagConstraints.gridx = 1;
128         gridBagConstraints.gridy = 1;
129         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
130         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
131         gridBagConstraints.weightx = 0.2;
132         gridBagConstraints.insets = new java.awt.Insets JavaDoc(11, 11, 11, 11);
133         add(sessParamTxt, gridBagConstraints);
134
135     }//GEN-END:initComponents
136

137     private void sessParamTxtKeyTyped(java.awt.event.KeyEvent JavaDoc evt) {//GEN-FIRST:event_sessParamTxtKeyTyped
138
if (bean.getSessionParam() == null || !bean.getSessionParam().trim().equals(sessParamTxt.getText().trim())) {
139             bean.setSessionParam(sessParamTxt.getText().trim());
140             System.out.println("sessParamTxtFocusLost property changed.");
141         }
142     }//GEN-LAST:event_sessParamTxtKeyTyped
143

144     private void secLevTxtKeyTyped(java.awt.event.KeyEvent JavaDoc evt) {//GEN-FIRST:event_secLevTxtKeyTyped
145
if (bean.getSecurityLevel() == null || !bean.getSecurityLevel().trim().equals(secLevTxt.getText().trim())) {
146             bean.setSecurityLevel(secLevTxt.getText().trim());
147             System.out.println("secLevTxtFocusLost property changed.");
148         }
149     }//GEN-LAST:event_secLevTxtKeyTyped
150

151     private void sessParamTxtFocusLost(java.awt.event.FocusEvent JavaDoc evt) {//GEN-FIRST:event_sessParamTxtFocusLost
152
if (bean.getSessionParam() == null || !bean.getSessionParam().trim().equals(sessParamTxt.getText().trim())) {
153             bean.setSessionParam(sessParamTxt.getText().trim());
154             System.out.println("sessParamTxtFocusLost property changed.");
155         }
156     }//GEN-LAST:event_sessParamTxtFocusLost
157

158     private void secLevTxtFocusLost(java.awt.event.FocusEvent JavaDoc evt) {//GEN-FIRST:event_secLevTxtFocusLost
159
if (bean.getSecurityLevel() == null || !bean.getSecurityLevel().trim().equals(secLevTxt.getText().trim())) {
160             bean.setSecurityLevel(secLevTxt.getText().trim());
161             System.out.println("secLevTxtFocusLost property changed.");
162         }
163     }//GEN-LAST:event_secLevTxtFocusLost
164

165     private void sessParamTxtActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_sessParamTxtActionPerformed
166
System.out.println("sessParamTxtactionPerformed ");
167         bean.setSessionParam(sessParamTxt.getText().trim());
168     }//GEN-LAST:event_sessParamTxtActionPerformed
169

170     private void secLevTxtActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_secLevTxtActionPerformed
171
System.out.println("secLevTxtActionPerformed ");
172         bean.setSecurityLevel(secLevTxt.getText().trim());
173     }//GEN-LAST:event_secLevTxtActionPerformed
174

175     /** This method gets called when a bound property is changed.
176      * @param evt A PropertyChangeEvent object describing the event source
177      * and the property that has changed.
178      *
179      */

180     public void propertyChange(PropertyChangeEvent JavaDoc evt) {
181         if (evt.getPropertyName().equals("sessionParam")) {
182             sessParamTxt.setText((String JavaDoc)evt.getNewValue());
183         }
184         else if (evt.getPropertyName().equals("securityLevel")) {
185             secLevTxt.setText((String JavaDoc)evt.getNewValue());
186         }
187     }
188
189
190     // Variables declaration - do not modify//GEN-BEGIN:variables
191
private javax.swing.JLabel JavaDoc jLabel1;
192     private javax.swing.JLabel JavaDoc jLabel2;
193     private javax.swing.JTextField JavaDoc secLevTxt;
194     private javax.swing.JTextField JavaDoc sessParamTxt;
195     // End of variables declaration//GEN-END:variables
196

197 }
198
Popular Tags