Example usage for com.jgoodies.forms.layout CellConstraints xyw

List of usage examples for com.jgoodies.forms.layout CellConstraints xyw

Introduction

In this page you can find the example usage for com.jgoodies.forms.layout CellConstraints xyw.

Prototype

public CellConstraints xyw(int col, int row, int colSpan) 

Source Link

Document

Sets the column, row, width, and height; uses a height (row span) of 1 and the horizontal and vertical default alignments.

Examples:

 cc.xyw(1, 3, 7); cc.xyw(1, 3, 2); 

Usage

From source file:com.atlassian.theplugin.idea.config.serverconfig.defaultCredentials.TestDefaultCredentialsDialog.java

License:Apache License

private synchronized void buildServerContent() {
    rootPanel.removeAll();//w  ww  .  j ava 2  s . c o m
    rootPanel.add(new JLabel("Testing default credentials for enabled servers"), BorderLayout.NORTH);

    String rowsSpecs = "3dlu, pref, 3dlu, " + StringUtils.repeat("pref,", servers.size());

    final FormLayout layout = new FormLayout("pref, 4dlu, pref, 4dlu, pref:grow",
            rowsSpecs.substring(0, rowsSpecs.length() - 1));

    int row = 4;
    final CellConstraints cc = new CellConstraints();
    PanelBuilder builder = new PanelBuilder(layout);
    builder.setDefaultDialogBorder();

    builder.addSeparator("Servers", cc.xyw(1, 2, ALL_COLUMNS));

    for (ServerDataExt server : servers) {
        //            if (server.getServerType())
        builder.add(
                new JLabel(
                        server.getServerData().getName() + " (" + server.getServerType().getShortName() + ")"),
                cc.xy(1, row));
        builder.add(new JLabel(server.getStatus().getIcon()), cc.xy(3, row));

        if (server.getStatus() == ConnectionStatus.FAILED) {
            HyperlinkLabel hyperlinkLabel = new HyperlinkLabel("error details");
            hyperlinkLabel.addMouseListener(getMouseListener(server));
            builder.add(hyperlinkLabel, cc.xy(5, row));
        }
        row++;
    }
    rootPanel.add(builder.getPanel(), BorderLayout.CENTER);
    changeCancelActionName();
}

From source file:com.atlassian.theplugin.idea.jira.WorkLogCreateAndMaybeDeactivateDialog.java

License:Apache License

