Example usage for java.lang Double MIN_VALUE

List of usage examples for java.lang Double MIN_VALUE

Introduction

In this page you can find the example usage for java.lang Double MIN_VALUE.

Prototype

double MIN_VALUE

To view the source code for java.lang Double MIN_VALUE.

Click Source Link

Document

A constant holding the smallest positive nonzero value of type double , 2-1074.

Usage

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

protected void init() {
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    setTitle("Transcribe Verbatim Data");
    setMinimumSize(new Dimension(1020, 640));
    setBounds(100, 100, 1020, 640);//  w ww .  j a  va  2  s .  co m
    getContentPane().setLayout(new BorderLayout());
    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(contentPanel, BorderLayout.CENTER);
    contentPanel.setLayout(new BorderLayout(0, 0));
    {
        JPanel panel = new JPanel();
        contentPanel.add(panel, BorderLayout.NORTH);
        panel.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));

        JLabel lblVerbatimDataFor = new JLabel("Verbatim Data for:");
        panel.add(lblVerbatimDataFor);
        lblBarcode = new JLabel("Barcode");
        panel.add(lblBarcode);
        lblCurrentid = new JLabel("CurrentID");
        panel.add(lblCurrentid);
    }
    {
        JPanel panel = new JPanel();
        contentPanel.add(panel, BorderLayout.WEST);
        GridBagLayout gbl_panel = new GridBagLayout();
        gbl_panel.columnWidths = new int[] { 0, 0, 0, 0 };
        gbl_panel.rowHeights = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
        gbl_panel.columnWeights = new double[] { 0.0, 1.0, 1.0, Double.MIN_VALUE };
        gbl_panel.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0,
                Double.MIN_VALUE };
        panel.setLayout(gbl_panel);

        JLabel lblNewLabel = new JLabel("Locality");
        GridBagConstraints gbc_lblNewLabel = new GridBagConstraints();
        gbc_lblNewLabel.anchor = GridBagConstraints.NORTHEAST;
        gbc_lblNewLabel.insets = new Insets(0, 0, 5, 5);
        gbc_lblNewLabel.gridx = 0;
        gbc_lblNewLabel.gridy = 0;
        panel.add(lblNewLabel, gbc_lblNewLabel);

        textFieldVerbLocality = new JTextArea();
        textFieldVerbLocality.setRows(3);
        GridBagConstraints gbc_textFieldVerbLocality = new GridBagConstraints();
        gbc_textFieldVerbLocality.gridheight = 2;
        gbc_textFieldVerbLocality.gridwidth = 2;
        gbc_textFieldVerbLocality.insets = new Insets(0, 0, 5, 5);
        gbc_textFieldVerbLocality.fill = GridBagConstraints.BOTH;
        gbc_textFieldVerbLocality.gridx = 1;
        gbc_textFieldVerbLocality.gridy = 0;
        panel.add(textFieldVerbLocality, gbc_textFieldVerbLocality);
        textFieldVerbLocality.setColumns(10);

        JLabel lblVerbatimDate = new JLabel("Date");
        GridBagConstraints gbc_lblVerbatimDate = new GridBagConstraints();
        gbc_lblVerbatimDate.anchor = GridBagConstraints.EAST;
        gbc_lblVerbatimDate.insets = new Insets(0, 0, 5, 5);
        gbc_lblVerbatimDate.gridx = 0;
        gbc_lblVerbatimDate.gridy = 2;
        panel.add(lblVerbatimDate, gbc_lblVerbatimDate);

        textFieldVerbDate = new JTextField();
        GridBagConstraints gbc_textFieldVerbDate = new GridBagConstraints();
        gbc_textFieldVerbDate.insets = new Insets(0, 0, 5, 5);
        gbc_textFieldVerbDate.gridwidth = 2;
        gbc_textFieldVerbDate.fill = GridBagConstraints.HORIZONTAL;
        gbc_textFieldVerbDate.gridx = 1;
        gbc_textFieldVerbDate.gridy = 2;
        panel.add(textFieldVerbDate, gbc_textFieldVerbDate);
        textFieldVerbDate.setColumns(10);

        JLabel lblCollector = new JLabel("Collector");
        GridBagConstraints gbc_lblCollector = new GridBagConstraints();
        gbc_lblCollector.anchor = GridBagConstraints.EAST;
        gbc_lblCollector.insets = new Insets(0, 0, 5, 5);
        gbc_lblCollector.gridx = 0;
        gbc_lblCollector.gridy = 3;
        panel.add(lblCollector, gbc_lblCollector);

        textFieldVerbCollector = new JTextField();
        GridBagConstraints gbc_textFieldVerbCollector = new GridBagConstraints();
        gbc_textFieldVerbCollector.insets = new Insets(0, 0, 5, 5);
        gbc_textFieldVerbCollector.gridwidth = 2;
        gbc_textFieldVerbCollector.fill = GridBagConstraints.HORIZONTAL;
        gbc_textFieldVerbCollector.gridx = 1;
        gbc_textFieldVerbCollector.gridy = 3;
        panel.add(textFieldVerbCollector, gbc_textFieldVerbCollector);
        textFieldVerbCollector.setColumns(10);

        JLabel lblNewLabel_1 = new JLabel("Collection");
        GridBagConstraints gbc_lblNewLabel_1 = new GridBagConstraints();
        gbc_lblNewLabel_1.anchor = GridBagConstraints.EAST;
        gbc_lblNewLabel_1.insets = new Insets(0, 0, 5, 5);
        gbc_lblNewLabel_1.gridx = 0;
        gbc_lblNewLabel_1.gridy = 4;
        panel.add(lblNewLabel_1, gbc_lblNewLabel_1);

        textFieldVerbCollection = new JTextField();
        GridBagConstraints gbc_textFieldVerbCollection = new GridBagConstraints();
        gbc_textFieldVerbCollection.insets = new Insets(0, 0, 5, 5);
        gbc_textFieldVerbCollection.fill = GridBagConstraints.HORIZONTAL;
        gbc_textFieldVerbCollection.gridx = 2;
        gbc_textFieldVerbCollection.gridy = 4;
        panel.add(textFieldVerbCollection, gbc_textFieldVerbCollection);
        textFieldVerbCollection.setColumns(10);

        JLabel lblNumbers = new JLabel("Numbers");
        GridBagConstraints gbc_lblNumbers = new GridBagConstraints();
        gbc_lblNumbers.anchor = GridBagConstraints.EAST;
        gbc_lblNumbers.insets = new Insets(0, 0, 5, 5);
        gbc_lblNumbers.gridx = 0;
        gbc_lblNumbers.gridy = 5;
        panel.add(lblNumbers, gbc_lblNumbers);

        textFieldVerbNumbers = new JTextField();
        GridBagConstraints gbc_textFieldVerbNumbers = new GridBagConstraints();
        gbc_textFieldVerbNumbers.insets = new Insets(0, 0, 5, 5);
        gbc_textFieldVerbNumbers.fill = GridBagConstraints.HORIZONTAL;
        gbc_textFieldVerbNumbers.gridx = 2;
        gbc_textFieldVerbNumbers.gridy = 5;
        panel.add(textFieldVerbNumbers, gbc_textFieldVerbNumbers);
        textFieldVerbNumbers.setColumns(10);

        JLabel lblNewLabel_2 = new JLabel("Other Text");
        GridBagConstraints gbc_lblNewLabel_2 = new GridBagConstraints();
        gbc_lblNewLabel_2.anchor = GridBagConstraints.EAST;
        gbc_lblNewLabel_2.insets = new Insets(0, 0, 5, 5);
        gbc_lblNewLabel_2.gridx = 0;
        gbc_lblNewLabel_2.gridy = 6;
        panel.add(lblNewLabel_2, gbc_lblNewLabel_2);

        textFieldVerbUnclassifiedText = new JTextArea();
        textFieldVerbUnclassifiedText.setRows(3);
        GridBagConstraints gbc_textFieldVerbUnclassifiedText = new GridBagConstraints();
        gbc_textFieldVerbUnclassifiedText.gridheight = 2;
        gbc_textFieldVerbUnclassifiedText.insets = new Insets(0, 0, 5, 5);
        gbc_textFieldVerbUnclassifiedText.fill = GridBagConstraints.HORIZONTAL;
        gbc_textFieldVerbUnclassifiedText.gridx = 2;
        gbc_textFieldVerbUnclassifiedText.gridy = 6;
        panel.add(textFieldVerbUnclassifiedText, gbc_textFieldVerbUnclassifiedText);
        textFieldVerbUnclassifiedText.setColumns(10);

        JLabel lblQuestions = new JLabel("Questions");
        GridBagConstraints gbc_lblQuestions = new GridBagConstraints();
        gbc_lblQuestions.anchor = GridBagConstraints.EAST;
        gbc_lblQuestions.insets = new Insets(0, 0, 5, 5);
        gbc_lblQuestions.gridx = 0;
        gbc_lblQuestions.gridy = 8;
        panel.add(lblQuestions, gbc_lblQuestions);

        textFieldQuestions = new JTextField();
        GridBagConstraints gbc_textFieldQuestions = new GridBagConstraints();
        gbc_textFieldQuestions.insets = new Insets(0, 0, 5, 5);
        gbc_textFieldQuestions.fill = GridBagConstraints.HORIZONTAL;
        gbc_textFieldQuestions.gridx = 2;
        gbc_textFieldQuestions.gridy = 8;
        panel.add(textFieldQuestions, gbc_textFieldQuestions);
        textFieldQuestions.setColumns(30);

        JLabel lblWorkflowStatus = new JLabel("Workflow Status");
        GridBagConstraints gbc_lblWorkflowStatus = new GridBagConstraints();
        gbc_lblWorkflowStatus.anchor = GridBagConstraints.EAST;
        gbc_lblWorkflowStatus.insets = new Insets(0, 0, 5, 5);
        gbc_lblWorkflowStatus.gridx = 0;
        gbc_lblWorkflowStatus.gridy = 9;
        panel.add(lblWorkflowStatus, gbc_lblWorkflowStatus);

        comboBoxWorkflowStatus = new JComboBox<String>(WorkFlowStatus.getVerbatimWorkFlowStatusValues());
        GridBagConstraints gbc_comboBoxWorkflowStatus = new GridBagConstraints();
        gbc_comboBoxWorkflowStatus.insets = new Insets(0, 0, 5, 0);
        gbc_comboBoxWorkflowStatus.gridwidth = 2;
        gbc_comboBoxWorkflowStatus.fill = GridBagConstraints.HORIZONTAL;
        gbc_comboBoxWorkflowStatus.gridx = 2;
        gbc_comboBoxWorkflowStatus.gridy = 9;
        panel.add(comboBoxWorkflowStatus, gbc_comboBoxWorkflowStatus);

        JPanel panel_1 = new JPanel();
        GridBagConstraints gbc_panel_1 = new GridBagConstraints();
        gbc_panel_1.gridwidth = 2;
        gbc_panel_1.insets = new Insets(0, 0, 0, 5);
        gbc_panel_1.fill = GridBagConstraints.BOTH;
        gbc_panel_1.gridx = 2;
        gbc_panel_1.gridy = 11;
        panel.add(panel_1, gbc_panel_1);
        GridBagLayout gbl_panel_1 = new GridBagLayout();
        gbl_panel_1.columnWidths = new int[] { 150, 143, 0 };
        gbl_panel_1.rowHeights = new int[] { 25, 0, 0, 0, 0 };
        gbl_panel_1.columnWeights = new double[] { 0.0, 0.0, 0.0 };
        gbl_panel_1.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE };
        panel_1.setLayout(gbl_panel_1);

        JButton btnPartiallyIllegible = new JButton("Partially Illegible");
        btnPartiallyIllegible.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                appendToQuestions(Verbatim.PARTLY_ILLEGIBLE);

            }
        });
        GridBagConstraints gbc_btnPartiallyIllegible = new GridBagConstraints();
        gbc_btnPartiallyIllegible.fill = GridBagConstraints.HORIZONTAL;
        gbc_btnPartiallyIllegible.anchor = GridBagConstraints.NORTH;
        gbc_btnPartiallyIllegible.insets = new Insets(0, 0, 5, 5);
        gbc_btnPartiallyIllegible.gridx = 0;
        gbc_btnPartiallyIllegible.gridy = 0;
        panel_1.add(btnPartiallyIllegible, gbc_btnPartiallyIllegible);

        JButton btnNewButton = new JButton("No Locality Data");
        btnNewButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                textFieldVerbLocality.setText(Verbatim.NO_LOCALITY_DATA);
            }
        });
        GridBagConstraints gbc_btnNewButton = new GridBagConstraints();
        gbc_btnNewButton.anchor = GridBagConstraints.NORTHWEST;
        gbc_btnNewButton.insets = new Insets(0, 0, 5, 5);
        gbc_btnNewButton.gridx = 1;
        gbc_btnNewButton.gridy = 0;
        panel_1.add(btnNewButton, gbc_btnNewButton);
        btnNewButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
            }
        });

        JButton btnNewButton_1 = new JButton("Entirely Illegible");
        btnNewButton_1.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                appendToQuestions(Verbatim.ENTIRELY_ILLEGIBLE);
            }
        });
        GridBagConstraints gbc_btnNewButton_1 = new GridBagConstraints();
        gbc_btnNewButton_1.fill = GridBagConstraints.HORIZONTAL;
        gbc_btnNewButton_1.anchor = GridBagConstraints.NORTH;
        gbc_btnNewButton_1.insets = new Insets(0, 0, 5, 5);
        gbc_btnNewButton_1.gridx = 0;
        gbc_btnNewButton_1.gridy = 1;
        panel_1.add(btnNewButton_1, gbc_btnNewButton_1);

        JButton btnNoDateData = new JButton("No Date Data");
        btnNoDateData.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                textFieldVerbDate.setText("[No date data]");
            }
        });
        GridBagConstraints gbc_btnNoDateData = new GridBagConstraints();
        gbc_btnNoDateData.fill = GridBagConstraints.HORIZONTAL;
        gbc_btnNoDateData.insets = new Insets(0, 0, 5, 5);
        gbc_btnNoDateData.gridx = 1;
        gbc_btnNoDateData.gridy = 1;
        panel_1.add(btnNoDateData, gbc_btnNoDateData);

        JButton btnLabelTruncatedIn = new JButton("Label Truncated in Image");
        btnLabelTruncatedIn.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                appendToQuestions(Verbatim.TRUNCATED_BY_IMAGE);
            }
        });
        GridBagConstraints gbc_btnLabelTruncatedIn = new GridBagConstraints();
        gbc_btnLabelTruncatedIn.insets = new Insets(0, 0, 5, 5);
        gbc_btnLabelTruncatedIn.anchor = GridBagConstraints.NORTHWEST;
        gbc_btnLabelTruncatedIn.gridx = 0;
        gbc_btnLabelTruncatedIn.gridy = 2;
        panel_1.add(btnLabelTruncatedIn, gbc_btnLabelTruncatedIn);

        JButton btnNoCollectorData = new JButton("No Collector Data");
        btnNoCollectorData.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                textFieldVerbCollector.setText("[No collector data]");
            }
        });
        GridBagConstraints gbc_btnNoCollectorData = new GridBagConstraints();
        gbc_btnNoCollectorData.insets = new Insets(0, 0, 5, 5);
        gbc_btnNoCollectorData.gridx = 1;
        gbc_btnNoCollectorData.gridy = 2;
        panel_1.add(btnNoCollectorData, gbc_btnNoCollectorData);

        JButton btnNoPinLabels = new JButton("No Pin Labels");
        btnNoPinLabels.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                appendToQuestions(Verbatim.NO_PIN_LABELS);
            }
        });
        GridBagConstraints gbc_btnNoPinLabels = new GridBagConstraints();
        gbc_btnNoPinLabels.insets = new Insets(0, 0, 0, 5);
        gbc_btnNoPinLabels.gridx = 0;
        gbc_btnNoPinLabels.gridy = 3;
        panel_1.add(btnNoPinLabels, gbc_btnNoPinLabels);
    }
    {
        JPanel panel = new JPanel();
        contentPanel.add(panel, BorderLayout.CENTER);
        panel.setLayout(new BorderLayout(0, 0));

        panel.add(getImagePanePinLabels());
    }
    {
        JPanel buttonPane = new JPanel();
        buttonPane.setLayout(new FlowLayout(FlowLayout.LEFT));
        getContentPane().add(buttonPane, BorderLayout.SOUTH);

        btnPrevious = new JButton("Previous");
        btnPrevious.setEnabled(false);
        if (specimenControler != null && specimenControler.isInTable()) {
            btnPrevious.setEnabled(true);
        }
        btnPrevious.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                save();
                if (specimenControler.previousSpecimenInTable()) {
                    specimen = specimenControler.getSpecimen();
                    setValues();
                }
            }
        });
        buttonPane.add(btnPrevious);

        btnNext = new JButton("Next");
        btnNext.setEnabled(false);
        if (specimenControler != null && specimenControler.isInTable()) {
            btnNext.setEnabled(true);
        }
        btnNext.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                save();
                if (specimenControler.nextSpecimenInTable()) {
                    specimen = specimenControler.getSpecimen();
                    setValues();
                }
            }
        });
        buttonPane.add(btnNext);
        {
            JButton okButton = new JButton("OK");
            okButton.setActionCommand("OK");
            okButton.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    if (save()) {
                        setVisible(false);
                    }
                }

            });
            buttonPane.add(okButton);
            getRootPane().setDefaultButton(okButton);
        }
        {
            JButton cancelButton = new JButton("Cancel");
            cancelButton.setActionCommand("Cancel");
            cancelButton.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    setVisible(false);
                }

            });
            buttonPane.add(cancelButton);
        }
    }
}

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

