KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > tax > beans > customizer > TreeEntityDeclCustomizer


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.xml.tax.beans.customizer;
20
21 import java.awt.CardLayout JavaDoc;
22 import java.beans.PropertyChangeEvent JavaDoc;
23
24 import org.netbeans.tax.TreeEntityDecl;
25 import org.netbeans.tax.TreeException;
26
27 import org.netbeans.modules.xml.tax.util.TAXUtil;
28
29 /**
30  *
31  * @author Libor Kramolis, Vladimir Zboril
32  * @version 0.1
33  */

34 public class TreeEntityDeclCustomizer extends AbstractTreeCustomizer {
35
36     /** Serial Version UID */
37     private static final long serialVersionUID = -4905667144375255810L;
38
39
40     /** */
41     private static final String JavaDoc TYPE_GENERAL = "General"; // NOI18N
42
/** */
43     private static final String JavaDoc TYPE_PARAMETER = "Parameter"; // NOI18N
44
/** */
45     private static final String JavaDoc[] typeItems = { TYPE_GENERAL, TYPE_PARAMETER };
46     
47     
48     
49     /** */
50     public TreeEntityDeclCustomizer () {
51         super ();
52         
53         initComponents ();
54         nameLabel.setDisplayedMnemonic (Util.THIS.getChar ("LAB_ElementName_mn")); // NOI18N
55
typeLabel.setDisplayedMnemonic (Util.THIS.getChar ("LAB_EntityType_mn")); // NOI18N
56
internalRadio.setMnemonic (Util.THIS.getChar ("RAD_Internal_mn")); // NOI18N
57
externalRadio.setMnemonic (Util.THIS.getChar ("RAD_External_mn")); // NOI18N
58
unparsedRadio.setMnemonic (Util.THIS.getChar ("RAD_Unparsed_mn")); // NOI18N
59

60         internValueLabel.setDisplayedMnemonic (Util.THIS.getChar ("LAB_internValue_mn")); // NOI18N
61
externPublicLabel.setDisplayedMnemonic (Util.THIS.getChar ("LAB_externPublic_mn")); // NOI18N
62
externSystemLabel.setDisplayedMnemonic (Util.THIS.getChar ("LAB_externSystem_mn")); // NOI18N
63
unparsedPublicLabel.setDisplayedMnemonic (Util.THIS.getChar ("LAB_unparsedPublic_mn")); // NOI18N
64
unparsedSystemLabel.setDisplayedMnemonic (Util.THIS.getChar ("LAB_unparsedSystem_mn")); // NOI18N
65
unparsedNotationLabel.setDisplayedMnemonic (Util.THIS.getChar ("LAB_unparsedNotation_mn")); // NOI18N
66

67         initAccessibility ();
68     }
69     
70     
71     /**
72      */

73     protected final TreeEntityDecl getEntityDecl () {
74         return (TreeEntityDecl)getTreeObject ();
75     }
76     
77     
78     /**
79      */

80     protected void safePropertyChange (PropertyChangeEvent JavaDoc pche) {
81         super.safePropertyChange (pche);
82         
83         if (pche.getPropertyName ().equals (TreeEntityDecl.PROP_PARAMETER)) {
84             updateParameterComponent ();
85         } else if (pche.getPropertyName ().equals (TreeEntityDecl.PROP_NAME)) {
86             updateNameComponent ();
87         } else if (pche.getPropertyName ().equals (TreeEntityDecl.PROP_INTERNAL_TEXT)) {
88             updateInternalTextComponent ();
89         } else if (pche.getPropertyName ().equals (TreeEntityDecl.PROP_PUBLIC_ID)) {
90             updatePublicIdComponent ();
91         } else if (pche.getPropertyName ().equals (TreeEntityDecl.PROP_SYSTEM_ID)) {
92             updateSystemIdComponent ();
93         } else if (pche.getPropertyName ().equals (TreeEntityDecl.PROP_NOTATION_NAME)) {
94             updateNotationComponent ();
95         } else if (pche.getPropertyName ().equals (TreeEntityDecl.PROP_TYPE)) {
96             updateTypeComponent ();
97         }
98     }
99     
100     /**
101      */

102     protected final void updateEntityDeclParameter () {
103         if ( typeCombo.getSelectedItem () == null ) {
104             return;
105         }
106         
107         try {
108             getEntityDecl ().setParameter (typeCombo.getSelectedItem () == TYPE_PARAMETER);
109         } catch (TreeException exc) {
110             updateParameterComponent ();
111             TAXUtil.notifyTreeException (exc);
112         }
113     }
114     
115     /**
116      */

117     protected final void updateParameterComponent () {
118         if (getEntityDecl ().isParameter ()) {
119             typeCombo.setSelectedItem (TYPE_PARAMETER);
120         } else {
121             typeCombo.setSelectedItem (TYPE_GENERAL);
122         }
123     }
124     
125     /**
126      */

127     protected final void updateEntityDeclName () {
128         try {
129             getEntityDecl ().setName (nameField.getText ());
130         } catch (TreeException exc) {
131             updateNameComponent ();
132             TAXUtil.notifyTreeException (exc);
133         }
134     }
135     
136     /**
137      */

138     protected final void updateNameComponent () {
139         nameField.setText (getEntityDecl ().getName ());
140     }
141     
142     
143     
144     /**
145      */

146     protected final void updateEntityDeclInternalText () {
147         try {
148             getEntityDecl ().setInternalText (text2null (internValueField.getText ()));
149         } catch (TreeException exc) {
150             updateInternalTextComponent ();
151             TAXUtil.notifyTreeException (exc);
152         }
153     }
154     
155     /**
156      */

157     protected final void updateInternalTextComponent () {
158         internValueField.setText (null2text (getEntityDecl ().getInternalText ()));
159     }
160     
161     /**
162      */

163     protected final void updateEntityDeclPublicId () {
164         try {
165             if ( externalRadio.isSelected () ) {
166                 getEntityDecl ().setPublicId (text2null (externPublicField.getText ()));
167             } else if ( unparsedRadio.isSelected () ) {
168                 getEntityDecl ().setPublicId (text2null (unparsedPublicField.getText ()));
169             }
170         } catch (TreeException exc) {
171             updatePublicIdComponent ();
172             TAXUtil.notifyTreeException (exc);
173         }
174     }
175     
176     /**
177      */

178     protected final void updatePublicIdComponent () {
179         externPublicField.setText (null2text (getEntityDecl ().getPublicId ()));
180         unparsedPublicField.setText (null2text (getEntityDecl ().getPublicId ()));
181     }
182     
183     /**
184      */

185     protected final void updateEntityDeclSystemId () {
186         try {
187             if ( externalRadio.isSelected () ) {
188                 getEntityDecl ().setSystemId (text2null (externSystemField.getText ()));
189             } else if ( unparsedRadio.isSelected () ) {
190                 getEntityDecl ().setSystemId (text2null (unparsedSystemField.getText ()));
191             }
192         } catch (TreeException exc) {
193             updateSystemIdComponent ();
194             TAXUtil.notifyTreeException (exc);
195         }
196     }
197     
198     /**
199      */

200     protected final void updateSystemIdComponent () {
201         externSystemField.setText (null2text (getEntityDecl ().getSystemId ()));
202         unparsedSystemField.setText (null2text (getEntityDecl ().getSystemId ()));
203     }
204     
205     
206     /**
207      */

208     protected final void updateEntityDeclNotationName () {
209         try {
210             getEntityDecl ().setNotationName (text2null (unparsedNotationField.getText ()));
211         } catch (TreeException exc) {
212             updateNotationComponent ();
213             TAXUtil.notifyTreeException (exc);
214         }
215     }
216     
217     /**
218      */

219     protected final void updateNotationComponent () {
220         unparsedNotationField.setText (null2text (getEntityDecl ().getNotationName ()));
221     }
222     
223     /**
224      */

225     protected final void updateTypeComponent () {
226         CardLayout JavaDoc cl = (CardLayout JavaDoc)typeCardPanel.getLayout ();
227         if ( getEntityDecl ().getType () == TreeEntityDecl.TYPE_INTERNAL ) {
228             internalRadio.setSelected (true);
229             cl.show (typeCardPanel, "internalPanel"); // NOI18N
230
} else if ( getEntityDecl ().getType () == TreeEntityDecl.TYPE_EXTERNAL ) {
231             externalRadio.setSelected (true);
232             cl.show (typeCardPanel, "externalPanel"); // NOI18N
233
} else {
234             unparsedRadio.setSelected (true);
235             cl.show (typeCardPanel, "unparsedPanel"); // NOI18N
236
}
237     }
238     
239     
240     /**
241      */

242     protected final void initComponentValues () {
243         updateParameterComponent ();
244         updateNameComponent ();
245         updateInternalTextComponent ();
246         updatePublicIdComponent ();
247         updateSystemIdComponent ();
248         updateNotationComponent ();
249         updateTypeComponent ();
250     }
251     
252     
253     /**
254      */

255     protected void updateReadOnlyStatus (boolean editable) {
256         nameField.setEditable (editable);
257         typeCombo.setEnabled (editable);
258         internalRadio.setEnabled (editable);
259         externalRadio.setEnabled (editable);
260         unparsedRadio.setEnabled (editable);
261         internValueField.setEditable (editable);
262         externPublicField.setEditable (editable);
263         externSystemField.setEditable (editable);
264         unparsedPublicField.setEditable (editable);
265         unparsedSystemField.setEditable (editable);
266         unparsedNotationField.setEditable (editable);
267     }
268     
269     
270     /** This method is called from within the constructor to
271      * initialize the form.
272      * WARNING: Do NOT modify this code. The content of this method is
273      * always regenerated by the FormEditor.
274      */

275     private void initComponents() {//GEN-BEGIN:initComponents
276
java.awt.GridBagConstraints JavaDoc gridBagConstraints;
277
278         buttonGroup = new javax.swing.ButtonGroup JavaDoc();
279         nameLabel = new javax.swing.JLabel JavaDoc();
280         nameField = new javax.swing.JTextField JavaDoc();
281         typeLabel = new javax.swing.JLabel JavaDoc();
282         typeCombo = new javax.swing.JComboBox JavaDoc(typeItems);
283         entityTypePanel = new javax.swing.JPanel JavaDoc();
284         internalRadio = new javax.swing.JRadioButton JavaDoc();
285         externalRadio = new javax.swing.JRadioButton JavaDoc();
286         unparsedRadio = new javax.swing.JRadioButton JavaDoc();
287         typeCardPanel = new javax.swing.JPanel JavaDoc();
288         internalPanel = new javax.swing.JPanel JavaDoc();
289         internValueLabel = new javax.swing.JLabel JavaDoc();
290         internValueField = new javax.swing.JTextField JavaDoc();
291         externalPanel = new javax.swing.JPanel JavaDoc();
292         externPublicLabel = new javax.swing.JLabel JavaDoc();
293         externPublicField = new javax.swing.JTextField JavaDoc();
294         externSystemLabel = new javax.swing.JLabel JavaDoc();
295         externSystemField = new javax.swing.JTextField JavaDoc();
296         unparsedPanel = new javax.swing.JPanel JavaDoc();
297         unparsedPublicLabel = new javax.swing.JLabel JavaDoc();
298         unparsedPublicField = new javax.swing.JTextField JavaDoc();
299         unparsedSystemLabel = new javax.swing.JLabel JavaDoc();
300         unparsedSystemField = new javax.swing.JTextField JavaDoc();
301         unparsedNotationLabel = new javax.swing.JLabel JavaDoc();
302         unparsedNotationField = new javax.swing.JTextField JavaDoc();
303
304         setLayout(new java.awt.GridBagLayout JavaDoc());
305
306         nameLabel.setText(Util.THIS.getString ("LAB_ElementName"));
307         nameLabel.setLabelFor(nameField);
308         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
309         gridBagConstraints.gridx = 0;
310         gridBagConstraints.gridy = 0;
311         gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
312         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 12, 0, 0);
313         add(nameLabel, gridBagConstraints);
314
315         nameField.setColumns(20);
316         nameField.addActionListener(new java.awt.event.ActionListener JavaDoc() {
317             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
318                 nameFieldActionPerformed(evt);
319             }
320         });
321
322         nameField.addFocusListener(new java.awt.event.FocusAdapter JavaDoc() {
323             public void focusGained(java.awt.event.FocusEvent JavaDoc evt) {
324                 nameFieldFocusGained(evt);
325             }
326             public void focusLost(java.awt.event.FocusEvent JavaDoc evt) {
327                 nameFieldFocusLost(evt);
328             }
329         });
330
331         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
332         gridBagConstraints.gridx = 1;
333         gridBagConstraints.gridy = 0;
334         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
335         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
336         gridBagConstraints.weightx = 1.0;
337         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 12, 0, 11);
338         add(nameField, gridBagConstraints);
339
340         typeLabel.setText(Util.THIS.getString ("LAB_EntityType"));
341         typeLabel.setLabelFor(typeCombo);
342         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
343         gridBagConstraints.gridx = 0;
344         gridBagConstraints.gridy = 1;
345         gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
346         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 12, 0, 0);
347         add(typeLabel, gridBagConstraints);
348
349         typeCombo.addActionListener(new java.awt.event.ActionListener JavaDoc() {
350             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
351                 typeComboActionPerformed(evt);
352             }
353         });
354
355         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
356         gridBagConstraints.gridx = 1;
357         gridBagConstraints.gridy = 1;
358         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
359         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
360         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 12, 0, 11);
361         add(typeCombo, gridBagConstraints);
362
363         entityTypePanel.setLayout(new java.awt.GridBagLayout JavaDoc());
364
365         entityTypePanel.setBorder(new javax.swing.border.TitledBorder JavaDoc(new javax.swing.border.EmptyBorder JavaDoc(new java.awt.Insets JavaDoc(0, 0, 0, 0))));
366         internalRadio.setSelected(true);
367         internalRadio.setText(Util.THIS.getString ("RAD_Internal"));
368         buttonGroup.add(internalRadio);
369         internalRadio.addActionListener(new java.awt.event.ActionListener JavaDoc() {
370             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
371                 internalRadioActionPerformed(evt);
372             }
373         });
374
375         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
376         gridBagConstraints.gridx = 0;
377         gridBagConstraints.gridy = 0;
378         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
379         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 12, 0, 0);
380         entityTypePanel.add(internalRadio, gridBagConstraints);
381
382         externalRadio.setText(Util.THIS.getString ("RAD_External"));
383         buttonGroup.add(externalRadio);
384         externalRadio.addActionListener(new java.awt.event.ActionListener JavaDoc() {
385             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
386                 externalRadioActionPerformed(evt);
387             }
388         });
389
390         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
391         gridBagConstraints.gridx = 1;
392         gridBagConstraints.gridy = 0;
393         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
394         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 12, 0, 0);
395         entityTypePanel.add(externalRadio, gridBagConstraints);
396
397         unparsedRadio.setText(Util.THIS.getString ("RAD_Unparsed"));
398         buttonGroup.add(unparsedRadio);
399         unparsedRadio.addActionListener(new java.awt.event.ActionListener JavaDoc() {
400             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
401                 unparsedRadioActionPerformed(evt);
402             }
403         });
404
405         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
406         gridBagConstraints.gridx = 2;
407         gridBagConstraints.gridy = 0;
408         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
409         gridBagConstraints.weightx = 1.0;
410         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 12, 0, 0);
411         entityTypePanel.add(unparsedRadio, gridBagConstraints);
412
413         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
414         gridBagConstraints.gridx = 0;
415         gridBagConstraints.gridy = 2;
416         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
417         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
418         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 12, 0, 11);
419         add(entityTypePanel, gridBagConstraints);
420
421         typeCardPanel.setLayout(new java.awt.CardLayout JavaDoc());
422
423         internalPanel.setLayout(new java.awt.GridBagLayout JavaDoc());
424
425         internValueLabel.setText(Util.THIS.getString ("LAB_Internal_Text"));
426         internValueLabel.setLabelFor(internValueField);
427         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
428         gridBagConstraints.gridx = 0;
429         gridBagConstraints.gridy = 0;
430         gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
431         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
432         gridBagConstraints.weighty = 1.0;
433         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 12, 0, 0);
434         internalPanel.add(internValueLabel, gridBagConstraints);
435
436         internValueField.addActionListener(new java.awt.event.ActionListener JavaDoc() {
437             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
438                 internValueFieldActionPerformed(evt);
439             }
440         });
441
442         internValueField.addFocusListener(new java.awt.event.FocusAdapter JavaDoc() {
443             public void focusGained(java.awt.event.FocusEvent JavaDoc evt) {
444                 internValueFieldFocusGained(evt);
445             }
446             public void focusLost(java.awt.event.FocusEvent JavaDoc evt) {
447                 internValueFieldFocusLost(evt);
448             }
449         });
450
451         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
452         gridBagConstraints.gridx = 1;
453         gridBagConstraints.gridy = 0;
454         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
455         gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
456         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
457         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
458         gridBagConstraints.weightx = 1.0;
459         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 12, 0, 0);
460         internalPanel.add(internValueField, gridBagConstraints);
461
462         typeCardPanel.add(internalPanel, "internalPanel");
463
464         externalPanel.setLayout(new java.awt.GridBagLayout JavaDoc());
465
466         externPublicLabel.setText(Util.THIS.getString ("LAB_External_PublicId"));
467         externPublicLabel.setLabelFor(externPublicField);
468         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
469         gridBagConstraints.gridx = 0;
470         gridBagConstraints.gridy = 0;
471         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
472         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 12, 0, 0);
473         externalPanel.add(externPublicLabel, gridBagConstraints);
474
475         externPublicField.addActionListener(new java.awt.event.ActionListener JavaDoc() {
476             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
477                 externPublicFieldActionPerformed(evt);
478             }
479         });
480
481         externPublicField.addFocusListener(new java.awt.event.FocusAdapter JavaDoc() {
482             public void focusLost(java.awt.event.FocusEvent JavaDoc evt) {
483                 externPublicFieldFocusLost(evt);
484             }
485         });
486
487         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
488         gridBagConstraints.gridx = 1;
489         gridBagConstraints.gridy = 0;
490         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
491         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
492         gridBagConstraints.weightx = 1.0;
493         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 12, 0, 0);
494         externalPanel.add(externPublicField, gridBagConstraints);
495
496         externSystemLabel.setText(Util.THIS.getString ("LAB_External_SystemId"));
497         externSystemLabel.setLabelFor(externSystemField);
498         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
499         gridBagConstraints.gridx = 0;
500         gridBagConstraints.gridy = 1;
501         gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
502         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
503         gridBagConstraints.weighty = 1.0;
504         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 12, 0, 0);
505         externalPanel.add(externSystemLabel, gridBagConstraints);
506
507         externSystemField.addActionListener(new java.awt.event.ActionListener JavaDoc() {
508             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
509                 externSystemFieldActionPerformed(evt);
510             }
511         });
512
513         externSystemField.addFocusListener(new java.awt.event.FocusAdapter JavaDoc() {
514             public void focusLost(java.awt.event.FocusEvent JavaDoc evt) {
515                 externSystemFieldFocusLost(evt);
516             }
517         });
518
519         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
520         gridBagConstraints.gridx = 1;
521         gridBagConstraints.gridy = 1;
522         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
523         gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
524         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
525         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
526         gridBagConstraints.weightx = 1.0;
527         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 12, 0, 0);
528         externalPanel.add(externSystemField, gridBagConstraints);
529
530         typeCardPanel.add(externalPanel, "externalPanel");
531
532         unparsedPanel.setLayout(new java.awt.GridBagLayout JavaDoc());
533
534         unparsedPublicLabel.setText(Util.THIS.getString ("LAB_Unparsed_PublicId"));
535         unparsedPublicLabel.setLabelFor(unparsedPublicField);
536         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
537         gridBagConstraints.gridx = 0;
538         gridBagConstraints.gridy = 0;
539         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
540         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
541         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 12, 0, 0);
542         unparsedPanel.add(unparsedPublicLabel, gridBagConstraints);
543
544         unparsedPublicField.addActionListener(new java.awt.event.ActionListener JavaDoc() {
545             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
546                 unparsedPublicFieldActionPerformed(evt);
547             }
548         });
549
550         unparsedPublicField.addFocusListener(new java.awt.event.FocusAdapter JavaDoc() {
551             public void focusLost(java.awt.event.FocusEvent JavaDoc evt) {
552                 unparsedPublicFieldFocusLost(evt);
553             }
554         });
555
556         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
557         gridBagConstraints.gridx = 1;
558         gridBagConstraints.gridy = 0;
559         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
560         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
561         gridBagConstraints.weightx = 1.0;
562         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 12, 0, 0);
563         unparsedPanel.add(unparsedPublicField, gridBagConstraints);
564
565         unparsedSystemLabel.setText(Util.THIS.getString ("LAB_Unparsed_SystemId"));
566         unparsedSystemLabel.setLabelFor(unparsedSystemField);
567         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
568         gridBagConstraints.gridx = 0;
569         gridBagConstraints.gridy = 1;
570         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
571         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
572         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 12, 0, 0);
573         unparsedPanel.add(unparsedSystemLabel, gridBagConstraints);
574
575         unparsedSystemField.addActionListener(new java.awt.event.ActionListener JavaDoc() {
576             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
577                 unparsedSystemFieldActionPerformed(evt);
578             }
579         });
580
581         unparsedSystemField.addFocusListener(new java.awt.event.FocusAdapter JavaDoc() {
582             public void focusLost(java.awt.event.FocusEvent JavaDoc evt) {
583                 unparsedSystemFieldFocusLost(evt);
584             }
585         });
586
587         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
588         gridBagConstraints.gridx = 1;
589         gridBagConstraints.gridy = 1;
590         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
591         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
592         gridBagConstraints.weightx = 1.0;
593         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 12, 0, 0);
594         unparsedPanel.add(unparsedSystemField, gridBagConstraints);
595
596         unparsedNotationLabel.setText(Util.THIS.getString ("LAB_Unparsed_NotationName"));
597         unparsedNotationLabel.setLabelFor(unparsedNotationField);
598         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
599         gridBagConstraints.gridx = 0;
600         gridBagConstraints.gridy = 2;
601         gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
602         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
603         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
604         gridBagConstraints.weighty = 1.0;
605         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 12, 0, 0);
606         unparsedPanel.add(unparsedNotationLabel, gridBagConstraints);
607
608         unparsedNotationField.addActionListener(new java.awt.event.ActionListener JavaDoc() {
609             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
610                 unparsedNotationFieldActionPerformed(evt);
611             }
612         });
613
614         unparsedNotationField.addFocusListener(new java.awt.event.FocusAdapter JavaDoc() {
615             public void focusLost(java.awt.event.FocusEvent JavaDoc evt) {
616                 unparsedNotationFieldFocusLost(evt);
617             }
618         });
619
620         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
621         gridBagConstraints.gridx = 1;
622         gridBagConstraints.gridy = 2;
623         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
624         gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
625         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
626         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
627         gridBagConstraints.weightx = 1.0;
628         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 12, 0, 0);
629         unparsedPanel.add(unparsedNotationField, gridBagConstraints);
630
631         typeCardPanel.add(unparsedPanel, "unparsedPanel");
632
633         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
634         gridBagConstraints.gridx = 0;
635         gridBagConstraints.gridy = 3;
636         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
637         gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
638         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
639         gridBagConstraints.weightx = 1.0;
640         gridBagConstraints.weighty = 1.0;
641         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 12, 0, 11);
642         add(typeCardPanel, gridBagConstraints);
643
644     }//GEN-END:initComponents
645