private JPanel createTimePanel() {
    CellConstraints cc = new CellConstraints();
    timePanel = new JPanel(new FormLayout(
            "3dlu, right:pref, 3dlu, left:pref, 3dlu, 10dlu, left:pref, 3dlu, left:pref:grow, 3dlu",
            "3dlu, pref, 3dlu, pref, pref, pref, 3dlu, pref, 10dlu, 40dlu, 3dlu"));

    timePanel.add(new JLabel("Time Spent:"), cc.xy(2, 2));

    timeSpentField = createFixedTextField(120, 28);
    timePanel.add(timeSpentField, cc.xy(4, 2));

    explanationText = new JTextPane();
    explanationText.setText("An estimate of how much time you have spent working."
            + "\nThe format of this is ' *w *d *h *m ' (representing weeks,"
            + "\ndays, hours and minutes - where * can be any number)" + "\nExamples: 4d, 5h 30m, 60m and 3w.");

    explanationText.setEditable(false);/*  w  ww.j a v a  2 s .co m*/
    explanationText.setEnabled(true);
    explanationText
            .setFont(new Font(explanationText.getFont().getName(), explanationText.getFont().getStyle(), 10));
    explanationText.setOpaque(false);

    timePanel.add(explanationText, cc.xywh(4, 4, 1, 4));

    timePanel.add(new JLabel("Remaining Estimate:"), cc.xyw(6, 2, 2));

    btnAutoUpdate = new JRadioButton("Auto Update", true);
    btnLeaveUnchanged = new JRadioButton("Leave Unchanged");
    btnUpdateManually = new JRadioButton("Update Manually:");

    timePanel.add(btnAutoUpdate, cc.xy(7, 4));
    timePanel.add(btnLeaveUnchanged, cc.xy(7, 5));
    timePanel.add(btnUpdateManually, cc.xy(7, 6));

    remainingEstimateField = createFixedTextField(120, 28);
    timePanel.add(remainingEstimateField, cc.xy(9, 6));

    ButtonGroup group = new ButtonGroup();
    group.add(btnUpdateManually);
    group.add(btnAutoUpdate);
    group.add(btnLeaveUnchanged);

    endTimePanel = new JPanel(new FormLayout("fill:pref:grow, 3dlu, pref", "pref"));
    endDateLabel = new JLabel("1/01/08 12:00");
    endTimePanel.add(endDateLabel, cc.xy(1, 1, CellConstraints.CENTER, CellConstraints.DEFAULT));
    endDateChange = new JButton("Change");
    endTimePanel.add(endDateChange, cc.xy(3, 1, CellConstraints.LEFT, CellConstraints.DEFAULT));

    if (!deactivateActiveIssue) {
        timePanel.add(new JLabel("End Time:"), cc.xy(2, 8));
        timePanel.add(endTimePanel, cc.xy(4, 8));
    }

    timePanel.add(new JLabel("Comment:"), cc.xy(2, 10, CellConstraints.RIGHT, CellConstraints.TOP));
    issueComment = new JTextArea();
    issueComment.setLineWrap(true);
    final JScrollPane scroll = new JScrollPane();
    scroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scroll.setViewportView(issueComment);

    timePanel.add(scroll, cc.xyw(4, 10, 6, CellConstraints.FILL, CellConstraints.FILL));

    UIUtil.setEnabled(timePanel, chkLogWork.isSelected() || !deactivateActiveIssue, true);
    remainingEstimateField.setEnabled(false);
    return timePanel;
}

From source file:com.brainflow.application.toplevel.Brainflow.java

private IImageDataSource specialHandling(IImageDataSource dataSource) {

    if (dataSource.getFileFormat().equals("Analyze7.5")) {
        JPanel panel = new JPanel();
        JLabel messageLabel = new JLabel("Please select correct image orientation from menu: ");
        java.util.List<Anatomy3D> choices = Anatomy3D.getInstanceList();
        JComboBox choiceBox = new JComboBox(choices.toArray());

        //todo hackery alert
        Anatomy anatomy = dataSource.getImageInfo().getAnatomy();
        choiceBox.setSelectedItem(anatomy);

        FormLayout layout = new FormLayout("4dlu, l:p, p:g, 4dlu", "6dlu, p, 10dlu, p, 6dlu");
        CellConstraints cc = new CellConstraints();
        panel.setLayout(layout);//from  w  ww  .  ja  v a  2s.co  m
        panel.add(messageLabel, cc.xyw(2, 2, 2));
        panel.add(choiceBox, cc.xyw(2, 4, 2));

        JOptionPane.showMessageDialog(brainFrame, panel, "Analyze 7.5 image format ...",
                JOptionPane.WARNING_MESSAGE);
        Anatomy selectedAnatomy = (Anatomy) choiceBox.getSelectedItem();
        if (selectedAnatomy != anatomy) {
            //todo hackery alert
            dataSource.getImageInfo().setAnatomy((Anatomy3D) selectedAnatomy);
            dataSource.releaseData();
        }
    }

    return dataSource;

}

From source file:com.devdaily.justwrite.view.OpenRecentFileDialog.java

License:Open Source License

