1 19 package org.netbeans.modules.j2ee.websphere6.dd.loaders.ui; 20 21 import org.netbeans.modules.j2ee.websphere6.dd.beans.DDXmiConstants; 22 import org.netbeans.modules.xml.multiview.*; 23 import org.netbeans.modules.xml.multiview.ui.*; 24 import org.netbeans.modules.xml.multiview.Error; 25 import org.netbeans.modules.j2ee.websphere6.dd.loaders.ejbext.*; 26 import org.netbeans.modules.j2ee.websphere6.dd.beans.WSEjbExt; 27 31 public class WSEjbExtAttributesPanel extends SectionInnerPanel { 32 33 34 WSEjbExt ejbext; 35 WSEjbExtDataObject dObj; 36 37 public WSEjbExtAttributesPanel(SectionView view, WSEjbExtDataObject dObj, WSEjbExt ejbext) { 38 super(view); 39 this.dObj=dObj; 40 this.ejbext=ejbext; 41 initComponents(); 42 nameField.setText(ejbext.getXmiId()); 43 hrefField.setText(ejbext.getEjbJarHref()); 44 addModifier(nameField); 45 addModifier(hrefField); 46 } 47 48 public void setValue(javax.swing.JComponent source,Object value) { 49 if (source==nameField) { 50 ejbext.setXmiId((String )value); 51 } else if (source==hrefField) { 52 ejbext.setEjbJarHref((String )value); 53 } 54 } 55 public void linkButtonPressed(Object ddBean, String ddProperty) { 56 } 57 public javax.swing.JComponent getErrorComponent(String errorId) { 58 if ("ID".equals(errorId)) return nameField; 59 if ("HREF".equals(errorId)) return hrefField; 60 return null; 61 } 62 public void documentChanged(javax.swing.text.JTextComponent comp, String value) { 63 if (comp==nameField) { 64 String val = (String )value; 65 if (val.length()==0) { 66 getSectionView() 67 .getErrorPanel() 68 .setError(new Error (Error.MISSING_VALUE_MESSAGE, "ID", comp)); 69 return; 70 } 71 getSectionView().getErrorPanel().clearError(); 72 } 73 if (comp==hrefField) { 74 String val = (String )value; 75 if (val.length()==0) { 76 getSectionView() 77 .getErrorPanel() 78 .setError(new Error (Error.MISSING_VALUE_MESSAGE, "HREF", comp)); 79 return; 80 } 81 getSectionView().getErrorPanel().clearError(); 82 } 83 84 } 85 86 protected void startUIChange() { 87 dObj.setChangedFromUI(true); 88 } 89 protected void endUIChange() { 90 dObj.modelUpdatedFromUI(); 91 dObj.setChangedFromUI(false); 92 } 93 98 private void initComponents() { 100 jLabel1 = new javax.swing.JLabel (); 101 nameField = new javax.swing.JTextField (); 102 jLabel2 = new javax.swing.JLabel (); 103 hrefField = new javax.swing.JTextField (); 104 105 jLabel1.setText("Name:"); 106 107 jLabel2.setText("ID:"); 108 109 org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); 110 this.setLayout(layout); 111 layout.setHorizontalGroup( 112 layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 113 .add(layout.createSequentialGroup() 114 .addContainerGap() 115 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) 116 .add(jLabel2) 117 .add(jLabel1)) 118 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 119 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 120 .add(hrefField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 472, Short.MAX_VALUE) 121 .add(nameField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 472, Short.MAX_VALUE)) 122 .addContainerGap()) 123 ); 124 layout.setVerticalGroup( 125 layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 126 .add(layout.createSequentialGroup() 127 .addContainerGap() 128 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) 129 .add(nameField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 130 .add(jLabel1)) 131 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 132 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) 133 .add(jLabel2) 134 .add(hrefField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) 135 .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) 136 ); 137 } 139 140 private javax.swing.JTextField hrefField; 142 private javax.swing.JLabel jLabel1; 143 private javax.swing.JLabel jLabel2; 144 private javax.swing.JTextField nameField; 145 147 } 148 | Popular Tags |