646     private void internValueFieldFocusGained(java.awt.event.FocusEvent JavaDoc evt) {//GEN-FIRST:event_internValueFieldFocusGained
647
// Accessibility:
648
internValueField.selectAll ();
649     }//GEN-LAST:event_internValueFieldFocusGained
650

651     private void nameFieldFocusGained(java.awt.event.FocusEvent JavaDoc evt) {//GEN-FIRST:event_nameFieldFocusGained
652
// Accessibility:
653
nameField.selectAll ();
654     }//GEN-LAST:event_nameFieldFocusGained
655

656     private void unparsedNotationFieldFocusLost(java.awt.event.FocusEvent JavaDoc evt) {//GEN-FIRST:event_unparsedNotationFieldFocusLost
657
// Add your handling code here:
658
updateEntityDeclNotationName ();
659     }//GEN-LAST:event_unparsedNotationFieldFocusLost
660

661     private void unparsedNotationFieldActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_unparsedNotationFieldActionPerformed
662
// Add your handling code here:
663
updateEntityDeclNotationName ();
664     }//GEN-LAST:event_unparsedNotationFieldActionPerformed
665

666     private void unparsedSystemFieldFocusLost(java.awt.event.FocusEvent JavaDoc evt) {//GEN-FIRST:event_unparsedSystemFieldFocusLost
667
// Add your handling code here:
668
updateEntityDeclSystemId ();
669     }//GEN-LAST:event_unparsedSystemFieldFocusLost
670