private void doLayoutForm() {
    FormLayout layout = new FormLayout("fill:pref, 3dlu, fill:80dlu:grow, 3dlu, left:pref",
            "pref, 6dlu, pref, 6dlu, pref");
    JPanel panel = new JPanel();
    DefaultFormBuilder builder = new DefaultFormBuilder(layout, panel);
    builder.setDefaultDialogBorder();/*  ww w  .  ja  v a 2 s. c  o  m*/
    CellConstraints cc = new CellConstraints();

    builder.addSeparator("Recent Files", cc.xyw(1, 1, 5));
    builder.add(scrollPane, cc.xyw(1, 3, 5));
    builder.add(ButtonBarFactory.buildCenteredBar(cancelButton, okButton),
            cc.xy(3, 5, CellConstraints.CENTER, CellConstraints.DEFAULT));
    //builder.add(okButton, cc.xy(3,5,CellConstraints.CENTER, CellConstraints.DEFAULT));
    this.setContentPane(builder.getPanel());
}

From source file:com.facetoe.jreader.ui.NewProfileWindow.java

License:Open Source License

/**
 * Method generated by IntelliJ IDEA GUI Designer
 * >>> IMPORTANT!! <<<
 * DO NOT edit this method OR call it in your code!
 *
 * @noinspection ALL/* w  w w.j  ava  2 s . c  o  m*/
 */
private void $$$setupUI$$$() {
    parentPanel = new JPanel();
    parentPanel.setLayout(new FormLayout("fill:d:grow",
            "center:max(d;4px):noGrow,top:4dlu:noGrow,center:d:grow,top:4dlu:noGrow,center:d:noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow"));
    parentPanel
            .setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10), null));
    pnlName = new JPanel();
    pnlName.setLayout(new FormLayout("fill:104px:noGrow,left:17dlu:noGrow,fill:d:grow",
            "center:d:noGrow,top:4dlu:noGrow,center:d:grow"));
    CellConstraints cc = new CellConstraints();
    parentPanel.add(pnlName, cc.xy(1, 5));
    pnlName.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), null));
    txtName = new JTextField();
    txtName.setPreferredSize(new Dimension(350, 20));
    txtName.setToolTipText("Name for this profile");
    pnlName.add(txtName, cc.xy(3, 1, CellConstraints.FILL, CellConstraints.FILL));
    final JLabel label1 = new JLabel();
    label1.setText("Profile Name:");
    pnlName.add(label1, cc.xy(1, 1));
    final Spacer spacer1 = new Spacer();
    pnlName.add(spacer1, cc.xy(3, 3, CellConstraints.DEFAULT, CellConstraints.FILL));
    pnlDocs = new JPanel();
    pnlDocs.setLayout(new FormLayout(
            "fill:101px:noGrow,left:19dlu:noGrow,fill:d:grow,left:4dlu:noGrow,fill:max(d;4px):noGrow",
            "center:d:noGrow"));
    parentPanel.add(pnlDocs, cc.xy(1, 7));
    pnlDocs.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), null));
    final JLabel label2 = new JLabel();
    label2.setPreferredSize(new Dimension(300, 14));
    label2.setText("Javadoc Directory:");
    pnlDocs.add(label2, cc.xyw(1, 1, 2));
    txtDocs = new JTextField();
    txtDocs.setText("");
    txtDocs.setToolTipText("Path to the Javadocs");
    pnlDocs.add(txtDocs, cc.xy(3, 1, CellConstraints.FILL, CellConstraints.DEFAULT));
    btnDocs = new JButton();
    btnDocs.setText("...");
    btnDocs.setToolTipText("Choose directory");
    pnlDocs.add(btnDocs, cc.xy(5, 1));
    pnlSrc = new JPanel();
    pnlSrc.setLayout(new FormLayout(
            "fill:101px:noGrow,left:19dlu:noGrow,fill:d:grow,left:4dlu:noGrow,fill:max(d;4px):noGrow",
            "center:d:noGrow"));
    parentPanel.add(pnlSrc, cc.xy(1, 9));
    pnlSrc.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), null));
    final JLabel label3 = new JLabel();
    label3.setPreferredSize(new Dimension(300, 14));
    label3.setText("Source Directory:");
    pnlSrc.add(label3, cc.xyw(1, 1, 2));
    txtSrc = new JTextField();
    txtSrc.setToolTipText("Path to the source code");
    pnlSrc.add(txtSrc, cc.xy(3, 1, CellConstraints.FILL, CellConstraints.DEFAULT));
    btnSrc = new JButton();
    btnSrc.setText("...");
    btnSrc.setToolTipText("Choose directory");
    pnlSrc.add(btnSrc, cc.xy(5, 1));
    final JPanel panel1 = new JPanel();
    panel1.setLayout(
            new FormLayout("fill:d:noGrow,left:4dlu:noGrow,fill:max(d;4px):noGrow", "center:d:noGrow"));
    parentPanel.add(panel1, cc.xy(1, 11));
    btnOK = new JButton();
    btnOK.setText("OK");
    panel1.add(btnOK, cc.xy(1, 1));
    btnCancel = new JButton();
    btnCancel.setText("Cancel");
    panel1.add(btnCancel, cc.xy(3, 1));
    final JPanel panel2 = new JPanel();
    panel2.setLayout(new FormLayout("fill:d:grow",
            "center:d:grow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow"));
    parentPanel.add(panel2, cc.xy(1, 1, CellConstraints.LEFT, CellConstraints.DEFAULT));
    final JLabel label4 = new JLabel();
    label4.setFont(new Font(label4.getFont().getName(), Font.BOLD, label4.getFont().getSize()));
    label4.setText("Select a name, source and documentation directory for this profile.");
    panel2.add(label4, cc.xy(1, 3));
    progressBar = new JProgressBar();
    progressBar.setVerifyInputWhenFocusTarget(true);
    progressBar.setVisible(false);
    panel2.add(progressBar, cc.xy(1, 5, CellConstraints.FILL, CellConstraints.DEFAULT));
    lblStatus = new JLabel();
    lblStatus.setText("Preparing to parse...");
    lblStatus.setVisible(false);
    panel2.add(lblStatus, cc.xy(1, 7));
    final Spacer spacer2 = new Spacer();
    parentPanel.add(spacer2, cc.xy(1, 3, CellConstraints.DEFAULT, CellConstraints.FILL));
}

