1 19 20 23 24 package org.netbeans.modules.j2ee.sun.ws7.ui; 25 import org.netbeans.modules.j2ee.sun.ws7.dm.WS70SunDeploymentManager; 26 import javax.swing.*; 27 import java.awt.event.*; 28 32 public class WS70ConnectionTabVisualPanel extends javax.swing.JPanel { 33 34 private WS70SunDeploymentManager manager; 35 36 public WS70ConnectionTabVisualPanel(WS70SunDeploymentManager dm) { 37 manager = dm; 38 initComponents(); 39 40 jAdminUrlTxt.setText(manager.getHost()+":"+manager.getPort()); 41 jAdminUserTxt.setText(manager.getUserName()); 42 jPasswordTxt.setText(manager.getPassword()); 43 jLocationTxt.setText(manager.getServerLocation()); 44 45 } 46 47 52 private void initComponents() { 54 jAdminUrlLbl = new javax.swing.JLabel (); 55 jAdminUrlTxt = new javax.swing.JTextField (); 56 jLocationLbl = new javax.swing.JLabel (); 57 jLocationTxt = new javax.swing.JTextField (); 58 jAdminUserLbl = new javax.swing.JLabel (); 59 jAdminUserTxt = new javax.swing.JTextField (); 60 jPasswordLbl = new javax.swing.JLabel (); 61 jPasswordTxt = new javax.swing.JPasswordField (); 62 63 addPropertyChangeListener(new java.beans.PropertyChangeListener () { 64 public void propertyChange(java.beans.PropertyChangeEvent evt) { 65 formPropertyChange(evt); 66 } 67 }); 68 addFocusListener(new java.awt.event.FocusAdapter () { 69 public void focusLost(java.awt.event.FocusEvent evt) { 70 formFocusLost(evt); 71 } 72 }); 73 74 jAdminUrlLbl.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("A11Y_Connection_Url_Mnem").charAt(0)); 75 jAdminUrlLbl.setLabelFor(jAdminUrlTxt); 76 jAdminUrlLbl.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("LBL_ConnectionAdminUrl")); 77 jAdminUrlLbl.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("A11Y_NAME_ConnectionAdminUrl")); 78 jAdminUrlLbl.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("A11Y_DESC_ConnectionAdminUrl")); 79 jAdminUrlLbl.getAccessibleContext().setAccessibleParent(this); 80 81 jAdminUrlTxt.setEditable(false); 82 83 jLocationLbl.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("A11Y_Connection_Location_Mnem").charAt(0)); 84 jLocationLbl.setLabelFor(jLocationTxt); 85 jLocationLbl.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("LBL_ConnectionLocation")); 86 jLocationLbl.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("A11Y_NAME_ConnectionLocation")); 87 jLocationLbl.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("A11Y_DESC_ConnectionLocation")); 88 jLocationLbl.getAccessibleContext().setAccessibleParent(this); 89 90 jLocationTxt.setEditable(false); 91 92 jAdminUserLbl.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("A11Y_Connection_User_Mnem").charAt(0)); 93 jAdminUserLbl.setLabelFor(jAdminUserTxt); 94 jAdminUserLbl.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("LBL_ConnectionAdminUser")); 95 jAdminUserLbl.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("A11Y_NAME_ConnectionAdminUser")); 96 jAdminUserLbl.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("A11Y_DESC_ConnectionAdminUser")); 97 jAdminUserLbl.getAccessibleContext().setAccessibleParent(this); 98 99 jAdminUserTxt.addKeyListener(new java.awt.event.KeyAdapter () { 100 public void keyReleased(java.awt.event.KeyEvent evt) { 101 jAdminUserTxtKeyReleased(evt); 102 } 103 }); 104 105 jPasswordLbl.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("A11Y_Connection_Password_Mnem").charAt(0)); 106 jPasswordLbl.setLabelFor(jPasswordTxt); 107 jPasswordLbl.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("LBL_ConnectionPassword")); 108 jPasswordLbl.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("A11Y_NAME_ConnectionPassword")); 109 jPasswordLbl.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("A11Y_DESC_ConnectionPassword")); 110 jPasswordLbl.getAccessibleContext().setAccessibleParent(this); 111 112 jPasswordTxt.addFocusListener(new java.awt.event.FocusAdapter () { 113 public void focusLost(java.awt.event.FocusEvent evt) { 114 jPasswordTxtFocusLost(evt); 115 } 116 }); 117 jPasswordTxt.addKeyListener(new java.awt.event.KeyAdapter () { 118 public void keyReleased(java.awt.event.KeyEvent evt) { 119 jPasswordTxtKeyReleased(evt); 120 } 121 }); 122 123 org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); 124 this.setLayout(layout); 125 layout.setHorizontalGroup( 126 layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 127 .add(layout.createSequentialGroup() 128 .add(22, 22, 22) 129 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 130 .add(jAdminUrlLbl) 131 .add(jLocationLbl) 132 .add(jAdminUserLbl) 133 .add(jPasswordLbl)) 134 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 135 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 136 .add(layout.createSequentialGroup() 137 .add(jPasswordTxt, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 248, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 138 .addContainerGap()) 139 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 140 .add(layout.createSequentialGroup() 141 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 142 .add(jAdminUrlTxt, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 248, Short.MAX_VALUE) 143 .add(jLocationTxt, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 248, Short.MAX_VALUE)) 144 .add(96, 96, 96)) 145 .add(layout.createSequentialGroup() 146 .add(jAdminUserTxt, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 248, Short.MAX_VALUE) 147 .addContainerGap())))) 148 ); 149 150 layout.linkSize(new java.awt.Component [] {jAdminUrlTxt, jAdminUserTxt, jLocationTxt, jPasswordTxt}, org.jdesktop.layout.GroupLayout.HORIZONTAL); 151 152 layout.setVerticalGroup( 153 layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 154 .add(layout.createSequentialGroup() 155 .add(28, 28, 28) 156 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) 157 .add(jAdminUrlLbl) 158 .add(jAdminUrlTxt, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) 159 .add(18, 18, 18) 160 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) 161 .add(jLocationLbl) 162 .add(jLocationTxt, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) 163 .add(19, 19, 19) 164 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) 165 .add(jAdminUserLbl) 166 .add(jAdminUserTxt, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) 167 .add(17, 17, 17) 168 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) 169 .add(jPasswordTxt, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 20, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 170 .add(jPasswordLbl)) 171 .addContainerGap(138, Short.MAX_VALUE)) 172 ); 173 174 layout.linkSize(new java.awt.Component [] {jAdminUrlTxt, jAdminUserTxt, jLocationTxt, jPasswordTxt}, org.jdesktop.layout.GroupLayout.VERTICAL); 175 176 layout.linkSize(new java.awt.Component [] {jAdminUrlLbl, jAdminUserLbl, jLocationLbl, jPasswordLbl}, org.jdesktop.layout.GroupLayout.VERTICAL); 177 178 } 180 private void formPropertyChange(java.beans.PropertyChangeEvent evt) { 182 String propertyname = evt.getPropertyName(); 183 Object oldValue = evt.getOldValue(); 184 Object newValue = evt.getNewValue(); 185 186 if(propertyname!=null && propertyname.equals("ancestor")){ 189 if(oldValue!=null && newValue==null){ 190 String uname = jAdminUserTxt.getText(); 191 char[] passWd = jPasswordTxt.getPassword(); 192 String password = new String (passWd); 193 manager.refreshInnerDM(uname, password); 194 } 195 } 196 } 198 private void formFocusLost(java.awt.event.FocusEvent evt) { } 201 private void jPasswordTxtFocusLost(java.awt.event.FocusEvent evt) { } 204 private void jPasswordTxtKeyReleased(java.awt.event.KeyEvent evt) { } 207 private void jAdminUserTxtKeyReleased(java.awt.event.KeyEvent evt) { } 210 public boolean isValid(){ 211 if(jAdminUserTxt.getText()==null || jAdminUserTxt.getText().trim().length()==0){ 212 return false; 213 } 215 return true; 216 } 217 private javax.swing.JLabel jAdminUrlLbl; 219 private javax.swing.JTextField jAdminUrlTxt; 220 private javax.swing.JLabel jAdminUserLbl; 221 private javax.swing.JTextField jAdminUserTxt; 222 private javax.swing.JLabel jLocationLbl; 223 private javax.swing.JTextField jLocationTxt; 224 private javax.swing.JLabel jPasswordLbl; 225 private javax.swing.JPasswordField jPasswordTxt; 226 228 } 229 | Popular Tags |