671     private void unparsedSystemFieldActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_unparsedSystemFieldActionPerformed
672
// Add your handling code here:
673
updateEntityDeclSystemId ();
674     }//GEN-LAST:event_unparsedSystemFieldActionPerformed
675

676     private void unparsedPublicFieldFocusLost(java.awt.event.FocusEvent JavaDoc evt) {//GEN-FIRST:event_unparsedPublicFieldFocusLost
677
// Add your handling code here:
678
updateEntityDeclPublicId ();
679     }//GEN-LAST:event_unparsedPublicFieldFocusLost
680

681     private void unparsedPublicFieldActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_unparsedPublicFieldActionPerformed
682
// Add your handling code here:
683
updateEntityDeclPublicId ();
684     }//GEN-LAST:event_unparsedPublicFieldActionPerformed
685

686     private void externSystemFieldFocusLost(java.awt.event.FocusEvent JavaDoc evt) {//GEN-FIRST:event_externSystemFieldFocusLost
687
// Add your handling code here:
688
updateEntityDeclSystemId ();
689     }//GEN-LAST:event_externSystemFieldFocusLost
690

691     private void externSystemFieldActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_externSystemFieldActionPerformed
692
// Add your handling code here:
693
updateEntityDeclSystemId ();
694     }//GEN-LAST:event_externSystemFieldActionPerformed
695