protected void init() {
    setTitle("Interpret verbatim data into fields.");
    setBounds(100, 100, 1203, 899);/*  w  w  w .  j av  a 2 s.co  m*/
    getContentPane().setLayout(new BorderLayout());
    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(contentPanel, BorderLayout.CENTER);
    contentPanel.setLayout(new BoxLayout(contentPanel, BoxLayout.Y_AXIS));
    {
        JPanel panelVerbatimValues = new JPanel();
        contentPanel.add(panelVerbatimValues);
        GridBagLayout gbl_panelVerbatimValues = new GridBagLayout();
        gbl_panelVerbatimValues.columnWidths = new int[] { 70, 0, 0, 0, 35, 0, 58, 0, 0, 0 };
        gbl_panelVerbatimValues.rowHeights = new int[] { 15, 0, 0, 0, 0, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                83, 0 };
        gbl_panelVerbatimValues.columnWeights = new double[] { 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0,
                1.0 };
        gbl_panelVerbatimValues.rowWeights = new double[] { 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, Double.MIN_VALUE };
        panelVerbatimValues.setLayout(gbl_panelVerbatimValues);
        {
            lblCount = new JLabel("New label");
            GridBagConstraints gbc_lblNewLabel = new GridBagConstraints();
            gbc_lblNewLabel.gridwidth = 2;
            gbc_lblNewLabel.insets = new Insets(0, 0, 5, 5);
            gbc_lblNewLabel.anchor = GridBagConstraints.SOUTHWEST;
            gbc_lblNewLabel.gridx = 0;
            gbc_lblNewLabel.gridy = 0;
            panelVerbatimValues.add(lblCount, gbc_lblNewLabel);
        }

        JButton buttonFillFromLast = new JButton("Fill From Last");
        GridBagConstraints gbc_buttonFillFromLast = new GridBagConstraints();
        gbc_buttonFillFromLast.anchor = GridBagConstraints.SOUTH;
        gbc_buttonFillFromLast.insets = new Insets(0, 0, 5, 5);
        gbc_buttonFillFromLast.gridx = 3;
        gbc_buttonFillFromLast.gridy = 0;
        panelVerbatimValues.add(buttonFillFromLast, gbc_buttonFillFromLast);
        {
            JLabel lblNewLabel_1 = new JLabel("Field values to apply to all records.");
            GridBagConstraints gbc_lblNewLabel_1 = new GridBagConstraints();
            gbc_lblNewLabel_1.anchor = GridBagConstraints.SOUTHEAST;
            gbc_lblNewLabel_1.gridwidth = 4;
            gbc_lblNewLabel_1.insets = new Insets(0, 0, 5, 5);
            gbc_lblNewLabel_1.gridx = 4;
            gbc_lblNewLabel_1.gridy = 0;
            panelVerbatimValues.add(lblNewLabel_1, gbc_lblNewLabel_1);
        }
        {
            JLabel lblNewLabel_2 = new JLabel("Verbatim Locality");
            GridBagConstraints gbc_lblNewLabel_2 = new GridBagConstraints();
            gbc_lblNewLabel_2.anchor = GridBagConstraints.EAST;
            gbc_lblNewLabel_2.insets = new Insets(0, 0, 5, 5);
            gbc_lblNewLabel_2.gridx = 0;
            gbc_lblNewLabel_2.gridy = 1;
            panelVerbatimValues.add(lblNewLabel_2, gbc_lblNewLabel_2);
        }
        {
            textFieldVerbLocality = new JTextArea();
            textFieldVerbLocality.setEditable(false);
            textFieldVerbLocality.setRows(5);
            GridBagConstraints gbc_textField = new GridBagConstraints();
            gbc_textField.gridheight = 3;
            gbc_textField.insets = new Insets(0, 0, 5, 5);
            gbc_textField.fill = GridBagConstraints.BOTH;
            gbc_textField.gridx = 1;
            gbc_textField.gridy = 1;
            panelVerbatimValues.add(textFieldVerbLocality, gbc_textField);
            textFieldVerbLocality.setColumns(30);
        }

        JLabel lblNewLabel = new JLabel("HigherGeography");
        GridBagConstraints gbc_lblNewLabel = new GridBagConstraints();
        gbc_lblNewLabel.anchor = GridBagConstraints.EAST;
        gbc_lblNewLabel.insets = new Insets(0, 0, 5, 5);
        gbc_lblNewLabel.gridx = 3;
        gbc_lblNewLabel.gridy = 1;
        panelVerbatimValues.add(lblNewLabel, gbc_lblNewLabel);

        GridBagConstraints gbc_textFieldHigherGeography = new GridBagConstraints();
        gbc_textFieldHigherGeography.fill = GridBagConstraints.HORIZONTAL;
        gbc_textFieldHigherGeography.gridwidth = 5;
        gbc_textFieldHigherGeography.insets = new Insets(0, 0, 5, 5);
        gbc_textFieldHigherGeography.gridx = 4;
        gbc_textFieldHigherGeography.gridy = 1;
        panelVerbatimValues.add(getComboBoxHighGeog(), gbc_textFieldHigherGeography);

        JButton btnCopyLocality = new JButton(">");
        btnCopyLocality.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                if (textFieldSpecificLocality.getText().isEmpty()) {
                    textFieldSpecificLocality.setText(textFieldVerbLocality.getText().replace("\n", "").trim());
                }
            }
        });
        GridBagConstraints gbc_btnCopyLocality = new GridBagConstraints();
        gbc_btnCopyLocality.insets = new Insets(0, 0, 5, 5);
        gbc_btnCopyLocality.gridx = 2;
        gbc_btnCopyLocality.gridy = 2;
        panelVerbatimValues.add(btnCopyLocality, gbc_btnCopyLocality);

        JLabel lblSpecificLocality = new JLabel("Specific Locality");
        GridBagConstraints gbc_lblSpecificLocality = new GridBagConstraints();
        gbc_lblSpecificLocality.anchor = GridBagConstraints.EAST;
        gbc_lblSpecificLocality.insets = new Insets(0, 0, 5, 5);
        gbc_lblSpecificLocality.gridx = 3;
        gbc_lblSpecificLocality.gridy = 2;
        panelVerbatimValues.add(lblSpecificLocality, gbc_lblSpecificLocality);

        JLabel lblElevation = new JLabel("Elevation");
        GridBagConstraints gbc_lblElevation = new GridBagConstraints();
        gbc_lblElevation.anchor = GridBagConstraints.EAST;
        gbc_lblElevation.insets = new Insets(0, 0, 5, 5);
        gbc_lblElevation.gridx = 3;
        gbc_lblElevation.gridy = 3;
        panelVerbatimValues.add(lblElevation, gbc_lblElevation);

        textFieldMinElevation = new JTextField();
        textFieldMinElevation.setMinimumSize(new Dimension(60, 19));
        GridBagConstraints gbc_textFieldMinElevation = new GridBagConstraints();
        gbc_textFieldMinElevation.insets = new Insets(0, 0, 5, 5);
        gbc_textFieldMinElevation.fill = GridBagConstraints.HORIZONTAL;
        gbc_textFieldMinElevation.gridx = 4;
        gbc_textFieldMinElevation.gridy = 3;
        panelVerbatimValues.add(textFieldMinElevation, gbc_textFieldMinElevation);
        textFieldMinElevation.setColumns(4);

        JLabel lblTo = new JLabel("to");
        GridBagConstraints gbc_lblTo = new GridBagConstraints();
        gbc_lblTo.anchor = GridBagConstraints.EAST;
        gbc_lblTo.insets = new Insets(0, 0, 5, 5);
        gbc_lblTo.gridx = 5;
        gbc_lblTo.gridy = 3;
        panelVerbatimValues.add(lblTo, gbc_lblTo);

        textFieldMaxElevation = new JTextField();
        textFieldMaxElevation.setMinimumSize(new Dimension(60, 19));
        GridBagConstraints gbc_textFieldMaxElevation = new GridBagConstraints();
        gbc_textFieldMaxElevation.anchor = GridBagConstraints.WEST;
        gbc_textFieldMaxElevation.insets = new Insets(0, 0, 5, 5);
        gbc_textFieldMaxElevation.gridx = 6;
        gbc_textFieldMaxElevation.gridy = 3;
        panelVerbatimValues.add(textFieldMaxElevation, gbc_textFieldMaxElevation);
        textFieldMaxElevation.setColumns(5);

        comboBoxElevUnits = new JComboBox();
        GridBagConstraints gbc_comboBoxElevUnits = new GridBagConstraints();
        gbc_comboBoxElevUnits.insets = new Insets(0, 0, 5, 5);
        gbc_comboBoxElevUnits.fill = GridBagConstraints.HORIZONTAL;
        gbc_comboBoxElevUnits.gridx = 7;
        gbc_comboBoxElevUnits.gridy = 3;
        panelVerbatimValues.add(comboBoxElevUnits, gbc_comboBoxElevUnits);
        {
            JLabel lblVerbatimdate = new JLabel("VerbatimDate");
            GridBagConstraints gbc_lblVerbatimdate = new GridBagConstraints();
            gbc_lblVerbatimdate.anchor = GridBagConstraints.EAST;
            gbc_lblVerbatimdate.insets = new Insets(0, 0, 5, 5);
            gbc_lblVerbatimdate.gridx = 0;
            gbc_lblVerbatimdate.gridy = 4;
            panelVerbatimValues.add(lblVerbatimdate, gbc_lblVerbatimdate);
        }

        textFieldVerbDate = new JTextField();
        GridBagConstraints gbc_textFieldVerbDate = new GridBagConstraints();
        gbc_textFieldVerbDate.insets = new Insets(0, 0, 5, 5);
        gbc_textFieldVerbDate.fill = GridBagConstraints.HORIZONTAL;
        gbc_textFieldVerbDate.gridx = 1;
        gbc_textFieldVerbDate.gridy = 4;
        panelVerbatimValues.add(textFieldVerbDate, gbc_textFieldVerbDate);
        textFieldVerbDate.setColumns(30);

        JButton btnCopyDate = new JButton(">");
        btnCopyDate.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                if (textFieldISODate.getText().isEmpty()) {
                    Map<String, String> extractResult = DateUtils
                            .extractDateFromVerbatim(textFieldVerbDate.getText().trim());
                    if (extractResult.containsKey("result")) {
                        textFieldISODate.setText(extractResult.get("result"));
                    }
                    if (extractResult.containsKey("resultState")) {
                        // TODO: Report suspect etc
                    }
                }
            }
        });
        GridBagConstraints gbc_btnCopyDate = new GridBagConstraints();
        gbc_btnCopyDate.insets = new Insets(0, 0, 5, 5);
        gbc_btnCopyDate.gridx = 2;
        gbc_btnCopyDate.gridy = 4;
        panelVerbatimValues.add(btnCopyDate, gbc_btnCopyDate);

        JLabel lblNewLabel_3 = new JLabel("ISO Date");
        GridBagConstraints gbc_lblNewLabel_3 = new GridBagConstraints();
        gbc_lblNewLabel_3.anchor = GridBagConstraints.EAST;
        gbc_lblNewLabel_3.insets = new Insets(0, 0, 5, 5);
        gbc_lblNewLabel_3.gridx = 3;
        gbc_lblNewLabel_3.gridy = 4;
        panelVerbatimValues.add(lblNewLabel_3, gbc_lblNewLabel_3);

        textFieldISODate = new JTextField();
        textFieldISODate.setInputVerifier(
                MetadataRetriever.getInputVerifier(Specimen.class, "ISODate", textFieldISODate));
        textFieldISODate.setToolTipText(MetadataRetriever.getFieldHelp(Specimen.class, "ISODate"));
        GridBagConstraints gbc_textFieldISODate = new GridBagConstraints();
        gbc_textFieldISODate.fill = GridBagConstraints.HORIZONTAL;
        gbc_textFieldISODate.gridwidth = 5;
        gbc_textFieldISODate.insets = new Insets(0, 0, 5, 5);
        gbc_textFieldISODate.gridx = 4;
        gbc_textFieldISODate.gridy = 4;
        panelVerbatimValues.add(textFieldISODate, gbc_textFieldISODate);
        textFieldISODate.setColumns(10);

        textFieldSpecificLocality = new JTextField();
        GridBagConstraints gbc_textFieldSpecificLocality = new GridBagConstraints();
        gbc_textFieldSpecificLocality.gridwidth = 5;
        gbc_textFieldSpecificLocality.fill = GridBagConstraints.HORIZONTAL;
        gbc_textFieldSpecificLocality.insets = new Insets(0, 0, 5, 5);
        gbc_textFieldSpecificLocality.gridx = 4;
        gbc_textFieldSpecificLocality.gridy = 2;
        panelVerbatimValues.add(textFieldSpecificLocality, gbc_textFieldSpecificLocality);
        textFieldSpecificLocality.setColumns(25);
        {
            JLabel lblVerbatimCollector = new JLabel("Verbatim Collector");
            GridBagConstraints gbc_lblVerbatimCollector = new GridBagConstraints();
            gbc_lblVerbatimCollector.anchor = GridBagConstraints.EAST;
            gbc_lblVerbatimCollector.insets = new Insets(0, 0, 5, 5);
            gbc_lblVerbatimCollector.gridx = 0;
            gbc_lblVerbatimCollector.gridy = 6;
            panelVerbatimValues.add(lblVerbatimCollector, gbc_lblVerbatimCollector);
        }

        textFieldVerbCollector = new JTextArea();
        textFieldVerbCollector.setEditable(false);
        textFieldVerbCollector.setRows(3);
        GridBagConstraints gbc_textFieldVerbCollector = new GridBagConstraints();
        gbc_textFieldVerbCollector.gridheight = 2;
        gbc_textFieldVerbCollector.insets = new Insets(0, 0, 5, 5);
        gbc_textFieldVerbCollector.fill = GridBagConstraints.BOTH;
        gbc_textFieldVerbCollector.gridx = 1;
        gbc_textFieldVerbCollector.gridy = 6;
        panelVerbatimValues.add(textFieldVerbCollector, gbc_textFieldVerbCollector);
        textFieldVerbCollector.setColumns(30);

        JLabel lblCollectors = new JLabel("Collector(s)");
        GridBagConstraints gbc_lblCollectors = new GridBagConstraints();
        gbc_lblCollectors.anchor = GridBagConstraints.EAST;
        gbc_lblCollectors.insets = new Insets(0, 0, 5, 5);
        gbc_lblCollectors.gridx = 3;
        gbc_lblCollectors.gridy = 6;
        panelVerbatimValues.add(lblCollectors, gbc_lblCollectors);

        JButton btnAddCollector = new JButton("+");
        btnAddCollector.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent e) {
                ((CollectorTableModel) jTableCollectors.getModel()).addCollector(new Collector(null, ""));
            }
        });
        GridBagConstraints gbc_btnAddCollector = new GridBagConstraints();
        gbc_btnAddCollector.anchor = GridBagConstraints.EAST;
        gbc_btnAddCollector.insets = new Insets(0, 0, 5, 5);
        gbc_btnAddCollector.gridx = 3;
        gbc_btnAddCollector.gridy = 7;
        panelVerbatimValues.add(btnAddCollector, gbc_btnAddCollector);

        GridBagConstraints gbc_collectorTable = new GridBagConstraints();
        gbc_collectorTable.insets = new Insets(0, 0, 5, 5);
        gbc_collectorTable.fill = GridBagConstraints.BOTH;
        gbc_collectorTable.gridx = 4;
        gbc_collectorTable.gridy = 6;
        gbc_collectorTable.gridheight = 2;
        gbc_collectorTable.gridwidth = 5;
        panelVerbatimValues.add(getJScrollPaneCollectors(), gbc_collectorTable);

        JLabel lblVerbatimCollection = new JLabel("Verbatim Collection");
        GridBagConstraints gbc_lblVerbatimCollection = new GridBagConstraints();
        gbc_lblVerbatimCollection.anchor = GridBagConstraints.EAST;
        gbc_lblVerbatimCollection.insets = new Insets(0, 0, 5, 5);
        gbc_lblVerbatimCollection.gridx = 0;
        gbc_lblVerbatimCollection.gridy = 8;
        panelVerbatimValues.add(lblVerbatimCollection, gbc_lblVerbatimCollection);

        textFieldVerbCollection = new JTextArea();
        textFieldVerbCollection.setEditable(false);
        textFieldVerbCollection.setRows(3);
        GridBagConstraints gbc_textFieldVerbCollection = new GridBagConstraints();
        gbc_textFieldVerbCollection.gridheight = 2;
        gbc_textFieldVerbCollection.insets = new Insets(0, 0, 5, 5);
        gbc_textFieldVerbCollection.fill = GridBagConstraints.BOTH;
        gbc_textFieldVerbCollection.gridx = 1;
        gbc_textFieldVerbCollection.gridy = 8;
        panelVerbatimValues.add(textFieldVerbCollection, gbc_textFieldVerbCollection);
        textFieldVerbCollection.setColumns(30);

        JLabel lblCollection = new JLabel("Collection");
        GridBagConstraints gbc_lblCollection = new GridBagConstraints();
        gbc_lblCollection.anchor = GridBagConstraints.EAST;
        gbc_lblCollection.insets = new Insets(0, 0, 5, 5);
        gbc_lblCollection.gridx = 3;
        gbc_lblCollection.gridy = 8;
        panelVerbatimValues.add(lblCollection, gbc_lblCollection);

        GridBagConstraints gbc_textFieldCollection = new GridBagConstraints();
        gbc_textFieldCollection.fill = GridBagConstraints.HORIZONTAL;
        gbc_textFieldCollection.gridwidth = 5;
        gbc_textFieldCollection.insets = new Insets(0, 0, 5, 5);
        gbc_textFieldCollection.gridx = 4;
        gbc_textFieldCollection.gridy = 8;
        panelVerbatimValues.add(getJComboBoxCollection(), gbc_textFieldCollection);

        JLabel lblVerbatimNumbers = new JLabel("Verbatim Numbers");
        GridBagConstraints gbc_lblVerbatimNumbers = new GridBagConstraints();
        gbc_lblVerbatimNumbers.anchor = GridBagConstraints.EAST;
        gbc_lblVerbatimNumbers.insets = new Insets(0, 0, 5, 5);
        gbc_lblVerbatimNumbers.gridx = 0;
        gbc_lblVerbatimNumbers.gridy = 10;
        panelVerbatimValues.add(lblVerbatimNumbers, gbc_lblVerbatimNumbers);

        textFieldVerbNumbers = new JTextArea();
        textFieldVerbNumbers.setRows(3);
        textFieldVerbNumbers.setEditable(false);
        GridBagConstraints gbc_textFieldVerbNumbers = new GridBagConstraints();
        gbc_textFieldVerbNumbers.gridheight = 2;
        gbc_textFieldVerbNumbers.insets = new Insets(0, 0, 5, 5);
        gbc_textFieldVerbNumbers.fill = GridBagConstraints.BOTH;
        gbc_textFieldVerbNumbers.gridx = 1;
        gbc_textFieldVerbNumbers.gridy = 10;
        panelVerbatimValues.add(textFieldVerbNumbers, gbc_textFieldVerbNumbers);
        textFieldVerbNumbers.setColumns(30);

        JLabel lblNumbers = new JLabel("Numbers");
        GridBagConstraints gbc_lblNumbers = new GridBagConstraints();
        gbc_lblNumbers.anchor = GridBagConstraints.EAST;
        gbc_lblNumbers.insets = new Insets(0, 0, 5, 5);
        gbc_lblNumbers.gridx = 3;
        gbc_lblNumbers.gridy = 10;
        panelVerbatimValues.add(lblNumbers, gbc_lblNumbers);

        JButton btnAddNumber = new JButton("+");
        btnAddNumber.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent e) {
                ((NumberTableModel) jTableNumbers.getModel())
                        .addNumber(new edu.harvard.mcz.imagecapture.data.Number(null, "", ""));
            }
        });
        GridBagConstraints gbc_btnAddNumber = new GridBagConstraints();
        gbc_btnAddNumber.anchor = GridBagConstraints.EAST;
        gbc_btnAddNumber.insets = new Insets(0, 0, 5, 5);
        gbc_btnAddNumber.gridx = 3;
        gbc_btnAddNumber.gridy = 11;
        panelVerbatimValues.add(btnAddNumber, gbc_btnAddNumber);

        GridBagConstraints gbc_numberTable = new GridBagConstraints();
        gbc_numberTable.insets = new Insets(0, 0, 5, 5);
        gbc_numberTable.fill = GridBagConstraints.BOTH;
        gbc_numberTable.gridx = 4;
        gbc_numberTable.gridy = 10;
        gbc_numberTable.gridheight = 2;
        gbc_numberTable.gridwidth = 5;
        panelVerbatimValues.add(this.getJScrollPaneNumbers(), gbc_numberTable);

        JLabel lblVerbatimOtherText = new JLabel("Verbatim Other Text");
        GridBagConstraints gbc_lblVerbatimOtherText = new GridBagConstraints();
        gbc_lblVerbatimOtherText.anchor = GridBagConstraints.EAST;
        gbc_lblVerbatimOtherText.insets = new Insets(0, 0, 5, 5);
        gbc_lblVerbatimOtherText.gridx = 0;
        gbc_lblVerbatimOtherText.gridy = 12;
        panelVerbatimValues.add(lblVerbatimOtherText, gbc_lblVerbatimOtherText);

        textFieldVerbUnclassifiedText = new JTextArea();
        textFieldVerbUnclassifiedText.setEditable(false);
        textFieldVerbUnclassifiedText.setRows(5);
        GridBagConstraints gbc_textFieldVerbUnclassifiedText = new GridBagConstraints();
        gbc_textFieldVerbUnclassifiedText.gridheight = 3;
        gbc_textFieldVerbUnclassifiedText.insets = new Insets(0, 0, 5, 5);
        gbc_textFieldVerbUnclassifiedText.fill = GridBagConstraints.BOTH;
        gbc_textFieldVerbUnclassifiedText.gridx = 1;
        gbc_textFieldVerbUnclassifiedText.gridy = 12;
        panelVerbatimValues.add(textFieldVerbUnclassifiedText, gbc_textFieldVerbUnclassifiedText);
        textFieldVerbUnclassifiedText.setColumns(30);

        JLabel lblHabitat = new JLabel("Habitat");
        GridBagConstraints gbc_lblHabitat = new GridBagConstraints();
        gbc_lblHabitat.anchor = GridBagConstraints.EAST;
        gbc_lblHabitat.insets = new Insets(0, 0, 5, 5);
        gbc_lblHabitat.gridx = 3;
        gbc_lblHabitat.gridy = 12;
        panelVerbatimValues.add(lblHabitat, gbc_lblHabitat);

        textFieldHabitat = new JTextField();
        GridBagConstraints gbc_textFieldHabitat = new GridBagConstraints();
        gbc_textFieldHabitat.fill = GridBagConstraints.HORIZONTAL;
        gbc_textFieldHabitat.gridwidth = 4;
        gbc_textFieldHabitat.insets = new Insets(0, 0, 5, 5);
        gbc_textFieldHabitat.gridx = 4;
        gbc_textFieldHabitat.gridy = 12;
        panelVerbatimValues.add(textFieldHabitat, gbc_textFieldHabitat);
        textFieldHabitat.setColumns(10);

        JLabel lblMicrohabitat = new JLabel("Microhabitat");
        GridBagConstraints gbc_lblMicrohabitat = new GridBagConstraints();
        gbc_lblMicrohabitat.anchor = GridBagConstraints.EAST;
        gbc_lblMicrohabitat.insets = new Insets(0, 0, 5, 5);
        gbc_lblMicrohabitat.gridx = 3;
        gbc_lblMicrohabitat.gridy = 13;
        panelVerbatimValues.add(lblMicrohabitat, gbc_lblMicrohabitat);

        textFieldMicrohabitat = new JTextField();
        GridBagConstraints gbc_textFieldMicrohabitat = new GridBagConstraints();
        gbc_textFieldMicrohabitat.fill = GridBagConstraints.HORIZONTAL;
        gbc_textFieldMicrohabitat.gridwidth = 4;
        gbc_textFieldMicrohabitat.insets = new Insets(0, 0, 5, 5);
        gbc_textFieldMicrohabitat.gridx = 4;
        gbc_textFieldMicrohabitat.gridy = 13;
        panelVerbatimValues.add(textFieldMicrohabitat, gbc_textFieldMicrohabitat);
        textFieldMicrohabitat.setColumns(10);

        JLabel lblNewLabel_4 = new JLabel("Workflow Status");
        GridBagConstraints gbc_lblNewLabel_4 = new GridBagConstraints();
        gbc_lblNewLabel_4.insets = new Insets(0, 0, 5, 5);
        gbc_lblNewLabel_4.gridx = 3;
        gbc_lblNewLabel_4.gridy = 15;
        panelVerbatimValues.add(lblNewLabel_4, gbc_lblNewLabel_4);

        comboBoxWorkflowStatus = new JComboBox(WorkFlowStatus.getVerbatimClassifiedWorkFlowStatusValues());
        comboBoxWorkflowStatus.setSelectedItem(WorkFlowStatus.STAGE_CLASSIFIED);
        GridBagConstraints gbc_comboBoxWorkflowStatus = new GridBagConstraints();
        gbc_comboBoxWorkflowStatus.gridwidth = 4;
        gbc_comboBoxWorkflowStatus.fill = GridBagConstraints.HORIZONTAL;
        gbc_comboBoxWorkflowStatus.insets = new Insets(0, 0, 5, 5);
        gbc_comboBoxWorkflowStatus.gridx = 4;
        gbc_comboBoxWorkflowStatus.gridy = 15;
        panelVerbatimValues.add(comboBoxWorkflowStatus, gbc_comboBoxWorkflowStatus);

        JButton btnApplyToAll = new JButton("Apply To All Records");
        GridBagConstraints gbc_btnApplyToAll = new GridBagConstraints();
        gbc_btnApplyToAll.gridwidth = 4;
        gbc_btnApplyToAll.insets = new Insets(0, 0, 5, 5);
        gbc_btnApplyToAll.gridx = 4;
        gbc_btnApplyToAll.gridy = 16;
        panelVerbatimValues.add(btnApplyToAll, gbc_btnApplyToAll);
        btnApplyToAll.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                saveChanges();
            }
        });
    }
    {
        JPanel panelRelatedData = new JPanel();
        contentPanel.add(panelRelatedData);
        GridBagLayout gbl_panelRelatedData = new GridBagLayout();
        gbl_panelRelatedData.maximumLayoutSize(panelRelatedData);
        gbl_panelRelatedData.columnWidths = new int[] { 20, 33, 1, 0 };
        gbl_panelRelatedData.rowHeights = new int[] { 25, 0 };
        gbl_panelRelatedData.columnWeights = new double[] { 0.0, 1.0, 0.0, Double.MIN_VALUE };
        gbl_panelRelatedData.rowWeights = new double[] { 1.0, Double.MIN_VALUE };
        panelRelatedData.setLayout(gbl_panelRelatedData);
        {
            JLabel lblTaxa = new JLabel("Taxa");
            GridBagConstraints gbc_lblTaxa = new GridBagConstraints();
            gbc_lblTaxa.anchor = GridBagConstraints.NORTHEAST;
            gbc_lblTaxa.insets = new Insets(0, 0, 0, 5);
            gbc_lblTaxa.gridx = 0;
            gbc_lblTaxa.gridy = 0;
            panelRelatedData.add(lblTaxa, gbc_lblTaxa);
        }

        JScrollPane scrollPane = new JScrollPane();
        // scrollPane.setPreferredSize(new Dimension(1000,100));
        GridBagConstraints gbc_scrollPane = new GridBagConstraints();
        gbc_scrollPane.anchor = GridBagConstraints.NORTH;
        gbc_scrollPane.insets = new Insets(0, 0, 0, 5);
        gbc_scrollPane.fill = GridBagConstraints.BOTH;
        gbc_scrollPane.gridx = 1;
        gbc_scrollPane.gridy = 0;
        panelRelatedData.add(scrollPane, gbc_scrollPane);

        tableTaxa = new JTable();
        SpecimenLifeCycle sls = new SpecimenLifeCycle();
        tableTaxa.setModel(new CountValueTableModel(sls.findTaxaFromVerbatim(this.verbatimData),
                "Current Idenfifications for these verbatim values."));
        scrollPane.setViewportView(tableTaxa);
    }
    {
        JPanel buttonPane = new JPanel();
        buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
        getContentPane().add(buttonPane, BorderLayout.SOUTH);
        {
            JButton cancelButton = new JButton("Close");
            cancelButton.setActionCommand("Close");
            cancelButton.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    setVisible(false);
                }
            });
            buttonPane.add(cancelButton);
        }
    }
}

