001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041: package org.netbeans.modules.xml.tax.beans.customizer;
042:
043: import java.awt.CardLayout;
044: import java.beans.PropertyChangeEvent;
045:
046: import org.netbeans.tax.TreeEntityDecl;
047: import org.netbeans.tax.TreeException;
048:
049: import org.netbeans.modules.xml.tax.util.TAXUtil;
050:
051: /**
052: *
053: * @author Libor Kramolis, Vladimir Zboril
054: * @version 0.1
055: */
056: public class TreeEntityDeclCustomizer extends AbstractTreeCustomizer {
057:
058: /** Serial Version UID */
059: private static final long serialVersionUID = -4905667144375255810L;
060:
061: /** */
062: private static final String TYPE_GENERAL = "General"; // NOI18N
063: /** */
064: private static final String TYPE_PARAMETER = "Parameter"; // NOI18N
065: /** */
066: private static final String[] typeItems = { TYPE_GENERAL,
067: TYPE_PARAMETER };
068:
069: /** */
070: public TreeEntityDeclCustomizer() {
071: super ();
072:
073: initComponents();
074: nameLabel.setDisplayedMnemonic(Util.THIS
075: .getChar("LAB_ElementName_mn")); // NOI18N
076: typeLabel.setDisplayedMnemonic(Util.THIS
077: .getChar("LAB_EntityType_mn")); // NOI18N
078: internalRadio.setMnemonic(Util.THIS.getChar("RAD_Internal_mn")); // NOI18N
079: externalRadio.setMnemonic(Util.THIS.getChar("RAD_External_mn")); // NOI18N
080: unparsedRadio.setMnemonic(Util.THIS.getChar("RAD_Unparsed_mn")); // NOI18N
081:
082: internValueLabel.setDisplayedMnemonic(Util.THIS
083: .getChar("LAB_internValue_mn")); // NOI18N
084: externPublicLabel.setDisplayedMnemonic(Util.THIS
085: .getChar("LAB_externPublic_mn")); // NOI18N
086: externSystemLabel.setDisplayedMnemonic(Util.THIS
087: .getChar("LAB_externSystem_mn")); // NOI18N
088: unparsedPublicLabel.setDisplayedMnemonic(Util.THIS
089: .getChar("LAB_unparsedPublic_mn")); // NOI18N
090: unparsedSystemLabel.setDisplayedMnemonic(Util.THIS
091: .getChar("LAB_unparsedSystem_mn")); // NOI18N
092: unparsedNotationLabel.setDisplayedMnemonic(Util.THIS
093: .getChar("LAB_unparsedNotation_mn")); // NOI18N
094:
095: initAccessibility();
096: }
097:
098: /**
099: */
100: protected final TreeEntityDecl getEntityDecl() {
101: return (TreeEntityDecl) getTreeObject();
102: }
103:
104: /**
105: */
106: protected void safePropertyChange(PropertyChangeEvent pche) {
107: super .safePropertyChange(pche);
108:
109: if (pche.getPropertyName()
110: .equals(TreeEntityDecl.PROP_PARAMETER)) {
111: updateParameterComponent();
112: } else if (pche.getPropertyName().equals(
113: TreeEntityDecl.PROP_NAME)) {
114: updateNameComponent();
115: } else if (pche.getPropertyName().equals(
116: TreeEntityDecl.PROP_INTERNAL_TEXT)) {
117: updateInternalTextComponent();
118: } else if (pche.getPropertyName().equals(
119: TreeEntityDecl.PROP_PUBLIC_ID)) {
120: updatePublicIdComponent();
121: } else if (pche.getPropertyName().equals(
122: TreeEntityDecl.PROP_SYSTEM_ID)) {
123: updateSystemIdComponent();
124: } else if (pche.getPropertyName().equals(
125: TreeEntityDecl.PROP_NOTATION_NAME)) {
126: updateNotationComponent();
127: } else if (pche.getPropertyName().equals(
128: TreeEntityDecl.PROP_TYPE)) {
129: updateTypeComponent();
130: }
131: }
132:
133: /**
134: */
135: protected final void updateEntityDeclParameter() {
136: if (typeCombo.getSelectedItem() == null) {
137: return;
138: }
139:
140: try {
141: getEntityDecl().setParameter(
142: typeCombo.getSelectedItem() == TYPE_PARAMETER);
143: } catch (TreeException exc) {
144: updateParameterComponent();
145: TAXUtil.notifyTreeException(exc);
146: }
147: }
148:
149: /**
150: */
151: protected final void updateParameterComponent() {
152: if (getEntityDecl().isParameter()) {
153: typeCombo.setSelectedItem(TYPE_PARAMETER);
154: } else {
155: typeCombo.setSelectedItem(TYPE_GENERAL);
156: }
157: }
158:
159: /**
160: */
161: protected final void updateEntityDeclName() {
162: try {
163: getEntityDecl().setName(nameField.getText());
164: } catch (TreeException exc) {
165: updateNameComponent();
166: TAXUtil.notifyTreeException(exc);
167: }
168: }
169:
170: /**
171: */
172: protected final void updateNameComponent() {
173: nameField.setText(getEntityDecl().getName());
174: }
175:
176: /**
177: */
178: protected final void updateEntityDeclInternalText() {
179: try {
180: getEntityDecl().setInternalText(
181: text2null(internValueField.getText()));
182: } catch (TreeException exc) {
183: updateInternalTextComponent();
184: TAXUtil.notifyTreeException(exc);
185: }
186: }
187:
188: /**
189: */
190: protected final void updateInternalTextComponent() {
191: internValueField.setText(null2text(getEntityDecl()
192: .getInternalText()));
193: }
194:
195: /**
196: */
197: protected final void updateEntityDeclPublicId() {
198: try {
199: if (externalRadio.isSelected()) {
200: getEntityDecl().setPublicId(
201: text2null(externPublicField.getText()));
202: } else if (unparsedRadio.isSelected()) {
203: getEntityDecl().setPublicId(
204: text2null(unparsedPublicField.getText()));
205: }
206: } catch (TreeException exc) {
207: updatePublicIdComponent();
208: TAXUtil.notifyTreeException(exc);
209: }
210: }
211:
212: /**
213: */
214: protected final void updatePublicIdComponent() {
215: externPublicField.setText(null2text(getEntityDecl()
216: .getPublicId()));
217: unparsedPublicField.setText(null2text(getEntityDecl()
218: .getPublicId()));
219: }
220:
221: /**
222: */
223: protected final void updateEntityDeclSystemId() {
224: try {
225: if (externalRadio.isSelected()) {
226: getEntityDecl().setSystemId(
227: text2null(externSystemField.getText()));
228: } else if (unparsedRadio.isSelected()) {
229: getEntityDecl().setSystemId(
230: text2null(unparsedSystemField.getText()));
231: }
232: } catch (TreeException exc) {
233: updateSystemIdComponent();
234: TAXUtil.notifyTreeException(exc);
235: }
236: }
237:
238: /**
239: */
240: protected final void updateSystemIdComponent() {
241: externSystemField.setText(null2text(getEntityDecl()
242: .getSystemId()));
243: unparsedSystemField.setText(null2text(getEntityDecl()
244: .getSystemId()));
245: }
246:
247: /**
248: */
249: protected final void updateEntityDeclNotationName() {
250: try {
251: getEntityDecl().setNotationName(
252: text2null(unparsedNotationField.getText()));
253: } catch (TreeException exc) {
254: updateNotationComponent();
255: TAXUtil.notifyTreeException(exc);
256: }
257: }
258:
259: /**
260: */
261: protected final void updateNotationComponent() {
262: unparsedNotationField.setText(null2text(getEntityDecl()
263: .getNotationName()));
264: }
265:
266: /**
267: */
268: protected final void updateTypeComponent() {
269: CardLayout cl = (CardLayout) typeCardPanel.getLayout();
270: if (getEntityDecl().getType() == TreeEntityDecl.TYPE_INTERNAL) {
271: internalRadio.setSelected(true);
272: cl.show(typeCardPanel, "internalPanel"); // NOI18N
273: } else if (getEntityDecl().getType() == TreeEntityDecl.TYPE_EXTERNAL) {
274: externalRadio.setSelected(true);
275: cl.show(typeCardPanel, "externalPanel"); // NOI18N
276: } else {
277: unparsedRadio.setSelected(true);
278: cl.show(typeCardPanel, "unparsedPanel"); // NOI18N
279: }
280: }
281:
282: /**
283: */
284: protected final void initComponentValues() {
285: updateParameterComponent();
286: updateNameComponent();
287: updateInternalTextComponent();
288: updatePublicIdComponent();
289: updateSystemIdComponent();
290: updateNotationComponent();
291: updateTypeComponent();
292: }
293:
294: /**
295: */
296: protected void updateReadOnlyStatus(boolean editable) {
297: nameField.setEditable(editable);
298: typeCombo.setEnabled(editable);
299: internalRadio.setEnabled(editable);
300: externalRadio.setEnabled(editable);
301: unparsedRadio.setEnabled(editable);
302: internValueField.setEditable(editable);
303: externPublicField.setEditable(editable);
304: externSystemField.setEditable(editable);
305: unparsedPublicField.setEditable(editable);
306: unparsedSystemField.setEditable(editable);
307: unparsedNotationField.setEditable(editable);
308: }
309:
310: /** This method is called from within the constructor to
311: * initialize the form.
312: * WARNING: Do NOT modify this code. The content of this method is
313: * always regenerated by the FormEditor.
314: */
315: private void initComponents() {//GEN-BEGIN:initComponents
316: java.awt.GridBagConstraints gridBagConstraints;
317:
318: buttonGroup = new javax.swing.ButtonGroup();
319: nameLabel = new javax.swing.JLabel();
320: nameField = new javax.swing.JTextField();
321: typeLabel = new javax.swing.JLabel();
322: typeCombo = new javax.swing.JComboBox(typeItems);
323: entityTypePanel = new javax.swing.JPanel();
324: internalRadio = new javax.swing.JRadioButton();
325: externalRadio = new javax.swing.JRadioButton();
326: unparsedRadio = new javax.swing.JRadioButton();
327: typeCardPanel = new javax.swing.JPanel();
328: internalPanel = new javax.swing.JPanel();
329: internValueLabel = new javax.swing.JLabel();
330: internValueField = new javax.swing.JTextField();
331: externalPanel = new javax.swing.JPanel();
332: externPublicLabel = new javax.swing.JLabel();
333: externPublicField = new javax.swing.JTextField();
334: externSystemLabel = new javax.swing.JLabel();
335: externSystemField = new javax.swing.JTextField();
336: unparsedPanel = new javax.swing.JPanel();
337: unparsedPublicLabel = new javax.swing.JLabel();
338: unparsedPublicField = new javax.swing.JTextField();
339: unparsedSystemLabel = new javax.swing.JLabel();
340: unparsedSystemField = new javax.swing.JTextField();
341: unparsedNotationLabel = new javax.swing.JLabel();
342: unparsedNotationField = new javax.swing.JTextField();
343:
344: setLayout(new java.awt.GridBagLayout());
345:
346: nameLabel.setText(Util.THIS.getString("LAB_ElementName"));
347: nameLabel.setLabelFor(nameField);
348: gridBagConstraints = new java.awt.GridBagConstraints();
349: gridBagConstraints.gridx = 0;
350: gridBagConstraints.gridy = 0;
351: gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
352: gridBagConstraints.insets = new java.awt.Insets(12, 12, 0, 0);
353: add(nameLabel, gridBagConstraints);
354:
355: nameField.setColumns(20);
356: nameField
357: .addActionListener(new java.awt.event.ActionListener() {
358: public void actionPerformed(
359: java.awt.event.ActionEvent evt) {
360: nameFieldActionPerformed(evt);
361: }
362: });
363:
364: nameField.addFocusListener(new java.awt.event.FocusAdapter() {
365: public void focusGained(java.awt.event.FocusEvent evt) {
366: nameFieldFocusGained(evt);
367: }
368:
369: public void focusLost(java.awt.event.FocusEvent evt) {
370: nameFieldFocusLost(evt);
371: }
372: });
373:
374: gridBagConstraints = new java.awt.GridBagConstraints();
375: gridBagConstraints.gridx = 1;
376: gridBagConstraints.gridy = 0;
377: gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
378: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
379: gridBagConstraints.weightx = 1.0;
380: gridBagConstraints.insets = new java.awt.Insets(12, 12, 0, 11);
381: add(nameField, gridBagConstraints);
382:
383: typeLabel.setText(Util.THIS.getString("LAB_EntityType"));
384: typeLabel.setLabelFor(typeCombo);
385: gridBagConstraints = new java.awt.GridBagConstraints();
386: gridBagConstraints.gridx = 0;
387: gridBagConstraints.gridy = 1;
388: gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
389: gridBagConstraints.insets = new java.awt.Insets(12, 12, 0, 0);
390: add(typeLabel, gridBagConstraints);
391:
392: typeCombo
393: .addActionListener(new java.awt.event.ActionListener() {
394: public void actionPerformed(
395: java.awt.event.ActionEvent evt) {
396: typeComboActionPerformed(evt);
397: }
398: });
399:
400: gridBagConstraints = new java.awt.GridBagConstraints();
401: gridBagConstraints.gridx = 1;
402: gridBagConstraints.gridy = 1;
403: gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
404: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
405: gridBagConstraints.insets = new java.awt.Insets(12, 12, 0, 11);
406: add(typeCombo, gridBagConstraints);
407:
408: entityTypePanel.setLayout(new java.awt.GridBagLayout());
409:
410: entityTypePanel.setBorder(new javax.swing.border.TitledBorder(
411: new javax.swing.border.EmptyBorder(new java.awt.Insets(
412: 0, 0, 0, 0))));
413: internalRadio.setSelected(true);
414: internalRadio.setText(Util.THIS.getString("RAD_Internal"));
415: buttonGroup.add(internalRadio);
416: internalRadio
417: .addActionListener(new java.awt.event.ActionListener() {
418: public void actionPerformed(
419: java.awt.event.ActionEvent evt) {
420: internalRadioActionPerformed(evt);
421: }
422: });
423:
424: gridBagConstraints = new java.awt.GridBagConstraints();
425: gridBagConstraints.gridx = 0;
426: gridBagConstraints.gridy = 0;
427: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
428: gridBagConstraints.insets = new java.awt.Insets(12, 12, 0, 0);
429: entityTypePanel.add(internalRadio, gridBagConstraints);
430:
431: externalRadio.setText(Util.THIS.getString("RAD_External"));
432: buttonGroup.add(externalRadio);
433: externalRadio
434: .addActionListener(new java.awt.event.ActionListener() {
435: public void actionPerformed(
436: java.awt.event.ActionEvent evt) {
437: externalRadioActionPerformed(evt);
438: }
439: });
440:
441: gridBagConstraints = new java.awt.GridBagConstraints();
442: gridBagConstraints.gridx = 1;
443: gridBagConstraints.gridy = 0;
444: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
445: gridBagConstraints.insets = new java.awt.Insets(12, 12, 0, 0);
446: entityTypePanel.add(externalRadio, gridBagConstraints);
447:
448: unparsedRadio.setText(Util.THIS.getString("RAD_Unparsed"));
449: buttonGroup.add(unparsedRadio);
450: unparsedRadio
451: .addActionListener(new java.awt.event.ActionListener() {
452: public void actionPerformed(
453: java.awt.event.ActionEvent evt) {
454: unparsedRadioActionPerformed(evt);
455: }
456: });
457:
458: gridBagConstraints = new java.awt.GridBagConstraints();
459: gridBagConstraints.gridx = 2;
460: gridBagConstraints.gridy = 0;
461: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
462: gridBagConstraints.weightx = 1.0;
463: gridBagConstraints.insets = new java.awt.Insets(12, 12, 0, 0);
464: entityTypePanel.add(unparsedRadio, gridBagConstraints);
465:
466: gridBagConstraints = new java.awt.GridBagConstraints();
467: gridBagConstraints.gridx = 0;
468: gridBagConstraints.gridy = 2;
469: gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
470: gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
471: gridBagConstraints.insets = new java.awt.Insets(12, 12, 0, 11);
472: add(entityTypePanel, gridBagConstraints);
473:
474: typeCardPanel.setLayout(new java.awt.CardLayout());
475:
476: internalPanel.setLayout(new java.awt.GridBagLayout());
477:
478: internValueLabel.setText(Util.THIS
479: .getString("LAB_Internal_Text"));
480: internValueLabel.setLabelFor(internValueField);
481: gridBagConstraints = new java.awt.GridBagConstraints();
482: gridBagConstraints.gridx = 0;
483: gridBagConstraints.gridy = 0;
484: gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
485: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
486: gridBagConstraints.weighty = 1.0;
487: gridBagConstraints.insets = new java.awt.Insets(12, 12, 0, 0);
488: internalPanel.add(internValueLabel, gridBagConstraints);
489:
490: internValueField
491: .addActionListener(new java.awt.event.ActionListener() {
492: public void actionPerformed(
493: java.awt.event.ActionEvent evt) {
494: internValueFieldActionPerformed(evt);
495: }
496: });
497:
498: internValueField
499: .addFocusListener(new java.awt.event.FocusAdapter() {
500: public void focusGained(
501: java.awt.event.FocusEvent evt) {
502: internValueFieldFocusGained(evt);
503: }
504:
505: public void focusLost(java.awt.event.FocusEvent evt) {
506: internValueFieldFocusLost(evt);
507: }
508: });
509:
510: gridBagConstraints = new java.awt.GridBagConstraints();
511: gridBagConstraints.gridx = 1;
512: gridBagConstraints.gridy = 0;
513: gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
514: gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
515: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
516: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
517: gridBagConstraints.weightx = 1.0;
518: gridBagConstraints.insets = new java.awt.Insets(12, 12, 0, 0);
519: internalPanel.add(internValueField, gridBagConstraints);
520:
521: typeCardPanel.add(internalPanel, "internalPanel");
522:
523: externalPanel.setLayout(new java.awt.GridBagLayout());
524:
525: externPublicLabel.setText(Util.THIS
526: .getString("LAB_External_PublicId"));
527: externPublicLabel.setLabelFor(externPublicField);
528: gridBagConstraints = new java.awt.GridBagConstraints();
529: gridBagConstraints.gridx = 0;
530: gridBagConstraints.gridy = 0;
531: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
532: gridBagConstraints.insets = new java.awt.Insets(12, 12, 0, 0);
533: externalPanel.add(externPublicLabel, gridBagConstraints);
534:
535: externPublicField
536: .addActionListener(new java.awt.event.ActionListener() {
537: public void actionPerformed(
538: java.awt.event.ActionEvent evt) {
539: externPublicFieldActionPerformed(evt);
540: }
541: });
542:
543: externPublicField
544: .addFocusListener(new java.awt.event.FocusAdapter() {
545: public void focusLost(java.awt.event.FocusEvent evt) {
546: externPublicFieldFocusLost(evt);
547: }
548: });
549:
550: gridBagConstraints = new java.awt.GridBagConstraints();
551: gridBagConstraints.gridx = 1;
552: gridBagConstraints.gridy = 0;
553: gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
554: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
555: gridBagConstraints.weightx = 1.0;
556: gridBagConstraints.insets = new java.awt.Insets(12, 12, 0, 0);
557: externalPanel.add(externPublicField, gridBagConstraints);
558:
559: externSystemLabel.setText(Util.THIS
560: .getString("LAB_External_SystemId"));
561: externSystemLabel.setLabelFor(externSystemField);
562: gridBagConstraints = new java.awt.GridBagConstraints();
563: gridBagConstraints.gridx = 0;
564: gridBagConstraints.gridy = 1;
565: gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
566: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
567: gridBagConstraints.weighty = 1.0;
568: gridBagConstraints.insets = new java.awt.Insets(12, 12, 0, 0);
569: externalPanel.add(externSystemLabel, gridBagConstraints);
570:
571: externSystemField
572: .addActionListener(new java.awt.event.ActionListener() {
573: public void actionPerformed(
574: java.awt.event.ActionEvent evt) {
575: externSystemFieldActionPerformed(evt);
576: }
577: });
578:
579: externSystemField
580: .addFocusListener(new java.awt.event.FocusAdapter() {
581: public void focusLost(java.awt.event.FocusEvent evt) {
582: externSystemFieldFocusLost(evt);
583: }
584: });
585:
586: gridBagConstraints = new java.awt.GridBagConstraints();
587: gridBagConstraints.gridx = 1;
588: gridBagConstraints.gridy = 1;
589: gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
590: gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
591: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
592: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
593: gridBagConstraints.weightx = 1.0;
594: gridBagConstraints.insets = new java.awt.Insets(12, 12, 0, 0);
595: externalPanel.add(externSystemField, gridBagConstraints);
596:
597: typeCardPanel.add(externalPanel, "externalPanel");
598:
599: unparsedPanel.setLayout(new java.awt.GridBagLayout());
600:
601: unparsedPublicLabel.setText(Util.THIS
602: .getString("LAB_Unparsed_PublicId"));
603: unparsedPublicLabel.setLabelFor(unparsedPublicField);
604: gridBagConstraints = new java.awt.GridBagConstraints();
605: gridBagConstraints.gridx = 0;
606: gridBagConstraints.gridy = 0;
607: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
608: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
609: gridBagConstraints.insets = new java.awt.Insets(12, 12, 0, 0);
610: unparsedPanel.add(unparsedPublicLabel, gridBagConstraints);
611:
612: unparsedPublicField
613: .addActionListener(new java.awt.event.ActionListener() {
614: public void actionPerformed(
615: java.awt.event.ActionEvent evt) {
616: unparsedPublicFieldActionPerformed(evt);
617: }
618: });
619:
620: unparsedPublicField
621: .addFocusListener(new java.awt.event.FocusAdapter() {
622: public void focusLost(java.awt.event.FocusEvent evt) {
623: unparsedPublicFieldFocusLost(evt);
624: }
625: });
626:
627: gridBagConstraints = new java.awt.GridBagConstraints();
628: gridBagConstraints.gridx = 1;
629: gridBagConstraints.gridy = 0;
630: gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
631: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
632: gridBagConstraints.weightx = 1.0;
633: gridBagConstraints.insets = new java.awt.Insets(12, 12, 0, 0);
634: unparsedPanel.add(unparsedPublicField, gridBagConstraints);
635:
636: unparsedSystemLabel.setText(Util.THIS
637: .getString("LAB_Unparsed_SystemId"));
638: unparsedSystemLabel.setLabelFor(unparsedSystemField);
639: gridBagConstraints = new java.awt.GridBagConstraints();
640: gridBagConstraints.gridx = 0;
641: gridBagConstraints.gridy = 1;
642: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
643: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
644: gridBagConstraints.insets = new java.awt.Insets(12, 12, 0, 0);
645: unparsedPanel.add(unparsedSystemLabel, gridBagConstraints);
646:
647: unparsedSystemField
648: .addActionListener(new java.awt.event.ActionListener() {
649: public void actionPerformed(
650: java.awt.event.ActionEvent evt) {
651: unparsedSystemFieldActionPerformed(evt);
652: }
653: });
654:
655: unparsedSystemField
656: .addFocusListener(new java.awt.event.FocusAdapter() {
657: public void focusLost(java.awt.event.FocusEvent evt) {
658: unparsedSystemFieldFocusLost(evt);
659: }
660: });
661:
662: gridBagConstraints = new java.awt.GridBagConstraints();
663: gridBagConstraints.gridx = 1;
664: gridBagConstraints.gridy = 1;
665: gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
666: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
667: gridBagConstraints.weightx = 1.0;
668: gridBagConstraints.insets = new java.awt.Insets(12, 12, 0, 0);
669: unparsedPanel.add(unparsedSystemField, gridBagConstraints);
670:
671: unparsedNotationLabel.setText(Util.THIS
672: .getString("LAB_Unparsed_NotationName"));
673: unparsedNotationLabel.setLabelFor(unparsedNotationField);
674: gridBagConstraints = new java.awt.GridBagConstraints();
675: gridBagConstraints.gridx = 0;
676: gridBagConstraints.gridy = 2;
677: gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
678: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
679: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
680: gridBagConstraints.weighty = 1.0;
681: gridBagConstraints.insets = new java.awt.Insets(12, 12, 0, 0);
682: unparsedPanel.add(unparsedNotationLabel, gridBagConstraints);
683:
684: unparsedNotationField
685: .addActionListener(new java.awt.event.ActionListener() {
686: public void actionPerformed(
687: java.awt.event.ActionEvent evt) {
688: unparsedNotationFieldActionPerformed(evt);
689: }
690: });
691:
692: unparsedNotationField
693: .addFocusListener(new java.awt.event.FocusAdapter() {
694: public void focusLost(java.awt.event.FocusEvent evt) {
695: unparsedNotationFieldFocusLost(evt);
696: }
697: });
698:
699: gridBagConstraints = new java.awt.GridBagConstraints();
700: gridBagConstraints.gridx = 1;
701: gridBagConstraints.gridy = 2;
702: gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
703: gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
704: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
705: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
706: gridBagConstraints.weightx = 1.0;
707: gridBagConstraints.insets = new java.awt.Insets(12, 12, 0, 0);
708: unparsedPanel.add(unparsedNotationField, gridBagConstraints);
709:
710: typeCardPanel.add(unparsedPanel, "unparsedPanel");
711:
712: gridBagConstraints = new java.awt.GridBagConstraints();
713: gridBagConstraints.gridx = 0;
714: gridBagConstraints.gridy = 3;
715: gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
716: gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
717: gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
718: gridBagConstraints.weightx = 1.0;
719: gridBagConstraints.weighty = 1.0;
720: gridBagConstraints.insets = new java.awt.Insets(12, 12, 0, 11);
721: add(typeCardPanel, gridBagConstraints);
722:
723: }//GEN-END:initComponents
724:
725: private void internValueFieldFocusGained(
726: java.awt.event.FocusEvent evt) {//GEN-FIRST:event_internValueFieldFocusGained
727: // Accessibility:
728: internValueField.selectAll();
729: }//GEN-LAST:event_internValueFieldFocusGained
730:
731: private void nameFieldFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_nameFieldFocusGained
732: // Accessibility:
733: nameField.selectAll();
734: }//GEN-LAST:event_nameFieldFocusGained
735:
736: private void unparsedNotationFieldFocusLost(
737: java.awt.event.FocusEvent evt) {//GEN-FIRST:event_unparsedNotationFieldFocusLost
738: // Add your handling code here:
739: updateEntityDeclNotationName();
740: }//GEN-LAST:event_unparsedNotationFieldFocusLost
741:
742: private void unparsedNotationFieldActionPerformed(
743: java.awt.event.ActionEvent evt) {//GEN-FIRST:event_unparsedNotationFieldActionPerformed
744: // Add your handling code here:
745: updateEntityDeclNotationName();
746: }//GEN-LAST:event_unparsedNotationFieldActionPerformed
747:
748: private void unparsedSystemFieldFocusLost(
749: java.awt.event.FocusEvent evt) {//GEN-FIRST:event_unparsedSystemFieldFocusLost
750: // Add your handling code here:
751: updateEntityDeclSystemId();
752: }//GEN-LAST:event_unparsedSystemFieldFocusLost
753:
754: private void unparsedSystemFieldActionPerformed(
755: java.awt.event.ActionEvent evt) {//GEN-FIRST:event_unparsedSystemFieldActionPerformed
756: // Add your handling code here:
757: updateEntityDeclSystemId();
758: }//GEN-LAST:event_unparsedSystemFieldActionPerformed
759:
760: private void unparsedPublicFieldFocusLost(
761: java.awt.event.FocusEvent evt) {//GEN-FIRST:event_unparsedPublicFieldFocusLost
762: // Add your handling code here:
763: updateEntityDeclPublicId();
764: }//GEN-LAST:event_unparsedPublicFieldFocusLost
765:
766: private void unparsedPublicFieldActionPerformed(
767: java.awt.event.ActionEvent evt) {//GEN-FIRST:event_unparsedPublicFieldActionPerformed
768: // Add your handling code here:
769: updateEntityDeclPublicId();
770: }//GEN-LAST:event_unparsedPublicFieldActionPerformed
771:
772: private void externSystemFieldFocusLost(
773: java.awt.event.FocusEvent evt) {//GEN-FIRST:event_externSystemFieldFocusLost
774: // Add your handling code here:
775: updateEntityDeclSystemId();
776: }//GEN-LAST:event_externSystemFieldFocusLost
777:
778: private void externSystemFieldActionPerformed(
779: java.awt.event.ActionEvent evt) {//GEN-FIRST:event_externSystemFieldActionPerformed
780: // Add your handling code here:
781: updateEntityDeclSystemId();
782: }//GEN-LAST:event_externSystemFieldActionPerformed
783:
784: private void externPublicFieldActionPerformed(
785: java.awt.event.ActionEvent evt) {//GEN-FIRST:event_externPublicFieldActionPerformed
786: // Add your handling code here:
787: updateEntityDeclPublicId();
788: }//GEN-LAST:event_externPublicFieldActionPerformed
789:
790: private void externPublicFieldFocusLost(
791: java.awt.event.FocusEvent evt) {//GEN-FIRST:event_externPublicFieldFocusLost
792: // Add your handling code here:
793: updateEntityDeclPublicId();
794: }//GEN-LAST:event_externPublicFieldFocusLost
795:
796: private void internValueFieldFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_internValueFieldFocusLost
797: // Add your handling code here:
798: updateEntityDeclInternalText();
799: }//GEN-LAST:event_internValueFieldFocusLost
800:
801: private void internValueFieldActionPerformed(
802: java.awt.event.ActionEvent evt) {//GEN-FIRST:event_internValueFieldActionPerformed
803: // Add your handling code here:
804: updateEntityDeclInternalText();
805: }//GEN-LAST:event_internValueFieldActionPerformed
806:
807: private void nameFieldFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_nameFieldFocusLost
808: // Add your handling code here:
809: updateEntityDeclName();
810: }//GEN-LAST:event_nameFieldFocusLost
811:
812: private void nameFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nameFieldActionPerformed
813: // Add your handling code here:
814: updateEntityDeclName();
815: }//GEN-LAST:event_nameFieldActionPerformed
816:
817: private void unparsedRadioActionPerformed(
818: java.awt.event.ActionEvent evt) {//GEN-FIRST:event_unparsedRadioActionPerformed
819: // Add your handling code here:
820: CardLayout cl = (CardLayout) typeCardPanel.getLayout();
821: cl.show(typeCardPanel, "unparsedPanel"); // NOI18N
822: }//GEN-LAST:event_unparsedRadioActionPerformed
823:
824: private void externalRadioActionPerformed(
825: java.awt.event.ActionEvent evt) {//GEN-FIRST:event_externalRadioActionPerformed
826: // Add your handling code here:
827: CardLayout cl = (CardLayout) typeCardPanel.getLayout();
828: cl.show(typeCardPanel, "externalPanel"); // NOI18N
829: }//GEN-LAST:event_externalRadioActionPerformed
830:
831: private void internalRadioActionPerformed(
832: java.awt.event.ActionEvent evt) {//GEN-FIRST:event_internalRadioActionPerformed
833: // Add your handling code here:
834: CardLayout cl = (CardLayout) typeCardPanel.getLayout();
835: cl.show(typeCardPanel, "internalPanel"); // NOI18N
836: }//GEN-LAST:event_internalRadioActionPerformed
837:
838: private void typeComboActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_typeComboActionPerformed
839: unparsedRadio.setEnabled(typeCombo.getSelectedIndex() != 1);
840: if (unparsedRadio.isSelected()) {
841: internalRadio.setSelected(true);
842: internalRadioActionPerformed(evt);
843: }
844: updateEntityDeclParameter();
845: }//GEN-LAST:event_typeComboActionPerformed
846:
847: // Variables declaration - do not modify//GEN-BEGIN:variables
848: private javax.swing.JTextField unparsedSystemField;
849: private javax.swing.JLabel nameLabel;
850: private javax.swing.JLabel externSystemLabel;
851: private javax.swing.JRadioButton internalRadio;
852: private javax.swing.JTextField nameField;
853: private javax.swing.JTextField externSystemField;
854: private javax.swing.JLabel typeLabel;
855: private javax.swing.JPanel internalPanel;
856: private javax.swing.JLabel unparsedPublicLabel;
857: private javax.swing.JLabel internValueLabel;
858: private javax.swing.JTextField unparsedPublicField;
859: private javax.swing.JLabel externPublicLabel;
860: private javax.swing.JRadioButton unparsedRadio;
861: private javax.swing.JTextField internValueField;
862: private javax.swing.JTextField externPublicField;
863: private javax.swing.JPanel entityTypePanel;
864: private javax.swing.JLabel unparsedNotationLabel;
865: private javax.swing.JPanel unparsedPanel;
866: private javax.swing.JRadioButton externalRadio;
867: private javax.swing.ButtonGroup buttonGroup;
868: private javax.swing.JTextField unparsedNotationField;
869: private javax.swing.JPanel typeCardPanel;
870: private javax.swing.JLabel unparsedSystemLabel;
871: private javax.swing.JPanel externalPanel;
872: private javax.swing.JComboBox typeCombo;
873:
874: // End of variables declaration//GEN-END:variables
875:
876: /** Initialize accesibility
877: */
878: public void initAccessibility() {
879:
880: this .getAccessibleContext().setAccessibleDescription(
881: Util.THIS.getString("ACSD_TreeEntityDeclCustomizer"));
882:
883: nameField.getAccessibleContext().setAccessibleDescription(
884: Util.THIS.getString("ACSD_nameField2"));
885: typeCombo.getAccessibleContext().setAccessibleDescription(
886: Util.THIS.getString("ACSD_typeCombo"));
887:
888: internValueField.getAccessibleContext()
889: .setAccessibleDescription(
890: Util.THIS.getString("ACSD_internValueField"));
891: internValueField.selectAll();
892:
893: externPublicField.getAccessibleContext()
894: .setAccessibleDescription(
895: Util.THIS.getString("ACSD_externPublicField"));
896: externSystemField.getAccessibleContext()
897: .setAccessibleDescription(
898: Util.THIS.getString("ACSD_externSystemField"));
899:
900: unparsedPublicField
901: .getAccessibleContext()
902: .setAccessibleDescription(
903: Util.THIS.getString("ACSD_unparsedPublicField"));
904: unparsedSystemField
905: .getAccessibleContext()
906: .setAccessibleDescription(
907: Util.THIS.getString("ACSD_unparsedSystemField"));
908: unparsedNotationField
909: .getAccessibleContext()
910: .setAccessibleDescription(
911: Util.THIS
912: .getString("ACSD_unparsedNotationField"));
913:
914: }
915: }
|