696     private void externPublicFieldActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_externPublicFieldActionPerformed
697
// Add your handling code here:
698
updateEntityDeclPublicId ();
699     }//GEN-LAST:event_externPublicFieldActionPerformed
700

701     private void externPublicFieldFocusLost(java.awt.event.FocusEvent JavaDoc evt) {//GEN-FIRST:event_externPublicFieldFocusLost
702
// Add your handling code here:
703
updateEntityDeclPublicId ();
704     }//GEN-LAST:event_externPublicFieldFocusLost
705

706     private void internValueFieldFocusLost(java.awt.event.FocusEvent JavaDoc evt) {//GEN-FIRST:event_internValueFieldFocusLost
707
// Add your handling code here:
708
updateEntityDeclInternalText ();
709     }//GEN-LAST:event_internValueFieldFocusLost
710

711     private void internValueFieldActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_internValueFieldActionPerformed
712
// Add your handling code here:
713
updateEntityDeclInternalText ();
714     }//GEN-LAST:event_internValueFieldActionPerformed
715

716     private void nameFieldFocusLost(java.awt.event.FocusEvent JavaDoc evt) {//GEN-FIRST:event_nameFieldFocusLost
717
// Add your handling code here:
718
updateEntityDeclName ();
719     }//GEN-LAST:event_nameFieldFocusLost
720

