1 19 package org.netbeans.modules.j2ee.websphere6.dd.loaders.ui; 20 21 import org.netbeans.modules.j2ee.websphere6.dd.beans.DDXmiConstants; 22 26 public class LocalTransactionPanel extends javax.swing.JPanel { 27 28 31 public LocalTransactionPanel() { 32 initComponents(); 33 boundaryComboBox.setModel(new javax.swing.DefaultComboBoxModel (DDXmiConstants.LOCAL_TRANSACTION_BOUNDARY_TYPES)); 34 resolverComboBox.setModel(new javax.swing.DefaultComboBoxModel (DDXmiConstants.LOCAL_TRANSACTION_RESOLVER_TYPES)); 35 unresolvedActionComboBox.setModel(new javax.swing.DefaultComboBoxModel (DDXmiConstants.LOCAL_TRANSACTION_UNRESOLVED_ACTION_TYPES)); 36 } 37 38 43 private void initComponents() { 45 java.awt.GridBagConstraints gridBagConstraints; 46 47 localTransactionCheckBox = new javax.swing.JCheckBox (); 48 nameLabel = new javax.swing.JLabel (); 49 transactionNameField = new javax.swing.JTextField (); 50 unresolvedLabel = new javax.swing.JLabel (); 51 unresolvedActionComboBox = new javax.swing.JComboBox (); 52 resolverCheckBox = new javax.swing.JCheckBox (); 53 resolverComboBox = new javax.swing.JComboBox (); 54 boundaryCheckBox = new javax.swing.JCheckBox (); 55 boundaryComboBox = new javax.swing.JComboBox (); 56 57 setLayout(new java.awt.GridBagLayout ()); 58 59 setPreferredSize(new java.awt.Dimension (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 (0, 0, 0, 0)); 63 localTransactionCheckBox.setMinimumSize(new java.awt.Dimension (40, 15)); 64 localTransactionCheckBox.setPreferredSize(new java.awt.Dimension (150, 15)); 65 localTransactionCheckBox.addActionListener(new java.awt.event.ActionListener () { 66 public void actionPerformed(java.awt.event.ActionEvent evt) { 67 localTransactionCheckBoxActionPerformed(evt); 68 } 69 }); 70 71 gridBagConstraints = new java.awt.GridBagConstraints (); 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 (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 (); 85 gridBagConstraints.gridx = 0; 86 gridBagConstraints.gridy = 1; 87 gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; 88 gridBagConstraints.insets = new java.awt.Insets (5, 14, 0, 6); 89 add(nameLabel, gridBagConstraints); 90 91 gridBagConstraints = new java.awt.GridBagConstraints (); 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 (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 (); 102 gridBagConstraints.gridx = 0; 103 gridBagConstraints.gridy = 2; 104 gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; 105 gridBagConstraints.insets = new java.awt.Insets (5, 14, 0, 6); 106 add(unresolvedLabel, gridBagConstraints); 107 108 unresolvedActionComboBox.setPreferredSize(new java.awt.Dimension (150, 22)); 109 gridBagConstraints = new java.awt.GridBagConstraints (); 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 (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 (0, 0, 0, 0)); 121 gridBagConstraints = new java.awt.GridBagConstraints (); 122 gridBagConstraints.gridx = 0; 123 gridBagConstraints.gridy = 3; 124 gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; 125 gridBagConstraints.insets = new java.awt.Insets (5, 14, 0, 6); 126 add(resolverCheckBox, gridBagConstraints); 127 128 resolverComboBox.setPreferredSize(new java.awt.Dimension (150, 22)); 129 gridBagConstraints = new java.awt.GridBagConstraints (); 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 (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 (0, 0, 0, 0)); 140 gridBagConstraints = new java.awt.GridBagConstraints (); 141 gridBagConstraints.gridx = 0; 142 gridBagConstraints.gridy = 4; 143 gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; 144 gridBagConstraints.insets = new java.awt.Insets (5, 14, 0, 6); 145 add(boundaryCheckBox, gridBagConstraints); 146 147 boundaryComboBox.setPreferredSize(new java.awt.Dimension (150, 22)); 148 gridBagConstraints = new java.awt.GridBagConstraints (); 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 (0, 1, 0, 10); 154 add(boundaryComboBox, gridBagConstraints); 155 156 } 158 private void localTransactionCheckBoxActionPerformed(java.awt.event.ActionEvent evt) { } 162 163 private javax.swing.JCheckBox boundaryCheckBox; 165 private javax.swing.JComboBox boundaryComboBox; 166 private javax.swing.JCheckBox localTransactionCheckBox; 167 private javax.swing.JLabel nameLabel; 168 private javax.swing.JCheckBox resolverCheckBox; 169 private javax.swing.JComboBox resolverComboBox; 170 private javax.swing.JTextField transactionNameField; 171 private javax.swing.JComboBox unresolvedActionComboBox; 172 private javax.swing.JLabel unresolvedLabel; 173 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); 189 } 190 } 191 public javax.swing.JCheckBox getBoundaryCheckBox(){ 192 return boundaryCheckBox; 193 } 194 public javax.swing.JCheckBox getResolverCheckBox(){ 195 return resolverCheckBox; 196 } 197 public javax.swing.JCheckBox getLocalTransactionCheckBox(){ 198 return localTransactionCheckBox; 199 } 200 public javax.swing.JComboBox getBoundaryComboBox() { 201 return boundaryComboBox; 202 } 203 public javax.swing.JComboBox getResolverComboBox() { 204 return resolverComboBox; 205 } 206 public javax.swing.JComboBox getUnresolvedActionComboBox() { 207 return unresolvedActionComboBox; 208 } 209 public javax.swing.JTextField getTransactionNameField() { 210 return transactionNameField; 211 } 212 public javax.swing.JLabel getNameLabel() { 213 return nameLabel; 214 } 215 public javax.swing.JLabel getUnresolvedActionLable() { 216 return unresolvedLabel; 217 } 218 public void setComponentsBackground(java.awt.Color 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 |