Example usage for javax.swing JTextField setInputVerifier

List of usage examples for javax.swing JTextField setInputVerifier

Introduction

In this page you can find the example usage for javax.swing JTextField setInputVerifier.

Prototype

@BeanProperty(description = "The component's input verifier.")
public void setInputVerifier(InputVerifier inputVerifier) 

Source Link

Document

Sets the input verifier for this component.

Usage

From source file:be.ac.ua.comp.scarletnebula.gui.windows.ServerPropertiesWindow.java

private Component getSingleServerServerNameComponent(final Server server) {
    final JTextField servernameTextField = new JTextField();
    servernameTextField.setInputVerifier(new ServernameInputVerifier(servernameTextField, server));
    final LabelEditSwitcherPanel servername = new LabelEditSwitcherPanel(server.getFriendlyName(),
            servernameTextField);/*from www  . j  a v a 2  s.  c om*/
    servername.addContentChangedListener(new LabelEditSwitcherPanel.ContentChangedListener() {
        @Override
        public void changed(final String newContents) {
            server.setFriendlyName(newContents);
            server.store();
        }
    });
    return servername;
}

From source file:fusion.Fusion.java

private static void initListPanel() {

    final JPanel listPanel = new JPanel();
    listPanel.setVisible(true);//from   w  w  w. j ava 2s  .  c om

    // Buttons
    JButton setSameAsLinksFile = new JButton("Set SameAsLinks file");
    JButton setDatasetFile1 = new JButton("Set Dataset1 file");
    JButton setDatasetFile2 = new JButton("Set Dataset2 file");

    JButton sourceButton = new JButton(" Edit Source Information ");
    JButton rulesButton = new JButton("        Edit Logic Rules         ");

    JLabel homogeneityLabel = new JLabel("Threshold for Homogeneity");
    final JTextField homogeneityTextfield = new JTextField("0.10");
    JLabel frequencyLabel = new JLabel("Threshold for Occurence Frequency");
    final JTextField frequencyTextfield = new JTextField("0.01");

    homogeneityTextfield.setInputVerifier(new MyInputVerifier());
    frequencyTextfield.setInputVerifier(new MyInputVerifier());

    JButton constructINAButton = new JButton("     Construct INA graph     ");
    JButton constructButton = new JButton("Generic construct graph");
    JButton loadButton = new JButton("   Load previous graph   ");
    JButton fusionButton = new JButton("           Data fusion            ");

    JButton displayFusionButton = new JButton("     Display fused data     ");

    setSameAsLinksFile.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            try {
                setSameAsLinksFile();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    });

    setDatasetFile1.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            try {
                setDatasetFile1();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    });
    setDatasetFile2.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            try {
                setDatasetFile2();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    });

    sourceButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            try {
                java.awt.Desktop.getDesktop().open(new File(sourceInfoFile));
            } catch (IOException ex) {
                Logger.getLogger(Fusion.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    });

    rulesButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            try {
                java.awt.Desktop.getDesktop().open(new File(logicRulesFile));
            } catch (IOException ex) {
                Logger.getLogger(Fusion.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    });

    constructINAButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {

            if (homogeneityTextfield.getText().length() != 0 && frequencyTextfield.getText().length() != 0) {

                Fusion.homogeneityThreshold = Float.parseFloat(homogeneityTextfield.getText());
                Fusion.occurenceFrequencyThreshold = Float.parseFloat(frequencyTextfield.getText());
                try {

                    constructINAGraph();
                    //genericConstructGraph("", "", "", "", "", "", "");

                } catch (FileNotFoundException ex) {
                    Logger.getLogger(Fusion.class.getName()).log(Level.SEVERE, null, ex);
                } catch (IOException ex) {
                    Logger.getLogger(Fusion.class.getName()).log(Level.SEVERE, null, ex);
                } catch (URISyntaxException e) {
                    e.printStackTrace();
                }
            } else {
                JOptionPane.showMessageDialog(guiFrame, "Please fill in all the fields!");
            }

        }
    });

    loadButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            loadGraph();
        }
    });

    fusionButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            executeFusion();
        }
    });

    constructButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {

            try {
                genericConstructGraph();
            } catch (IOException | AlignmentException | URISyntaxException e) {
                e.printStackTrace();
            }

        }
    });

    displayFusionButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            displayFusedGraph();
        }
    });

    listPanel.setLayout(new GridBagLayout());

    GridBagConstraints c = new GridBagConstraints();

    c.gridx = 0;
    c.gridy = 0;
    listPanel.add(setSameAsLinksFile, c);
    c.gridx = 1;
    c.gridy = 0;
    listPanel.add(setDatasetFile1, c);
    c.gridx = 2;
    c.gridy = 0;
    listPanel.add(setDatasetFile2, c);
    c.gridx = 1;
    c.gridy = 1;
    listPanel.add(sourceButton, c);
    c.gridx = 1;
    c.gridy = 2;
    listPanel.add(rulesButton, c);
    c.gridx = 1;
    c.gridy = 3;
    listPanel.add(homogeneityLabel, c);
    c.gridx = 2;
    c.gridy = 4;
    listPanel.add(homogeneityTextfield, c);
    c.gridx = 1;
    c.gridy = 4;
    listPanel.add(frequencyLabel, c);
    c.gridx = 2;
    c.gridy = 5;
    listPanel.add(frequencyTextfield, c);
    c.gridx = 1;
    c.gridy = 5;
    listPanel.add(constructINAButton, c);
    c.gridx = 1;
    c.gridy = 6;
    listPanel.add(constructButton, c);
    c.gridx = 1;
    c.gridy = 7;
    listPanel.add(loadButton, c);
    c.gridx = 1;
    c.gridy = 8;
    listPanel.add(fusionButton, c);
    c.gridx = 1;
    c.gridy = 9;
    listPanel.add(displayFusionButton, c);

    //container.add(listPanel, BorderLayout.WEST);
    split.add(listPanel);
    guiFrame.setVisible(true);
}

