KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > websphere6 > dd > loaders > ui > LocalTransactionPanel


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 package org.netbeans.modules.j2ee.websphere6.dd.loaders.ui;
20
21 import org.netbeans.modules.j2ee.websphere6.dd.beans.DDXmiConstants;
22 /**
23  *
24  * @author dlm198383
25  */

26 public class LocalTransactionPanel extends javax.swing.JPanel JavaDoc {
27
28     /**
29      * Creates new form LocalTransactionPanel
30      */

31     public LocalTransactionPanel() {
32         initComponents();
33         boundaryComboBox.setModel(new javax.swing.DefaultComboBoxModel JavaDoc(DDXmiConstants.LOCAL_TRANSACTION_BOUNDARY_TYPES));
34         resolverComboBox.setModel(new javax.swing.DefaultComboBoxModel JavaDoc(DDXmiConstants.LOCAL_TRANSACTION_RESOLVER_TYPES));
35         unresolvedActionComboBox.setModel(new javax.swing.DefaultComboBoxModel JavaDoc(DDXmiConstants.LOCAL_TRANSACTION_UNRESOLVED_ACTION_TYPES));
36     }
37     
38     /** This method is called from within the constructor to
39      * initialize the form.
40      * WARNING: Do NOT modify this code. The content of this method is
41      * always regenerated by the Form Editor.
42      */

43     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
44
private void initComponents() {
45         java.awt.GridBagConstraints JavaDoc gridBagConstraints;
46
47         localTransactionCheckBox = new javax.swing.JCheckBox JavaDoc();
48         nameLabel = new javax.swing.JLabel JavaDoc();
49         transactionNameField = new javax.swing.JTextField JavaDoc();
50         unresolvedLabel = new javax.swing.JLabel JavaDoc();
51         unresolvedActionComboBox = new javax.swing.JComboBox JavaDoc();
52         resolverCheckBox = new javax.swing.JCheckBox JavaDoc();
53         resolverComboBox = new javax.swing.JComboBox JavaDoc();
54         boundaryCheckBox = new javax.swing.JCheckBox JavaDoc();
55         boundaryComboBox = new javax.swing.JComboBox JavaDoc();
56
57         setLayout(new java.awt.GridBagLayout JavaDoc());
58
59         setPreferredSize(new java.awt.Dimension JavaDoc(150, 22));
60         localTransactionCheckBox.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/websphere6/dd/loaders/ui/Bundle").getString("LBL_LocalTransaction"));
61         localTransactionCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
62         localTransactionCheckBox.setMargin(new java.awt.Insets JavaDoc(0, 0, 0, 0));
63         localTransactionCheckBox.setMinimumSize(new java.awt.Dimension JavaDoc(40, 15));
64         localTransactionCheckBox.setPreferredSize(new java.awt.Dimension JavaDoc(150, 15));
65         localTransactionCheckBox.addActionListener(new java.awt.event.ActionListener JavaDoc() {
66             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
67                 localTransactionCheckBoxActionPerformed(evt);
68             }
69         });
70
71         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
72         gridBagConstraints.gridx = 0;
73         gridBagConstraints.gridy = 0;
74         gridBagConstraints.gridwidth = 3;
75         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
76         gridBagConstraints.ipadx = 20;
77         gridBagConstraints.ipady = 8;
78         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
79         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 11, 0, 26);
80         add(localTransactionCheckBox, gridBagConstraints);
81
82         nameLabel.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
83         nameLabel.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/websphere6/dd/loaders/ui/Bundle").getString("LBL_Name"));
84         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
85         gridBagConstraints.gridx = 0;
86         gridBagConstraints.gridy = 1;
87         gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
88         gridBagConstraints.insets = new java.awt.Insets JavaDoc(5, 14, 0, 6);
89         add(nameLabel, gridBagConstraints);
90
91         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
92         gridBagConstraints.gridx = 2;
93         gridBagConstraints.gridy = 1;
94         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
95         gridBagConstraints.weightx = 1.0;
96         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 1, 0, 10);
97         add(transactionNameField, gridBagConstraints);
98
99         unresolvedLabel.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
100         unresolvedLabel.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/websphere6/dd/loaders/ui/Bundle").getString("LBL_UnresolvedAction"));
101         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
102         gridBagConstraints.gridx = 0;
103         gridBagConstraints.gridy = 2;
104         gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
105         gridBagConstraints.insets = new java.awt.Insets JavaDoc(5, 14, 0, 6);
106         add(unresolvedLabel, gridBagConstraints);
107
108         unresolvedActionComboBox.setPreferredSize(new java.awt.Dimension JavaDoc(150, 22));
109         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
110         gridBagConstraints.gridx = 2;
111         gridBagConstraints.gridy = 2;
112         gridBagConstraints.ipadx = 36;
113         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
114         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 1, 0, 10);
115         add(unresolvedActionComboBox, gridBagConstraints);
116
117         resolverCheckBox.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/websphere6/dd/loaders/ui/Bundle").getString("LBL_Resolver"));
118         resolverCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
119         resolverCheckBox.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
120         resolverCheckBox.setMargin(new java.awt.Insets JavaDoc(0, 0, 0, 0));
121         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
122         gridBagConstraints.gridx = 0;
123         gridBagConstraints.gridy = 3;
124         gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
125         gridBagConstraints.insets = new java.awt.Insets JavaDoc(5, 14, 0, 6);
126         add(resolverCheckBox, gridBagConstraints);
127
128         resolverComboBox.setPreferredSize(new java.awt.Dimension JavaDoc(150, 22));
129         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
130         gridBagConstraints.gridx = 2;
131         gridBagConstraints.gridy = 3;
132         gridBagConstraints.ipadx = 36;
133         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
134         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 1, 0, 10);
135         add(resolverComboBox, gridBagConstraints);
136
137         boundaryCheckBox.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/websphere6/dd/loaders/ui/Bundle").getString("LBL_Boundary"));
138         boundaryCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
139         boundaryCheckBox.setMargin(new java.awt.Insets JavaDoc(0, 0, 0, 0));
140         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
141         gridBagConstraints.gridx = 0;
142         gridBagConstraints.gridy = 4;
143         gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
144         gridBagConstraints.insets = new java.awt.Insets JavaDoc(5, 14, 0, 6);
145         add(boundaryCheckBox, gridBagConstraints);
146
147         boundaryComboBox.setPreferredSize(new java.awt.Dimension JavaDoc(150, 22));
148         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
149         gridBagConstraints.gridx = 2;
150         gridBagConstraints.gridy = 4;
151         gridBagConstraints.ipadx = 36;
152         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
153         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 1, 0, 10);
154         add(boundaryComboBox, gridBagConstraints);
155
156     }// </editor-fold>//GEN-END:initComponents
157