From source file:com.isencia.passerelle.hmi.specific.HMITest.java

License:Open Source License

private JPanel getButtonPanel() {
    addScanLineButton = new JButton("Add scan line");
    final AddRowCommand addRowCommand = new AddRowCommand(myTableModel);
    addScanLineButton.addActionListener(addRowCommand);
    ////from  w  w  w  .  j  a v a2  s . c  om
    deleteScanLineButton = new JButton("Delete scan line");
    final DeleteRowCommand deleteRowCommand = new DeleteRowCommand(table, myTableModel);
    deleteScanLineButton.addActionListener(deleteRowCommand);
    //
    goButton = new JButton("GO");
    //
    loadScanButton = new JButton("Load sequence");
    // LoadSequenceCommand loadSequenceCommand = new
    // LoadSequenceCommand(contextData);
    // loadScanButton.addActionListener(loadSequenceCommand);
    //
    saveScanButton = new JButton("Save sequence");
    //
    // //SaveRockingCommand saveRockingCommand = new SaveRockingCommand();
    // saveScanButton.addActionListener(new ModelSaver());
    saveScanButton.setAction(new SaveAction(this));
    //
    saveScanAsButton = new JButton("Save sequence as");
    // SaveSequenceCommand saveSequenceCommand = new
    // SaveSequenceCommand(contextData);
    // saveScanAsButton.addActionListener(saveSequenceCommand);
    //
    //
    saveFileTextField = new JTextField(getCurrentModel().getName());
    //
    final FormLayout layout = new FormLayout("p, 3dlu, p, 3dlu, p", // cols
            "pref, 3dlu, p, 9dlu, p, 3dlu, p, 3dlu, p"); // rows

    // Specify that columns 1 & 5 as well as 3 & 7 have equal widths.
    layout.setColumnGroups(new int[][] { { 1, 3, 5 } });
    //
    // // Create a builder that assists in adding components to the
    // container.
    // // Wrap the panel with a standardized border.
    final PanelBuilder builder = new PanelBuilder(layout);
    builder.setDefaultDialogBorder();

    // Obtain a reusable constraints object to place components in the grid.
    final CellConstraints cc = new CellConstraints();

    // Fill the grid with components; the builder offers to create
    // frequently used components, e.g. separators and labels.

    // Add a titled separator to cell (1, 1) that spans 7 columns.

    builder.addSeparator("Commands", cc.xyw(1, 1, 5));
    builder.add(addScanLineButton, cc.xyw(1, 3, 1));
    builder.add(deleteScanLineButton, cc.xyw(3, 3, 1));
    builder.add(goButton, cc.xyw(5, 3, 1));

    builder.addSeparator("File", cc.xyw(1, 5, 5));
    builder.add(loadScanButton, cc.xyw(1, 7, 1));
    builder.add(saveScanButton, cc.xyw(3, 7, 1));
    builder.add(saveScanAsButton, cc.xyw(5, 7, 1));
    builder.add(saveFileTextField, cc.xyw(1, 9, 5));

    return builder.getPanel();
}