From source file:edu.harvard.mcz.imagecapture.SpecimenDetailsViewPane.java

private void setValues() {
    log.debug("invoking setValues()");
    jTextFieldStatus.setText("Loading");

    jTextFieldBarcode.setText(specimen.getBarcode());
    jComboBoxLocationInCollection.setSelectedItem(specimen.getLocationInCollection());
    cbTypeStatus.setSelectedItem(specimen.getTypeStatus());
    jTextFieldDrawerNumber.setText(specimen.getDrawerNumber());
    jComboBoxFamily.setSelectedItem(specimen.getFamily());
    jComboBoxSubfamily.setSelectedItem(specimen.getSubfamily());
    jTextFieldTribe.setText(specimen.getTribe());
    jTextFieldGenus.setText(specimen.getGenus());
    jTextFieldSpecies.setText(specimen.getSpecificEpithet());
    jTextFieldSubspecies.setText(specimen.getSubspecificEpithet());
    jTextFieldInfraspecificEpithet.setText(specimen.getInfraspecificEpithet());
    jTextFieldInfraspecificRank.setText(specimen.getInfraspecificRank());
    jTextFieldAuthorship.setText(specimen.getAuthorship());

    jTextFieldIdRemarks.setText(specimen.getIdentificationRemarks());
    jTextFieldDateDetermined.setText(specimen.getDateIdentified());

    MCZbaseAuthAgentName selection = new MCZbaseAuthAgentName();
    selection.setAgent_name(specimen.getIdentifiedBy());
    ((AgentNameComboBoxModel) jCBDeterminer.getModel()).setSelectedItem(selection);
    jCBDeterminer.getEditor().setItem(jCBDeterminer.getModel().getSelectedItem());

    jComboBoxNatureOfId.setSelectedItem(specimen.getNatureOfId());

    jTextFieldUnnamedForm.setText(specimen.getUnNamedForm());
    jTextFieldVerbatimLocality.setText(specimen.getVerbatimLocality());
    // Specimen record contains a string, delegate handling of lookup of object to the combo box model.
    log.debug(specimen.getHigherGeography());
    ((HigherGeographyComboBoxModel) comboBoxHigherGeog.getModel())
            .setSelectedItem(specimen.getHigherGeography());
    //TODO ? set model not notifying listeners?       
    comboBoxHigherGeog.getEditor().setItem(comboBoxHigherGeog.getModel().getSelectedItem());
    jTextFieldCountry.setText(specimen.getCountry());
    if (specimen.getValidDistributionFlag() != null) {
        jCheckBoxValidDistributionFlag.setSelected(specimen.getValidDistributionFlag());
    } else {// w  w  w  .  j ava2  s.  c o m
        jCheckBoxValidDistributionFlag.setSelected(false);
    }
    jTextFieldPrimaryDivision.setText(specimen.getPrimaryDivison());
    jTextFieldLocality.setText(specimen.getSpecificLocality());

    // Elevations  **********************************************************************
    try {
        jTextFieldMinElevation.setText(Long.toString(specimen.getMinimum_elevation()));
    } catch (Exception e) {
        jTextFieldMinElevation.setText("");
    }
    try {
        textFieldMaxElev.setText(Long.toString(specimen.getMaximum_elevation()));
    } catch (Exception e) {
        textFieldMaxElev.setText("");
    }
    if (specimen.getElev_units() != null) {
        comboBoxElevUnits.setSelectedItem(specimen.getElev_units());
    } else {
        comboBoxElevUnits.setSelectedItem("");
    }

    jTextFieldCollectingMethod.setText(specimen.getCollectingMethod());
    jTextFieldISODate.setText(specimen.getIsoDate());
    jTextFieldDateNos.setText(specimen.getDateNos());
    jTextFieldDateCollected.setText(specimen.getDateCollected());
    jTextFieldDateEmerged.setText(specimen.getDateEmerged());
    jTextFieldDateCollectedIndicator.setText(specimen.getDateCollectedIndicator());
    jTextFieldDateEmergedIndicator.setText(specimen.getDateEmergedIndicator());
    jComboBoxCollection.setSelectedItem(specimen.getCollection());
    //jTextFieldPreparationType.setText(specimen.getPreparationType());
    jTextFieldAssociatedTaxon.setText(specimen.getAssociatedTaxon());
    jTextFieldHabitat.setText(specimen.getHabitat());
    jTextAreaSpecimenNotes.setText(specimen.getSpecimenNotes());
    jComboBoxFeatures.setSelectedItem(specimen.getFeatures());
    jComboBoxLifeStage.setSelectedItem(specimen.getLifeStage());
    jComboBoxSex.setSelectedItem(specimen.getSex());
    jTextFieldCitedInPub.setText(specimen.getCitedInPublication());
    jTextFieldQuestions.setText(specimen.getQuestions());
    jComboBoxWorkflowStatus.setSelectedItem(specimen.getWorkFlowStatus());
    if (specimen.isStateDone()) {
        jLabelMigrationStatus.setText("http://mczbase.mcz.harvard.edu/guid/MCZ:Ent:" + specimen.getCatNum());
    } else {
        jLabelMigrationStatus.setText("");
    }
    jTextFieldInferences.setText(specimen.getInferences());
    jTextFieldCreator.setText(specimen.getCreatedBy());
    if (specimen.getDateCreated() != null) {
        jTextFieldDateCreated.setText(specimen.getDateCreated().toString());
    }
    jTextFieldLastUpdatedBy.setText(specimen.getLastUpdatedBy());
    if (specimen.getDateLastUpdated() != null) {
        jTextFieldDateLastUpdated.setText(specimen.getDateLastUpdated().toString());
    }

    jTableNumbers.setModel(new NumberTableModel(specimen.getNumbers()));
    // Setting the model will overwrite the existing cell editor bound 
    // to the column model, so we need to add it again.
    JTextField field1 = new JTextField();
    field1.setInputVerifier(MetadataRetriever.getInputVerifier(edu.harvard.mcz.imagecapture.data.Number.class,
            "Number", field1));
    field1.setVerifyInputWhenFocusTarget(true);
    jTableNumbers.getColumnModel().getColumn(0).setCellEditor(new ValidatingTableCellEditor(field1));
    JComboBox<String> jComboNumberTypes = new JComboBox<String>();
    jComboNumberTypes.setModel(new DefaultComboBoxModel<String>(NumberLifeCycle.getDistinctTypes()));
    jComboNumberTypes.setEditable(true);
    TableColumn typeColumn = jTableNumbers.getColumnModel().getColumn(NumberTableModel.COLUMN_TYPE);
    typeColumn.setCellEditor(new DefaultCellEditor(jComboNumberTypes));

    jTableCollectors.setModel(new CollectorTableModel(specimen.getCollectors()));
    // Setting the model will overwrite the existing cell editor bound 
    // to the column model, so we need to add it again.
    // JTextField field = new JTextField();
    FilteringAgentJComboBox field = new FilteringAgentJComboBox();
    //field.setInputVerifier(MetadataRetriever.getInputVerifier(Collector.class, "CollectorName", field));
    //jTableCollectors.getColumnModel().getColumn(0).setCellEditor(new PicklistTableCellEditor(field, true));
    jTableCollectors.getColumnModel().getColumn(0).setCellEditor(new ComboBoxCellEditor(field));
    //field.setInputVerifier(MetadataRetriever.getInputVerifier(Collector.class, "CollectorName", field));
    //field.setVerifyInputWhenFocusTarget(true);
    //jTableCollectors.getColumnModel().getColumn(0).setCellEditor(new ValidatingTableCellEditor(field));

    jTableSpecimenParts.setModel(new SpecimenPartsTableModel(specimen.getSpecimenParts()));
    jTableSpecimenParts.getColumnModel().getColumn(0).setPreferredWidth(90);
    for (int i = 0; i < jTableSpecimenParts.getColumnCount(); i++) {
        TableColumn column = jTableSpecimenParts.getColumnModel().getColumn(i);
        if (i == 0) {
            column.setPreferredWidth(120);
        } else {
            column.setPreferredWidth(50);
        }
    }
    setSpecimenPartsTableCellEditors();

    updateDeterminationCount();

    if (specimen.getICImages() != null) {
        int imageCount = specimen.getICImages().size();
        jTextFieldImageCount.setText("Number of Images=" + imageCount);
        if (imageCount > 1) {
            jTextFieldImageCount.setForeground(Color.RED);
        } else {
            jTextFieldImageCount.setForeground(Color.BLACK);
        }
    }

    setWarnings();
    this.setStateToClean();
    jTextFieldStatus.setText("Loaded");
}