From source file:de.tuberlin.uebb.jdae.simulation.PendulumTest.java

@Test
public void testShortSimulationVariableStep() {

    dae.data[1][0] = 0.1;//from w w  w.  ja va 2  s . co  m
    dae.initialize();

    runtime.simulateVariableStep(dae, 1, Double.MIN_VALUE, Double.MAX_VALUE, 1e-6, 1e-6);

    assertEquals(1, dae.data[0][0], 1e-8);
    assertEquals(-0.4354014183074412, dae.data[1][0], 1e-6);
}

From source file:com.github.rinde.rinsim.examples.demo.factory.FactoryExample.java

static ImmutableList<Point> getBorderNodes(Graph<?> g) {
    final Set<Point> points = g.getNodes();
    double xMin = Double.MAX_VALUE;
    double yMin = Double.MAX_VALUE;
    double xMax = Double.MIN_VALUE;
    double yMax = Double.MIN_VALUE;

    for (final Point p : points) {
        xMin = Math.min(xMin, p.x);
        yMin = Math.min(yMin, p.y);
        xMax = Math.max(xMax, p.x);
        yMax = Math.max(yMax, p.y);
    }/*from w  w w. ja  v a2s .  co m*/
    final ImmutableList.Builder<Point> builder = ImmutableList.builder();
    for (final Point p : points) {
        if (p.x == xMin || p.x == xMax || p.y == yMin || p.y == yMax) {
            builder.add(p);
        }
    }
    return builder.build();
}