From source file:com.isencia.passerelle.hmi.specific.HMITest.java

License:Open Source License

private JPanel getRockingCurvePanel() {
    // Initialization
    rockingCurveTextField = new JTextField("100");
    registerBinding("rockingCurveField", rockingCurveTextField,
            (ParameterToWidgetBinder) new ParameterToTextFieldBinder());

    // Create panel
    final FormLayout layout = new FormLayout("p, 3dlu, p", // cols
            "pref, 3dlu, p"); // rows

    // Specify that columns 1 & 5 as well as 3 & 7 have equal widths.
    layout.setColumnGroups(new int[][] { { 1, 3 } });

    // Create a builder that assists in adding components to the container.
    // Wrap the panel with a standardized border.
    final PanelBuilder builder = new PanelBuilder(layout);
    builder.setDefaultDialogBorder();/*w  ww .  j a v a 2 s. c o m*/

    // Obtain a reusable constraints object to place components in the grid.
    final CellConstraints cc = new CellConstraints();

    builder.addSeparator("Rocking curve", cc.xyw(1, 1, 3));
    builder.addLabel("Rocking curve (%)", cc.xy(1, 3));
    builder.add(rockingCurveTextField, cc.xy(3, 3));

    return builder.getPanel();
}

From source file:com.isencia.passerelle.hmi.specific.HMITest.java

License:Open Source License

private JPanel getTableScrollPane() {
    // Scan list table
    final String[] columnNames = { "Scan", "Position", "Sample name", "Scan name", "Number of scans",
            "Gain auto" };

    myTableModel = new MyTableModel(columnNames, 0);
    table = new JTable(myTableModel);
    table.setPreferredScrollableViewportSize(new Dimension(600, 200));
    tableScrollPane = new JScrollPane(table);

    registerBinding("scanPositionColumn", myTableModel,
            (ParameterToWidgetBinder) new ParameterToTableColumnBinder(1));

    // Create panel
    final FormLayout layout = new FormLayout("p", // cols
            "pref, 3dlu, p"); // rows

    // Specify that columns 1 & 5 as well as 3 & 7 have equal widths.
    // layout.setColumnGroups(new int[][]{{1, 3}});

    // Create a builder that assists in adding components to the container.
    // Wrap the panel with a standardized border.
    final PanelBuilder builder = new PanelBuilder(layout);
    builder.setDefaultDialogBorder();//from  w w  w. j  a v a2  s .c  o  m

    // Obtain a reusable constraints object to place components in the grid.
    final CellConstraints cc = new CellConstraints();

    builder.addSeparator("Scan sequences", cc.xyw(1, 1, 1));
    builder.add(tableScrollPane, cc.xyw(1, 3, 1));

    return builder.getPanel();
}