From source file:eu.crisis_economics.abm.dashboard.Page_Parameters.java

@SuppressWarnings("unchecked")
private List<ParameterInfo> createAndDisplayAParameterPanel(
        final List<ai.aitia.meme.paramsweep.batch.param.ParameterInfo<?>> batchParameters, final String title,
        final SubmodelInfo parent, final boolean submodelSelectionWithoutNotify,
        final IModelHandler currentModelHandler) {
    final List<ParameterMetaData> metadata = new LinkedList<ParameterMetaData>(),
            unknownFields = new ArrayList<ParameterMetaData>();
    for (final ai.aitia.meme.paramsweep.batch.param.ParameterInfo<?> record : batchParameters) {
        final String parameterName = record.getName(), fieldName = StringUtils.uncapitalize(parameterName);
        Class<?> modelComponentType = parent == null ? currentModelHandler.getModelClass()
                : parent.getActualType();
        while (true) {
            try {
                final Field field = modelComponentType.getDeclaredField(fieldName);
                final ParameterMetaData datum = new ParameterMetaData();
                for (final Annotation element : field.getAnnotations()) {
                    if (element.annotationType().getName() != Layout.class.getName()) // Proxies
                        continue;
                    final Class<? extends Annotation> type = element.annotationType();
                    datum.verboseDescription = (String) type.getMethod("VerboseDescription").invoke(element);
                    datum.banner = (String) type.getMethod("Title").invoke(element);
                    datum.fieldName = (String) " " + type.getMethod("FieldName").invoke(element);
                    datum.imageFileName = (String) type.getMethod("Image").invoke(element);
                    datum.layoutOrder = (Double) type.getMethod("Order").invoke(element);
                }//from  ww  w .j  av a2s.co  m
                datum.parameter = record;
                if (datum.fieldName.trim().isEmpty())
                    datum.fieldName = parameterName.replaceAll("([A-Z])", " $1");
                metadata.add(datum);
                break;
            } catch (final SecurityException e) {
            } catch (final NoSuchFieldException e) {
            } catch (final IllegalArgumentException e) {
            } catch (final IllegalAccessException e) {
            } catch (final InvocationTargetException e) {
            } catch (final NoSuchMethodException e) {
            }
            modelComponentType = modelComponentType.getSuperclass();
            if (modelComponentType == null) {
                ParameterMetaData.createAndRegisterUnknown(fieldName, record, unknownFields);
                break;
            }
        }
    }
    Collections.sort(metadata);
    for (int i = unknownFields.size() - 1; i >= 0; --i)
        metadata.add(0, unknownFields.get(i));

    // initialize single run form
    final DefaultFormBuilder formBuilder = FormsUtils.build("p ~ p:g", "");
    appendMinimumWidthHintToPresentation(formBuilder, 550);

    if (parent == null) {
        SwingUtilities.invokeLater(new Runnable() {

            @Override
            public void run() {
                numberOfTurnsField.grabFocus();
            }
        });

        appendBannerToPresentation(formBuilder, "General Parameters");
        appendTextToPresentation(formBuilder, "Global parameters affecting the entire simulation");

        formBuilder.append(NUMBER_OF_TURNS_LABEL_TEXT, numberOfTurnsField);
        formBuilder.append(NUMBER_OF_TIMESTEPS_TO_IGNORE_LABEL_TEXT, numberTimestepsIgnored);

        appendCheckBoxFieldToPresentation(formBuilder, UPDATE_CHARTS_LABEL_TEXT, onLineChartsCheckBox);
        appendCheckBoxFieldToPresentation(formBuilder, DISPLAY_ADVANCED_CHARTS_LABEL_TEXT,
                advancedChartsCheckBox);
    }

    appendBannerToPresentation(formBuilder, title);

    final DefaultMutableTreeNode parentNode = (parent == null) ? parameterValueComponentTree
            : findParameterInfoNode(parent, false);

    final List<ParameterInfo> info = new ArrayList<ParameterInfo>();

    // Search for a @ConfigurationComponent annotation
    {
        String headerText = "", imagePath = "";
        final Class<?> parentType = parent == null ? currentModelHandler.getModelClass()
                : parent.getActualType();
        for (final Annotation element : parentType.getAnnotations()) { // Proxies
            if (element.annotationType().getName() != ConfigurationComponent.class.getName())
                continue;
            boolean doBreak = false;
            try {
                try {
                    headerText = (String) element.annotationType().getMethod("Description").invoke(element);
                    if (headerText.startsWith("#")) {
                        headerText = (String) parent.getActualType().getMethod(headerText.substring(1))
                                .invoke(parent.getInstance());
                    }
                    doBreak = true;
                } catch (IllegalArgumentException e) {
                } catch (SecurityException e) {
                } catch (IllegalAccessException e) {
                } catch (InvocationTargetException e) {
                } catch (NoSuchMethodException e) {
                }
            } catch (final Exception e) {
            }
            try {
                imagePath = (String) element.annotationType().getMethod("ImagePath").invoke(element);
                doBreak = true;
            } catch (IllegalArgumentException e) {
            } catch (SecurityException e) {
            } catch (IllegalAccessException e) {
            } catch (InvocationTargetException e) {
            } catch (NoSuchMethodException e) {
            }
            if (doBreak)
                break;
        }
        if (!headerText.isEmpty())
            appendHeaderTextToPresentation(formBuilder, headerText);
        if (!imagePath.isEmpty())
            appendImageToPresentation(formBuilder, imagePath);
    }

    if (metadata.isEmpty()) {
        // No fields to display.
        appendTextToPresentation(formBuilder, "No configuration is required for this module.");
    } else {
        for (final ParameterMetaData record : metadata) {
            final ai.aitia.meme.paramsweep.batch.param.ParameterInfo<?> batchParameterInfo = record.parameter;

            if (!record.banner.isEmpty())
                appendBannerToPresentation(formBuilder, record.banner);
            if (!record.imageFileName.isEmpty())
                appendImageToPresentation(formBuilder, record.imageFileName);
            appendTextToPresentation(formBuilder, record.verboseDescription);

            final ParameterInfo parameterInfo = InfoConverter.parameterInfo2ParameterInfo(batchParameterInfo);
            if (parent != null && parameterInfo instanceof ISubmodelGUIInfo) {
                //               sgi.setParentValue(parent.getActualType());
            }

            final JComponent field;
            final DefaultMutableTreeNode oldNode = findParameterInfoNode(parameterInfo, true);
            Pair<ParameterInfo, JComponent> userData = null;
            JComponent oldField = null;
            if (oldNode != null) {
                userData = (Pair<ParameterInfo, JComponent>) oldNode.getUserObject();
                oldField = userData.getSecond();
            }

            if (parameterInfo.isBoolean()) {
                field = new JCheckBox();
                boolean value = oldField != null ? ((JCheckBox) oldField).isSelected()
                        : ((Boolean) batchParameterInfo.getDefaultValue()).booleanValue();
                ((JCheckBox) field).setSelected(value);
            } else if (parameterInfo.isEnum() || parameterInfo instanceof MasonChooserParameterInfo) {
                Object[] elements = null;
                if (parameterInfo.isEnum()) {
                    final Class<Enum<?>> type = (Class<Enum<?>>) parameterInfo.getJavaType();
                    elements = type.getEnumConstants();
                } else {
                    final MasonChooserParameterInfo chooserInfo = (MasonChooserParameterInfo) parameterInfo;
                    elements = chooserInfo.getValidStrings();
                }
                final JComboBox list = new JComboBox(elements);

                if (parameterInfo.isEnum()) {
                    final Object value = oldField != null ? ((JComboBox) oldField).getSelectedItem()
                            : parameterInfo.getValue();
                    list.setSelectedItem(value);
                } else {
                    final int value = oldField != null ? ((JComboBox) oldField).getSelectedIndex()
                            : (Integer) parameterInfo.getValue();
                    list.setSelectedIndex(value);
                }

                field = list;
            } else if (parameterInfo instanceof SubmodelInfo) {
                final SubmodelInfo submodelInfo = (SubmodelInfo) parameterInfo;
                final Object[] elements = new Object[] { "Loading class information..." };
                final JComboBox list = new JComboBox(elements);
                //            field = list;

                final Object value = oldField != null
                        ? ((JComboBox) ((JPanel) oldField).getComponent(0)).getSelectedItem()
                        : new ClassElement(submodelInfo.getActualType(), null);

                new ClassCollector(this, list, submodelInfo, value, submodelSelectionWithoutNotify).execute();

                final JButton rightButton = new JButton();
                rightButton.setOpaque(false);
                rightButton.setRolloverEnabled(true);
                rightButton.setIcon(SHOW_SUBMODEL_ICON);
                rightButton.setRolloverIcon(SHOW_SUBMODEL_ICON_RO);
                rightButton.setDisabledIcon(SHOW_SUBMODEL_ICON_DIS);
                rightButton.setBorder(null);
                rightButton.setToolTipText("Display submodel parameters");
                rightButton.setActionCommand(ACTIONCOMMAND_SHOW_SUBMODEL);
                rightButton.addActionListener(new ActionListener() {

                    @Override
                    public void actionPerformed(ActionEvent arg0) {
                        if (parameterInfo instanceof SubmodelInfo) {
                            SubmodelInfo submodelInfo = (SubmodelInfo) parameterInfo;
                            int level = 0;

                            showHideSubparameters(list, submodelInfo);

                            List<String> components = new ArrayList<String>();
                            components.add(submodelInfo.getName());
                            while (submodelInfo.getParent() != null) {
                                submodelInfo = submodelInfo.getParent();
                                components.add(submodelInfo.getName());
                                level++;
                            }
                            Collections.reverse(components);
                            final String[] breadcrumbText = components.toArray(new String[components.size()]);
                            for (int i = 0; i < breadcrumbText.length; ++i)
                                breadcrumbText[i] = breadcrumbText[i].replaceAll("([A-Z])", " $1");
                            breadcrumb.setPath(
                                    currentModelHandler.getModelClassSimpleName().replaceAll("([A-Z])", " $1"),
                                    breadcrumbText);
                            Style.apply(breadcrumb, dashboard.getCssStyle());

                            // reset all buttons that are nested deeper than this to default color
                            for (int i = submodelButtons.size() - 1; i >= level; i--) {
                                JButton button = submodelButtons.get(i);
                                button.setIcon(SHOW_SUBMODEL_ICON);
                                submodelButtons.remove(i);
                            }

                            rightButton.setIcon(SHOW_SUBMODEL_ICON_RO);
                            submodelButtons.add(rightButton);
                        }
                    }
                });

                field = new JPanel(new BorderLayout());
                field.add(list, BorderLayout.CENTER);
                field.add(rightButton, BorderLayout.EAST);
            } else if (File.class.isAssignableFrom(parameterInfo.getJavaType())) {
                field = new JPanel(new BorderLayout());

                String oldName = "";
                String oldPath = "";
                if (oldField != null) {
                    final JTextField oldTextField = (JTextField) oldField.getComponent(0);
                    oldName = oldTextField.getText();
                    oldPath = oldTextField.getToolTipText();
                } else if (parameterInfo.getValue() != null) {
                    final File file = (File) parameterInfo.getValue();
                    oldName = file.getName();
                    oldPath = file.getAbsolutePath();
                }

                final JTextField textField = new JTextField(oldName);
                textField.setToolTipText(oldPath);
                textField.setInputVerifier(new InputVerifier() {

                    @Override
                    public boolean verify(final JComponent input) {
                        final JTextField inputField = (JTextField) input;
                        if (inputField.getText() == null || inputField.getText().isEmpty()) {
                            final File file = new File("");
                            inputField.setToolTipText(file.getAbsolutePath());
                            hideError();
                            return true;
                        }

                        final File oldFile = new File(inputField.getToolTipText());
                        if (oldFile.exists() && oldFile.getName().equals(inputField.getText().trim())) {
                            hideError();
                            return true;
                        }

                        inputField.setToolTipText("");
                        final File file = new File(inputField.getText().trim());
                        if (file.exists()) {
                            inputField.setToolTipText(file.getAbsolutePath());
                            inputField.setText(file.getName());
                            hideError();
                            return true;
                        } else {
                            final PopupFactory popupFactory = PopupFactory.getSharedInstance();
                            final Point locationOnScreen = inputField.getLocationOnScreen();
                            final JLabel message = new JLabel("Please specify an existing file!");
                            message.setBorder(new LineBorder(Color.RED, 2, true));
                            if (errorPopup != null)
                                errorPopup.hide();
                            errorPopup = popupFactory.getPopup(inputField, message, locationOnScreen.x - 10,
                                    locationOnScreen.y - 30);
                            errorPopup.show();
                            return false;
                        }
                    }
                });

                final JButton browseButton = new JButton(BROWSE_BUTTON_TEXT);
                browseButton.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        final JFileChooser fileDialog = new JFileChooser(
                                !"".equals(textField.getToolTipText()) ? textField.getToolTipText()
                                        : currentDirectory);
                        if (!"".equals(textField.getToolTipText()))
                            fileDialog.setSelectedFile(new File(textField.getToolTipText()));
                        int dialogResult = fileDialog.showOpenDialog(dashboard);
                        if (dialogResult == JFileChooser.APPROVE_OPTION) {
                            final File selectedFile = fileDialog.getSelectedFile();
                            if (selectedFile != null) {
                                currentDirectory = selectedFile.getAbsoluteFile().getParent();
                                textField.setText(selectedFile.getName());
                                textField.setToolTipText(selectedFile.getAbsolutePath());
                            }
                        }
                    }
                });

                field.add(textField, BorderLayout.CENTER);
                field.add(browseButton, BorderLayout.EAST);
            } else if (parameterInfo instanceof MasonIntervalParameterInfo) {
                final MasonIntervalParameterInfo intervalInfo = (MasonIntervalParameterInfo) parameterInfo;

                field = new JPanel(new BorderLayout());

                String oldValueStr = String.valueOf(parameterInfo.getValue());
                if (oldField != null) {
                    final JTextField oldTextField = (JTextField) oldField.getComponent(0);
                    oldValueStr = oldTextField.getText();
                }

                final JTextField textField = new JTextField(oldValueStr);

                PercentJSlider tempSlider = null;
                if (intervalInfo.isDoubleInterval())
                    tempSlider = new PercentJSlider(intervalInfo.getIntervalMin().doubleValue(),
                            intervalInfo.getIntervalMax().doubleValue(), Double.parseDouble(oldValueStr));
                else
                    tempSlider = new PercentJSlider(intervalInfo.getIntervalMin().longValue(),
                            intervalInfo.getIntervalMax().longValue(), Long.parseLong(oldValueStr));

                final PercentJSlider slider = tempSlider;
                slider.setMajorTickSpacing(100);
                slider.setMinorTickSpacing(10);
                slider.setPaintTicks(true);
                slider.setPaintLabels(true);
                slider.addChangeListener(new ChangeListener() {
                    public void stateChanged(final ChangeEvent _) {
                        if (slider.hasFocus()) {
                            final String value = intervalInfo.isDoubleInterval()
                                    ? String.valueOf(slider.getDoubleValue())
                                    : String.valueOf(slider.getLongValue());
                            textField.setText(value);
                            slider.setToolTipText(value);
                        }
                    }
                });

                textField.setInputVerifier(new InputVerifier() {
                    public boolean verify(JComponent input) {
                        final JTextField inputField = (JTextField) input;

                        try {
                            hideError();
                            final String valueStr = inputField.getText().trim();
                            if (intervalInfo.isDoubleInterval()) {
                                final double value = Double.parseDouble(valueStr);
                                if (intervalInfo.isValidValue(valueStr)) {
                                    slider.setValue(value);
                                    return true;
                                } else
                                    showError(
                                            "Please specify a value between " + intervalInfo.getIntervalMin()
                                                    + " and " + intervalInfo.getIntervalMax() + ".",
                                            inputField);
                                return false;
                            } else {
                                final long value = Long.parseLong(valueStr);
                                if (intervalInfo.isValidValue(valueStr)) {
                                    slider.setValue(value);
                                    return true;
                                } else {
                                    showError("Please specify an integer value between "
                                            + intervalInfo.getIntervalMin() + " and "
                                            + intervalInfo.getIntervalMax() + ".", inputField);
                                    return false;
                                }
                            }
                        } catch (final NumberFormatException _) {
                            final String message = "The specified value is not a"
                                    + (intervalInfo.isDoubleInterval() ? "" : "n integer") + " number.";
                            showError(message, inputField);
                            return false;
                        }

                    }
                });

                textField.getDocument().addDocumentListener(new DocumentListener() {
                    //               private Popup errorPopup;

                    public void removeUpdate(final DocumentEvent _) {
                        textFieldChanged();
                    }

                    public void insertUpdate(final DocumentEvent _) {
                        textFieldChanged();
                    }

                    public void changedUpdate(final DocumentEvent _) {
                        textFieldChanged();
                    }

                    private void textFieldChanged() {
                        if (!textField.hasFocus()) {
                            hideError();
                            return;
                        }

                        try {
                            hideError();
                            final String valueStr = textField.getText().trim();
                            if (intervalInfo.isDoubleInterval()) {
                                final double value = Double.parseDouble(valueStr);
                                if (intervalInfo.isValidValue(valueStr))
                                    slider.setValue(value);
                                else
                                    showError("Please specify a value between " + intervalInfo.getIntervalMin()
                                            + " and " + intervalInfo.getIntervalMax() + ".", textField);
                            } else {
                                final long value = Long.parseLong(valueStr);
                                if (intervalInfo.isValidValue(valueStr))
                                    slider.setValue(value);
                                else
                                    showError("Please specify an integer value between "
                                            + intervalInfo.getIntervalMin() + " and "
                                            + intervalInfo.getIntervalMax() + ".", textField);
                            }
                        } catch (final NumberFormatException _) {
                            final String message = "The specified value is not a"
                                    + (intervalInfo.isDoubleInterval() ? "" : "n integer") + " number.";
                            showError(message, textField);
                        }
                    }
                });

                field.add(textField, BorderLayout.CENTER);
                field.add(slider, BorderLayout.SOUTH);
            } else {
                final Object value = oldField != null ? ((JTextField) oldField).getText()
                        : parameterInfo.getValue();
                field = new JTextField(value.toString());
                ((JTextField) field).addActionListener(new ActionListener() {

                    @Override
                    public void actionPerformed(final ActionEvent e) {
                        wizard.clickDefaultButton();
                    }
                });
            }

            final JLabel parameterLabel = new JLabel(record.fieldName);

            final String description = parameterInfo.getDescription();
            if (description != null && !description.isEmpty()) {
                parameterLabel.addMouseListener(new MouseAdapter() {

                    @Override
                    public void mouseEntered(final MouseEvent e) {
                        final DescriptionPopupFactory popupFactory = DescriptionPopupFactory.getInstance();

                        final Popup parameterDescriptionPopup = popupFactory.getPopup(parameterLabel,
                                description, dashboard.getCssStyle());

                        parameterDescriptionPopup.show();
                    }

                });
            }

            if (oldNode != null)
                userData.setSecond(field);
            else {
                final Pair<ParameterInfo, JComponent> pair = new Pair<ParameterInfo, JComponent>(parameterInfo,
                        field);
                final DefaultMutableTreeNode newNode = new DefaultMutableTreeNode(pair);
                parentNode.add(newNode);
            }

            if (field instanceof JCheckBox) {
                parameterLabel
                        .setText("<html><div style=\"margin-bottom: 4pt; margin-top: 6pt; margin-left: 4pt\">"
                                + parameterLabel.getText() + "</div></html>");
                formBuilder.append(parameterLabel, field);

                //            appendCheckBoxFieldToPresentation(
                //               formBuilder, parameterLabel.getText(), (JCheckBox) field);
            } else {
                formBuilder.append(parameterLabel, field);
                final CellConstraints constraints = formBuilder.getLayout().getConstraints(parameterLabel);
                constraints.vAlign = CellConstraints.TOP;
                constraints.insets = new Insets(5, 0, 0, 0);
                formBuilder.getLayout().setConstraints(parameterLabel, constraints);
            }

            // prepare the parameterInfo for the param sweeps
            parameterInfo.setRuns(0);
            parameterInfo.setDefinitionType(ParameterInfo.CONST_DEF);
            parameterInfo.setValue(batchParameterInfo.getDefaultValue());
            info.add(parameterInfo);
        }
    }
    appendVerticalSpaceToPresentation(formBuilder);

    final JPanel panel = formBuilder.getPanel();
    singleRunParametersPanel.add(panel);

    if (singleRunParametersPanel.getComponentCount() > 1) {
        panel.setBorder(
                BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(0, 1, 0, 0, Color.GRAY),
                        BorderFactory.createEmptyBorder(0, 5, 0, 5)));
    } else {
        panel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
    }

    Style.apply(panel, dashboard.getCssStyle());

    return info;
}