From source file:ome.server.itests.query.pojos.QueryTest.java

@Test(groups = "ticket:1150")
public void testDoublesDontGetRounded() throws Exception {
    DoubleAnnotation da = new DoubleAnnotation();
    da.setDoubleValue(1.4);/*from  www  . j a  va 2 s .c  om*/

    DoubleAnnotation t1 = iUpdate.saveAndReturnObject(da);
    assertEquals(1.4, t1.getDoubleValue().doubleValue(), Double.MIN_VALUE);

}

From source file:org.fhcrc.cpl.toolbox.gui.chart.PanelWithHeatMap.java

public void setData(double[] xValues, double[] yValues, double[][] zValues) {
    this.xValues = xValues;
    this.yValues = yValues;
    this.zValues = zValues;

    double minZValue = Double.MAX_VALUE;
    double maxZValue = Double.MIN_VALUE;
    int width = xValues.length;
    int height = yValues.length;
    int numCells = width * height;
    _log.debug("Number of cells in heat map: " + numCells);
    if (zValues.length != width || zValues[0].length != height)
        throw new RuntimeException(
                "PanelWithHeatMap: wrong number of z values for x and y values (" + zValues.length + " vs. "
                        + width + ", " + zValues[0].length + " vs. " + height + ", x/y first, z second)");
    DefaultXYZDataset theDataset = new DefaultXYZDataset();
    double[][] data = new double[3][numCells];
    for (int j = 0; j < height; j++) {
        for (int i = 0; i < width; i++) {
            int cellIndex = (j * width) + i;
            data[0][cellIndex] = xValues[i];
            data[1][cellIndex] = yValues[j];
            data[2][cellIndex] = zValues[i][j];
            //keep track of lowest/highest z values
            minZValue = Math.min(zValues[i][j], minZValue);
            maxZValue = Math.max(zValues[i][j], maxZValue);
        }/*from www  . j  a  va2  s.c  om*/
    }
    lowerZBound = Rounder.round(minZValue, 3);
    upperZBound = Rounder.round(maxZValue, 3);
    if (lowerZBound == upperZBound)
        upperZBound += .0001;
    _log.debug("low,high values: " + lowerZBound + ", " + upperZBound);
    theDataset.addSeries("Range: " + lowerZBound + "-" + upperZBound, data);

    dataset = theDataset;
    if (renderer == null) {
        renderer = new XYBlockRenderer();
    }

    if (paintScale == null) {
        setPaintScale(createPaintScale(palette));
    }
    //This is necessary to get everything to line up
    renderer.setBlockAnchor(RectangleAnchor.BOTTOM);

    if (getPlot() != null) {
        ((XYPlot) getPlot()).setDataset(dataset);
        ((XYPlot) getPlot()).setRenderer(renderer);

        invalidate();
        return;
    }
    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);

    JFreeChart chart = new JFreeChart(dataSetName, JFreeChart.DEFAULT_TITLE_FONT, plot, true);

    //        chart.addLegend(new LegendTitle(renderer));
    //        PaintScaleLegend legend = new PaintScaleLegend(paintScale, xAxis);
    //        chart.addLegend(legend);

    //        LegendItemCollection c1 = new LegendItemCollection();
    //
    //        LegendItem item1 = new LegendItem("Label", "Description",
    //                "ToolTip", "URL", true,
    //                new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0), true, Color.red,
    //                true, Color.blue, new BasicStroke(1.2f), true,
    //                new Line2D.Double(1.0, 2.0, 3.0, 4.0),
    //                new BasicStroke(2.1f), Color.green);
    //        LegendItem item2 = new LegendItem("Label", "Description",
    //                "ToolTip", "URL", true,
    //                new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0),
    //                true, Color.red, true, Color.blue, new BasicStroke(1.2f), true,
    //                new Line2D.Double(1.0, 2.0, 3.0, 4.0), new BasicStroke(2.1f),
    //                Color.green);
    //        c1.add(item1);
    //
    //        chart.getLegend().setSources(new LegendItemSource[]{renderer});

    init(chart);
}