721     private void nameFieldActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_nameFieldActionPerformed
722
// Add your handling code here:
723
updateEntityDeclName ();
724     }//GEN-LAST:event_nameFieldActionPerformed
725

726     private void unparsedRadioActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_unparsedRadioActionPerformed
727
// Add your handling code here:
728
CardLayout JavaDoc cl = (CardLayout JavaDoc)typeCardPanel.getLayout ();
729         cl.show (typeCardPanel, "unparsedPanel"); // NOI18N
730
}//GEN-LAST:event_unparsedRadioActionPerformed
731

732     private void externalRadioActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_externalRadioActionPerformed
733
// Add your handling code here:
734
CardLayout JavaDoc cl = (CardLayout JavaDoc)typeCardPanel.getLayout ();
735         cl.show (typeCardPanel, "externalPanel"); // NOI18N
736
}//GEN-LAST:event_externalRadioActionPerformed
737

738     private void internalRadioActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_internalRadioActionPerformed
739
// Add your handling code here:
740
CardLayout JavaDoc cl = (CardLayout JavaDoc)typeCardPanel.getLayout ();
741         cl.show (typeCardPanel, "internalPanel"); // NOI18N
742
}//GEN-LAST:event_internalRadioActionPerformed
743

744     private void typeComboActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_typeComboActionPerformed
745
unparsedRadio.setEnabled (typeCombo.getSelectedIndex () != 1);
746         if (unparsedRadio.isSelected ()) {
747             internalRadio.setSelected (true);
748             internalRadioActionPerformed (evt);
749         }
750         updateEntityDeclParameter ();
751     }//GEN-LAST:event_typeComboActionPerformed
752

