KickJava   Java API By Example, From Geeks To Geeks.

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


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

31 public class WSWebBndAttributesPanel extends /*javax.swing.JPanel*/ SectionInnerPanel{
32
33     //private WSWebBndRootCustomizer masterPanel;
34
WSWebBnd webbnd;
35     WSMultiViewDataObject dObj;
36     /*
37     public WSWebBndAttributesPanel() {
38         initComponents();
39     }
40      */

41     /** Creates new form WSWebBndAttributesPanel */
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 JavaDoc source, Object JavaDoc value) {
55         if (source==nameField) {
56             webbnd.setXmiId((String JavaDoc)value);
57         } else if (source==virtualHostField) {
58             webbnd.setVirtualHostName((String JavaDoc)value);
59         }
60     }
61     public javax.swing.JTextField JavaDoc getNameField() {
62         return nameField;
63     }
64     public javax.swing.JTextField JavaDoc getVirtualHostNameField() {
65         return virtualHostField;
66     }
67     public void linkButtonPressed(Object JavaDoc ddBean, String JavaDoc ddProperty) {
68     }
69     
70     public void documentChanged(javax.swing.text.JTextComponent JavaDoc comp, String JavaDoc value) {
71         if (comp==nameField) {
72             String JavaDoc val = (String JavaDoc)value;
73             if (val.length()==0) {
74                 getSectionView()
75                 .getErrorPanel()
76                 .setError(new Error JavaDoc(Error.MISSING_VALUE_MESSAGE, "name", comp));
77                 return;
78             }
79             getSectionView().getErrorPanel().clearError();
80         }
81         if (comp==virtualHostField) {
82             String JavaDoc val = (String JavaDoc)value;
83             if (val.length()==0) {
84                 getSectionView()
85                 .getErrorPanel()
86                 .setError(new Error JavaDoc(Error.MISSING_VALUE_MESSAGE, "vhn", comp));
87                 return;
88             }
89             getSectionView().getErrorPanel().clearError();
90         }
91     }
92     
93     public void rollbackValue(javax.swing.text.JTextComponent JavaDoc source) {
94         if (nameField==source) {
95             nameField.setText(webbnd.getXmiId());
96         }
97     }
98     /*
99     protected void signalUIChange() {
100         dObj.modelUpdatedFromUI();
101     }*/

102     
103     public javax.swing.JComponent JavaDoc getErrorComponent(String JavaDoc 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 JavaDoc evt) {
109         // TODO add your handling code here:
110
dObj.setChangedFromUI(true);
111         dObj.modelUpdatedFromUI();
112         //dObj.setChangedFromUI(true);
113
dObj.setChangedFromUI(false);
114     }
115      
116     /** This will be called before model is changed from this panel
117      */

118     protected void startUIChange() {
119         dObj.setChangedFromUI(true);
120     }
121     
122     /** This will be called after model is changed from this panel
123      */

124     protected void endUIChange() {
125         dObj.modelUpdatedFromUI();
126         dObj.setChangedFromUI(false);
127     }
128     
129     
130     /** This method is called from within the constructor to
131      * initialize the form.
132      * WARNING: Do NOT modify this code. The content of this method is
133      * always regenerated by the Form Editor.
134      */

135     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
136
private void initComponents() {
137         jLabel1 = new javax.swing.JLabel JavaDoc();
138         virtualHostField = new javax.swing.JTextField JavaDoc();
139         jLabel2 = new javax.swing.JLabel JavaDoc();
140         nameField = new javax.swing.JTextField JavaDoc();
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     }// </editor-fold>//GEN-END:initComponents
179

180     
181     // Variables declaration - do not modify//GEN-BEGIN:variables
182
private javax.swing.JLabel JavaDoc jLabel1;
183     private javax.swing.JLabel JavaDoc jLabel2;
184     private javax.swing.JTextField JavaDoc nameField;
185     private javax.swing.JTextField JavaDoc virtualHostField;
186     // End of variables declaration//GEN-END:variables
187

188 }
189
Popular Tags