From source file:ca.uhn.hl7v2.testpanel.ui.conn.Hl7ConnectionPanelBackup.java

/**
 * Create the panel.//w ww .  ja  va2s .com
 */
public Hl7ConnectionPanelBackup(Controller theController) {
    myController = theController;

    setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    GridBagLayout gridBagLayout = new GridBagLayout();
    gridBagLayout.columnWidths = new int[] { 150, 0 };
    gridBagLayout.rowHeights = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 };
    gridBagLayout.columnWeights = new double[] { 0.0, 1.0 };
    gridBagLayout.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, Double.MIN_VALUE };
    setLayout(gridBagLayout);

    mySinglePortRadio = new JRadioButton("Single Port MLLP");
    mySinglePortRadio.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            updatePortsModel();
            updatePortsUi();
        }
    });
    myPortButtonGroup.add(mySinglePortRadio);
    GridBagConstraints gbc_SinglePortRadio = new GridBagConstraints();
    gbc_SinglePortRadio.anchor = GridBagConstraints.WEST;
    gbc_SinglePortRadio.insets = new Insets(0, 0, 5, 5);
    gbc_SinglePortRadio.gridx = 0;
    gbc_SinglePortRadio.gridy = 0;
    add(mySinglePortRadio, gbc_SinglePortRadio);

    JPanel panel_4 = new JPanel();
    panel_4.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    GridBagConstraints gbc_panel_4 = new GridBagConstraints();
    gbc_panel_4.fill = GridBagConstraints.BOTH;
    gbc_panel_4.insets = new Insets(0, 0, 5, 0);
    gbc_panel_4.gridx = 1;
    gbc_panel_4.gridy = 0;
    add(panel_4, gbc_panel_4);
    GridBagLayout gbl_panel_4 = new GridBagLayout();
    gbl_panel_4.columnWidths = new int[] { 0, 0, 0 };
    gbl_panel_4.rowHeights = new int[] { 0, 0 };
    gbl_panel_4.columnWeights = new double[] { 0.0, 1.0, Double.MIN_VALUE };
    gbl_panel_4.rowWeights = new double[] { 0.0, Double.MIN_VALUE };
    panel_4.setLayout(gbl_panel_4);

    mySinglePortTextBox = new JTextField();
    mySinglePortTextBox.getDocument().addDocumentListener(new SimpleDocumentListener() {
        @Override
        public void update(DocumentEvent theE) {
            String text = mySinglePortTextBox.getText();
            text = text.replaceAll("[^0-9]+", "");
            if (!StringUtils.equals(mySinglePortTextBox.getText(), text)) {
                final String newVal = text;
                SwingUtilities.invokeLater(new Runnable() {
                    public void run() {
                        mySinglePortTextBox.setText(newVal);
                    }
                });
            }
            if (mySinglePortRadio.isSelected()) {
                if (text.length() > 0) {
                    myConnection.setIncomingOrSinglePort(Integer.parseInt(text));
                } else {
                    myConnection.setIncomingOrSinglePort(-1);
                }
            }
        }
    });

    mylabel = new JLabel("Port");
    mylabel.setHorizontalAlignment(SwingConstants.CENTER);
    mylabel.setPreferredSize(new Dimension(60, 16));
    mylabel.setMinimumSize(new Dimension(60, 16));
    mylabel.setMaximumSize(new Dimension(60, 16));
    GridBagConstraints gbc_label = new GridBagConstraints();
    gbc_label.anchor = GridBagConstraints.EAST;
    gbc_label.insets = new Insets(0, 0, 0, 5);
    gbc_label.gridx = 0;
    gbc_label.gridy = 0;
    panel_4.add(mylabel, gbc_label);
    GridBagConstraints gbc_SinglePortTextBox = new GridBagConstraints();
    gbc_SinglePortTextBox.insets = new Insets(0, 5, 0, 0);
    gbc_SinglePortTextBox.anchor = GridBagConstraints.WEST;
    gbc_SinglePortTextBox.gridx = 1;
    gbc_SinglePortTextBox.gridy = 0;
    panel_4.add(mySinglePortTextBox, gbc_SinglePortTextBox);
    mySinglePortTextBox.setMinimumSize(new Dimension(100, 28));
    mySinglePortTextBox.setMaximumSize(new Dimension(100, 2147483647));
    mySinglePortTextBox.setColumns(10);

    myDualPortRadio = new JRadioButton("Dual Port MLLP");
    myDualPortRadio.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            updatePortsModel();
            updatePortsUi();
        }
    });
    myPortButtonGroup.add(myDualPortRadio);
    GridBagConstraints gbc_DualPortRadio = new GridBagConstraints();
    gbc_DualPortRadio.anchor = GridBagConstraints.WEST;
    gbc_DualPortRadio.insets = new Insets(0, 0, 5, 5);
    gbc_DualPortRadio.gridx = 0;
    gbc_DualPortRadio.gridy = 1;
    add(myDualPortRadio, gbc_DualPortRadio);

    JPanel panel = new JPanel();
    panel.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    GridBagConstraints gbc_BottomPanel = new GridBagConstraints();
    gbc_BottomPanel.insets = new Insets(0, 0, 5, 0);
    gbc_BottomPanel.fill = GridBagConstraints.BOTH;
    gbc_BottomPanel.gridx = 1;
    gbc_BottomPanel.gridy = 1;
    add(panel, gbc_BottomPanel);
    GridBagLayout gbl_panel = new GridBagLayout();
    gbl_panel.columnWidths = new int[] { 0, 0, 0, 0, 0, 0 };
    gbl_panel.rowHeights = new int[] { 0, 0 };
    gbl_panel.columnWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE };
    gbl_panel.rowWeights = new double[] { 0.0, Double.MIN_VALUE };
    panel.setLayout(gbl_panel);

    JLabel lblInbound = new JLabel("Inbound");
    lblInbound.setHorizontalAlignment(SwingConstants.CENTER);
    lblInbound.setPreferredSize(new Dimension(60, 16));
    lblInbound.setMinimumSize(new Dimension(60, 16));
    lblInbound.setMaximumSize(new Dimension(60, 16));
    GridBagConstraints gbc_lblInbound = new GridBagConstraints();
    gbc_lblInbound.insets = new Insets(0, 5, 0, 5);
    gbc_lblInbound.anchor = GridBagConstraints.EAST;
    gbc_lblInbound.gridx = 0;
    gbc_lblInbound.gridy = 0;
    panel.add(lblInbound, gbc_lblInbound);

    myDualIncomingTextBox = new JTextField();
    myDualIncomingTextBox.getDocument().addDocumentListener(new SimpleDocumentListener() {
        @Override
        public void update(DocumentEvent theE) {
            String text = myDualIncomingTextBox.getText();
            text = text.replaceAll("[^0-9]+", "");
            if (!StringUtils.equals(myDualIncomingTextBox.getText(), text)) {
                final String newVal = text;
                SwingUtilities.invokeLater(new Runnable() {
                    public void run() {
                        myDualIncomingTextBox.setText(newVal);
                    }
                });
            }
            if (myDualPortRadio.isSelected()) {
                if (text.length() > 0) {
                    myConnection.setIncomingOrSinglePort(Integer.parseInt(text));
                } else {
                    myConnection.setIncomingOrSinglePort(-1);
                }
            }
        }
    });
    myDualIncomingTextBox.setMaximumSize(new Dimension(100, 2147483647));
    myDualIncomingTextBox.setMinimumSize(new Dimension(100, 28));
    GridBagConstraints gbc_DualIncomingTextBox = new GridBagConstraints();
    gbc_DualIncomingTextBox.anchor = GridBagConstraints.WEST;
    gbc_DualIncomingTextBox.insets = new Insets(0, 0, 0, 5);
    gbc_DualIncomingTextBox.gridx = 1;
    gbc_DualIncomingTextBox.gridy = 0;
    panel.add(myDualIncomingTextBox, gbc_DualIncomingTextBox);
    myDualIncomingTextBox.setColumns(10);

    JLabel lblOutbound = new JLabel("Outbound");
    GridBagConstraints gbc_lblOutbound = new GridBagConstraints();
    gbc_lblOutbound.anchor = GridBagConstraints.EAST;
    gbc_lblOutbound.insets = new Insets(0, 0, 0, 5);
    gbc_lblOutbound.gridx = 2;
    gbc_lblOutbound.gridy = 0;
    panel.add(lblOutbound, gbc_lblOutbound);

    myDualOutgoingTextBox = new JTextField();
    myDualOutgoingTextBox.getDocument().addDocumentListener(new SimpleDocumentListener() {
        @Override
        public void update(DocumentEvent theE) {
            String text = myDualOutgoingTextBox.getText();
            text = text.replaceAll("[^0-9]+", "");
            if (!StringUtils.equals(myDualOutgoingTextBox.getText(), text)) {
                final String newVal = text;
                SwingUtilities.invokeLater(new Runnable() {
                    public void run() {
                        myDualOutgoingTextBox.setText(newVal);
                    }
                });
            }
            if (myDualPortRadio.isSelected()) {
                if (text.length() > 0) {
                    myConnection.setOutgoingPort(Integer.parseInt(text));
                } else {
                    myConnection.setOutgoingPort(-1);
                }
            }
        }
    });
    myDualOutgoingTextBox.setMinimumSize(new Dimension(100, 28));
    myDualOutgoingTextBox.setMaximumSize(new Dimension(100, 2147483647));
    GridBagConstraints gbc_DualOutgoingTextBox = new GridBagConstraints();
    gbc_DualOutgoingTextBox.insets = new Insets(0, 0, 0, 5);
    gbc_DualOutgoingTextBox.anchor = GridBagConstraints.WEST;
    gbc_DualOutgoingTextBox.gridx = 3;
    gbc_DualOutgoingTextBox.gridy = 0;
    panel.add(myDualOutgoingTextBox, gbc_DualOutgoingTextBox);
    myDualOutgoingTextBox.setColumns(10);

    myHl7OverHttpRadioButton = new JRadioButton("HL7 over HTTP");
    myHl7OverHttpRadioButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            updatePortsModel();
            updatePortsUi();
        }
    });
    myPortButtonGroup.add(myHl7OverHttpRadioButton);
    GridBagConstraints gbc_Hl7OverHttpRadioButton = new GridBagConstraints();
    gbc_Hl7OverHttpRadioButton.anchor = GridBagConstraints.WEST;
    gbc_Hl7OverHttpRadioButton.insets = new Insets(0, 0, 5, 5);
    gbc_Hl7OverHttpRadioButton.gridx = 0;
    gbc_Hl7OverHttpRadioButton.gridy = 2;
    add(myHl7OverHttpRadioButton, gbc_Hl7OverHttpRadioButton);

    mypanel = new JPanel();
    mypanel.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    GridBagConstraints gbc_panel = new GridBagConstraints();
    gbc_panel.insets = new Insets(0, 0, 5, 0);
    gbc_panel.fill = GridBagConstraints.BOTH;
    gbc_panel.gridx = 1;
    gbc_panel.gridy = 2;
    add(mypanel, gbc_panel);
    GridBagLayout gbl_panel2 = new GridBagLayout();
    gbl_panel2.columnWidths = new int[] { 0, 0 };
    gbl_panel2.rowHeights = new int[] { 0, 0 };
    gbl_panel2.columnWeights = new double[] { 0.0, 1.0 };
    gbl_panel2.rowWeights = new double[] { 0.0, Double.MIN_VALUE };
    mypanel.setLayout(gbl_panel2);

    mylabel_1 = new JLabel("URL");
    mylabel_1.setHorizontalAlignment(SwingConstants.CENTER);
    mylabel_1.setPreferredSize(new Dimension(60, 16));
    mylabel_1.setMinimumSize(new Dimension(60, 16));
    mylabel_1.setMaximumSize(new Dimension(60, 16));
    GridBagConstraints gbc_label_1 = new GridBagConstraints();
    gbc_label_1.anchor = GridBagConstraints.EAST;
    gbc_label_1.insets = new Insets(0, 0, 0, 5);
    gbc_label_1.gridx = 0;
    gbc_label_1.gridy = 0;
    mypanel.add(mylabel_1, gbc_label_1);

    myHoHUrlTextField = new JTextField();
    myHoHUrlTextField.getDocument().addDocumentListener(new SimpleDocumentListener() {
        @Override
        public void update(DocumentEvent theE) {
            if (myHohUrlTextFieldUpdating) {
                return;
            }

            String value = myHoHUrlTextField.getText();
            try {
                URL url = new URL(value);
                boolean tls;
                if (url.getProtocol().equals("http")) {
                    tls = false;
                } else if (url.getProtocol().equals("https")) {
                    tls = true;
                } else {
                    ourLog.info("Unknown protocol: {}", url.getProtocol());
                    myHoHUrlTextField.setBackground(ERROR_BG);
                    return;
                }

                myConnection.setTls(tls);
                myConnection.setHost(url.getHost());
                myConnection
                        .setIncomingOrSinglePort(url.getPort() != -1 ? url.getPort() : url.getDefaultPort());
                myConnection.setHttpUriPath(url.getPath());

                myHohUrlTextFieldUpdating = true;
                updatePortsUi();
                myHohUrlTextFieldUpdating = false;

                myTlsCheckbox.setSelected(tls);
                myHohTlsCheckbox.setSelected(tls);

                myHoHUrlTextField.setBackground(Color.white);
            } catch (MalformedURLException e) {
                myHoHUrlTextField.setBackground(ERROR_BG);
            }

        }
    });
    GridBagConstraints gbc_HohUsernameTextbox = new GridBagConstraints();
    gbc_HohUsernameTextbox.fill = GridBagConstraints.HORIZONTAL;
    gbc_HohUsernameTextbox.gridx = 1;
    gbc_HohUsernameTextbox.gridy = 0;
    mypanel.add(myHoHUrlTextField, gbc_HohUsernameTextbox);
    myHoHUrlTextField.setColumns(10);

    JLabel lblEncoding = new JLabel("Encoding");
    GridBagConstraints gbc_lblEncoding = new GridBagConstraints();
    gbc_lblEncoding.insets = new Insets(0, 0, 5, 5);
    gbc_lblEncoding.gridx = 0;
    gbc_lblEncoding.gridy = 3;
    add(lblEncoding, gbc_lblEncoding);

    JPanel encodingPanel = new JPanel();
    GridBagConstraints gbc_encodingPanel = new GridBagConstraints();
    gbc_encodingPanel.fill = GridBagConstraints.HORIZONTAL;
    gbc_encodingPanel.insets = new Insets(0, 0, 5, 0);
    gbc_encodingPanel.gridx = 1;
    gbc_encodingPanel.gridy = 3;
    add(encodingPanel, gbc_encodingPanel);
    encodingPanel.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    GridBagLayout gbl_encodingPanel = new GridBagLayout();
    gbl_encodingPanel.columnWidths = new int[] { 144, 58, 0 };
    gbl_encodingPanel.rowHeights = new int[] { 23, 0 };
    gbl_encodingPanel.columnWeights = new double[] { 0.0, 0.0, Double.MIN_VALUE };
    gbl_encodingPanel.rowWeights = new double[] { 0.0, Double.MIN_VALUE };
    encodingPanel.setLayout(gbl_encodingPanel);

    myXmlRadio = new JRadioButton("XML");
    myXmlRadio.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent theE) {
            updateEncodingModel();
        }
    });

    myEr7Radio = new JRadioButton("ER7 (Pipe and hat)");
    myEr7Radio.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            updateEncodingModel();
        }
    });
    encodingButtonGroup.add(myEr7Radio);
    GridBagConstraints gbc_Er7Radio = new GridBagConstraints();
    gbc_Er7Radio.anchor = GridBagConstraints.NORTHWEST;
    gbc_Er7Radio.insets = new Insets(0, 0, 0, 5);
    gbc_Er7Radio.gridx = 0;
    gbc_Er7Radio.gridy = 0;
    encodingPanel.add(myEr7Radio, gbc_Er7Radio);
    encodingButtonGroup.add(myXmlRadio);
    GridBagConstraints gbc_XmlRadio = new GridBagConstraints();
    gbc_XmlRadio.anchor = GridBagConstraints.NORTHWEST;
    gbc_XmlRadio.gridx = 1;
    gbc_XmlRadio.gridy = 0;
    encodingPanel.add(myXmlRadio, gbc_XmlRadio);

    JLabel lblCharset = new JLabel("Charset");
    GridBagConstraints gbc_lblCharset = new GridBagConstraints();
    gbc_lblCharset.insets = new Insets(0, 0, 5, 5);
    gbc_lblCharset.gridx = 0;
    gbc_lblCharset.gridy = 4;
    add(lblCharset, gbc_lblCharset);

    JPanel panel_2 = new JPanel();
    GridBagConstraints gbc_panel_2 = new GridBagConstraints();
    gbc_panel_2.fill = GridBagConstraints.HORIZONTAL;
    gbc_panel_2.insets = new Insets(0, 0, 5, 0);
    gbc_panel_2.gridx = 1;
    gbc_panel_2.gridy = 4;
    add(panel_2, gbc_panel_2);
    panel_2.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    GridBagLayout gbl_panel_2 = new GridBagLayout();
    gbl_panel_2.columnWidths = new int[] { 28, 198, 0, 0 };
    gbl_panel_2.rowHeights = new int[] { 27, 0 };
    gbl_panel_2.columnWeights = new double[] { 0.0, 0.0, 0.0, Double.MIN_VALUE };
    gbl_panel_2.rowWeights = new double[] { 0.0, Double.MIN_VALUE };
    panel_2.setLayout(gbl_panel_2);

    myCharsetSelectRadio = new JRadioButton("");
    myCharsetSelectRadio.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            updateCharsetModel();
        }
    });
    charsetButtonGroup.add(myCharsetSelectRadio);
    GridBagConstraints gbc_CharsetSelectRadio = new GridBagConstraints();
    gbc_CharsetSelectRadio.anchor = GridBagConstraints.WEST;
    gbc_CharsetSelectRadio.insets = new Insets(0, 0, 0, 5);
    gbc_CharsetSelectRadio.gridx = 0;
    gbc_CharsetSelectRadio.gridy = 0;
    panel_2.add(myCharsetSelectRadio, gbc_CharsetSelectRadio);

    myCharsetCombo = new JComboBox();
    myCharsetCombo.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            updateCharsetModel();
        }
    });
    GridBagConstraints gbc_CharsetCombo = new GridBagConstraints();
    gbc_CharsetCombo.anchor = GridBagConstraints.NORTHWEST;
    gbc_CharsetCombo.insets = new Insets(0, 0, 0, 5);
    gbc_CharsetCombo.gridx = 1;
    gbc_CharsetCombo.gridy = 0;
    panel_2.add(myCharsetCombo, gbc_CharsetCombo);

    myCharsetDetectRadio = new JRadioButton("Detect in Message (MSH-18)");
    myCharsetDetectRadio.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            updateCharsetModel();
        }
    });
    charsetButtonGroup.add(myCharsetDetectRadio);
    GridBagConstraints gbc_CharsetDetectRadio = new GridBagConstraints();
    gbc_CharsetDetectRadio.anchor = GridBagConstraints.NORTH;
    gbc_CharsetDetectRadio.gridwidth = 2;
    gbc_CharsetDetectRadio.gridx = 2;
    gbc_CharsetDetectRadio.gridy = 0;
    panel_2.add(myCharsetDetectRadio, gbc_CharsetDetectRadio);

    mylabel_5 = new JLabel("Debug");
    GridBagConstraints gbc_label_5 = new GridBagConstraints();
    gbc_label_5.insets = new Insets(0, 0, 5, 5);
    gbc_label_5.gridx = 0;
    gbc_label_5.gridy = 5;
    add(mylabel_5, gbc_label_5);

    mypanel_2 = new JPanel();
    mypanel_2.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    GridBagConstraints gbc_panel_75 = new GridBagConstraints();
    gbc_panel_75.insets = new Insets(0, 0, 5, 0);
    gbc_panel_75.fill = GridBagConstraints.BOTH;
    gbc_panel_75.gridx = 1;
    gbc_panel_75.gridy = 5;
    add(mypanel_2, gbc_panel_75);
    GridBagLayout gbl_panel_74 = new GridBagLayout();
    gbl_panel_74.columnWidths = new int[] { 0, 0 };
    gbl_panel_74.rowHeights = new int[] { 0, 0 };
    gbl_panel_74.columnWeights = new double[] { 0.0, Double.MIN_VALUE };
    gbl_panel_74.rowWeights = new double[] { 0.0, Double.MIN_VALUE };
    mypanel_2.setLayout(gbl_panel_74);

    myCaptureByteStreamCheckbox = new JCheckBox("Capture Bytes");
    GridBagConstraints gbc_CaptureByteStreamCheckbox = new GridBagConstraints();
    gbc_CaptureByteStreamCheckbox.gridx = 0;
    gbc_CaptureByteStreamCheckbox.gridy = 0;
    mypanel_2.add(myCaptureByteStreamCheckbox, gbc_CaptureByteStreamCheckbox);
    myCaptureByteStreamCheckbox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            myConnection.setCaptureBytes(myCaptureByteStreamCheckbox.isSelected());
        }
    });
    myCaptureByteStreamCheckbox.setToolTipText("Check this box to capture the transport level communication");

    myInterfaceTypeCardPanel = new JPanel();
    myInterfaceTypeCardPanel.setBorder(null);
    GridBagConstraints gbc_InterfaceTypeCardPanel = new GridBagConstraints();
    gbc_InterfaceTypeCardPanel.gridwidth = 2;
    gbc_InterfaceTypeCardPanel.fill = GridBagConstraints.BOTH;
    gbc_InterfaceTypeCardPanel.gridx = 0;
    gbc_InterfaceTypeCardPanel.gridy = 6;
    add(myInterfaceTypeCardPanel, gbc_InterfaceTypeCardPanel);
    myInterfaceTypeCardPanel.setLayout(new CardLayout(0, 0));

    myMllpCard = new JPanel();
    myMllpCard.setBorder(null);
    myInterfaceTypeCardPanel.add(myMllpCard, IFACE_TYPE_CARD_MLLP);
    GridBagLayout gbl_MllpCard = new GridBagLayout();
    gbl_MllpCard.columnWidths = new int[] { 150, 0, 0 };
    gbl_MllpCard.rowHeights = new int[] { 0, 0, 0, 0 };
    gbl_MllpCard.columnWeights = new double[] { 0.0, 1.0, Double.MIN_VALUE };
    gbl_MllpCard.rowWeights = new double[] { 0.0, 0.0, 0.0, Double.MIN_VALUE };
    myMllpCard.setLayout(gbl_MllpCard);

    JLabel lblHost = new JLabel("Host");
    GridBagConstraints gbc_lblHost = new GridBagConstraints();
    gbc_lblHost.insets = new Insets(0, 0, 5, 5);
    gbc_lblHost.gridx = 0;
    gbc_lblHost.gridy = 0;
    myMllpCard.add(lblHost, gbc_lblHost);

    mypanel_1 = new JPanel();
    mypanel_1.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    GridBagConstraints gbc_panel_1 = new GridBagConstraints();
    gbc_panel_1.insets = new Insets(0, 0, 5, 0);
    gbc_panel_1.fill = GridBagConstraints.BOTH;
    gbc_panel_1.gridx = 1;
    gbc_panel_1.gridy = 0;
    myMllpCard.add(mypanel_1, gbc_panel_1);
    GridBagLayout gbl_panel_1 = new GridBagLayout();
    gbl_panel_1.columnWidths = new int[] { 134, 0 };
    gbl_panel_1.rowHeights = new int[] { 28, 0 };
    gbl_panel_1.columnWeights = new double[] { 1.0, Double.MIN_VALUE };
    gbl_panel_1.rowWeights = new double[] { 0.0, Double.MIN_VALUE };
    mypanel_1.setLayout(gbl_panel_1);

    myHostBox = new JTextField();
    GridBagConstraints gbc_HostBox = new GridBagConstraints();
    gbc_HostBox.fill = GridBagConstraints.HORIZONTAL;
    gbc_HostBox.anchor = GridBagConstraints.NORTH;
    gbc_HostBox.gridx = 0;
    gbc_HostBox.gridy = 0;
    mypanel_1.add(myHostBox, gbc_HostBox);
    myHostBox.getDocument().addDocumentListener(new SimpleDocumentListener() {
        @Override
        public void update(DocumentEvent theE) {
            myConnection.setHost(myHostBox.getText());
        }
    });
    myHostBox.setColumns(10);

    JLabel lblTransport = new JLabel("Transport");
    GridBagConstraints gbc_lblTransport = new GridBagConstraints();
    gbc_lblTransport.insets = new Insets(0, 0, 5, 5);
    gbc_lblTransport.gridx = 0;
    gbc_lblTransport.gridy = 1;
    myMllpCard.add(lblTransport, gbc_lblTransport);

    JPanel panel_3 = new JPanel();
    GridBagConstraints gbc_hohAuthPanel = new GridBagConstraints();
    gbc_hohAuthPanel.fill = GridBagConstraints.HORIZONTAL;
    gbc_hohAuthPanel.insets = new Insets(0, 0, 5, 0);
    gbc_hohAuthPanel.gridx = 1;
    gbc_hohAuthPanel.gridy = 1;
    myMllpCard.add(panel_3, gbc_hohAuthPanel);
    panel_3.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    GridBagLayout gbl_hohAuthPanel = new GridBagLayout();
    gbl_hohAuthPanel.columnWidths = new int[] { 0, 0, 0 };
    gbl_hohAuthPanel.rowHeights = new int[] { 0, 0 };
    gbl_hohAuthPanel.columnWeights = new double[] { 0.0, 0.0, Double.MIN_VALUE };
    gbl_hohAuthPanel.rowWeights = new double[] { 0.0, Double.MIN_VALUE };
    panel_3.setLayout(gbl_hohAuthPanel);

    myTlsCheckbox = new JCheckBox("Use TLS/SSL");
    myTlsCheckbox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            myHohTlsCheckbox.setSelected(myTlsCheckbox.isSelected());
            myConnection.setTls(myTlsCheckbox.isSelected());
        }
    });
    GridBagConstraints gbc_TlsCheckbox = new GridBagConstraints();
    gbc_TlsCheckbox.insets = new Insets(0, 0, 0, 5);
    gbc_TlsCheckbox.anchor = GridBagConstraints.WEST;
    gbc_TlsCheckbox.gridx = 0;
    gbc_TlsCheckbox.gridy = 0;
    panel_3.add(myTlsCheckbox, gbc_TlsCheckbox);

    myHoHCard = new JPanel();
    myInterfaceTypeCardPanel.add(myHoHCard, IFACE_TYPE_CARD_HOH);
    GridBagLayout gbl_HoHCard = new GridBagLayout();
    gbl_HoHCard.columnWidths = new int[] { 150, 0, 0 };
    gbl_HoHCard.rowHeights = new int[] { 0, 0, 0, 0 };
    gbl_HoHCard.columnWeights = new double[] { 0.0, 1.0, Double.MIN_VALUE };
    gbl_HoHCard.rowWeights = new double[] { 0.0, 0.0, 0.0, Double.MIN_VALUE };
    myHoHCard.setLayout(gbl_HoHCard);

    mylabel_6 = new JLabel("Authorization");
    GridBagConstraints gbc_label_6 = new GridBagConstraints();
    gbc_label_6.insets = new Insets(0, 0, 5, 5);
    gbc_label_6.gridx = 0;
    gbc_label_6.gridy = 0;
    myHoHCard.add(mylabel_6, gbc_label_6);

    hohAuthPanel = new JPanel();
    hohAuthPanel.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    GridBagConstraints gbc_hohAuthPanel2 = new GridBagConstraints();
    gbc_hohAuthPanel2.insets = new Insets(0, 0, 5, 0);
    gbc_hohAuthPanel2.fill = GridBagConstraints.BOTH;
    gbc_hohAuthPanel2.gridx = 1;
    gbc_hohAuthPanel2.gridy = 0;
    myHoHCard.add(hohAuthPanel, gbc_hohAuthPanel2);
    GridBagLayout gbl_hohAuthPanel3 = new GridBagLayout();
    gbl_hohAuthPanel3.columnWidths = new int[] { 0, 0, 0, 0, 0, 0, 0 };
    gbl_hohAuthPanel3.rowHeights = new int[] { 0, 0 };
    gbl_hohAuthPanel3.columnWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, Double.MIN_VALUE };
    gbl_hohAuthPanel3.rowWeights = new double[] { 0.0, Double.MIN_VALUE };
    hohAuthPanel.setLayout(gbl_hohAuthPanel3);

    myHohAuthEnabledCheckbox = new JCheckBox("Enabled");
    myHohAuthEnabledCheckbox.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent theE) {
            myConnection.setHohAuthenticationEnabled(myHohAuthEnabledCheckbox.isSelected());
        }
    });
    GridBagConstraints gbc_HohAuthEnabledCheckbox = new GridBagConstraints();
    gbc_HohAuthEnabledCheckbox.insets = new Insets(0, 0, 0, 5);
    gbc_HohAuthEnabledCheckbox.gridx = 0;
    gbc_HohAuthEnabledCheckbox.gridy = 0;
    hohAuthPanel.add(myHohAuthEnabledCheckbox, gbc_HohAuthEnabledCheckbox);

    mylabel_7 = new JLabel("Username:");
    GridBagConstraints gbc_label_7 = new GridBagConstraints();
    gbc_label_7.insets = new Insets(0, 0, 0, 5);
    gbc_label_7.anchor = GridBagConstraints.EAST;
    gbc_label_7.gridx = 1;
    gbc_label_7.gridy = 0;
    hohAuthPanel.add(mylabel_7, gbc_label_7);

    myHohAuthUsernameTextbox = new JTextField();
    myHohAuthUsernameTextbox.getDocument().addDocumentListener(new SimpleDocumentListener() {
        @Override
        public void update(DocumentEvent theE) {
            myConnection.setHohAuthenticationUsername(myHohAuthUsernameTextbox.getText());
        }
    });
    myHohAuthUsernameTextbox.setMaximumSize(new Dimension(200, 2147483647));
    myHohAuthUsernameTextbox.setMinimumSize(new Dimension(100, 28));
    myHohAuthUsernameTextbox.setPreferredSize(new Dimension(100, 28));
    GridBagConstraints gbc_HohUsernameTextbox2 = new GridBagConstraints();
    gbc_HohUsernameTextbox2.insets = new Insets(0, 0, 0, 5);
    gbc_HohUsernameTextbox2.fill = GridBagConstraints.HORIZONTAL;
    gbc_HohUsernameTextbox2.gridx = 2;
    gbc_HohUsernameTextbox2.gridy = 0;
    hohAuthPanel.add(myHohAuthUsernameTextbox, gbc_HohUsernameTextbox2);
    myHohAuthUsernameTextbox.setColumns(10);

    mylabel_8 = new JLabel("Password:");
    GridBagConstraints gbc_label_8 = new GridBagConstraints();
    gbc_label_8.insets = new Insets(0, 0, 0, 5);
    gbc_label_8.anchor = GridBagConstraints.EAST;
    gbc_label_8.gridx = 3;
    gbc_label_8.gridy = 0;
    hohAuthPanel.add(mylabel_8, gbc_label_8);

    myHohAuthPasswordTextbox = new JTextField();
    myHohAuthPasswordTextbox.getDocument().addDocumentListener(new SimpleDocumentListener() {
        @Override
        public void update(DocumentEvent theE) {
            myConnection.setHohAuthenticationPassword(myHohAuthPasswordTextbox.getText());
        }
    });
    myHohAuthPasswordTextbox.setPreferredSize(new Dimension(100, 28));
    myHohAuthPasswordTextbox.setMaximumSize(new Dimension(200, 2147483647));
    myHohAuthPasswordTextbox.setMinimumSize(new Dimension(100, 28));
    GridBagConstraints gbc_textField = new GridBagConstraints();
    gbc_textField.insets = new Insets(0, 0, 0, 5);
    gbc_textField.fill = GridBagConstraints.HORIZONTAL;
    gbc_textField.gridx = 4;
    gbc_textField.gridy = 0;
    hohAuthPanel.add(myHohAuthPasswordTextbox, gbc_textField);
    myHohAuthPasswordTextbox.setColumns(10);

    mylabel_2 = new JLabel("Security Profile");
    GridBagConstraints gbc_label_2 = new GridBagConstraints();
    gbc_label_2.insets = new Insets(0, 0, 5, 5);
    gbc_label_2.gridx = 0;
    gbc_label_2.gridy = 1;
    myHoHCard.add(mylabel_2, gbc_label_2);

    securityProfilePanel = new JPanel();
    GridBagConstraints gbc_securityProfilePanel = new GridBagConstraints();
    gbc_securityProfilePanel.insets = new Insets(0, 0, 5, 0);
    gbc_securityProfilePanel.fill = GridBagConstraints.BOTH;
    gbc_securityProfilePanel.gridx = 1;
    gbc_securityProfilePanel.gridy = 1;
    myHoHCard.add(securityProfilePanel, gbc_securityProfilePanel);
    securityProfilePanel.setLayout(new BorderLayout(0, 0));

    myHohTlsCheckbox = new JCheckBox("TLS Enabled");
    myHohTlsCheckbox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            myConnection.setTls(myHohTlsCheckbox.isSelected());
            myTlsCheckbox.setSelected(myHohTlsCheckbox.isSelected());
            updatePortsUi();
        }
    });
    securityProfilePanel.add(myHohTlsCheckbox, BorderLayout.WEST);

    tlsKeystorePanel = new JPanel();
    tlsKeystorePanel.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    securityProfilePanel.add(tlsKeystorePanel, BorderLayout.CENTER);
    GridBagLayout gbl_tlsKeystorePanel = new GridBagLayout();
    gbl_tlsKeystorePanel.columnWidths = new int[] { 58, 107, 77, 0, 0 };
    gbl_tlsKeystorePanel.rowHeights = new int[] { 28, 16, 0 };
    gbl_tlsKeystorePanel.columnWeights = new double[] { 0.0, 1.0, 1.0, 0.0, Double.MIN_VALUE };
    gbl_tlsKeystorePanel.rowWeights = new double[] { 0.0, 0.0, Double.MIN_VALUE };
    tlsKeystorePanel.setLayout(gbl_tlsKeystorePanel);

    mylabel_3 = new JLabel("Keystore:");
    GridBagConstraints gbc_label_3 = new GridBagConstraints();
    gbc_label_3.anchor = GridBagConstraints.WEST;
    gbc_label_3.fill = GridBagConstraints.VERTICAL;
    gbc_label_3.insets = new Insets(0, 0, 5, 5);
    gbc_label_3.gridx = 0;
    gbc_label_3.gridy = 0;
    tlsKeystorePanel.add(mylabel_3, gbc_label_3);

    myHohSecurityKeystoreTextbox = new JTextField();
    GridBagConstraints gbc_HohKeystoreTextbox = new GridBagConstraints();
    gbc_HohKeystoreTextbox.gridwidth = 2;
    gbc_HohKeystoreTextbox.anchor = GridBagConstraints.NORTH;
    gbc_HohKeystoreTextbox.fill = GridBagConstraints.HORIZONTAL;
    gbc_HohKeystoreTextbox.insets = new Insets(0, 0, 5, 5);
    gbc_HohKeystoreTextbox.gridx = 1;
    gbc_HohKeystoreTextbox.gridy = 0;
    tlsKeystorePanel.add(myHohSecurityKeystoreTextbox, gbc_HohKeystoreTextbox);
    myHohSecurityKeystoreTextbox.setColumns(10);
    myHohSecurityKeystoreTextbox.getDocument().addDocumentListener(new SimpleDocumentListener() {
        @Override
        public void update(DocumentEvent theE) {
            String text = myHohSecurityKeystoreTextbox.getText();
            myHohSecurityKeyPwTextBox.setEnabled(isNotBlank(text));
            myConnection.setTlsKeystoreLocation(text);
            scheduleHohSecurityKeystoreCheck();
        }
    });

    myHohSecurityKeystoreChooseBtn = new JButton("Choose");
    myHohSecurityKeystoreChooseBtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            String directory = Prefs.getInstance().getInterfaceHohSecurityKeystoreDirectory();
            directory = StringUtils.defaultString(directory, ".");
            JFileChooser chooser = new JFileChooser(directory);
            chooser.setDialogType(JFileChooser.OPEN_DIALOG);
            chooser.setDialogTitle("Select a Java Keystore");
            int result = chooser.showOpenDialog(Hl7ConnectionPanelBackup.this);
            if (result == JFileChooser.APPROVE_OPTION) {
                Prefs.getInstance()
                        .setInterfaceHohSecurityKeystoreDirectory(chooser.getSelectedFile().getParent());
                myHohSecurityKeystoreTextbox.setText(chooser.getSelectedFile().getAbsolutePath());
            }
        }
    });
    myHohSecurityKeystoreChooseBtn.setIcon(new ImageIcon(
            Hl7ConnectionPanelBackup.class.getResource("/ca/uhn/hl7v2/testpanel/images/open.png")));
    GridBagConstraints gbc_button = new GridBagConstraints();
    gbc_button.insets = new Insets(0, 0, 5, 0);
    gbc_button.gridx = 3;
    gbc_button.gridy = 0;
    tlsKeystorePanel.add(myHohSecurityKeystoreChooseBtn, gbc_button);

    mylabel_4 = new JLabel("Store Pass:");
    GridBagConstraints gbc_label_4 = new GridBagConstraints();
    gbc_label_4.insets = new Insets(0, 0, 0, 5);
    gbc_label_4.anchor = GridBagConstraints.EAST;
    gbc_label_4.gridx = 0;
    gbc_label_4.gridy = 1;
    tlsKeystorePanel.add(mylabel_4, gbc_label_4);

    myHohSecurityKeyPwTextBox = new JTextField();
    myHohSecurityKeyPwTextBox.getDocument().addDocumentListener(new SimpleDocumentListener() {
        @Override
        public void update(DocumentEvent theE) {
            myConnection.setTlsKeystorePassword(myHohSecurityKeyPwTextBox.getText());
            scheduleHohSecurityKeystoreCheck();
        }
    });
    GridBagConstraints gbc_HohSecurityKeyPwTextBox = new GridBagConstraints();
    gbc_HohSecurityKeyPwTextBox.insets = new Insets(0, 0, 0, 5);
    gbc_HohSecurityKeyPwTextBox.fill = GridBagConstraints.HORIZONTAL;
    gbc_HohSecurityKeyPwTextBox.gridx = 1;
    gbc_HohSecurityKeyPwTextBox.gridy = 1;
    tlsKeystorePanel.add(myHohSecurityKeyPwTextBox, gbc_HohSecurityKeyPwTextBox);
    myHohSecurityKeyPwTextBox.setColumns(10);

    myHohSecurityProfileKeystoreStatus = new JLabel("Value goes here");
    myHohSecurityProfileKeystoreStatus.setHorizontalAlignment(SwingConstants.LEFT);
    GridBagConstraints gbc_HohSecurityProfileKeystoreStatus = new GridBagConstraints();
    gbc_HohSecurityProfileKeystoreStatus.anchor = GridBagConstraints.NORTH;
    gbc_HohSecurityProfileKeystoreStatus.fill = GridBagConstraints.HORIZONTAL;
    gbc_HohSecurityProfileKeystoreStatus.gridwidth = 2;
    gbc_HohSecurityProfileKeystoreStatus.gridx = 2;
    gbc_HohSecurityProfileKeystoreStatus.gridy = 1;
    tlsKeystorePanel.add(myHohSecurityProfileKeystoreStatus, gbc_HohSecurityProfileKeystoreStatus);

    init();

}