From source file:com.isencia.passerelle.hmi.specific.HMITest.java

License:Open Source License

private JPanel getTemperaturePanel() {

    final String[] columnNames = { "Step", "Temperature" };

    myTableModelTemperature = new MyTableModel(columnNames, 0);
    temperatureTable = new JTable(myTableModelTemperature);
    temperatureTable.setPreferredScrollableViewportSize(new Dimension(200, 200));

    temperatureTableScrollPane = new JScrollPane(temperatureTable);

    // Create buttons
    addTemperatureButton = new JButton("Add temperature");
    final AddRowCommand addRowCommand = new AddRowCommand(myTableModelTemperature);
    addTemperatureButton.addActionListener(addRowCommand);

    deleteTemperatureButton = new JButton("Delete temperature");
    final DeleteRowCommand deleteRowCommand = new DeleteRowCommand(temperatureTable, myTableModelTemperature);
    deleteTemperatureButton.addActionListener(deleteRowCommand);

    // Create panel
    final FormLayout layout = new FormLayout("p, 3dlu, p", // cols
            "pref, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, 30dlu"); // rows

    // Specify that columns 1 & 5 as well as 3 & 7 have equal widths.
    // layout.setColumnGroups(new int[][]{{1, 3}});

    // Create a builder that assists in adding components to the container.
    // Wrap the panel with a standardized border.
    final PanelBuilder builder = new PanelBuilder(layout);
    builder.setDefaultDialogBorder();//from   w w w  .  j a  v a2  s. com

    // Obtain a reusable constraints object to place components in the grid.
    final CellConstraints cc = new CellConstraints();

    builder.addSeparator("Temperature settings", cc.xyw(1, 1, 3));
    builder.add(temperatureTableScrollPane, cc.xywh(1, 3, 1, 7));
    builder.add(addTemperatureButton, cc.xyw(3, 3, 1));
    builder.add(deleteTemperatureButton, cc.xyw(3, 5, 1));

    return builder.getPanel();
}

From source file:com.jhash.oimadmin.ui.ConnectionDetails.java

License:Apache License