158     private void localTransactionCheckBoxActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_localTransactionCheckBoxActionPerformed
159
// TODO add your handling code here:
160
}//GEN-LAST:event_localTransactionCheckBoxActionPerformed
161

162     
163     // Variables declaration - do not modify//GEN-BEGIN:variables
164
private javax.swing.JCheckBox JavaDoc boundaryCheckBox;
165     private javax.swing.JComboBox JavaDoc boundaryComboBox;
166     private javax.swing.JCheckBox JavaDoc localTransactionCheckBox;
167     private javax.swing.JLabel JavaDoc nameLabel;
168     private javax.swing.JCheckBox JavaDoc resolverCheckBox;
169     private javax.swing.JComboBox JavaDoc resolverComboBox;
170     private javax.swing.JTextField JavaDoc transactionNameField;
171     private javax.swing.JComboBox JavaDoc unresolvedActionComboBox;
172     private javax.swing.JLabel JavaDoc unresolvedLabel;
173     // End of variables declaration//GEN-END:variables
174

175     public void setEnabledComponents() {
176         boolean state=localTransactionCheckBox.isSelected();
177         nameLabel.setEnabled(state);
178         unresolvedLabel.setEnabled(state);
179         transactionNameField.setEnabled(state);
180         unresolvedActionComboBox.setEnabled(state);
181         resolverCheckBox.setEnabled(state);
182         boundaryCheckBox.setEnabled(state);
183         boundaryComboBox.setEnabled(state?boundaryCheckBox.isSelected():false);
184         resolverComboBox.setEnabled(state?resolverCheckBox.isSelected():false);
185         if(state && (transactionNameField.getText().trim().equals(""))){
186             long timeStamp=java.lang.System.currentTimeMillis();
187             transactionNameField.setText(DDXmiConstants.LOCAL_TRANSACTION+"_"+timeStamp);//NOI18N
188

189         }
190     }
191     public javax.swing.JCheckBox JavaDoc getBoundaryCheckBox(){
192         return boundaryCheckBox;
193     }
194     public javax.swing.JCheckBox JavaDoc getResolverCheckBox(){
195         return resolverCheckBox;
196     }
197     public javax.swing.JCheckBox JavaDoc getLocalTransactionCheckBox(){
198         return localTransactionCheckBox;
199     }
200     public javax.swing.JComboBox JavaDoc getBoundaryComboBox() {
201         return boundaryComboBox;
202     }
203     public javax.swing.JComboBox JavaDoc getResolverComboBox() {
204         return resolverComboBox;
205     }
206     public javax.swing.JComboBox JavaDoc getUnresolvedActionComboBox() {
207         return unresolvedActionComboBox;
208     }
209     public javax.swing.JTextField JavaDoc getTransactionNameField() {
210         return transactionNameField;
211     }
212     public javax.swing.JLabel JavaDoc getNameLabel() {
213         return nameLabel;
214     }
215     public javax.swing.JLabel JavaDoc getUnresolvedActionLable() {
216         return unresolvedLabel;
217     }
218     public void setComponentsBackground(java.awt.Color JavaDoc c) {
219         nameLabel.setBackground(c);
220         unresolvedLabel.setBackground(c);
221         resolverCheckBox.setBackground(c);
222         boundaryCheckBox.setBackground(c);
223         localTransactionCheckBox.setBackground(c);
224         setBackground(c);
225     }
226 }
227
228
Popular Tags