From source file:org.apache.tinkerpop.gremlin.process.computer.clustering.peerpressure.PeerPressureVertexProgram.java

private static <T> T largestCount(final Map<T, Double> map) {
    T largestKey = null;/*from w  w  w  .ja v a 2s  . co  m*/
    double largestValue = Double.MIN_VALUE;
    for (Map.Entry<T, Double> entry : map.entrySet()) {
        if (entry.getValue() == largestValue) {
            if (null != largestKey && largestKey.toString().compareTo(entry.getKey().toString()) > 0) {
                largestKey = entry.getKey();
                largestValue = entry.getValue();
            }
        } else if (entry.getValue() > largestValue) {
            largestKey = entry.getKey();
            largestValue = entry.getValue();
        }
    }
    return largestKey;
}

From source file:distributions.Beta.java

public double findmax(int i) {

    double max = Double.MIN_VALUE;
    for (double[] data1 : data) {
        if (max < data1[i]) {
            max = data1[i];/*from   ww  w.java 2  s.c  o m*/
        }
    }
    return max;
}

From source file:etymology.util.EtyMath.java

public static double getMax(Collection<Double> values) {
    double max = Double.MIN_VALUE;
    for (double value : values) {
        max = Math.max(max, value);
    }/*from  w  ww  .  j ava 2 s .  c  o  m*/

    return max;
}