1 19 package org.netbeans.modules.j2ee.websphere6.dd.loaders.ui; 20 21 import org.netbeans.modules.j2ee.websphere6.dd.beans.WSWebBnd; 22 import org.netbeans.modules.j2ee.websphere6.dd.loaders.WSMultiViewDataObject; 23 import org.netbeans.modules.j2ee.websphere6.dd.loaders.webbnd.WSWebBndDataObject; 24 import org.netbeans.modules.xml.multiview.*; 25 import org.netbeans.modules.xml.multiview.ui.*; 26 import org.netbeans.modules.xml.multiview.Error; 27 31 public class WSWebBndAttributesPanel extends SectionInnerPanel{ 32 33 WSWebBnd webbnd; 35 WSMultiViewDataObject dObj; 36 41 42 43 public WSWebBndAttributesPanel(SectionView view, WSMultiViewDataObject dObj, WSWebBnd webbnd) { 44 super(view); 45 this.dObj=dObj; 46 this.webbnd=webbnd; 47 initComponents(); 48 nameField.setText(webbnd.getXmiId()); 49 addModifier(nameField); 50 virtualHostField.setText(webbnd.getVirtualHostName()); 51 addModifier(virtualHostField); 52 getSectionView().getErrorPanel().clearError(); 53 } 54 public void setValue(javax.swing.JComponent source, Object value) { 55 if (source==nameField) { 56 webbnd.setXmiId((String )value); 57 } else if (source==virtualHostField) { 58 webbnd.setVirtualHostName((String )value); 59 } 60 } 61 public javax.swing.JTextField getNameField() { 62 return nameField; 63 } 64 public javax.swing.JTextField getVirtualHostNameField() { 65 return virtualHostField; 66 } 67 public void linkButtonPressed(Object ddBean, String ddProperty) { 68 } 69 70 public void documentChanged(javax.swing.text.JTextComponent comp, String value) { 71 if (comp==nameField) { 72 String val = (String )value; 73 if (val.length()==0) { 74 getSectionView() 75 .getErrorPanel() 76 .setError(new Error (Error.MISSING_VALUE_MESSAGE, "name", comp)); 77 return; 78 } 79 getSectionView().getErrorPanel().clearError(); 80 } 81 if (comp==virtualHostField) { 82 String val = (String )value; 83 if (val.length()==0) { 84 getSectionView() 85 .getErrorPanel() 86 .setError(new Error (Error.MISSING_VALUE_MESSAGE, "vhn", comp)); 87 return; 88 } 89 getSectionView().getErrorPanel().clearError(); 90 } 91 } 92 93 public void rollbackValue(javax.swing.text.JTextComponent source) { 94 if (nameField==source) { 95 nameField.setText(webbnd.getXmiId()); 96 } 97 } 98 102 103 public javax.swing.JComponent getErrorComponent(String errorId) { 104 if ("name".equals(errorId)) return nameField; 105 if ("vhn".equals(errorId)) return virtualHostField; 106 return null; 107 } 108 public void itemStateChanged(java.awt.event.ItemEvent evt) { 109 dObj.setChangedFromUI(true); 111 dObj.modelUpdatedFromUI(); 112 dObj.setChangedFromUI(false); 114 } 115 116 118 protected void startUIChange() { 119 dObj.setChangedFromUI(true); 120 } 121 122 124 protected void endUIChange() { 125 dObj.modelUpdatedFromUI(); 126 dObj.setChangedFromUI(false); 127 } 128 129 130 135 private void initComponents() { 137 jLabel1 = new javax.swing.JLabel (); 138 virtualHostField = new javax.swing.JTextField (); 139 jLabel2 = new javax.swing.JLabel (); 140 nameField = new javax.swing.JTextField (); 141 142 jLabel1.setText("Virtual Host Name:"); 143 144 virtualHostField.setText("virtual_host"); 145 146 jLabel2.setText("Name:"); 147 148 nameField.setText("WebApp_1_Bnd"); 149 150 org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); 151 this.setLayout(layout); 152 layout.setHorizontalGroup( 153 layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 154 .add(layout.createSequentialGroup() 155 .addContainerGap() 156 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) 157 .add(jLabel2) 158 .add(jLabel1)) 159 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 160 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 161 .add(nameField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 332, Short.MAX_VALUE) 162 .add(virtualHostField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 332, Short.MAX_VALUE)) 163 .addContainerGap()) 164 ); 165 layout.setVerticalGroup( 166 layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 167 .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup() 168 .addContainerGap() 169 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) 170 .add(jLabel2) 171 .add(nameField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) 172 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 173 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) 174 .add(virtualHostField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 175 .add(jLabel1)) 176 .add(56, 56, 56)) 177 ); 178 } 180 181 private javax.swing.JLabel jLabel1; 183 private javax.swing.JLabel jLabel2; 184 private javax.swing.JTextField nameField; 185 private javax.swing.JTextField virtualHostField; 186 188 } 189 | Popular Tags |