KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > websphere6 > dd > loaders > ui > WSEjbExtAttributesPanel


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

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 /**
28  *
29  * @author dlm198383
30  */

31 public class WSEjbExtAttributesPanel extends SectionInnerPanel {
32
33     /** Creates new form WSEjbExtAttributesPanel */
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 JavaDoc source,Object JavaDoc value) {
49         if (source==nameField) {
50             ejbext.setXmiId((String JavaDoc)value);
51         } else if (source==hrefField) {
52             ejbext.setEjbJarHref((String JavaDoc)value);
53         }
54     }
55     public void linkButtonPressed(Object JavaDoc ddBean, String JavaDoc ddProperty) {
56     }
57     public javax.swing.JComponent JavaDoc getErrorComponent(String JavaDoc 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 JavaDoc comp, String JavaDoc value) {
63         if (comp==nameField) {
64             String JavaDoc val = (String JavaDoc)value;
65             if (val.length()==0) {
66                 getSectionView()
67                 .getErrorPanel()
68                 .setError(new Error JavaDoc(Error.MISSING_VALUE_MESSAGE, "ID", comp));
69                 return;
70             }
71             getSectionView().getErrorPanel().clearError();
72         }
73         if (comp==hrefField) {
74             String JavaDoc val = (String JavaDoc)value;
75             if (val.length()==0) {
76                 getSectionView()
77                 .getErrorPanel()
78                 .setError(new Error JavaDoc(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     /** This method is called from within the constructor to
94      * initialize the form.
95      * WARNING: Do NOT modify this code. The content of this method is
96      * always regenerated by the Form Editor.
97      */

98     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
99
private void initComponents() {
100         jLabel1 = new javax.swing.JLabel JavaDoc();
101         nameField = new javax.swing.JTextField JavaDoc();
102         jLabel2 = new javax.swing.JLabel JavaDoc();
103         hrefField = new javax.swing.JTextField JavaDoc();
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     }// </editor-fold>//GEN-END:initComponents
138

139     
140     // Variables declaration - do not modify//GEN-BEGIN:variables
141
private javax.swing.JTextField JavaDoc hrefField;
142     private javax.swing.JLabel JavaDoc jLabel1;
143     private javax.swing.JLabel JavaDoc jLabel2;
144     private javax.swing.JTextField JavaDoc nameField;
145     // End of variables declaration//GEN-END:variables
146

147 }
148
Popular Tags