1 19 package org.netbeans.modules.j2ee.websphere6.dd.loaders.ui; 20 21 import javax.swing.DefaultComboBoxModel ; 22 import org.netbeans.modules.j2ee.websphere6.dd.beans.*; 23 import org.netbeans.modules.j2ee.websphere6.dd.loaders.webext.*; 24 import org.netbeans.modules.xml.multiview.*; 25 import org.netbeans.modules.xml.multiview.ui.*; 26 27 31 public class ReferencePanel extends javax.swing.JPanel implements DDXmiConstants{ 32 CommonRef ref; 33 34 35 36 public ReferencePanel(CommonRef ref) { 37 this.ref=ref; 38 initComponents(); 39 typeComboBox.setModel(new DefaultComboBoxModel (BINDING_REFERENCE_TYPES)); 40 if(ref!=null) { 41 idField.setText(ref.getXmiId()); 42 jndiNameField.setText(ref.getJndiName()); 43 hrefField.setText(ref.getHref()); 44 if(ref instanceof ResRefBindingsType) { 45 typeComboBox.setSelectedIndex(0); 46 } else if(ref instanceof EjbRefBindingsType) { 47 typeComboBox.setSelectedIndex(1); 48 } else if(ref instanceof ResEnvRefBindingsType) { 49 typeComboBox.setSelectedIndex(2); 50 } 51 typeComboBox.setEnabled(false); 52 } 53 54 } 55 56 public ReferencePanel() { 57 initComponents(); 58 typeComboBox.setModel(new DefaultComboBoxModel (BINDING_REFERENCE_TYPES)); 59 typeComboBox.setEnabled(true); 60 } 61 62 67 private void initComponents() { 69 java.awt.GridBagConstraints gridBagConstraints; 70 71 idLabel = new javax.swing.JLabel (); 72 jndiNameLabel = new javax.swing.JLabel (); 73 hrefLabel = new javax.swing.JLabel (); 74 idField = new javax.swing.JTextField (); 75 jndiNameField = new javax.swing.JTextField (); 76 hrefField = new javax.swing.JTextField (); 77 jLabel1 = new javax.swing.JLabel (); 78 typeComboBox = new javax.swing.JComboBox (); 79 80 setLayout(new java.awt.GridBagLayout ()); 81 82 idLabel.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); 83 idLabel.setText("ID:"); 84 gridBagConstraints = new java.awt.GridBagConstraints (); 85 gridBagConstraints.gridx = 0; 86 gridBagConstraints.gridy = 1; 87 gridBagConstraints.ipadx = 28; 88 gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; 89 gridBagConstraints.insets = new java.awt.Insets (5, 20, 0, 5); 90 add(idLabel, gridBagConstraints); 91 92 jndiNameLabel.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); 93 jndiNameLabel.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/websphere6/dd/loaders/ui/Bundle").getString("LBL_JNDI_Name")); 94 gridBagConstraints = new java.awt.GridBagConstraints (); 95 gridBagConstraints.gridx = 0; 96 gridBagConstraints.gridy = 2; 97 gridBagConstraints.ipadx = 14; 98 gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; 99 gridBagConstraints.insets = new java.awt.Insets (5, 17, 0, 5); 100 add(jndiNameLabel, gridBagConstraints); 101 102 hrefLabel.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); 103 hrefLabel.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/websphere6/dd/loaders/ui/Bundle").getString("LBL_EjbJarId")); 104 gridBagConstraints = new java.awt.GridBagConstraints (); 105 gridBagConstraints.gridx = 0; 106 gridBagConstraints.gridy = 3; 107 gridBagConstraints.ipadx = 14; 108 gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; 109 gridBagConstraints.insets = new java.awt.Insets (5, 17, 0, 5); 110 add(hrefLabel, gridBagConstraints); 111 112 idField.setColumns(20); 113 gridBagConstraints = new java.awt.GridBagConstraints (); 114 gridBagConstraints.gridx = 10; 115 gridBagConstraints.gridy = 1; 116 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 117 gridBagConstraints.weightx = 1.0; 118 gridBagConstraints.insets = new java.awt.Insets (0, 0, 0, 10); 119 add(idField, gridBagConstraints); 120 121 gridBagConstraints = new java.awt.GridBagConstraints (); 122 gridBagConstraints.gridx = 10; 123 gridBagConstraints.gridy = 2; 124 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 125 gridBagConstraints.insets = new java.awt.Insets (0, 0, 0, 10); 126 add(jndiNameField, gridBagConstraints); 127 128 gridBagConstraints = new java.awt.GridBagConstraints (); 129 gridBagConstraints.gridx = 10; 130 gridBagConstraints.gridy = 3; 131 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 132 gridBagConstraints.insets = new java.awt.Insets (0, 0, 0, 10); 133 add(hrefField, gridBagConstraints); 134 135 jLabel1.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/websphere6/dd/loaders/ui/Bundle").getString("LBL_ReferenceType")); 136 gridBagConstraints = new java.awt.GridBagConstraints (); 137 gridBagConstraints.gridx = 0; 138 gridBagConstraints.gridy = 0; 139 gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; 140 gridBagConstraints.insets = new java.awt.Insets (5, 17, 0, 5); 141 add(jLabel1, gridBagConstraints); 142 143 typeComboBox.setOpaque(false); 144 typeComboBox.setPreferredSize(new java.awt.Dimension (200, 22)); 145 gridBagConstraints = new java.awt.GridBagConstraints (); 146 gridBagConstraints.gridx = 10; 147 gridBagConstraints.gridy = 0; 148 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 149 gridBagConstraints.insets = new java.awt.Insets (0, 0, 0, 10); 150 add(typeComboBox, gridBagConstraints); 151 152 } 154 155 private javax.swing.JTextField hrefField; 157 private javax.swing.JLabel hrefLabel; 158 private javax.swing.JTextField idField; 159 private javax.swing.JLabel idLabel; 160 private javax.swing.JLabel jLabel1; 161 private javax.swing.JTextField jndiNameField; 162 private javax.swing.JLabel jndiNameLabel; 163 private javax.swing.JComboBox typeComboBox; 164 public javax.swing.JTextField getIdField() { 166 return idField; 167 } 168 public javax.swing.JTextField getJndiNameField() { 169 return jndiNameField; 170 } 171 public javax.swing.JTextField getHrefField() { 172 return hrefField; 173 } 174 public javax.swing.JComboBox getTypeComboBox() { 175 return typeComboBox; 176 } 177 } 178 | Popular Tags |