private JPanel buildComponent() {
    FormLayout eventHandlerFormLayout = new FormLayout(
            "3dlu, right:pref, 3dlu, pref:grow, 5dlu, right:pref, 3dlu, pref:grow, 5dlu",
            "5dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu,p, 3dlu, p, 3dlu, p, 3dlu, p,3dlu, p, 3dlu, p ");
    eventHandlerFormLayout.setColumnGroups(new int[][] { { 2, 6 } });
    CellConstraints cellConstraint = new CellConstraints();
    PanelBuilder builder = new PanelBuilder(eventHandlerFormLayout);
    builder.addLabel("Name", cellConstraint.xy(2, 2));
    builder.add(nameLabel, cellConstraint.xy(4, 2));
    builder.addLabel("OIM Home Directory", cellConstraint.xy(6, 2));
    JFileChooser fileChooser = new JFileChooser();
    fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    oimHome.addFocusListener(new FocusListener() {
        boolean focusAfterShowFileChooser = false;

        @Override/* w  w  w  .  jav a 2  s.c o  m*/
        public void focusGained(FocusEvent e) {
            if (focusAfterShowFileChooser)
                return;
            fileChooser.setSelectedFile(new File(oimHome.getText()));
            int returnedResult = fileChooser.showOpenDialog(ConnectionDetails.this);
            if (returnedResult == JFileChooser.APPROVE_OPTION) {
                File file = fileChooser.getSelectedFile();
                oimHome.setText(file.getAbsolutePath());
            }
        }

        @Override
        public void focusLost(FocusEvent e) {
            focusAfterShowFileChooser = fileChooser.isShowing();
        }
    });
    builder.add(oimHome, cellConstraint.xy(8, 2));

    builder.addSeparator("OIM Connection", cellConstraint.xyw(2, 4, 7));
    builder.addLabel("Server Platform", cellConstraint.xy(2, 6));
    builder.add(platform, cellConstraint.xy(4, 6));
    builder.addLabel("OIM Server URL", cellConstraint.xy(6, 6));
    builder.add(oimURL, cellConstraint.xy(8, 6));

    builder.addLabel("User", cellConstraint.xy(2, 8));
    builder.add(oimUser, cellConstraint.xy(4, 8));
    builder.addLabel("Password", cellConstraint.xy(6, 8));
    builder.add(oimUserPassword, cellConstraint.xy(8, 8));

    builder.addSeparator("Weblogic Admin Server (JMX)", cellConstraint.xyw(2, 10, 7));
    builder.addLabel("Protocol", cellConstraint.xy(2, 12));
    builder.add(jmxProtocol, cellConstraint.xy(4, 12));

    builder.addLabel("Host name", cellConstraint.xy(2, 14));
    builder.add(jmxHostname, cellConstraint.xy(4, 14));
    builder.addLabel("Port", cellConstraint.xy(6, 14));
    builder.add(jmxPort, cellConstraint.xy(8, 14));

    builder.addLabel("User", cellConstraint.xy(2, 16));
    builder.add(jmxUser, cellConstraint.xy(4, 16));
    builder.addLabel("Password", cellConstraint.xy(6, 16));
    builder.add(jmxUserPassword, cellConstraint.xy(8, 16));

    builder.addSeparator("Database", cellConstraint.xyw(2, 18, 5));
    JButton testDBButton = JGComponentFactory.getCurrent().createButton("Test");
    testDBButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            Utils.executeAsyncOperation("Test Database Connection", new Runnable() {
                public void run() {
                    logger.debug("Trying to test connection using configuration {}", connectionDetails);
                    DBConnection connection = new DBConnection();
                    try {
                        connection.initialize(connectionDetails);
                        displayMessage("Database Connection", "Successfully connected to database", null);
                    } catch (Exception exception) {
                        displayMessage("Database Connection Failed",
                                "Failed to create data base connection using details", exception);
                    }
                    try {
                        connection.destroy();
                    } catch (Exception exception) {
                        logger.warn("Failed to destroy new connection. Ignoring error", exception);
                    }
                    logger.debug("Tested connection");
                }
            });
        }
    });
    builder.add(testDBButton, cellConstraint.xy(8, 18));

    builder.addLabel("Driver Class", cellConstraint.xy(2, 20));
    builder.add(dbJDBCDriverClass, cellConstraint.xy(4, 20));
    builder.addLabel("JDBC URL", cellConstraint.xy(6, 20));
    builder.add(dbJDBCURL, cellConstraint.xy(8, 20));

    builder.addLabel("User", cellConstraint.xy(2, 22));
    builder.add(dbUser, cellConstraint.xy(4, 22));
    builder.addLabel("Password", cellConstraint.xy(6, 22));
    builder.add(dbPassword, cellConstraint.xy(8, 22));

    builder.add(dbAutoCommit, cellConstraint.xy(4, 24));

    JButton saveButton = JGComponentFactory.getCurrent().createButton("&Save");
    saveButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            logger.debug("Trying to save configuration {}", connectionDetails);
            connectionDetails.getConfig().saveConfiguration(connectionDetails, false);
            String connectionName = connectionDetails.getProperty(Connection.ATTR_CONN_NAME);
            if (isNewConnection)
                ConnectionTreeNode.ConnectionsRegisterUI.addNewNode(connectionName,
                        connectionDetails.getConfig(), selectionTree, displayArea);
            destroy();
            logger.debug("Saved configuration");
        }
    });
    JButton cancelButton = JGComponentFactory.getCurrent().createButton("Cancel");
    cancelButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            destroy();
        }
    });
    builder.add(saveButton, cellConstraint.xy(4, 26));
    builder.add(cancelButton, cellConstraint.xy(6, 26));
    return builder.build();
}