753     // Variables declaration - do not modify//GEN-BEGIN:variables
754
private javax.swing.JTextField JavaDoc unparsedSystemField;
755     private javax.swing.JLabel JavaDoc nameLabel;
756     private javax.swing.JLabel JavaDoc externSystemLabel;
757     private javax.swing.JRadioButton JavaDoc internalRadio;
758     private javax.swing.JTextField JavaDoc nameField;
759     private javax.swing.JTextField JavaDoc externSystemField;
760     private javax.swing.JLabel JavaDoc typeLabel;
761     private javax.swing.JPanel JavaDoc internalPanel;
762     private javax.swing.JLabel JavaDoc unparsedPublicLabel;
763     private javax.swing.JLabel JavaDoc internValueLabel;
764     private javax.swing.JTextField JavaDoc unparsedPublicField;
765     private javax.swing.JLabel JavaDoc externPublicLabel;
766     private javax.swing.JRadioButton JavaDoc unparsedRadio;
767     private javax.swing.JTextField JavaDoc internValueField;
768     private javax.swing.JTextField JavaDoc externPublicField;
769     private javax.swing.JPanel JavaDoc entityTypePanel;
770     private javax.swing.JLabel JavaDoc unparsedNotationLabel;
771     private javax.swing.JPanel JavaDoc unparsedPanel;
772     private javax.swing.JRadioButton JavaDoc externalRadio;
773     private javax.swing.ButtonGroup JavaDoc buttonGroup;
774     private javax.swing.JTextField JavaDoc unparsedNotationField;
775     private javax.swing.JPanel JavaDoc typeCardPanel;
776     private javax.swing.JLabel JavaDoc unparsedSystemLabel;
777     private javax.swing.JPanel JavaDoc externalPanel;
778     private javax.swing.JComboBox JavaDoc typeCombo;
779     // End of variables declaration//GEN-END:variables
780

