Source Code Cross Referenced for BindingCustomizer.java in  » IDE-Netbeans » form » org » netbeans » modules » form » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Netbeans » form » org.netbeans.modules.form 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
0003:         *
0004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
0005:         *
0006:         * The contents of this file are subject to the terms of either the GNU
0007:         * General Public License Version 2 only ("GPL") or the Common
0008:         * Development and Distribution License("CDDL") (collectively, the
0009:         * "License"). You may not use this file except in compliance with the
0010:         * License. You can obtain a copy of the License at
0011:         * http://www.netbeans.org/cddl-gplv2.html
0012:         * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
0013:         * specific language governing permissions and limitations under the
0014:         * License.  When distributing the software, include this License Header
0015:         * Notice in each file and include the License file at
0016:         * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
0017:         * particular file as subject to the "Classpath" exception as provided
0018:         * by Sun in the GPL Version 2 section of the License file that
0019:         * accompanied this code. If applicable, add the following below the
0020:         * License Header, with the fields enclosed by brackets [] replaced by
0021:         * your own identifying information:
0022:         * "Portions Copyrighted [year] [name of copyright owner]"
0023:         *
0024:         * Contributor(s):
0025:         *
0026:         * The Original Software is NetBeans. The Initial Developer of the Original
0027:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
0028:         * Microsystems, Inc. All Rights Reserved.
0029:         *
0030:         * If you wish your version of this file to be governed by only the CDDL
0031:         * or only the GPL Version 2, indicate your decision by adding
0032:         * "[Contributor] elects to include this software in this distribution
0033:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
0034:         * single choice of license, a recipient has the option to distribute
0035:         * your version of this file under either the CDDL, the GPL Version 2 or
0036:         * to extend the choice of license to its licensees as provided above.
0037:         * However, if you add GPL Version 2 code and therefore, elected the GPL
0038:         * Version 2 license, then the option applies only if the new code is
0039:         * made subject to such option by the copyright holder.
0040:         */
0041:
0042:        package org.netbeans.modules.form;
0043:
0044:        import java.awt.*;
0045:        import java.awt.event.*;
0046:        import java.beans.PropertyChangeListener;
0047:        import java.beans.PropertyChangeSupport;
0048:        import java.lang.reflect.*;
0049:        import java.text.MessageFormat;
0050:        import java.util.*;
0051:        import java.util.List;
0052:        import java.util.concurrent.*;
0053:        import java.util.logging.Level;
0054:        import java.util.logging.Logger;
0055:        import javax.swing.*;
0056:        import javax.swing.event.ChangeEvent;
0057:        import javax.swing.event.ChangeListener;
0058:        import javax.swing.text.JTextComponent;
0059:        import javax.swing.tree.DefaultMutableTreeNode;
0060:        import javax.swing.tree.DefaultTreeCellRenderer;
0061:        import javax.swing.tree.DefaultTreeModel;
0062:        import javax.swing.tree.TreeCellRenderer;
0063:        import javax.swing.tree.TreeModel;
0064:        import javax.swing.tree.TreePath;
0065:        import org.jdesktop.layout.GroupLayout;
0066:        import org.jdesktop.layout.LayoutStyle;
0067:        import org.netbeans.api.progress.ProgressHandle;
0068:        import org.netbeans.api.progress.ProgressHandleFactory;
0069:        import org.netbeans.modules.form.FormUtils.TypeHelper;
0070:        import org.openide.DialogDescriptor;
0071:        import org.openide.DialogDisplayer;
0072:        import org.openide.util.Cancellable;
0073:        import org.openide.util.HelpCtx;
0074:        import org.openide.util.Lookup;
0075:        import org.openide.util.NbBundle;
0076:
0077:        /**
0078:         * Binding customizer.
0079:         *
0080:         * @author Jan Stola, Tomas Pavek
0081:         */
0082:        public class BindingCustomizer extends JPanel {
0083:            private BindingDesignSupport designSupport;
0084:            /** Target component e.g. component to bound. */
0085:            private RADComponent bindingComponent;
0086:            /** Descriptor of the property to bound. */
0087:            private BindingDescriptor bindingDescriptor;
0088:            /** Binding to customize. */
0089:            private MetaBinding binding;
0090:
0091:            /** Selected source component. */
0092:            private RADComponent selectedComponent;
0093:            /** List of all source components. */
0094:            private List<RADComponent> allComponents;
0095:
0096:            /** Nested properties. */
0097:            private FormProperty nullValueProperty;
0098:            private FormProperty incompletePathValueProperty;
0099:            private FormProperty converterProperty;
0100:            private FormProperty validatorProperty;
0101:            private FormProperty nameProperty;
0102:            /** Original values of nested properties. */
0103:            private FormProperty.ValueWithEditor oldNullValue;
0104:            private FormProperty.ValueWithEditor oldIncompletePathValue;
0105:            private FormProperty.ValueWithEditor oldConverter;
0106:            private FormProperty.ValueWithEditor oldValidator;
0107:            private FormProperty.ValueWithEditor oldName;
0108:
0109:            /** Expression combo box. */
0110:            private ComboBoxWithTree expressionCombo;
0111:            /** Display expression combo box. */
0112:            private ComboBoxWithTree displayExpressionCombo;
0113:            /** Column selector for JTable.elements. */
0114:            private ListSelector columnSelector;
0115:            /** Tree model for the expression combo box. */
0116:            private DefaultTreeModel expressionModel = new DefaultTreeModel(
0117:                    new DefaultMutableTreeNode(null, false));
0118:            /** Tree model for the display expression combo box. */
0119:            private DefaultTreeModel displayExpressionModel = new DefaultTreeModel(
0120:                    new DefaultMutableTreeNode(null, false));
0121:            /** Dialog wrapper around the customizer */
0122:            private Dialog dialog;
0123:            /**
0124:             * Listener invoked when the customization of the binding is finished
0125:             * e.g. OK button of the dialog is pressed.
0126:             */
0127:            private ActionListener dialogListener;
0128:            /** OK button of the dialog. */
0129:            private JButton okButton;
0130:            /** Cancel button of the dialog. */
0131:            private JButton cancelButton;
0132:
0133:            /** Property change support for selected type changes. */
0134:            private PropertyChangeSupport typeChangeSupport = new PropertyChangeSupport(
0135:                    this );
0136:
0137:            /**
0138:             * Creates new <code>BindingCustomizer</code>.
0139:             *
0140:             * @param property property to customize.
0141:             */
0142:            public BindingCustomizer(BindingProperty property) {
0143:                bindingComponent = property.getBindingComponent();
0144:                bindingDescriptor = property.getBindingDescriptor();
0145:                designSupport = FormEditor.getBindingSupport(bindingComponent
0146:                        .getFormModel());
0147:
0148:                initExpressionCombo();
0149:                initComponents();
0150:
0151:                expressionLabel.setLabelFor(expressionCombo);
0152:                displayExpressionLabel.setLabelFor(displayExpressionCombo);
0153:
0154:                DefaultComboBoxModel model = new DefaultComboBoxModel();
0155:                model.addElement(FormUtils
0156:                        .getBundleString("MSG_BindingCustomizer_UpdateMode1")); // NOI18N
0157:                model.addElement(FormUtils
0158:                        .getBundleString("MSG_BindingCustomizer_UpdateMode2")); // NOI18N
0159:                model.addElement(FormUtils
0160:                        .getBundleString("MSG_BindingCustomizer_UpdateMode3")); // NOI18N
0161:                updateModeCombo.setModel(model);
0162:
0163:                boolean showUpdateWhen = showUpdateWhen();
0164:                updateWhenLabel.setVisible(showUpdateWhen);
0165:                updateWhenCombo.setVisible(showUpdateWhen);
0166:                if (showUpdateWhen) {
0167:                    model = new DefaultComboBoxModel();
0168:                    model
0169:                            .addElement(FormUtils
0170:                                    .getBundleString("MSG_BindingCustomizer_UpdateWhen1")); // NOI18N
0171:                    model
0172:                            .addElement(FormUtils
0173:                                    .getBundleString("MSG_BindingCustomizer_UpdateWhen2")); // NOI18N
0174:                    model
0175:                            .addElement(FormUtils
0176:                                    .getBundleString("MSG_BindingCustomizer_UpdateWhen3")); // NOI18N
0177:                    updateWhenCombo.setModel(model);
0178:                }
0179:
0180:                ignoreAdjustingChoice.setVisible(showIgnoreAdjusting());
0181:
0182:                importDataButton.setVisible(showImportData());
0183:
0184:                if (showColumnSelector()) {
0185:                    columnSelector = new ListSelector();
0186:                    ((GroupLayout) bindingPanel.getLayout()).replace(
0187:                            detailPanel, columnSelector);
0188:                }
0189:
0190:                boolean showDisplayExpression = showDisplayExpression();
0191:                displayExpressionLabel.setVisible(showDisplayExpression);
0192:                displayExpressionCombo.setVisible(showDisplayExpression);
0193:
0194:                nullValueProperty = property.getNullValueProperty();
0195:                if (nullValueProperty != null) {
0196:                    nullValuePanel.setProperty(nullValueProperty);
0197:                }
0198:                incompletePathValueProperty = property
0199:                        .getIncompleteValueProperty();
0200:                if (incompletePathValueProperty != null) {
0201:                    incompletePathValuePanel
0202:                            .setProperty(incompletePathValueProperty);
0203:                }
0204:                converterProperty = property.getConverterProperty();
0205:                if (converterProperty != null) {
0206:                    converterPanel.setProperty(converterProperty);
0207:                }
0208:                validatorProperty = property.getValidatorProperty();
0209:                if (validatorProperty != null) {
0210:                    validatorPanel.setProperty(validatorProperty);
0211:                }
0212:                nameProperty = property.getNameProperty();
0213:                if (nameProperty != null) {
0214:                    namePanel.setProperty(nameProperty);
0215:                }
0216:
0217:                // Hack - make HTML labels non-resizable
0218:                updatePropertiesLabel.setMinimumSize(updatePropertiesLabel
0219:                        .getPreferredSize());
0220:                conversionLabel.setMinimumSize(conversionLabel
0221:                        .getPreferredSize());
0222:                validatorLabel
0223:                        .setMinimumSize(validatorLabel.getPreferredSize());
0224:                specialValuesLabel.setMinimumSize(specialValuesLabel
0225:                        .getPreferredSize());
0226:                updatePropertiesLabel.setMaximumSize(updatePropertiesLabel
0227:                        .getPreferredSize());
0228:                conversionLabel.setMaximumSize(conversionLabel
0229:                        .getPreferredSize());
0230:                validatorLabel
0231:                        .setMaximumSize(validatorLabel.getPreferredSize());
0232:                specialValuesLabel.setMaximumSize(specialValuesLabel
0233:                        .getPreferredSize());
0234:            }
0235:
0236:            /**
0237:             * Determines whether Update When section should be shown. 
0238:             * 
0239:             * @return <code>true</code> if Update When section should be shown,
0240:             * returns <code>false</code> otherwise.
0241:             */
0242:            private boolean showUpdateWhen() {
0243:                String path = bindingDescriptor.getPath();
0244:                return "text".equals(path)
0245:                        && JTextComponent.class
0246:                                .isAssignableFrom(bindingComponent
0247:                                        .getBeanClass()); // NOI18N
0248:            }
0249:
0250:            private boolean showIgnoreAdjusting() {
0251:                String path = bindingDescriptor.getPath();
0252:                Class<?> beanClass = bindingComponent.getBeanClass();
0253:                return ("value".equals(path) && JSlider.class
0254:                        .isAssignableFrom(beanClass))
0255:                        || // NOI18N
0256:                        (("selectedElement".equals(path) || "selectedElements"
0257:                                .equals(path)) // NOI18N
0258:                        && (JList.class.isAssignableFrom(beanClass)
0259:                                || JTable.class.isAssignableFrom(beanClass) || JComboBox.class
0260:                                .isAssignableFrom(beanClass)));
0261:            }
0262:
0263:            private boolean showImportData() {
0264:                String path = bindingDescriptor.getPath();
0265:                Class clazz = bindingComponent.getBeanClass();
0266:                return "elements".equals(path) // NOI18N
0267:                        && (JList.class.isAssignableFrom(clazz)
0268:                                || JComboBox.class.isAssignableFrom(clazz) || JTable.class
0269:                                .isAssignableFrom(clazz))
0270:                        && (Lookup.getDefault().lookup(DataImporter.class) != null);
0271:            }
0272:
0273:            private boolean showDisplayExpression() {
0274:                String path = bindingDescriptor.getPath();
0275:                Class clazz = bindingComponent.getBeanClass();
0276:                return "elements".equals(path) // NOI18N
0277:                        && (JList.class.isAssignableFrom(clazz)
0278:                        /*|| JComboBox.class.isAssignableFrom(clazz)*/);
0279:            }
0280:
0281:            private boolean showColumnSelector() {
0282:                return "elements".equals(bindingDescriptor.getPath()) // NOI18N
0283:                        && JTable.class.isAssignableFrom(bindingComponent
0284:                                .getBeanClass());
0285:            }
0286:
0287:            /**
0288:             * Returns customized binding.
0289:             *
0290:             * @return customized binding.
0291:             */
0292:            public MetaBinding getBinding() {
0293:                return binding;
0294:            }
0295:
0296:            /**
0297:             * Sets binding to customize.
0298:             *
0299:             * @param binding binding to customize.
0300:             */
0301:            public void setBinding(MetaBinding binding) {
0302:                this .binding = binding;
0303:                String info = MessageFormat.format(infoLabel.getText(),
0304:                        new Object[] { bindingComponent.getName(),
0305:                                bindingDescriptor.getPath(),
0306:                                bindingDescriptor.getValueType().getName() });
0307:                infoLabel.setText(info);
0308:                setBindingToUI();
0309:            }
0310:
0311:            /**
0312:             * Returns dialog wrapper around the customizer.
0313:             *
0314:             * @param listener listener notified when the customization of the binding is finished.
0315:             * @return dialog wrapper around the customizer.
0316:             */
0317:            public Dialog getDialog(ActionListener listener) {
0318:                if (dialog == null) {
0319:                    ResourceBundle bundle = NbBundle
0320:                            .getBundle(BindingCustomizer.class);
0321:                    initButtons(bundle);
0322:                    String pattern = bundle
0323:                            .getString("MSG_BindingCustomizer_Binding"); // NOI18N
0324:                    String title = MessageFormat.format(pattern,
0325:                            bindingComponent.getName(), bindingDescriptor
0326:                                    .getPath());
0327:                    final DialogDescriptor dd = new DialogDescriptor(this ,
0328:                            title, true,
0329:                            new JButton[] { okButton, cancelButton }, okButton,
0330:                            DialogDescriptor.DEFAULT_ALIGN, new HelpCtx(
0331:                                    "gui.binding-customizer.basic"), // NOI18N
0332:                            null);
0333:                    tabbedPane.addChangeListener(new ChangeListener() {
0334:                        public void stateChanged(ChangeEvent e) {
0335:                            dd
0336:                                    .setHelpCtx(new HelpCtx(
0337:                                            (tabbedPane.getSelectedIndex() == 1) ? "gui.binding-customizer.advanced"
0338:                                                    : "gui.binding-customizer.basic")); // NOI18N
0339:
0340:                        }
0341:                    });
0342:                    dd
0343:                            .setClosingOptions(new JButton[] { okButton,
0344:                                    cancelButton });
0345:                    dialog = DialogDisplayer.getDefault().createDialog(dd);
0346:                    dialog.addWindowListener(new WindowAdapter() {
0347:                        @Override
0348:                        public void windowClosed(WindowEvent e) {
0349:                            restore(nullValueProperty, oldNullValue);
0350:                            restore(incompletePathValueProperty,
0351:                                    oldIncompletePathValue);
0352:                            restore(converterProperty, oldConverter);
0353:                            restore(validatorProperty, oldValidator);
0354:                            restore(nameProperty, oldName);
0355:                        }
0356:
0357:                        private void restore(FormProperty property, Object value) {
0358:                            // the original values are cleared when okButton is pressed
0359:                            if (value != null) {
0360:                                try {
0361:                                    property.setValue(value);
0362:                                } catch (IllegalAccessException iaex) {
0363:                                    Logger.getLogger(getClass().getName())
0364:                                            .log(Level.INFO, iaex.getMessage(),
0365:                                                    iaex);
0366:                                } catch (InvocationTargetException itex) {
0367:                                    Logger.getLogger(getClass().getName())
0368:                                            .log(Level.INFO, itex.getMessage(),
0369:                                                    itex);
0370:                                }
0371:                            }
0372:                        }
0373:                    });
0374:                }
0375:                dialogListener = listener;
0376:                updatePropertyPanels();
0377:                return dialog;
0378:            }
0379:
0380:            public JComponent getBindingPanel() {
0381:                infoLabel.setVisible(false);
0382:                if (columnSelector.getParent() != null) {
0383:                    detailPanel.setVisible(false);
0384:                    ((GroupLayout) bindingPanel.getLayout()).replace(
0385:                            columnSelector, detailPanel);
0386:                }
0387:                return bindingPanel;
0388:            }
0389:
0390:            public ComboBoxWithTree getSubExpressionCombo() {
0391:                return displayExpressionCombo;
0392:            }
0393:
0394:            public TreeModel getSubExpressionModel() {
0395:                return displayExpressionModel;
0396:            }
0397:
0398:            /**
0399:             * Initializes buttons on the dialog.
0400:             *
0401:             * @param bundle localized messages to be included on the buttons.
0402:             */
0403:            private void initButtons(ResourceBundle bundle) {
0404:                okButton = new JButton(bundle
0405:                        .getString("MSG_BindingCustomizer_OK")); // NOI18N
0406:                okButton.addActionListener(new ActionListener() {
0407:                    public void actionPerformed(ActionEvent ev) {
0408:                        if (getBindingFromUI()) {
0409:                            oldNullValue = null;
0410:                            oldIncompletePathValue = null;
0411:                            oldConverter = null;
0412:                            oldValidator = null;
0413:                            oldName = null;
0414:                            if (dialogListener != null) {
0415:                                dialogListener.actionPerformed(ev);
0416:                            }
0417:                        }
0418:                    }
0419:                });
0420:                cancelButton = new JButton(bundle
0421:                        .getString("MSG_BindingCustomizer_Cancel")); // NOI18N
0422:            }
0423:
0424:            /**
0425:             * Returns form model.
0426:             *
0427:             * @return form model.
0428:             */
0429:            private FormModel getFormModel() {
0430:                return bindingComponent.getFormModel();
0431:            }
0432:
0433:            /**
0434:             * Updates UI according to value of <code>binding</code> property.
0435:             */
0436:            private void setBindingToUI() {
0437:                fillSourceComponentsCombo();
0438:                if (binding != null) {
0439:                    // source component
0440:                    int index = allComponents.indexOf(binding.getSource());
0441:                    if (index >= 0) {
0442:                        // +1 because the first item is <select>
0443:                        sourceCombo.setSelectedIndex(index + 1);
0444:                        setSelectedComponent(binding.getSource());
0445:
0446:                        String sourcePath = binding.getSourcePath();
0447:                        expressionCombo
0448:                                .setSelectedItem(sourcePath == null ? "null"
0449:                                        : sourcePath); // NOI18N
0450:                    }
0451:                    updateModeCombo.setSelectedIndex(binding
0452:                            .getUpdateStrategy());
0453:                    if (showUpdateWhen()) {
0454:                        int updateWhen = 2;
0455:                        String value = binding
0456:                                .getParameter(MetaBinding.TEXT_CHANGE_STRATEGY);
0457:                        if (MetaBinding.TEXT_CHANGE_ON_ACTION_OR_FOCUS_LOST
0458:                                .equals(value)) {
0459:                            updateWhen = 0;
0460:                        } else if (MetaBinding.TEXT_CHANGE_ON_FOCUS_LOST
0461:                                .equals(value)) {
0462:                            updateWhen = 1;
0463:                        } else if (MetaBinding.TEXT_CHANGE_ON_TYPE
0464:                                .equals(value)) {
0465:                            updateWhen = 2;
0466:                        }
0467:                        updateWhenCombo.setSelectedIndex(updateWhen);
0468:                    }
0469:                    if (showIgnoreAdjusting()) {
0470:                        String value = binding
0471:                                .getParameter(MetaBinding.IGNORE_ADJUSTING_PARAMETER);
0472:                        boolean ignoreAdjusting = "Y".equals(value); // NOI18N
0473:                        ignoreAdjustingChoice.setSelected(ignoreAdjusting);
0474:                    }
0475:                    if (showDisplayExpression()) {
0476:                        String displayPath = binding
0477:                                .getParameter(MetaBinding.DISPLAY_PARAMETER);
0478:                        displayExpressionCombo
0479:                                .setSelectedItem(displayPath == null ? "null"
0480:                                        : displayPath); // NOI18N
0481:                    }
0482:                    updateColumnSelector();
0483:                    if (columnSelector != null) {
0484:                        if (binding.hasSubBindings()) {
0485:                            List<String> available = new LinkedList<String>(
0486:                                    columnSelector.getSelectedItems());
0487:                            List<String> selected = new LinkedList<String>();
0488:                            for (MetaBinding subBinding : binding
0489:                                    .getSubBindings()) {
0490:                                String column = subBinding.getSourcePath();
0491:                                column = BindingDesignSupport
0492:                                        .unwrapSimpleExpression(column);
0493:                                if (available.contains(column)) {
0494:                                    selected.add(column);
0495:                                    available.remove(column);
0496:                                }
0497:                            }
0498:                            columnSelector.setItems(available, selected);
0499:                        } else {
0500:                            // Issue 104707 part 2 - no column selected
0501:                            columnSelector.setItems(columnSelector
0502:                                    .getSelectedItems(), Collections
0503:                                    .emptyList());
0504:                        }
0505:                    }
0506:                    nullValueCheckBox.setSelected(binding
0507:                            .isNullValueSpecified());
0508:                    incompletePathValueCheckBox.setSelected(binding
0509:                            .isIncompletePathValueSpecified());
0510:                    if (binding.isNullValueSpecified()) {
0511:                        oldNullValue = propertyValue(nullValueProperty);
0512:                    }
0513:                    if (binding.isIncompletePathValueSpecified()) {
0514:                        oldIncompletePathValue = propertyValue(incompletePathValueProperty);
0515:                    }
0516:                    if (binding.isConverterSpecified()) {
0517:                        oldConverter = propertyValue(converterProperty);
0518:                    }
0519:                    if (binding.isValidatorSpecified()) {
0520:                        oldValidator = propertyValue(validatorProperty);
0521:                    }
0522:                    if (binding.isNameSpecified()) {
0523:                        oldName = propertyValue(nameProperty);
0524:                    }
0525:                } else {
0526:                    sourceCombo.setSelectedIndex(0);
0527:                    updateModeCombo.setSelectedIndex(0);
0528:                    if (showUpdateWhen()) {
0529:                        updateWhenCombo.setSelectedIndex(2);
0530:                    }
0531:                    if (showIgnoreAdjusting()) {
0532:                        ignoreAdjustingChoice.setSelected(false);
0533:                    }
0534:                    nullValueCheckBox.setSelected(false);
0535:                    incompletePathValueCheckBox.setSelected(false);
0536:                    oldNullValue = null;
0537:                    oldIncompletePathValue = null;
0538:                    oldConverter = null;
0539:                    oldValidator = null;
0540:                    oldName = null;
0541:                }
0542:                updatePropertyPanels();
0543:            }
0544:
0545:            private void updatePropertyPanels() {
0546:                if (binding != null) {
0547:                    nullValuePanel.setEnabled(nullValueCheckBox.isSelected());
0548:                    incompletePathValuePanel
0549:                            .setEnabled(incompletePathValueCheckBox
0550:                                    .isSelected());
0551:                } else {
0552:                    nullValuePanel.setEnabled(false);
0553:                    incompletePathValuePanel.setEnabled(false);
0554:                }
0555:            }
0556:
0557:            private FormProperty.ValueWithEditor propertyValue(
0558:                    FormProperty property) {
0559:                FormProperty.ValueWithEditor value = null;
0560:                try {
0561:                    value = new FormProperty.ValueWithEditor(property
0562:                            .getValue(), property.getCurrentEditor());
0563:                } catch (IllegalAccessException iaex) {
0564:                    Logger.getLogger(getClass().getName()).log(Level.INFO,
0565:                            iaex.getMessage(), iaex);
0566:                } catch (InvocationTargetException itex) {
0567:                    Logger.getLogger(getClass().getName()).log(Level.INFO,
0568:                            itex.getMessage(), itex);
0569:                }
0570:                return value;
0571:            }
0572:
0573:            /**
0574:             * Fills combo box with source components.
0575:             */
0576:            private void fillSourceComponentsCombo() {
0577:                FormModel formModel = getFormModel();
0578:                List<RADComponent> nonvisualList = formModel
0579:                        .getNonVisualComponents();
0580:                List<RADComponent> visualList = formModel.getVisualComponents();
0581:                RADComponent topcomp = formModel.getTopRADComponent();
0582:                if (topcomp != null) {
0583:                    nonvisualList.remove(topcomp);
0584:                    visualList.remove(topcomp);
0585:                }
0586:
0587:                Comparator<RADComponent> c = new RADComponentComparator();
0588:                Collections.sort(nonvisualList, c);
0589:                Collections.sort(visualList, c);
0590:
0591:                allComponents = new ArrayList<RADComponent>(nonvisualList
0592:                        .size()
0593:                        + visualList.size() + 1);
0594:                allComponents.addAll(nonvisualList);
0595:                allComponents.addAll(visualList);
0596:                if (topcomp != null) {
0597:                    allComponents.add(topcomp);
0598:                }
0599:
0600:                sourceCombo.removeAllItems();
0601:                String select = NbBundle.getMessage(BindingCustomizer.class,
0602:                        "MSG_BindingCustomizer_None"); // NOI18N
0603:                sourceCombo.addItem(select);
0604:                for (RADComponent metacomp : allComponents) {
0605:                    sourceCombo.addItem(metacomp.getName());
0606:                }
0607:            }
0608:
0609:            /**
0610:             * Sets a selected component.
0611:             *
0612:             * @param metacomp selected component.
0613:             */
0614:            private void setSelectedComponent(RADComponent metacomp) {
0615:                if (metacomp != selectedComponent) {
0616:                    selectedComponent = metacomp;
0617:                }
0618:            }
0619:
0620:            public boolean getBindingFromUI() {
0621:                if (selectedComponent != null) {
0622:                    String sourcePath = expressionCombo.getSelectedItem()
0623:                            .toString();
0624:                    if ("null".equals(sourcePath)) { // NOI18N
0625:                        sourcePath = null;
0626:                    }
0627:                    binding = new MetaBinding(selectedComponent, sourcePath,
0628:                            bindingComponent, bindingDescriptor.getPath());
0629:                    binding.setNullValueSpecified(nullValueCheckBox
0630:                            .isSelected());
0631:                    binding
0632:                            .setIncompletePathValueSpecified(incompletePathValueCheckBox
0633:                                    .isSelected());
0634:                    binding.setUpdateStrategy(updateModeCombo
0635:                            .getSelectedIndex());
0636:                    if (showUpdateWhen()) {
0637:                        int index = updateWhenCombo.getSelectedIndex();
0638:                        String updateWhen = null;
0639:                        switch (index) {
0640:                        case 0:
0641:                            updateWhen = MetaBinding.TEXT_CHANGE_ON_ACTION_OR_FOCUS_LOST;
0642:                            break;
0643:                        case 1:
0644:                            updateWhen = MetaBinding.TEXT_CHANGE_ON_FOCUS_LOST;
0645:                            break;
0646:                        case 2:
0647:                            updateWhen = MetaBinding.TEXT_CHANGE_ON_TYPE;
0648:                            break;
0649:                        default:
0650:                            assert false;
0651:                        }
0652:                        binding.setParameter(MetaBinding.TEXT_CHANGE_STRATEGY,
0653:                                updateWhen);
0654:                    }
0655:                    if (showIgnoreAdjusting()) {
0656:                        String ignoreAdjusting = ignoreAdjustingChoice
0657:                                .isSelected() ? "Y" : "N"; // NOI18N
0658:                        binding.setParameter(
0659:                                MetaBinding.IGNORE_ADJUSTING_PARAMETER,
0660:                                ignoreAdjusting);
0661:                    }
0662:                    if (showDisplayExpression()) {
0663:                        String displayExpression = displayExpressionCombo
0664:                                .getSelectedItem().toString();
0665:                        if ("null".equals(displayExpression)) { // NOI18N
0666:                            displayExpression = null;
0667:                        }
0668:                        if (displayExpression != null) {
0669:                            binding.setParameter(MetaBinding.DISPLAY_PARAMETER,
0670:                                    displayExpression);
0671:                        }
0672:                    }
0673:                    if (columnSelector != null) {
0674:                        binding.setBindImmediately(true);
0675:                        if (columnSelector.isVisible()) {
0676:                            List items = columnSelector.getSelectedItems();
0677:                            for (int i = 0; i < items.size(); i++) {
0678:                                String item = items.get(i).toString();
0679:                                MetaBinding subBinding = binding
0680:                                        .addSubBinding(BindingDesignSupport
0681:                                                .elWrap(item), null);
0682:                                String columnType = columnToType.get(item);
0683:                                if ((columnType != null)
0684:                                        && (!columnType
0685:                                                .equals("java.lang.Object"))) { // NOI18N
0686:                                    String clazz = FormUtils
0687:                                            .autobox(columnType);
0688:                                    if (clazz.startsWith("java.lang.")) { // NOI18N
0689:                                        clazz = clazz.substring(10);
0690:                                    }
0691:                                    clazz += ".class"; // NOI18N
0692:                                    subBinding
0693:                                            .setParameter(
0694:                                                    MetaBinding.TABLE_COLUMN_CLASS_PARAMETER,
0695:                                                    clazz);
0696:                                }
0697:                            }
0698:                        }
0699:                    }
0700:                    String path = bindingDescriptor.getPath();
0701:                    FormModel model = bindingComponent.getFormModel();
0702:                    FormProperty.ValueWithEditor newName = propertyValue(nameProperty);
0703:                    if ((oldName == null) ? nameProperty.isChanged() : (newName
0704:                            .getValue() != oldName.getValue())) {
0705:                        model.fireBindingChanged(bindingComponent, path,
0706:                                BindingProperty.PROP_NAME, oldName, newName);
0707:                    }
0708:                    FormProperty.ValueWithEditor newNullValue = propertyValue(nullValueProperty);
0709:                    if ((oldNullValue == null) ? nullValueProperty.isChanged()
0710:                            : (newNullValue.getValue() != oldNullValue
0711:                                    .getValue())) {
0712:                        model.fireBindingChanged(bindingComponent, path,
0713:                                BindingProperty.PROP_NULL_VALUE, oldNullValue,
0714:                                newNullValue);
0715:                    }
0716:                    FormProperty.ValueWithEditor newIncompletePathValue = propertyValue(incompletePathValueProperty);
0717:                    if ((oldIncompletePathValue == null) ? incompletePathValueProperty
0718:                            .isChanged()
0719:                            : (newIncompletePathValue.getValue() != oldIncompletePathValue
0720:                                    .getValue())) {
0721:                        model.fireBindingChanged(bindingComponent, path,
0722:                                BindingProperty.PROP_INCOMPLETE_VALUE,
0723:                                oldIncompletePathValue, newIncompletePathValue);
0724:                    }
0725:                    FormProperty.ValueWithEditor newConverter = propertyValue(converterProperty);
0726:                    if ((oldConverter == null) ? converterProperty.isChanged()
0727:                            : (newConverter.getValue() != oldConverter
0728:                                    .getValue())) {
0729:                        model.fireBindingChanged(bindingComponent, path,
0730:                                BindingProperty.PROP_CONVERTER, oldConverter,
0731:                                newConverter);
0732:                    }
0733:                    FormProperty.ValueWithEditor newValidator = propertyValue(validatorProperty);
0734:                    if ((oldValidator == null) ? validatorProperty.isChanged()
0735:                            : (newValidator.getValue() != oldValidator
0736:                                    .getValue())) {
0737:                        model.fireBindingChanged(bindingComponent, path,
0738:                                BindingProperty.PROP_VALIDATOR, oldValidator,
0739:                                newValidator);
0740:                    }
0741:                } else {
0742:                    binding = null;
0743:                }
0744:                return true;
0745:            }
0746:
0747:            private void initExpressionCombo() {
0748:                TreeCellRenderer renderer = new TreeComboRenderer(
0749:                        FormUtils
0750:                                .getBundleString("MSG_BindingCustomizer_NullExpression")); // NOI18N
0751:                expressionCombo = new ComboBoxWithTree(expressionModel,
0752:                        renderer, new Converter(expressionModel));
0753:                expressionCombo.setSelectedItem("null"); // NOI18N
0754:
0755:                renderer = new TreeComboRenderer(
0756:                        FormUtils
0757:                                .getBundleString("MSG_BindingCustomizer_NullDisplayExpression")); // NOI18N
0758:                displayExpressionCombo = new ComboBoxWithTree(
0759:                        displayExpressionModel, renderer, new Converter(
0760:                                displayExpressionModel));
0761:                displayExpressionCombo.setSelectedItem("null"); // NOI18N
0762:            }
0763:
0764:            /**
0765:             * This method is called from within the constructor to initialize the form.
0766:             * WARNING: Do NOT modify this code. The content of this method is
0767:             * always regenerated by the Form Editor.
0768:             */
0769:            // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
0770:            private void initComponents() {
0771:
0772:                tabbedPane = new javax.swing.JTabbedPane();
0773:                bindingPanel = new javax.swing.JPanel();
0774:                infoLabel = new javax.swing.JLabel();
0775:                sourceLabel = new javax.swing.JLabel();
0776:                sourceCombo = new javax.swing.JComboBox();
0777:                expressionLabel = new javax.swing.JLabel();
0778:                treeCombo = expressionCombo;
0779:                importDataButton = new javax.swing.JButton();
0780:                displayExpressionLabel = new javax.swing.JLabel();
0781:                treeCombo2 = displayExpressionCombo;
0782:                detailPanel = new javax.swing.JPanel();
0783:                advancedPanel = new javax.swing.JPanel();
0784:                updatePropertiesLabel = new javax.swing.JLabel();
0785:                updateModeLabel = new javax.swing.JLabel();
0786:                updateModeCombo = new javax.swing.JComboBox();
0787:                updateWhenLabel = new javax.swing.JLabel();
0788:                updateWhenCombo = new javax.swing.JComboBox();
0789:                nullValuePanel = new org.openide.explorer.propertysheet.PropertyPanel();
0790:                incompletePathValuePanel = new org.openide.explorer.propertysheet.PropertyPanel();
0791:                nullValueCheckBox = new javax.swing.JCheckBox();
0792:                displayValuesLabel = new javax.swing.JLabel();
0793:                incompletePathValueCheckBox = new javax.swing.JCheckBox();
0794:                conversionLabel = new javax.swing.JLabel();
0795:                validationLabel = new javax.swing.JLabel();
0796:                validatorLabel = new javax.swing.JLabel();
0797:                converterLabel = new javax.swing.JLabel();
0798:                converterPanel = new org.openide.explorer.propertysheet.PropertyPanel();
0799:                validatorPanel = new org.openide.explorer.propertysheet.PropertyPanel();
0800:                specialValuesLabel = new javax.swing.JLabel();
0801:                updateLabel = new javax.swing.JLabel();
0802:                converterMessage = new javax.swing.JLabel();
0803:                validatorMessage = new javax.swing.JLabel();
0804:                identificationLabel = new javax.swing.JLabel();
0805:                nameLabel = new javax.swing.JLabel();
0806:                namePanel = new org.openide.explorer.propertysheet.PropertyPanel();
0807:                ignoreAdjustingChoice = new javax.swing.JCheckBox();
0808:
0809:                FormListener formListener = new FormListener();
0810:
0811:                org.openide.awt.Mnemonics.setLocalizedText(infoLabel,
0812:                        org.openide.util.NbBundle.getMessage(
0813:                                BindingCustomizer.class,
0814:                                "MSG_BindingCustomizer_Bind")); // NOI18N
0815:
0816:                sourceLabel.setLabelFor(sourceCombo);
0817:                org.openide.awt.Mnemonics.setLocalizedText(sourceLabel,
0818:                        org.openide.util.NbBundle.getMessage(
0819:                                BindingCustomizer.class,
0820:                                "MSG_BindingCustomizer_Source")); // NOI18N
0821:
0822:                sourceCombo.addActionListener(formListener);
0823:
0824:                org.openide.awt.Mnemonics.setLocalizedText(expressionLabel,
0825:                        org.openide.util.NbBundle.getMessage(
0826:                                BindingCustomizer.class,
0827:                                "MSG_BindingCustomizer_Expression")); // NOI18N
0828:
0829:                treeCombo.addActionListener(formListener);
0830:
0831:                org.openide.awt.Mnemonics.setLocalizedText(importDataButton,
0832:                        org.openide.util.NbBundle.getMessage(
0833:                                BindingCustomizer.class,
0834:                                "MSG_BindingCustomizer_ImportData")); // NOI18N
0835:                importDataButton.addActionListener(formListener);
0836:
0837:                org.openide.awt.Mnemonics.setLocalizedText(
0838:                        displayExpressionLabel,
0839:                        org.openide.util.NbBundle.getMessage(
0840:                                BindingCustomizer.class,
0841:                                "MSG_BindingCustomizer_DisplayExpression")); // NOI18N
0842:
0843:                org.jdesktop.layout.GroupLayout detailPanelLayout = new org.jdesktop.layout.GroupLayout(
0844:                        detailPanel);
0845:                detailPanel.setLayout(detailPanelLayout);
0846:                detailPanelLayout.setHorizontalGroup(detailPanelLayout
0847:                        .createParallelGroup(
0848:                                org.jdesktop.layout.GroupLayout.LEADING).add(0,
0849:                                452, Short.MAX_VALUE));
0850:                detailPanelLayout.setVerticalGroup(detailPanelLayout
0851:                        .createParallelGroup(
0852:                                org.jdesktop.layout.GroupLayout.LEADING).add(0,
0853:                                297, Short.MAX_VALUE));
0854:
0855:                org.jdesktop.layout.GroupLayout bindingPanelLayout = new org.jdesktop.layout.GroupLayout(
0856:                        bindingPanel);
0857:                bindingPanel.setLayout(bindingPanelLayout);
0858:                bindingPanelLayout
0859:                        .setHorizontalGroup(bindingPanelLayout
0860:                                .createParallelGroup(
0861:                                        org.jdesktop.layout.GroupLayout.LEADING)
0862:                                .add(
0863:                                        bindingPanelLayout
0864:                                                .createSequentialGroup()
0865:                                                .addContainerGap()
0866:                                                .add(
0867:                                                        bindingPanelLayout
0868:                                                                .createParallelGroup(
0869:                                                                        org.jdesktop.layout.GroupLayout.LEADING)
0870:                                                                .add(
0871:                                                                        infoLabel,
0872:                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0873:                                                                        452,
0874:                                                                        Short.MAX_VALUE)
0875:                                                                .add(
0876:                                                                        bindingPanelLayout
0877:                                                                                .createSequentialGroup()
0878:                                                                                .add(
0879:                                                                                        bindingPanelLayout
0880:                                                                                                .createParallelGroup(
0881:                                                                                                        org.jdesktop.layout.GroupLayout.LEADING)
0882:                                                                                                .add(
0883:                                                                                                        displayExpressionLabel)
0884:                                                                                                .add(
0885:                                                                                                        expressionLabel)
0886:                                                                                                .add(
0887:                                                                                                        sourceLabel))
0888:                                                                                .addPreferredGap(
0889:                                                                                        org.jdesktop.layout.LayoutStyle.RELATED)
0890:                                                                                .add(
0891:                                                                                        bindingPanelLayout
0892:                                                                                                .createParallelGroup(
0893:                                                                                                        org.jdesktop.layout.GroupLayout.LEADING)
0894:                                                                                                .add(
0895:                                                                                                        bindingPanelLayout
0896:                                                                                                                .createSequentialGroup()
0897:                                                                                                                .add(
0898:                                                                                                                        sourceCombo,
0899:                                                                                                                        0,
0900:                                                                                                                        204,
0901:                                                                                                                        Short.MAX_VALUE)
0902:                                                                                                                .addPreferredGap(
0903:                                                                                                                        org.jdesktop.layout.LayoutStyle.RELATED)
0904:                                                                                                                .add(
0905:                                                                                                                        importDataButton))
0906:                                                                                                .add(
0907:                                                                                                        treeCombo,
0908:                                                                                                        0,
0909:                                                                                                        355,
0910:                                                                                                        Short.MAX_VALUE)
0911:                                                                                                .add(
0912:                                                                                                        treeCombo2,
0913:                                                                                                        0,
0914:                                                                                                        355,
0915:                                                                                                        Short.MAX_VALUE)))
0916:                                                                .add(
0917:                                                                        detailPanel,
0918:                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0919:                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0920:                                                                        Short.MAX_VALUE))
0921:                                                .add(10, 10, 10)));
0922:                bindingPanelLayout
0923:                        .setVerticalGroup(bindingPanelLayout
0924:                                .createParallelGroup(
0925:                                        org.jdesktop.layout.GroupLayout.LEADING)
0926:                                .add(
0927:                                        bindingPanelLayout
0928:                                                .createSequentialGroup()
0929:                                                .addContainerGap()
0930:                                                .add(infoLabel)
0931:                                                .addPreferredGap(
0932:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
0933:                                                .add(
0934:                                                        bindingPanelLayout
0935:                                                                .createParallelGroup(
0936:                                                                        org.jdesktop.layout.GroupLayout.BASELINE)
0937:                                                                .add(
0938:                                                                        sourceLabel)
0939:                                                                .add(
0940:                                                                        sourceCombo,
0941:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
0942:                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0943:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
0944:                                                                .add(
0945:                                                                        importDataButton))
0946:                                                .addPreferredGap(
0947:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
0948:                                                .add(
0949:                                                        bindingPanelLayout
0950:                                                                .createParallelGroup(
0951:                                                                        org.jdesktop.layout.GroupLayout.BASELINE)
0952:                                                                .add(
0953:                                                                        expressionLabel)
0954:                                                                .add(
0955:                                                                        treeCombo,
0956:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
0957:                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0958:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
0959:                                                .addPreferredGap(
0960:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
0961:                                                .add(
0962:                                                        bindingPanelLayout
0963:                                                                .createParallelGroup(
0964:                                                                        org.jdesktop.layout.GroupLayout.BASELINE)
0965:                                                                .add(
0966:                                                                        displayExpressionLabel)
0967:                                                                .add(
0968:                                                                        treeCombo2,
0969:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
0970:                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0971:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
0972:                                                .addPreferredGap(
0973:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
0974:                                                .add(
0975:                                                        detailPanel,
0976:                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0977:                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
0978:                                                        Short.MAX_VALUE)
0979:                                                .addContainerGap()));
0980:
0981:                sourceLabel.getAccessibleContext().setAccessibleDescription(
0982:                        org.openide.util.NbBundle.getMessage(
0983:                                BindingCustomizer.class,
0984:                                "MSG_BindingCustomizer_Source_ACSD")); // NOI18N
0985:                sourceCombo.getAccessibleContext().setAccessibleDescription(
0986:                        org.openide.util.NbBundle.getMessage(
0987:                                BindingCustomizer.class,
0988:                                "MSG_BindingCustomizer_Source_ACSD")); // NOI18N
0989:                expressionLabel
0990:                        .getAccessibleContext()
0991:                        .setAccessibleDescription(
0992:                                org.openide.util.NbBundle
0993:                                        .getMessage(BindingCustomizer.class,
0994:                                                "MSG_BindingCustomizer_Expression_ACSD")); // NOI18N
0995:                treeCombo.getAccessibleContext().setAccessibleDescription(
0996:                        org.openide.util.NbBundle.getMessage(
0997:                                BindingCustomizer.class,
0998:                                "MSG_BindingCustomizer_Expression_ACSD")); // NOI18N
0999:                importDataButton
1000:                        .getAccessibleContext()
1001:                        .setAccessibleDescription(
1002:                                org.openide.util.NbBundle
1003:                                        .getMessage(BindingCustomizer.class,
1004:                                                "MSG_BindingCustomizer_ImportData_ACSD")); // NOI18N
1005:                displayExpressionLabel
1006:                        .getAccessibleContext()
1007:                        .setAccessibleDescription(
1008:                                org.openide.util.NbBundle
1009:                                        .getMessage(BindingCustomizer.class,
1010:                                                "MSG_BindingCustomizer_DisplayExpression_ACSD")); // NOI18N
1011:                treeCombo2
1012:                        .getAccessibleContext()
1013:                        .setAccessibleDescription(
1014:                                org.openide.util.NbBundle
1015:                                        .getMessage(BindingCustomizer.class,
1016:                                                "MSG_BindingCustomizer_DisplayExpression_ACSD")); // NOI18N
1017:
1018:                tabbedPane.addTab(org.openide.util.NbBundle.getMessage(
1019:                        BindingCustomizer.class,
1020:                        "MSG_BindingCustomizer_BindingTab"), bindingPanel); // NOI18N
1021:
1022:                org.openide.awt.Mnemonics.setLocalizedText(
1023:                        updatePropertiesLabel,
1024:                        org.openide.util.NbBundle.getMessage(
1025:                                BindingCustomizer.class,
1026:                                "MSG_BindingCustomizer_UpdateProperties")); // NOI18N
1027:
1028:                updateModeLabel.setLabelFor(updateModeCombo);
1029:                org.openide.awt.Mnemonics.setLocalizedText(updateModeLabel,
1030:                        org.openide.util.NbBundle.getMessage(
1031:                                BindingCustomizer.class,
1032:                                "MSG_BindingCustomizer_UpdateMode")); // NOI18N
1033:
1034:                updateWhenLabel.setLabelFor(updateWhenCombo);
1035:                org.openide.awt.Mnemonics.setLocalizedText(updateWhenLabel,
1036:                        org.openide.util.NbBundle.getMessage(
1037:                                BindingCustomizer.class,
1038:                                "MSG_BindingCustomizer_UpdateWhen")); // NOI18N
1039:
1040:                nullValuePanel.setEnabled(false);
1041:
1042:                org.jdesktop.layout.GroupLayout nullValuePanelLayout = new org.jdesktop.layout.GroupLayout(
1043:                        nullValuePanel);
1044:                nullValuePanel.setLayout(nullValuePanelLayout);
1045:                nullValuePanelLayout.setHorizontalGroup(nullValuePanelLayout
1046:                        .createParallelGroup(
1047:                                org.jdesktop.layout.GroupLayout.LEADING).add(0,
1048:                                305, Short.MAX_VALUE));
1049:                nullValuePanelLayout.setVerticalGroup(nullValuePanelLayout
1050:                        .createParallelGroup(
1051:                                org.jdesktop.layout.GroupLayout.LEADING).add(0,
1052:                                24, Short.MAX_VALUE));
1053:
1054:                incompletePathValuePanel.setEnabled(false);
1055:
1056:                org.jdesktop.layout.GroupLayout incompletePathValuePanelLayout = new org.jdesktop.layout.GroupLayout(
1057:                        incompletePathValuePanel);
1058:                incompletePathValuePanel
1059:                        .setLayout(incompletePathValuePanelLayout);
1060:                incompletePathValuePanelLayout
1061:                        .setHorizontalGroup(incompletePathValuePanelLayout
1062:                                .createParallelGroup(
1063:                                        org.jdesktop.layout.GroupLayout.LEADING)
1064:                                .add(0, 305, Short.MAX_VALUE));
1065:                incompletePathValuePanelLayout
1066:                        .setVerticalGroup(incompletePathValuePanelLayout
1067:                                .createParallelGroup(
1068:                                        org.jdesktop.layout.GroupLayout.LEADING)
1069:                                .add(0, 24, Short.MAX_VALUE));
1070:
1071:                org.openide.awt.Mnemonics.setLocalizedText(nullValueCheckBox,
1072:                        org.openide.util.NbBundle.getMessage(
1073:                                BindingCustomizer.class,
1074:                                "MSG_BindingCustomizer_NullValue")); // NOI18N
1075:                nullValueCheckBox.setBorder(javax.swing.BorderFactory
1076:                        .createEmptyBorder(0, 0, 0, 0));
1077:                nullValueCheckBox.setMargin(new java.awt.Insets(0, 0, 0, 0));
1078:                nullValueCheckBox.addActionListener(formListener);
1079:
1080:                org.openide.awt.Mnemonics.setLocalizedText(displayValuesLabel,
1081:                        org.openide.util.NbBundle.getMessage(
1082:                                BindingCustomizer.class,
1083:                                "MSG_BindingCustomizer_DisplayValues")); // NOI18N
1084:
1085:                org.openide.awt.Mnemonics.setLocalizedText(
1086:                        incompletePathValueCheckBox,
1087:                        org.openide.util.NbBundle.getMessage(
1088:                                BindingCustomizer.class,
1089:                                "MSG_BindingCustomizer_IncompletePathValue")); // NOI18N
1090:                incompletePathValueCheckBox.setBorder(javax.swing.BorderFactory
1091:                        .createEmptyBorder(0, 0, 0, 0));
1092:                incompletePathValueCheckBox.setMargin(new java.awt.Insets(0, 0,
1093:                        0, 0));
1094:                incompletePathValueCheckBox.addActionListener(formListener);
1095:
1096:                org.openide.awt.Mnemonics.setLocalizedText(conversionLabel,
1097:                        org.openide.util.NbBundle.getMessage(
1098:                                BindingCustomizer.class,
1099:                                "MSG_BindingCustomizer_Conversion")); // NOI18N
1100:
1101:                org.openide.awt.Mnemonics.setLocalizedText(validationLabel,
1102:                        org.openide.util.NbBundle.getMessage(
1103:                                BindingCustomizer.class,
1104:                                "MSG_BindingCustomizer_Validation")); // NOI18N
1105:
1106:                validatorLabel.setLabelFor(validatorPanel);
1107:                org.openide.awt.Mnemonics.setLocalizedText(validatorLabel,
1108:                        org.openide.util.NbBundle.getMessage(
1109:                                BindingCustomizer.class,
1110:                                "MSG_BindingCustomizer_Validator")); // NOI18N
1111:
1112:                converterLabel.setLabelFor(converterPanel);
1113:                org.openide.awt.Mnemonics.setLocalizedText(converterLabel,
1114:                        org.openide.util.NbBundle.getMessage(
1115:                                BindingCustomizer.class,
1116:                                "MSG_BindingCustomizer_Converter")); // NOI18N
1117:
1118:                if (false) {
1119:                    converterPanel.setEnabled(false);
1120:                }
1121:
1122:                org.jdesktop.layout.GroupLayout converterPanelLayout = new org.jdesktop.layout.GroupLayout(
1123:                        converterPanel);
1124:                converterPanel.setLayout(converterPanelLayout);
1125:                converterPanelLayout.setHorizontalGroup(converterPanelLayout
1126:                        .createParallelGroup(
1127:                                org.jdesktop.layout.GroupLayout.LEADING).add(0,
1128:                                342, Short.MAX_VALUE));
1129:                converterPanelLayout.setVerticalGroup(converterPanelLayout
1130:                        .createParallelGroup(
1131:                                org.jdesktop.layout.GroupLayout.LEADING).add(0,
1132:                                24, Short.MAX_VALUE));
1133:
1134:                if (false) {
1135:                    validatorPanel.setEnabled(false);
1136:                }
1137:
1138:                org.jdesktop.layout.GroupLayout validatorPanelLayout = new org.jdesktop.layout.GroupLayout(
1139:                        validatorPanel);
1140:                validatorPanel.setLayout(validatorPanelLayout);
1141:                validatorPanelLayout.setHorizontalGroup(validatorPanelLayout
1142:                        .createParallelGroup(
1143:                                org.jdesktop.layout.GroupLayout.LEADING).add(0,
1144:                                342, Short.MAX_VALUE));
1145:                validatorPanelLayout.setVerticalGroup(validatorPanelLayout
1146:                        .createParallelGroup(
1147:                                org.jdesktop.layout.GroupLayout.LEADING).add(0,
1148:                                24, Short.MAX_VALUE));
1149:
1150:                org.openide.awt.Mnemonics.setLocalizedText(specialValuesLabel,
1151:                        org.openide.util.NbBundle.getMessage(
1152:                                BindingCustomizer.class,
1153:                                "MSG_BindingCustomizer_SpecialValues")); // NOI18N
1154:
1155:                org.openide.awt.Mnemonics.setLocalizedText(updateLabel,
1156:                        org.openide.util.NbBundle.getMessage(
1157:                                BindingCustomizer.class,
1158:                                "MSG_BindingCustomizer_Update")); // NOI18N
1159:
1160:                org.openide.awt.Mnemonics.setLocalizedText(converterMessage,
1161:                        org.openide.util.NbBundle.getMessage(
1162:                                BindingCustomizer.class,
1163:                                "MSG_BindingCustomizer_ConversionTxt")); // NOI18N
1164:
1165:                org.openide.awt.Mnemonics.setLocalizedText(validatorMessage,
1166:                        org.openide.util.NbBundle.getMessage(
1167:                                BindingCustomizer.class,
1168:                                "MSG_BindingCustomizer_ValidationTxt")); // NOI18N
1169:
1170:                org.openide.awt.Mnemonics.setLocalizedText(identificationLabel,
1171:                        org.openide.util.NbBundle.getMessage(
1172:                                BindingCustomizer.class,
1173:                                "MSG_BindingCustomizer_Identification")); // NOI18N
1174:
1175:                nameLabel.setLabelFor(namePanel);
1176:                org.openide.awt.Mnemonics.setLocalizedText(nameLabel,
1177:                        org.openide.util.NbBundle.getMessage(
1178:                                BindingCustomizer.class,
1179:                                "MSG_BindingCustomizer_Name")); // NOI18N
1180:
1181:                if (false) {
1182:                    namePanel.setEnabled(false);
1183:                }
1184:
1185:                org.jdesktop.layout.GroupLayout namePanelLayout = new org.jdesktop.layout.GroupLayout(
1186:                        namePanel);
1187:                namePanel.setLayout(namePanelLayout);
1188:                namePanelLayout.setHorizontalGroup(namePanelLayout
1189:                        .createParallelGroup(
1190:                                org.jdesktop.layout.GroupLayout.LEADING).add(0,
1191:                                342, Short.MAX_VALUE));
1192:                namePanelLayout.setVerticalGroup(namePanelLayout
1193:                        .createParallelGroup(
1194:                                org.jdesktop.layout.GroupLayout.LEADING).add(0,
1195:                                24, Short.MAX_VALUE));
1196:
1197:                org.openide.awt.Mnemonics.setLocalizedText(
1198:                        ignoreAdjustingChoice,
1199:                        org.openide.util.NbBundle.getMessage(
1200:                                BindingCustomizer.class,
1201:                                "MSG_BindingCustomizer_IgnoreAdjusting")); // NOI18N
1202:
1203:                org.jdesktop.layout.GroupLayout advancedPanelLayout = new org.jdesktop.layout.GroupLayout(
1204:                        advancedPanel);
1205:                advancedPanel.setLayout(advancedPanelLayout);
1206:                advancedPanelLayout
1207:                        .setHorizontalGroup(advancedPanelLayout
1208:                                .createParallelGroup(
1209:                                        org.jdesktop.layout.GroupLayout.LEADING)
1210:                                .add(
1211:                                        advancedPanelLayout
1212:                                                .createSequentialGroup()
1213:                                                .add(
1214:                                                        advancedPanelLayout
1215:                                                                .createParallelGroup(
1216:                                                                        org.jdesktop.layout.GroupLayout.LEADING)
1217:                                                                .add(
1218:                                                                        advancedPanelLayout
1219:                                                                                .createSequentialGroup()
1220:                                                                                .addContainerGap()
1221:                                                                                .add(
1222:                                                                                        advancedPanelLayout
1223:                                                                                                .createParallelGroup(
1224:                                                                                                        org.jdesktop.layout.GroupLayout.LEADING)
1225:                                                                                                .add(
1226:                                                                                                        converterLabel)
1227:                                                                                                .add(
1228:                                                                                                        validatorLabel)
1229:                                                                                                .add(
1230:                                                                                                        nameLabel)
1231:                                                                                                .add(
1232:                                                                                                        updateModeLabel)
1233:                                                                                                .add(
1234:                                                                                                        updateWhenLabel))
1235:                                                                                .addPreferredGap(
1236:                                                                                        org.jdesktop.layout.LayoutStyle.RELATED)
1237:                                                                                .add(
1238:                                                                                        advancedPanelLayout
1239:                                                                                                .createParallelGroup(
1240:                                                                                                        org.jdesktop.layout.GroupLayout.LEADING)
1241:                                                                                                .add(
1242:                                                                                                        namePanel,
1243:                                                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
1244:                                                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
1245:                                                                                                        Short.MAX_VALUE)
1246:                                                                                                .add(
1247:                                                                                                        updateModeCombo,
1248:                                                                                                        0,
1249:                                                                                                        342,
1250:                                                                                                        Short.MAX_VALUE)
1251:                                                                                                .add(
1252:                                                                                                        updateWhenCombo,
1253:                                                                                                        0,
1254:                                                                                                        342,
1255:                                                                                                        Short.MAX_VALUE)
1256:                                                                                                .add(
1257:                                                                                                        converterPanel,
1258:                                                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
1259:                                                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
1260:                                                                                                        Short.MAX_VALUE)
1261:                                                                                                .add(
1262:                                                                                                        validatorPanel,
1263:                                                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
1264:                                                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
1265:                                                                                                        Short.MAX_VALUE)))
1266:                                                                .add(
1267:                                                                        advancedPanelLayout
1268:                                                                                .createSequentialGroup()
1269:                                                                                .addContainerGap()
1270:                                                                                .add(
1271:                                                                                        validationLabel))
1272:                                                                .add(
1273:                                                                        advancedPanelLayout
1274:                                                                                .createSequentialGroup()
1275:                                                                                .addContainerGap()
1276:                                                                                .add(
1277:                                                                                        validatorMessage))
1278:                                                                .add(
1279:                                                                        advancedPanelLayout
1280:                                                                                .createSequentialGroup()
1281:                                                                                .addContainerGap()
1282:                                                                                .add(
1283:                                                                                        converterMessage))
1284:                                                                .add(
1285:                                                                        advancedPanelLayout
1286:                                                                                .createSequentialGroup()
1287:                                                                                .addContainerGap()
1288:                                                                                .add(
1289:                                                                                        conversionLabel))
1290:                                                                .add(
1291:                                                                        advancedPanelLayout
1292:                                                                                .createSequentialGroup()
1293:                                                                                .addContainerGap()
1294:                                                                                .add(
1295:                                                                                        displayValuesLabel))
1296:                                                                .add(
1297:                                                                        advancedPanelLayout
1298:                                                                                .createSequentialGroup()
1299:                                                                                .addContainerGap()
1300:                                                                                .add(
1301:                                                                                        advancedPanelLayout
1302:                                                                                                .createParallelGroup(
1303:                                                                                                        org.jdesktop.layout.GroupLayout.LEADING)
1304:                                                                                                .add(
1305:                                                                                                        nullValueCheckBox)
1306:                                                                                                .add(
1307:                                                                                                        incompletePathValueCheckBox))
1308:                                                                                .addPreferredGap(
1309:                                                                                        org.jdesktop.layout.LayoutStyle.RELATED)
1310:                                                                                .add(
1311:                                                                                        advancedPanelLayout
1312:                                                                                                .createParallelGroup(
1313:                                                                                                        org.jdesktop.layout.GroupLayout.LEADING)
1314:                                                                                                .add(
1315:                                                                                                        incompletePathValuePanel,
1316:                                                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
1317:                                                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
1318:                                                                                                        Short.MAX_VALUE)
1319:                                                                                                .add(
1320:                                                                                                        nullValuePanel,
1321:                                                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
1322:                                                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
1323:                                                                                                        Short.MAX_VALUE)))
1324:                                                                .add(
1325:                                                                        advancedPanelLayout
1326:                                                                                .createSequentialGroup()
1327:                                                                                .add(
1328:                                                                                        10,
1329:                                                                                        10,
1330:                                                                                        10)
1331:                                                                                .add(
1332:                                                                                        updatePropertiesLabel))
1333:                                                                .add(
1334:                                                                        advancedPanelLayout
1335:                                                                                .createSequentialGroup()
1336:                                                                                .addContainerGap()
1337:                                                                                .add(
1338:                                                                                        specialValuesLabel))
1339:                                                                .add(
1340:                                                                        advancedPanelLayout
1341:                                                                                .createSequentialGroup()
1342:                                                                                .addContainerGap()
1343:                                                                                .add(
1344:                                                                                        updateLabel))
1345:                                                                .add(
1346:                                                                        advancedPanelLayout
1347:                                                                                .createSequentialGroup()
1348:                                                                                .addContainerGap()
1349:                                                                                .add(
1350:                                                                                        identificationLabel))
1351:                                                                .add(
1352:                                                                        advancedPanelLayout
1353:                                                                                .createSequentialGroup()
1354:                                                                                .addContainerGap()
1355:                                                                                .add(
1356:                                                                                        ignoreAdjustingChoice)))
1357:                                                .addContainerGap()));
1358:                advancedPanelLayout
1359:                        .setVerticalGroup(advancedPanelLayout
1360:                                .createParallelGroup(
1361:                                        org.jdesktop.layout.GroupLayout.LEADING)
1362:                                .add(
1363:                                        advancedPanelLayout
1364:                                                .createSequentialGroup()
1365:                                                .addContainerGap()
1366:                                                .add(identificationLabel)
1367:                                                .addPreferredGap(
1368:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
1369:                                                .add(
1370:                                                        advancedPanelLayout
1371:                                                                .createParallelGroup(
1372:                                                                        org.jdesktop.layout.GroupLayout.CENTER)
1373:                                                                .add(
1374:                                                                        namePanel,
1375:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
1376:                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
1377:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
1378:                                                                .add(nameLabel))
1379:                                                .addPreferredGap(
1380:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
1381:                                                .add(updatePropertiesLabel)
1382:                                                .addPreferredGap(
1383:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
1384:                                                .add(updateLabel)
1385:                                                .addPreferredGap(
1386:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
1387:                                                .add(
1388:                                                        advancedPanelLayout
1389:                                                                .createParallelGroup(
1390:                                                                        org.jdesktop.layout.GroupLayout.BASELINE)
1391:                                                                .add(
1392:                                                                        updateModeLabel)
1393:                                                                .add(
1394:                                                                        updateModeCombo,
1395:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
1396:                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
1397:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
1398:                                                .addPreferredGap(
1399:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
1400:                                                .add(
1401:                                                        advancedPanelLayout
1402:                                                                .createParallelGroup(
1403:                                                                        org.jdesktop.layout.GroupLayout.BASELINE)
1404:                                                                .add(
1405:                                                                        updateWhenLabel)
1406:                                                                .add(
1407:                                                                        updateWhenCombo,
1408:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
1409:                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
1410:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
1411:                                                .addPreferredGap(
1412:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
1413:                                                .add(ignoreAdjustingChoice)
1414:                                                .addPreferredGap(
1415:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
1416:                                                .add(conversionLabel)
1417:                                                .addPreferredGap(
1418:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
1419:                                                .add(converterMessage)
1420:                                                .addPreferredGap(
1421:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
1422:                                                .add(
1423:                                                        advancedPanelLayout
1424:                                                                .createParallelGroup(
1425:                                                                        org.jdesktop.layout.GroupLayout.CENTER)
1426:                                                                .add(
1427:                                                                        converterLabel)
1428:                                                                .add(
1429:                                                                        converterPanel,
1430:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
1431:                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
1432:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
1433:                                                .addPreferredGap(
1434:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
1435:                                                .add(validationLabel)
1436:                                                .addPreferredGap(
1437:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
1438:                                                .add(validatorMessage)
1439:                                                .addPreferredGap(
1440:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
1441:                                                .add(
1442:                                                        advancedPanelLayout
1443:                                                                .createParallelGroup(
1444:                                                                        org.jdesktop.layout.GroupLayout.CENTER)
1445:                                                                .add(
1446:                                                                        validatorLabel)
1447:                                                                .add(
1448:                                                                        validatorPanel,
1449:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
1450:                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
1451:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
1452:                                                .addPreferredGap(
1453:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
1454:                                                .add(specialValuesLabel)
1455:                                                .addPreferredGap(
1456:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
1457:                                                .add(displayValuesLabel)
1458:                                                .addPreferredGap(
1459:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
1460:                                                .add(
1461:                                                        advancedPanelLayout
1462:                                                                .createParallelGroup(
1463:                                                                        org.jdesktop.layout.GroupLayout.LEADING)
1464:                                                                .add(
1465:                                                                        org.jdesktop.layout.GroupLayout.CENTER,
1466:                                                                        nullValueCheckBox)
1467:                                                                .add(
1468:                                                                        org.jdesktop.layout.GroupLayout.CENTER,
1469:                                                                        nullValuePanel,
1470:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
1471:                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
1472:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
1473:                                                .add(7, 7, 7)
1474:                                                .add(
1475:                                                        advancedPanelLayout
1476:                                                                .createParallelGroup(
1477:                                                                        org.jdesktop.layout.GroupLayout.LEADING)
1478:                                                                .add(
1479:                                                                        org.jdesktop.layout.GroupLayout.CENTER,
1480:                                                                        incompletePathValueCheckBox)
1481:                                                                .add(
1482:                                                                        org.jdesktop.layout.GroupLayout.CENTER,
1483:                                                                        incompletePathValuePanel,
1484:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
1485:                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
1486:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
1487:                                                .addContainerGap(
1488:                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
1489:                                                        Short.MAX_VALUE)));
1490:
1491:                updateModeCombo
1492:                        .getAccessibleContext()
1493:                        .setAccessibleDescription(
1494:                                org.openide.util.NbBundle
1495:                                        .getMessage(BindingCustomizer.class,
1496:                                                "MSG_BindingCustomizer_UpdateMode_ACSD")); // NOI18N
1497:                updateWhenCombo
1498:                        .getAccessibleContext()
1499:                        .setAccessibleDescription(
1500:                                org.openide.util.NbBundle
1501:                                        .getMessage(BindingCustomizer.class,
1502:                                                "MSG_BindingCustomizer_UpdateWhen_ACSD")); // NOI18N
1503:                nullValuePanel.getAccessibleContext().setAccessibleDescription(
1504:                        org.openide.util.NbBundle.getMessage(
1505:                                BindingCustomizer.class,
1506:                                "MSG_BindingCustomizer_NullValue_ACSD")); // NOI18N
1507:                incompletePathValuePanel
1508:                        .getAccessibleContext()
1509:                        .setAccessibleDescription(
1510:                                org.openide.util.NbBundle
1511:                                        .getMessage(BindingCustomizer.class,
1512:                                                "MSG_BindingCustomizer_IncompletePathValue_ACSD")); // NOI18N
1513:                nullValueCheckBox
1514:                        .getAccessibleContext()
1515:                        .setAccessibleDescription(
1516:                                org.openide.util.NbBundle.getMessage(
1517:                                        BindingCustomizer.class,
1518:                                        "MSG_BindingCustomizer_NullValue_ACSD")); // NOI18N
1519:                incompletePathValueCheckBox
1520:                        .getAccessibleContext()
1521:                        .setAccessibleDescription(
1522:                                org.openide.util.NbBundle
1523:                                        .getMessage(BindingCustomizer.class,
1524:                                                "MSG_BindingCustomizer_IncompletePathValue_ACSD")); // NOI18N
1525:                converterPanel.getAccessibleContext().setAccessibleDescription(
1526:                        org.openide.util.NbBundle.getMessage(
1527:                                BindingCustomizer.class,
1528:                                "MSG_BindingCustomizer_Converter_ACSD")); // NOI18N
1529:                validatorPanel.getAccessibleContext().setAccessibleDescription(
1530:                        org.openide.util.NbBundle.getMessage(
1531:                                BindingCustomizer.class,
1532:                                "MSG_BindingCustomizer_Validator_ACSD")); // NOI18N
1533:                namePanel.getAccessibleContext().setAccessibleDescription(
1534:                        org.openide.util.NbBundle.getMessage(
1535:                                BindingCustomizer.class,
1536:                                "MSG_BindingCustomizer_Name_ACSD")); // NOI18N
1537:
1538:                tabbedPane.addTab(org.openide.util.NbBundle.getMessage(
1539:                        BindingCustomizer.class,
1540:                        "MSG_BindingCustomizer_AdvancedTab"), advancedPanel); // NOI18N
1541:
1542:                org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(
1543:                        this );
1544:                this .setLayout(layout);
1545:                layout.setHorizontalGroup(layout.createParallelGroup(
1546:                        org.jdesktop.layout.GroupLayout.LEADING).add(
1547:                        tabbedPane,
1548:                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 477,
1549:                        Short.MAX_VALUE));
1550:                layout.setVerticalGroup(layout.createParallelGroup(
1551:                        org.jdesktop.layout.GroupLayout.LEADING).add(
1552:                        tabbedPane,
1553:                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 449,
1554:                        Short.MAX_VALUE));
1555:
1556:                tabbedPane.getAccessibleContext().setAccessibleDescription(
1557:                        org.openide.util.NbBundle.getMessage(
1558:                                BindingCustomizer.class,
1559:                                "MSG_BindingCustomizer_ACSD")); // NOI18N
1560:            }
1561:
1562:            // Code for dispatching events from components to event handlers.
1563:
1564:            private class FormListener implements  java.awt.event.ActionListener {
1565:                FormListener() {
1566:                }
1567:
1568:                public void actionPerformed(java.awt.event.ActionEvent evt) {
1569:                    if (evt.getSource() == sourceCombo) {
1570:                        BindingCustomizer.this .sourceComboActionPerformed(evt);
1571:                    } else if (evt.getSource() == treeCombo) {
1572:                        BindingCustomizer.this .treeComboActionPerformed(evt);
1573:                    } else if (evt.getSource() == importDataButton) {
1574:                        BindingCustomizer.this 
1575:                                .importDataButtonActionPerformed(evt);
1576:                    } else if (evt.getSource() == nullValueCheckBox) {
1577:                        BindingCustomizer.this 
1578:                                .nullValueCheckBoxActionPerformed(evt);
1579:                    } else if (evt.getSource() == incompletePathValueCheckBox) {
1580:                        BindingCustomizer.this 
1581:                                .incompletePathValueCheckBoxActionPerformed(evt);
1582:                    }
1583:                }
1584:            }// </editor-fold>//GEN-END:initComponents
1585:
1586:            private void importDataButtonActionPerformed(
1587:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_importDataButtonActionPerformed
1588:                final DataImporter importer = Lookup.getDefault().lookup(
1589:                        DataImporter.class);
1590:                if (importer != null) {
1591:                    final Future<RADComponent> task = importer
1592:                            .importData(bindingComponent.getFormModel());
1593:                    if (task != null) {
1594:                        final ProgressHandle handle = ProgressHandleFactory
1595:                                .createHandle(null, (Cancellable) null);
1596:                        JComponent handlePanel = panelForHandle(handle);
1597:                        handle.start();
1598:                        handle
1599:                                .progress(FormUtils
1600:                                        .getBundleString("MSG_BindingCustomizer_Importing")); // NOI18N
1601:                        String cancelString = FormUtils
1602:                                .getBundleString("MSG_BindingCustomizer_Cancel"); // NOI18N
1603:                        DialogDescriptor dd = new DialogDescriptor(
1604:                                handlePanel,
1605:                                FormUtils
1606:                                        .getBundleString("MSG_BindingCustomizer_Please_Wait"), // NOI18N
1607:                                true, new Object[] { cancelString },
1608:                                cancelString, DialogDescriptor.DEFAULT_ALIGN,
1609:                                null, null);
1610:                        final Dialog dialog = DialogDisplayer.getDefault()
1611:                                .createDialog(dd);
1612:                        new Thread(new Runnable() {
1613:                            public void run() {
1614:                                try {
1615:                                    final RADComponent data = task.get();
1616:                                    EventQueue.invokeLater(new Runnable() {
1617:                                        public void run() {
1618:                                            if (data != null) {
1619:                                                // refresh source components combo
1620:                                                fillSourceComponentsCombo();
1621:                                                sourceCombo
1622:                                                        .setSelectedItem(data
1623:                                                                .getName());
1624:                                            }
1625:                                            dialog.setVisible(false);
1626:                                            handle.finish();
1627:                                        }
1628:                                    });
1629:                                } catch (Exception ex) {
1630:                                    Logger.getLogger(getClass().getName()).log(
1631:                                            Level.INFO, ex.getMessage(), ex);
1632:                                }
1633:                            }
1634:                        }).start();
1635:                        dialog.setVisible(true);
1636:                    }
1637:                }
1638:            }//GEN-LAST:event_importDataButtonActionPerformed
1639:
1640:            private void treeComboActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_treeComboActionPerformed
1641:                updateColumnSelector();
1642:                fireTypeChange();
1643:            }//GEN-LAST:event_treeComboActionPerformed
1644:
1645:            private void incompletePathValueCheckBoxActionPerformed(
1646:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_incompletePathValueCheckBoxActionPerformed
1647:                incompletePathValuePanel.setEnabled(incompletePathValueCheckBox
1648:                        .isSelected());
1649:            }//GEN-LAST:event_incompletePathValueCheckBoxActionPerformed
1650:
1651:            private void nullValueCheckBoxActionPerformed(
1652:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nullValueCheckBoxActionPerformed
1653:                nullValuePanel.setEnabled(nullValueCheckBox.isSelected());
1654:            }//GEN-LAST:event_nullValueCheckBoxActionPerformed
1655:
1656:            /**
1657:             * Handles change of selected source component.
1658:             *
1659:             * @param evt event describing the change that occured.
1660:             */
1661:            private void sourceComboActionPerformed(
1662:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sourceComboActionPerformed
1663:                int index = sourceCombo.getSelectedIndex();
1664:                if (index >= 0) {
1665:                    setSelectedComponent(index > 0 ? allComponents
1666:                            .get(index - 1) : null);
1667:                    if (index > 0) {
1668:                        expressionModel.setRoot(new ExpressionNode(
1669:                                allComponents.get(index - 1)));
1670:                    } else {
1671:                        expressionCombo.setSelectedItem("null"); // NOI18N
1672:                        expressionModel.setRoot(new DefaultMutableTreeNode(
1673:                                null, false));
1674:                    }
1675:                    if (tabbedPane.getTabCount() > 1) {
1676:                        tabbedPane.setEnabledAt(1, index > 0);
1677:                    }
1678:                }
1679:                expressionCombo.setEnabled(index > 0);
1680:                displayExpressionCombo.setEnabled(index > 0);
1681:                updateColumnSelector();
1682:                fireTypeChange();
1683:            }//GEN-LAST:event_sourceComboActionPerformed
1684:
1685:            // Variables declaration - do not modify//GEN-BEGIN:variables
1686:            javax.swing.JPanel advancedPanel;
1687:            javax.swing.JPanel bindingPanel;
1688:            javax.swing.JLabel conversionLabel;
1689:            javax.swing.JLabel converterLabel;
1690:            javax.swing.JLabel converterMessage;
1691:            org.openide.explorer.propertysheet.PropertyPanel converterPanel;
1692:            javax.swing.JPanel detailPanel;
1693:            javax.swing.JLabel displayExpressionLabel;
1694:            javax.swing.JLabel displayValuesLabel;
1695:            javax.swing.JLabel expressionLabel;
1696:            javax.swing.JLabel identificationLabel;
1697:            javax.swing.JCheckBox ignoreAdjustingChoice;
1698:            javax.swing.JButton importDataButton;
1699:            javax.swing.JCheckBox incompletePathValueCheckBox;
1700:            org.openide.explorer.propertysheet.PropertyPanel incompletePathValuePanel;
1701:            javax.swing.JLabel infoLabel;
1702:            javax.swing.JLabel nameLabel;
1703:            org.openide.explorer.propertysheet.PropertyPanel namePanel;
1704:            javax.swing.JCheckBox nullValueCheckBox;
1705:            org.openide.explorer.propertysheet.PropertyPanel nullValuePanel;
1706:            javax.swing.JComboBox sourceCombo;
1707:            javax.swing.JLabel sourceLabel;
1708:            javax.swing.JLabel specialValuesLabel;
1709:            javax.swing.JTabbedPane tabbedPane;
1710:            javax.swing.JComboBox treeCombo;
1711:            javax.swing.JComboBox treeCombo2;
1712:            javax.swing.JLabel updateLabel;
1713:            javax.swing.JComboBox updateModeCombo;
1714:            javax.swing.JLabel updateModeLabel;
1715:            javax.swing.JLabel updatePropertiesLabel;
1716:            javax.swing.JComboBox updateWhenCombo;
1717:            javax.swing.JLabel updateWhenLabel;
1718:            javax.swing.JLabel validationLabel;
1719:            javax.swing.JLabel validatorLabel;
1720:            javax.swing.JLabel validatorMessage;
1721:            org.openide.explorer.propertysheet.PropertyPanel validatorPanel;
1722:
1723:            // End of variables declaration//GEN-END:variables
1724:
1725:            private static JPanel panelForHandle(ProgressHandle handle) {
1726:                JLabel label = ProgressHandleFactory
1727:                        .createDetailLabelComponent(handle);
1728:                JComponent progress = ProgressHandleFactory
1729:                        .createProgressComponent(handle);
1730:                JPanel panel = new JPanel();
1731:                GroupLayout layout = new GroupLayout(panel);
1732:                panel.setLayout(layout);
1733:                layout.setHorizontalGroup(layout.createParallelGroup(
1734:                        GroupLayout.LEADING).add(
1735:                        layout.createSequentialGroup().addContainerGap().add(
1736:                                layout.createParallelGroup(GroupLayout.LEADING)
1737:                                        .add(label).add(progress))
1738:                                .addContainerGap()));
1739:                layout.setVerticalGroup(layout.createSequentialGroup()
1740:                        .addContainerGap().add(label).addPreferredGap(
1741:                                LayoutStyle.RELATED).add(progress)
1742:                        .addContainerGap());
1743:                return panel;
1744:            }
1745:
1746:            /**
1747:             * Comparator of <code>RADComponent</code>s.
1748:             */
1749:            private static class RADComponentComparator implements 
1750:                    Comparator<RADComponent> {
1751:                public int compare(RADComponent o1, RADComponent o2) {
1752:                    String name1 = o1.getName();
1753:                    String name2 = o2.getName();
1754:                    return name1.compareToIgnoreCase(name2);
1755:                }
1756:
1757:            }
1758:
1759:            public TypeHelper getSelectedType() {
1760:                TypeHelper type = null;
1761:                if (selectedComponent != null) {
1762:                    Object value = expressionCombo.getSelectedItem();
1763:                    if ((value == null) || ("null".equals(value))) { // NOI18N
1764:                        type = BindingDesignSupport
1765:                                .determineType(selectedComponent);
1766:                    } else {
1767:                        String path = value.toString();
1768:                        if (BindingDesignSupport.isSimpleExpression(path)) {
1769:                            type = designSupport.determineType(
1770:                                    selectedComponent, BindingDesignSupport
1771:                                            .unwrapSimpleExpression(path));
1772:                        } else {
1773:                            type = new TypeHelper(String.class);
1774:                        }
1775:                    }
1776:                }
1777:                return type;
1778:            }
1779:
1780:            private Map<String, String> columnToType;
1781:
1782:            // Updates also displayExpressionCombo
1783:            private TypeHelper lastElemType;
1784:
1785:            private void updateColumnSelector() {
1786:                boolean showDisplayExpression = showDisplayExpression();
1787:                if (!showDisplayExpression && (columnSelector == null))
1788:                    return;
1789:                TypeHelper type = getSelectedType();
1790:                if ((type != null)
1791:                        && Collection.class.isAssignableFrom(FormUtils
1792:                                .typeToClass(type))) {
1793:                    TypeHelper elemType = BindingDesignSupport
1794:                            .typeOfElement(type);
1795:                    if ((elemType != null) && elemType.equals(lastElemType))
1796:                        return;
1797:                    lastElemType = elemType;
1798:                    if (columnSelector != null) {
1799:                        List<BindingDescriptor> descriptors = designSupport
1800:                                .getAllBindingDescriptors(elemType);
1801:                        columnSelector.setVisible(descriptors.size() > 0);
1802:                        List<String> available = new LinkedList<String>();
1803:                        columnToType = new HashMap<String, String>();
1804:                        for (BindingDescriptor desc : descriptors) {
1805:                            TypeHelper t = desc.getGenericValueType();
1806:                            String className = t.getName();
1807:                            if (className == null) {
1808:                                Class clazz = desc.getValueType();
1809:                                className = clazz.getName();
1810:                            }
1811:                            columnToType.put(desc.getPath(), className);
1812:                            available.add(desc.getPath());
1813:                        }
1814:                        columnSelector.setItems(Collections.EMPTY_LIST,
1815:                                available);
1816:                    }
1817:                    displayExpressionModel
1818:                            .setRoot(new ExpressionNode(elemType));
1819:                } else {
1820:                    lastElemType = null;
1821:                    if (columnSelector != null) {
1822:                        columnSelector.setVisible(false);
1823:                    } else {
1824:                        displayExpressionCombo.setSelectedItem("null"); // NOI18N
1825:                    }
1826:                    DefaultMutableTreeNode node = new DefaultMutableTreeNode(
1827:                            null, true);
1828:                    node.add(new DefaultMutableTreeNode(null, false));
1829:                    displayExpressionModel.setRoot(node);
1830:                }
1831:            }
1832:
1833:            public void addTypeChangeListener(PropertyChangeListener listener) {
1834:                typeChangeSupport.addPropertyChangeListener(listener);
1835:            }
1836:
1837:            public void removeTypeChangeListener(PropertyChangeListener listener) {
1838:                typeChangeSupport.removePropertyChangeListener(listener);
1839:            }
1840:
1841:            private void fireTypeChange() {
1842:                typeChangeSupport.firePropertyChange(null, null, null);
1843:            }
1844:
1845:            public class ExpressionNode extends JTree.DynamicUtilTreeNode {
1846:                private BindingDescriptor descriptor;
1847:                private RADComponent comp;
1848:                private int category;
1849:                private TypeHelper type;
1850:
1851:                ExpressionNode(RADComponent comp) {
1852:                    this (BindingDesignSupport.determineType(comp));
1853:                    this .comp = comp;
1854:                }
1855:
1856:                ExpressionNode(TypeHelper type) {
1857:                    super ("root", designSupport.getBindingDescriptors(type)); // NOI18N
1858:                    this .type = type;
1859:                    setAllowsChildren(true);
1860:                }
1861:
1862:                private ExpressionNode(BindingDescriptor descriptor) {
1863:                    super (descriptor.getPath(), designSupport
1864:                            .getBindingDescriptors(descriptor
1865:                                    .getGenericValueType()));
1866:                    this .descriptor = descriptor;
1867:                    this .type = descriptor.getGenericValueType();
1868:                    updateLeafStatus();
1869:                }
1870:
1871:                private ExpressionNode() {
1872:                    super (null, null);
1873:                }
1874:
1875:                private void updateLeafStatus() {
1876:                    boolean leaf = true;
1877:                    if (childValue instanceof  List[]) {
1878:                        List[] lists = (List[]) childValue;
1879:                        for (int i = 0; i < lists.length; i++) {
1880:                            if (lists[i].size() > 0) {
1881:                                leaf = false;
1882:                                break;
1883:                            }
1884:                        }
1885:                    }
1886:                    setAllowsChildren(!leaf);
1887:                }
1888:
1889:                BindingDescriptor getDescriptor() {
1890:                    return descriptor;
1891:                }
1892:
1893:                int getCategory() {
1894:                    return category;
1895:                }
1896:
1897:                public String getTypeName() {
1898:                    String name = (type == null) ? null : type.getName();
1899:                    if (name == null) {
1900:                        name = FormUtils.typeToClass(type).getName();
1901:                    }
1902:                    return name;
1903:                }
1904:
1905:                @Override
1906:                protected void loadChildren() {
1907:                    loadedChildren = true;
1908:                    if ("root".equals(getUserObject())) { // NOI18N
1909:                        add(new ExpressionNode()); // null expression
1910:                    }
1911:                    if (childValue instanceof  List[]) {
1912:                        List<BindingDescriptor>[] lists = (List<BindingDescriptor>[]) childValue;
1913:                        for (int i = 0; i < lists.length; i++) {
1914:                            loadChildren(lists[i], i);
1915:                        }
1916:                    }
1917:                }
1918:
1919:                private void loadChildren(List<BindingDescriptor> descriptors,
1920:                        int category) {
1921:                    for (BindingDescriptor descriptor : descriptors) {
1922:                        ExpressionNode child;
1923:                        if (descriptor.isValueTypeRelative()) {
1924:                            StringBuilder sb = new StringBuilder(descriptor
1925:                                    .getPath());
1926:                            ExpressionNode node = this ;
1927:                            while (node.comp == null) {
1928:                                sb.insert(0, node.getDescriptor().getPath()
1929:                                        + "."); // NOI18N
1930:                                node = (ExpressionNode) getParent();
1931:                            }
1932:                            TypeHelper type = designSupport.determineType(
1933:                                    node.comp, sb.toString());
1934:                            child = new ExpressionNode(new BindingDescriptor(
1935:                                    descriptor.getPath(), type));
1936:                        } else {
1937:                            child = new ExpressionNode(descriptor);
1938:                        }
1939:                        child.category = category;
1940:                        add(child);
1941:                    }
1942:                }
1943:
1944:            }
1945:
1946:            private static class Converter implements 
1947:                    ComboBoxWithTree.Converter {
1948:                private DefaultTreeModel treeModel;
1949:
1950:                Converter(DefaultTreeModel treeModel) {
1951:                    this .treeModel = treeModel;
1952:                }
1953:
1954:                public String pathToString(TreePath path) {
1955:                    StringBuilder sb = new StringBuilder();
1956:                    Object[] items = path.getPath();
1957:                    for (int i = 1; i < items.length; i++) {
1958:                        sb.append(items[i]).append('.');
1959:                    }
1960:                    if (sb.length() > 0) {
1961:                        sb.deleteCharAt(sb.length() - 1);
1962:                    }
1963:                    String value = sb.toString().trim();
1964:                    return "null".equals(value) ? "null" : BindingDesignSupport
1965:                            .elWrap(sb.toString()); // NOI18N
1966:                }
1967:
1968:                public TreePath stringToPath(String value) {
1969:                    DefaultMutableTreeNode node = (DefaultMutableTreeNode) treeModel
1970:                            .getRoot();
1971:                    if (BindingDesignSupport.isSimpleExpression(value)) {
1972:                        value = BindingDesignSupport
1973:                                .unwrapSimpleExpression(value);
1974:                    } else {
1975:                        if ("null".equals(value)) { // NOI18N
1976:                            return new TreePath(new Object[] { node,
1977:                                    node.getChildAt(0) });
1978:                        }
1979:                        return null;
1980:                    }
1981:                    List<DefaultMutableTreeNode> path = new LinkedList<DefaultMutableTreeNode>();
1982:                    // always include root
1983:                    path.add(node);
1984:                    int index;
1985:                    while ((index = value.indexOf('.')) != -1) {
1986:                        String item = value.substring(0, index);
1987:                        node = findNode(node, item);
1988:                        if (node == null) {
1989:                            return null;
1990:                        } else {
1991:                            path.add(node);
1992:                        }
1993:                        value = value.substring(index + 1);
1994:                    }
1995:                    // add last
1996:                    node = findNode(node, value);
1997:                    if (node != null) {
1998:                        path.add(node);
1999:                    } else {
2000:                        return null;
2001:                    }
2002:                    return new TreePath(path.toArray());
2003:                }
2004:
2005:                private DefaultMutableTreeNode findNode(
2006:                        DefaultMutableTreeNode parent, String userObject) {
2007:                    for (int i = 0; i < parent.getChildCount(); i++) {
2008:                        DefaultMutableTreeNode child = (DefaultMutableTreeNode) parent
2009:                                .getChildAt(i);
2010:                        if (userObject.equals(child.getUserObject())) {
2011:                            return child;
2012:                        }
2013:                    }
2014:                    return null;
2015:                }
2016:
2017:            }
2018:
2019:            private static class TreeComboRenderer extends
2020:                    DefaultTreeCellRenderer {
2021:                private String nullString;
2022:                private int baseSize;
2023:
2024:                TreeComboRenderer(String nullString) {
2025:                    this .nullString = nullString;
2026:                    this .baseSize = new JLabel().getFont().getSize() + 1;
2027:                }
2028:
2029:                @Override
2030:                public Component getTreeCellRendererComponent(JTree tree,
2031:                        Object value, boolean selected, boolean expanded,
2032:                        boolean leaf, int row, boolean hasFocus) {
2033:                    JLabel label = (JLabel) super .getTreeCellRendererComponent(
2034:                            tree, value, selected, expanded, leaf, row,
2035:                            hasFocus); // NOI18N
2036:                    if (value instanceof  ExpressionNode) {
2037:                        ExpressionNode node = (ExpressionNode) value;
2038:                        Object object = node.getUserObject();
2039:                        if (object == null) {
2040:                            updateFont(label, baseSize);
2041:                            label.setText(nullString);
2042:                        } else {
2043:                            BindingDescriptor descriptor = node.getDescriptor();
2044:                            if (descriptor != null) {
2045:                                updateFont(label, baseSize - node.getCategory());
2046:                                label.setText("<html><b>"
2047:                                        + descriptor.getPath()
2048:                                        + "</b> "
2049:                                        + nameOfClass(descriptor
2050:                                                .getGenericValueType())); // NOI18N
2051:                            }
2052:                        }
2053:                    } else if (value instanceof  DefaultMutableTreeNode) {
2054:                        DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
2055:                        Object object = node.getUserObject();
2056:                        if (object == null) {
2057:                            updateFont(label, baseSize);
2058:                            label.setText("null"); // NOI18N
2059:                        }
2060:                    }
2061:                    return label;
2062:                }
2063:
2064:                private static void updateFont(JLabel label, int size) {
2065:                    if (label.getFont().getSize() != size) {
2066:                        label.setFont(label.getFont().deriveFont((float) size));
2067:                    }
2068:                }
2069:
2070:                private String nameOfClass(TypeHelper type) {
2071:                    String name = type.getName();
2072:                    if (name == null) {
2073:                        name = FormUtils.typeToClass(type).getName();
2074:                        if (name.startsWith("[")) { // NOI18N
2075:                            StringBuilder sb = new StringBuilder();
2076:                            while (name.startsWith("[")) { // NOI18N
2077:                                sb.append("[]"); // NOI18N
2078:                                name = name.substring(1);
2079:                            }
2080:                            if ("Z".equals(name)) { // NOI18N
2081:                                sb.insert(0, "boolean"); // NOI18N
2082:                            } else if ("B".equals(name)) { // NOI18N
2083:                                sb.insert(0, "byte"); // NOI18N
2084:                            } else if ("C".equals(name)) { // NOI18N
2085:                                sb.insert(0, "char"); // NOI18N
2086:                            } else if ("D".equals(name)) { // NOI18N
2087:                                sb.insert(0, "double"); // NOI18N
2088:                            } else if ("F".equals(name)) { // NOI18N
2089:                                sb.insert(0, "float"); // NOI18N
2090:                            } else if ("I".equals(name)) { // NOI18N
2091:                                sb.insert(0, "int"); // NOI18N
2092:                            } else if ("J".equals(name)) { // NOI18N
2093:                                sb.insert(0, "long"); // NOI18N
2094:                            } else if ("S".equals(name)) { // NOI18N
2095:                                sb.insert(0, "short"); // NOI18N
2096:                            } else {
2097:                                sb.insert(0, name.substring(1,
2098:                                        name.length() - 1));
2099:                            }
2100:                            name = sb.toString();
2101:                        }
2102:                    }
2103:                    return name;
2104:                }
2105:            }
2106:
2107:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.