781     /** Initialize accesibility
782      */

783     public void initAccessibility (){
784         
785         this.getAccessibleContext ().setAccessibleDescription (Util.THIS.getString ("ACSD_TreeEntityDeclCustomizer"));
786         
787         nameField.getAccessibleContext ().setAccessibleDescription (Util.THIS.getString ("ACSD_nameField2"));
788         typeCombo.getAccessibleContext ().setAccessibleDescription (Util.THIS.getString ("ACSD_typeCombo"));
789         
790         internValueField.getAccessibleContext ().setAccessibleDescription (Util.THIS.getString ("ACSD_internValueField"));
791         internValueField.selectAll ();
792         
793         externPublicField.getAccessibleContext ().setAccessibleDescription (Util.THIS.getString ("ACSD_externPublicField"));
794         externSystemField.getAccessibleContext ().setAccessibleDescription (Util.THIS.getString ("ACSD_externSystemField"));
795         
796         unparsedPublicField.getAccessibleContext ().setAccessibleDescription (Util.THIS.getString ("ACSD_unparsedPublicField"));
797         unparsedSystemField.getAccessibleContext ().setAccessibleDescription (Util.THIS.getString ("ACSD_unparsedSystemField"));
798         unparsedNotationField.getAccessibleContext ().setAccessibleDescription (Util.THIS.getString ("ACSD_unparsedNotationField"));
799         
800     }
801 }
802
Popular Tags