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

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

Introduction

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

Prototype

public CellConstraints() 

Source Link

Document

Constructs a default instance of CellConstraints .

Usage

From source file:com.atlassian.theplugin.idea.config.ProjectDefaultsConfigurationPanel.java

License:Apache License

public ProjectDefaultsConfigurationPanel(final Project project, final ProjectConfiguration projectConfiguration,
        final FishEyeServerFacade fishEyeServerFacade, final BambooServerFacade bambooServerFacade,
        final JiraServerFacade jiraServerFacade, final UiTaskExecutor uiTaskExecutor,
        @NotNull UserCfg defaultCredentials) {
    this.project = project;
    this.projectConfiguration = projectConfiguration;
    this.bambooServerFacade = bambooServerFacade;
    this.jiraServerFacade = jiraServerFacade;
    this.uiTaskExecutor = uiTaskExecutor;
    this.defaultCredentials = defaultCredentials;
    this.fishEyeServerFacade = fishEyeServerFacade;

    pathToProjectEdit.setToolTipText("Path to root directory in your repository. "
            + "E.g. trunk/myproject. Leave it blank if your project is located at the repository root");

    final FormLayout layout = new FormLayout("10dlu, 20dlu, right:pref, 3dlu, min(150dlu;default):grow, 3dlu", //columns
            "p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 10dlu, " + //14
                    "p, 3dlu, p, 3dlu, p, 10dlu, " + //20
                    "p, 3dlu, p, 3dlu, p, 3dlu, p, 20dlu, fill:p"); //rows

    //CHECKSTYLE:MAGIC:OFF
    PanelBuilder builder = new PanelBuilder(layout, this);
    builder.setDefaultDialogBorder();/*from  w w  w  .j av  a 2s. com*/

    final CellConstraints cc = new CellConstraints();
    builder.addSeparator("FishEye", cc.xyw(1, 1, ALL_COLUMNS)); //11
    JLabel fshHelp1 = new JLabel(FISHEYE_HELP_TEXT_1);
    fshHelp1.setFont(fshHelp1.getFont().deriveFont(10.0f));
    fshHelp1.setMaximumSize(new Dimension(600, Integer.MAX_VALUE));
    builder.add(fshHelp1, cc.xyw(2, 3, ALL_COLUMNS - 1));
    builder.addLabel("Default Server:", cc.xy(3, 5));
    builder.add(defaultFishEyeServerCombo, cc.xy(5, 5));
    builder.addLabel("Default Repository:", cc.xy(3, 7));
    builder.add(defaultFishEyeRepositoryCombo, cc.xy(5, 7));
    builder.addLabel("Path to Project:", cc.xy(3, 9));
    builder.add(pathToProjectEdit, cc.xy(5, 9));
    JLabel fshHelp2 = new JLabel(FISHEYE_HELP_TEXT_2);
    fshHelp2.setFont(fshHelp2.getFont().deriveFont(10.0f));
    fshHelp2.setMaximumSize(new Dimension(600, Integer.MAX_VALUE));
    builder.add(fshHelp2, cc.xy(5, 11));

    builder.addSeparator("JIRA", cc.xyw(1, 13, ALL_COLUMNS));
    JLabel jiraHelp = new JLabel(JIRA_HELP_TEXT);
    jiraHelp.setFont(jiraHelp.getFont().deriveFont(10.0f));
    // jgorycki: well, it seems like FormLayout doesn't give a shit about JLabel's maximum width. However,
    // if I set it to something sane, at least the JLabel seems to wrap its HTML contents properly, instead
    // of producing one long line
    jiraHelp.setMaximumSize(new Dimension(600, Integer.MAX_VALUE));
    builder.add(jiraHelp, cc.xyw(2, 15, ALL_COLUMNS - 1));
    builder.addLabel("Default Server:", cc.xy(3, 17));
    builder.add(defaultJiraServerCombo, cc.xy(5, 17));

    builder.addSeparator("Default Credentials", cc.xyw(1, 19, ALL_COLUMNS));
    final String DEFAULT_CREDENTIALS_TEXT = "Default credentials for selected servers";
    JLabel defaultCredentialsLabel = new JLabel(DEFAULT_CREDENTIALS_TEXT);
    defaultCredentialsLabel.setFont(defaultCredentialsLabel.getFont().deriveFont(10.0f));
    builder.add(defaultCredentialsLabel, cc.xyw(2, 21, ALL_COLUMNS - 1));
    builder.addLabel("Username:", cc.xy(3, 23));
    builder.add(defaultUsername, cc.xy(5, 23));
    builder.addLabel("Password:", cc.xy(3, 25));
    builder.add(defaultPassword, cc.xy(5, 25));
    JPanel panel = new JPanel(new BorderLayout());
    panel.add(defaultCredentialsTestButton, BorderLayout.EAST);
    defaultCredentialsTestButton.setMaximumSize(defaultCredentialsTestButton.getPreferredSize());

    builder.add(defaultCredentialsTestButton, cc.xy(5, 27, CellConstraints.RIGHT, CellConstraints.CENTER));

    initializeControls();
    registerListeners();

    //CHECKSTYLE:MAGIC:ON

}

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

License:Apache License

/**
 * Method generated by IntelliJ IDEA GUI Designer
 * >>> IMPORTANT!! <<<
 * DO NOT edit this method OR call it in your code!
 *
 * @noinspection ALL/*from   w  w  w. ja v  a 2 s. c  o m*/
 */
private void $$$setupUI$$$() {
    rootComponent = new JPanel();
    rootComponent.setLayout(new FormLayout(
            "fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:d:grow,left:4dlu:noGrow,fill:d:grow",
            "center:max(d;4px):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,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:d:grow"));
    rootComponent
            .setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(12, 12, 12, 12), null));
    allFailuresFirstSuccess = new JRadioButton();
    allFailuresFirstSuccess.setSelected(true);
    allFailuresFirstSuccess.setText("All Build Failures and First Build Success");
    CellConstraints cc = new CellConstraints();
    rootComponent.add(allFailuresFirstSuccess, cc.xy(3, 1, CellConstraints.LEFT, CellConstraints.DEFAULT));
    firstFailureFirstSuccess = new JRadioButton();
    firstFailureFirstSuccess.setText("First Build Failure and First Build Success");
    rootComponent.add(firstFailureFirstSuccess, cc.xy(3, 3, CellConstraints.LEFT, CellConstraints.DEFAULT));
    never = new JRadioButton();
    never.setText("Never");
    rootComponent.add(never, cc.xy(3, 5, CellConstraints.LEFT, CellConstraints.DEFAULT));
    final Spacer spacer1 = new Spacer();
    rootComponent.add(spacer1, cc.xy(3, 11, CellConstraints.DEFAULT, CellConstraints.FILL));
    final Spacer spacer2 = new Spacer();
    rootComponent.add(spacer2, cc.xy(5, 11, CellConstraints.FILL, CellConstraints.DEFAULT));
    final JLabel label1 = new JLabel();
    label1.setText("Popups:");
    rootComponent.add(label1, cc.xy(1, 1, CellConstraints.RIGHT, CellConstraints.DEFAULT));
    final JLabel label2 = new JLabel();
    label2.setText("Background refresh  every:");
    rootComponent.add(label2, cc.xy(1, 9));
    final JPanel panel1 = new JPanel();
    panel1.setLayout(new GridLayoutManager(1, 4, new Insets(0, 0, 0, 0), -1, -1));
    rootComponent.add(panel1, cc.xy(3, 9));
    pollTimeSpinner = new JSpinner();
    panel1.add(pollTimeSpinner,
            new GridConstraints(0, 0, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null,
                    new Dimension(50, -1), null, 0, false));
    final JLabel label3 = new JLabel();
    label3.setText("minute(s)");
    panel1.add(label3, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
            GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    final Spacer spacer3 = new Spacer();
    panel1.add(spacer3,
            new GridConstraints(0, 3, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
    onlyMyBuilds = new JCheckBox();
    onlyMyBuilds.setText("Only for My Builds");
    onlyMyBuilds.setToolTipText(
            "Shows notification popup only for builds triggered by commit of the logged in user");
    rootComponent.add(onlyMyBuilds, new CellConstraints(3, 7, 1, 1, CellConstraints.DEFAULT,
            CellConstraints.DEFAULT, new Insets(0, 20, 0, 0)));
    label3.setLabelFor(pollTimeSpinner);
    ButtonGroup buttonGroup;
    buttonGroup = new ButtonGroup();
    buttonGroup.add(allFailuresFirstSuccess);
    buttonGroup.add(firstFailureFirstSuccess);
    buttonGroup.add(never);
}

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

License:Apache License

private synchronized void buildServerContent() {
    rootPanel.removeAll();//w  w w  .jav a2  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.config.serverconfig.JiraServerConfigForm.java

License:Apache License

/**
 * Method generated by IntelliJ IDEA GUI Designer
 * >>> IMPORTANT!! <<<
 * DO NOT edit this method OR call it in your code!
 *
 * @noinspection ALL//from  w  w w.  ja  v  a2s  . c om
 */
private void $$$setupUI$$$() {
    createUIComponents();
    rootComponent = new JPanel();
    rootComponent.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
    final JPanel panel1 = new JPanel();
    panel1.setLayout(new GridLayoutManager(2, 1, new Insets(0, 0, 0, 0), -1, -1));
    rootComponent.add(panel1,
            new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null,
                    null, 0, false));
    panel1.add(genericServerConfigForm.$$$getRootComponent$$$(), new GridConstraints(0, 0, 1, 1,
            GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, 1, 1, null, null, null, 0, false));
    final JPanel panel2 = new JPanel();
    panel2.setLayout(new FormLayout("fill:262px:noGrow",
            "top:26px:noGrow,top:4dlu:noGrow,center:d:grow,top:4dlu:noGrow,center:max(d;4px):noGrow"));
    panel1.add(panel2,
            new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null,
                    new Dimension(1, 80), null, 0, false));
    panel2.setBorder(
            BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Additional Configuration"));
    cbUseSessionCookies.setText("Do not use HTTP authentication");
    CellConstraints cc = new CellConstraints();
    panel2.add(cbUseSessionCookies, new CellConstraints(1, 1, 1, 1, CellConstraints.DEFAULT,
            CellConstraints.DEFAULT, new Insets(0, 12, 0, 0)));
    final JTextArea textArea1 = new JTextArea();
    textArea1.setEditable(false);
    textArea1.setFont(new Font(textArea1.getFont().getName(), textArea1.getFont().getStyle(), 10));
    textArea1.setRows(2);
    textArea1.setText(
            "Check this box if you are using NTLM \nauthentiaction method or your  JIRA \nserver is located behind a proxy");
    textArea1.setWrapStyleWord(true);
    panel2.add(textArea1, new CellConstraints(1, 3, 1, 1, CellConstraints.LEFT, CellConstraints.FILL,
            new Insets(0, 40, 0, 0)));
}

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

License:Apache License

public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
        boolean cellHasFocus) {
    JPanel panel = new JPanel();
    CellConstraints cc = new CellConstraints();
    panel.setLayout(new FormLayout("pref, 5dlu, pref:grow, pref, 5dlu", "pref"));
    JLabel label = new JLabel();
    panel.add(label, cc.xy(1, 1));//from w ww .  ja v a  2  s .  c om
    Color background = new Color(-1);

    //PL-2371 lines are not necessary
    //                isSelected ? list.getSelectionBackground() : index % 2 == 0 ? new Color(238, 229, 222)
    //                        : list.getBackground();

    if (value instanceof BambooPlanItem) {

        BambooPlanItem pi = (BambooPlanItem) value;
        JCheckBox checkBox = new JCheckBox(pi.getPlan().getKey());
        JCheckBox groupedBox = new JCheckBox();

        groupedBox.setSelected(pi.isGrouped());
        groupedBox.setBackground(background);
        groupedBox.setName(GROUP_NAME);

        label.setIcon(
                pi.getPlan().isEnabled() ? (pi.getPlan().isFavourite() ? FAVOURITE_ON_ICON : FAVOURITE_OFF_ICON)
                        : DISABLED_ICON);
        label.setBackground(background);
        checkBox.setText(pi.getPlan().getName() + " (" + pi.getPlan().getKey() + ")");
        checkBox.setSelected(pi.isSelected());
        checkBox.setBackground(background);

        panel.add(checkBox, cc.xy(3, 1));

        checkBox.setBackground(background);
        checkBox.setForeground(isSelected ? list.getSelectionForeground() : list.getForeground());

        checkBox.setEnabled(list.isEnabled());
        checkBox.setFont(list.getFont());
        checkBox.setFocusPainted(false);
        checkBox.setBorder(isSelected ? UIManager.getBorder("List.focusCellHighlightBorder") : NO_FOCUS_BORDER);

        //            final JPanel growPanel = new JPanel();
        //            growPanel.setBackground(background);
        //            //growPanel.setPreferredSize(checkBox.getPreferredSize());
        //            panel.add(growPanel, cc.xy(4, 1));
        panel.add(groupedBox, cc.xy(4, 1));

        groupedBox.setEnabled(list.isEnabled());
        groupedBox.setBackground(background);
        groupedBox.setForeground(isSelected ? list.getSelectionForeground() : list.getForeground());
        groupedBox.setFocusPainted(false);
        groupedBox
                .setBorder(isSelected ? UIManager.getBorder("List.focusCellHighlightBorder") : NO_FOCUS_BORDER);
        groupedBox.setToolTipText("Group builds");

        final JPanel finalPanel = new JPanel();
        finalPanel.setBackground(background);
        finalPanel.setPreferredSize(checkBox.getPreferredSize());
        panel.add(finalPanel, cc.xy(5, 1));

    } else {
        label.setText(value.toString());
        label.setBackground(background);
    }
    panel.setBackground(list.getBackground());
    panel.setForeground(isSelected ? list.getSelectionForeground() : list.getForeground());
    panel.setEnabled(list.isEnabled());

    return panel;
}

From source file:com.atlassian.theplugin.idea.crucible.CrucibleReviewCreateForm.java

License:Apache License

/**
 * Method generated by IntelliJ IDEA GUI Designer
 * >>> IMPORTANT!! <<<
 * DO NOT edit this method OR call it in your code!
 *
 * @noinspection ALL// ww w. java 2  s .c om
 */
private void $$$setupUI$$$() {
    rootComponent = new JPanel();
    rootComponent.setLayout(new FormLayout("fill:d:grow",
            "center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,center:max(d;4px):noGrow,center:p:grow,top:3dlu:noGrow,fill:d:noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow"));
    rootComponent.setMinimumSize(new Dimension(800, 505));
    final JLabel label1 = new JLabel();
    label1.setText("Title:");
    CellConstraints cc = new CellConstraints();
    rootComponent.add(label1, cc.xy(1, 1));
    titleText = new JTextField();
    rootComponent.add(titleText, cc.xy(1, 3, CellConstraints.FILL, CellConstraints.DEFAULT));
    final JPanel panel1 = new JPanel();
    panel1.setLayout(new FormLayout(
            "fill:d:noGrow,left:4dlu:noGrow,fill:300px:grow,left:4dlu:noGrow,fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:max(p;4px):grow",
            "center:d:noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow"));
    rootComponent.add(panel1, cc.xy(1, 5));
    final JLabel label2 = new JLabel();
    label2.setText("Server:");
    panel1.add(label2, cc.xy(1, 1, CellConstraints.DEFAULT, CellConstraints.CENTER));
    crucibleServersComboBox = new JComboBox();
    panel1.add(crucibleServersComboBox, cc.xy(3, 1));
    final JLabel label3 = new JLabel();
    label3.setInheritsPopupMenu(false);
    label3.setText("Project:");
    panel1.add(label3, cc.xy(1, 3, CellConstraints.DEFAULT, CellConstraints.CENTER));
    projectsComboBox = new JComboBox();
    panel1.add(projectsComboBox, cc.xy(3, 3));
    final JLabel label4 = new JLabel();
    label4.setText("Moderator:");
    panel1.add(label4, cc.xy(1, 7, CellConstraints.DEFAULT, CellConstraints.CENTER));
    final JLabel label5 = new JLabel();
    label5.setText("Author:");
    panel1.add(label5, cc.xy(1, 9, CellConstraints.DEFAULT, CellConstraints.CENTER));
    moderatorComboBox = new JComboBox();
    panel1.add(moderatorComboBox, cc.xy(3, 7));
    authorComboBox = new JComboBox();
    panel1.add(authorComboBox, cc.xy(3, 9));
    final JPanel panel2 = new JPanel();
    panel2.setLayout(new BorderLayout(0, 0));
    panel1.add(panel2, cc.xywh(7, 1, 1, 7, CellConstraints.DEFAULT, CellConstraints.FILL));
    final JScrollPane scrollPane1 = new JScrollPane();
    panel2.add(scrollPane1, BorderLayout.CENTER);
    final JLabel label6 = new JLabel();
    label6.setText("Reviewers: ");
    panel1.add(label6, cc.xy(5, 1, CellConstraints.RIGHT, CellConstraints.TOP));
    final JLabel label7 = new JLabel();
    label7.setText("Selected: ");
    panel1.add(label7, cc.xy(5, 9, CellConstraints.RIGHT, CellConstraints.DEFAULT));
    final JLabel label8 = new JLabel();
    label8.setText("Statement of Objectives:");
    rootComponent.add(label8, cc.xy(1, 7));
    final JScrollPane scrollPane2 = new JScrollPane();
    rootComponent.add(scrollPane2, cc.xy(1, 9, CellConstraints.FILL, CellConstraints.FILL));
    statementArea = new JTextArea();
    statementArea.setLineWrap(true);
    statementArea.setRows(5);
    scrollPane2.setViewportView(statementArea);
    customComponentPanel = new JPanel();
    customComponentPanel.setLayout(new BorderLayout(0, 0));
    rootComponent.add(customComponentPanel, cc.xy(1, 11, CellConstraints.DEFAULT, CellConstraints.FILL));
    label1.setLabelFor(titleText);
    label2.setLabelFor(crucibleServersComboBox);
    label5.setLabelFor(scrollPane1);
    label8.setLabelFor(statementArea);
}

From source file:com.atlassian.theplugin.idea.GeneralConfigForm.java

License:Apache 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  .  jav a 2  s  .  c o m*/
 */
private void $$$setupUI$$$() {
    createUIComponents();
    mainPanel = new JPanel();
    mainPanel.setLayout(new FormLayout("fill:d:grow",
            "center:max(d;4px):noGrow,top:3dlu:noGrow,center:d:noGrow,top:4dlu:noGrow,center:max(d;4px):grow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow"));
    mainPanel
            .setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(12, 12, 12, 12), null));
    autoUpdateConfigPanel = new JPanel();
    autoUpdateConfigPanel.setLayout(new GridLayoutManager(3, 3, new Insets(0, 12, 12, 12), -1, -1));
    CellConstraints cc = new CellConstraints();
    mainPanel.add(autoUpdateConfigPanel, cc.xy(1, 1));
    autoUpdateConfigPanel
            .setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Auto Upgrade"));
    checkNowButton = new JButton();
    checkNowButton.setText("Check Now");
    checkNowButton.setMnemonic('C');
    checkNowButton.setDisplayedMnemonicIndex(0);
    autoUpdateConfigPanel.add(checkNowButton,
            new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    final JPanel panel1 = new JPanel();
    panel1.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1));
    autoUpdateConfigPanel.add(panel1,
            new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_VERTICAL,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null,
                    null, 0, false));
    chkUnstableVersionsCheckBox = new JCheckBox();
    chkUnstableVersionsCheckBox.setEnabled(false);
    chkUnstableVersionsCheckBox.setText("Check Snapshot Versions");
    panel1.add(chkUnstableVersionsCheckBox,
            new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    final Spacer spacer1 = new Spacer();
    panel1.add(spacer1,
            new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_WANT_GROW, 1, new Dimension(12, -1), null, null, 0, false));
    chkAutoUpdateEnabled = new JCheckBox();
    chkAutoUpdateEnabled.setText("Enabled (Stable Version)");
    chkAutoUpdateEnabled.setMnemonic('E');
    chkAutoUpdateEnabled.setDisplayedMnemonicIndex(0);
    autoUpdateConfigPanel.add(chkAutoUpdateEnabled,
            new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    final Spacer spacer2 = new Spacer();
    autoUpdateConfigPanel.add(spacer2,
            new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
    checkNewVersionStable = new JRadioButton();
    checkNewVersionStable.setSelected(true);
    checkNewVersionStable.setText("Stable Only");
    autoUpdateConfigPanel.add(checkNewVersionStable,
            new GridConstraints(1, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    checkNewVersionAll = new JRadioButton();
    checkNewVersionAll.setText("Stable + Snapshot");
    autoUpdateConfigPanel.add(checkNewVersionAll,
            new GridConstraints(2, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    httpProxyPanel = new JPanel();
    httpProxyPanel.setLayout(new GridLayoutManager(4, 2, new Insets(0, 12, 12, 0), -1, -1));
    mainPanel.add(httpProxyPanel, cc.xy(1, 3, CellConstraints.DEFAULT, CellConstraints.TOP));
    httpProxyPanel
            .setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "HTTP Proxy"));
    chkUseIdeaProxy = new JRadioButton();
    chkUseIdeaProxy.setText("Use IDEA Proxy Settings");
    httpProxyPanel.add(chkUseIdeaProxy,
            new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    httpProxyButton = new JButton();
    httpProxyButton.setText("Edit IDEA Proxy Settings");
    httpProxyPanel.add(httpProxyButton,
            new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_NORTHWEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    chkNoProxy = new JRadioButton();
    chkNoProxy.setText("Do Not Use Proxy");
    httpProxyPanel.add(chkNoProxy,
            new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    final Spacer spacer3 = new Spacer();
    httpProxyPanel.add(spacer3,
            new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1,
                    GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
    final JLabel label1 = new JLabel();
    label1.setFont(new Font(label1.getFont().getName(), label1.getFont().getStyle(), 10));
    label1.setText("Information: You have to restart IDEA to apply changes in the proxy configuration");
    httpProxyPanel.add(label1,
            new GridConstraints(3, 0, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0,
                    false));
    final JPanel panel2 = new JPanel();
    panel2.setLayout(new FormLayout("left:p:noGrow,left:p:noGrow", "center:d:grow"));
    mainPanel.add(panel2, cc.xy(1, 9));
    reportAnonymousUsageStatisticsCheckBox = new JCheckBox();
    reportAnonymousUsageStatisticsCheckBox.setEnabled(true);
    reportAnonymousUsageStatisticsCheckBox.setSelected(false);
    reportAnonymousUsageStatisticsCheckBox
            .setText("Provide anonymous usage statistics to help us develop a better plugin");
    reportAnonymousUsageStatisticsCheckBox.setMnemonic('P');
    reportAnonymousUsageStatisticsCheckBox.setDisplayedMnemonicIndex(0);
    panel2.add(reportAnonymousUsageStatisticsCheckBox, cc.xy(1, 1));
    panel2.add(usageStatsHelp, cc.xy(2, 1, CellConstraints.LEFT, CellConstraints.CENTER));
    final JPanel panel3 = new JPanel();
    panel3.setLayout(new GridLayoutManager(5, 3, new Insets(0, 12, 12, 12), -1, -1));
    mainPanel.add(panel3, cc.xy(1, 5, CellConstraints.DEFAULT, CellConstraints.TOP));
    panel3.setBorder(
            BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Direct Click Through"));
    ctrlHttpServer = new JCheckBox();
    ctrlHttpServer.setSelected(false);
    ctrlHttpServer.setText("Enable Direct Click Through");
    panel3.add(ctrlHttpServer,
            new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    final Spacer spacer4 = new Spacer();
    panel3.add(spacer4,
            new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1,
                    GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
    final JLabel label2 = new JLabel();
    label2.setFont(new Font(label2.getFont().getName(), label2.getFont().getStyle(), 10));
    label2.setText("Information: You have to restart IDEA to apply changes (start/stop http server)");
    panel3.add(label2, new GridConstraints(3, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE,
            GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    final JLabel label3 = new JLabel();
    label3.setText("  Direct Click Through TCP/IP Port: ");
    panel3.add(label3, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
            GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    final Spacer spacer5 = new Spacer();
    panel3.add(spacer5,
            new GridConstraints(1, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
    final Spacer spacer6 = new Spacer();
    panel3.add(spacer6,
            new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1,
                    GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
    ctrlHttpServerPort = new JSpinner();
    panel3.add(ctrlHttpServerPort,
            new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, new Dimension(70, -1),
                    new Dimension(70, -1), null, 0, false));
    ButtonGroup buttonGroup;
    buttonGroup = new ButtonGroup();
    buttonGroup.add(checkNewVersionStable);
    buttonGroup.add(checkNewVersionAll);
    buttonGroup = new ButtonGroup();
    buttonGroup.add(chkNoProxy);
    buttonGroup.add(chkUseIdeaProxy);
}

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

License:Apache License

private void createContent(final List<JIRAActionField> fieldList) {

    String columns = "3dlu, right:pref, 3dlu, fill:1dlu:grow, 3dlu";
    String rows = "3dlu";

    Collection<JIRAActionField> sortedFieldList = JiraActionFieldType.sortFieldList(fieldList);

    JIRAServerModel jiraServerModel = IdeaHelper.getJIRAServerModel(project);

    List<ActionFieldEditor> editors = Lists.newArrayList();
    List<String> unsupportedFields = Lists.newArrayList();

    for (JIRAActionField field : sortedFieldList) {

        ActionFieldEditor editor = null;
        String row = null;/*from w  w  w  . j  a  va 2s  .  c o m*/

        switch (JiraActionFieldType.getFieldTypeForFieldId(field)) {
        case SUMMARY:
            editor = new FieldTextField(issue.getSummary(), field);
            row = ", pref, 3dlu";
            break;
        case DESCRIPTION:
            editor = new FieldTextArea(Html2text.translate(issue.getWikiDescription()), field);
            row = ", fill:pref:grow, 3dlu";
            break;
        case ISSUE_TYPE:
            editor = new FieldIssueType(jiraServerModel, issue, field, this);
            row = ", p, 3dlu";
            break;
        case RESOLUTION:
            editor = new FieldResolution(jiraServerModel, issue, field, this);
            row = ", p, 3dlu";
            break;
        case ASSIGNEE:
            editor = new FieldUser(jiraServerModel, issue.getJiraServerData(), issue.getAssigneeId(), field);
            row = ", p, 3dlu";
            break;
        case PRIORITY:
            editor = new FieldPriority(jiraServerModel, issue, field, this);
            row = ", p, 3dlu";
            break;
        case VERSIONS:
            editor = new FieldAffectsVersion(jiraServerModel, issue, field, this);
            row = ", p, 3dlu";
            break;
        case FIX_VERSIONS:
            editor = new FieldFixForVersion(jiraServerModel, issue, field, this);
            row = ", p, 3dlu";
            break;
        case COMPONENTS:
            editor = new FieldComponents(jiraServerModel, issue, field, this);
            row = ", p, 3dlu";
            break;
        case REPORTER:
            editor = new FieldUser(jiraServerModel, issue.getJiraServerData(), issue.getReporterId(), field);
            row = ", p, 3dlu";
            break;
        case ENVIRONMENT:
            //                    editor = new FieldTextArea(field.getValues().get(0), field);
            editor = new FieldTextArea(Html2text.translate(issue.getEnvironment()), field);
            row = ", fill:pref:grow, 3dlu";
            break;
        case TIMETRACKING:
            editor = new FieldTimeTracking(field.getValues().get(0), issue, field, this);
            row = ", p, 3dlu";
            break;
        case DUE_DATE:
            String content = "";
            if (field.getValues() != null && field.getValues().size() > 0) {
                content = field.getValues().get(0);
            }
            editor = new FieldDueDate(content, field, this);
            row = ", p, 3dlu";
            break;
        case CUSTOM_FIELD:
            for (JiraCustomField custom : issue.getCustomFields()) {
                if (custom.getId().equals(field.getFieldId())) {
                    List<String> values = custom.getValues();
                    String val = values != null && values.size() > 0 ? values.get(0) : null;
                    switch (custom.getTypeKey()) {
                    case NUMERIC:
                        editor = new FieldTextField(val, field);
                        row = ", p, 3dlu";
                        break;
                    case TEXT:
                        editor = new FieldTextField(val, field);
                        row = ", p, 3dlu";
                        break;
                    case TEXT_AREA:
                        //                                    editor = new FieldEditorPane(custom.getValues().get(0).replaceAll("<br/>", "\n"), field, true);
                        editor = new FieldTextArea(val != null ? val.replaceAll("<br/>", "") : "", field);
                        row = ", p, 3dlu";
                        break;
                    case DATE_PICKER:
                        editor = new FieldDueDate(custom.getFormattedValue(), field, this);
                        row = ", p, 3dlu";
                        break;
                    case URL:
                        editor = new FieldTextField(custom.getFormattedValue(), field);
                        row = ", p, 3dlu";
                    case UNSUPPORTED:
                    default:
                        break;
                    }
                }
            }
            break;
        case UNSUPPORTED:
        default:
            unsupportedFields.add(field.getName());
            break;
        }

        if (editor != null) {
            editors.add(editor);
            rows += row;
        }
    }

    rows += ", fill:pref:grow, 3dlu"; // Comments text area

    if (!unsupportedFields.isEmpty()) {
        rows += ", pref, 3dlu"; // warning status line about not handled
    }

    contentPanel.setLayout(new FormLayout(columns, rows));
    final CellConstraints cc = new CellConstraints();

    int y = 2;

    for (ActionFieldEditor editor : editors) {
        final JLabel label = new JLabel(editor.getFieldName() + ":");
        contentPanel.add(label, cc.xy(2, y, CellConstraints.RIGHT, CellConstraints.TOP));
        contentPanel.add(editor.getComponent(), cc.xy(4, y));
        createdFieldEditors.add(editor);
        y += 2;
    }

    final JLabel label = new JLabel("Comment :");
    contentPanel.add(label, cc.xy(2, y, CellConstraints.RIGHT, CellConstraints.TOP));
    // todo create field for Comments
    commentTextArea = new CommentTextArea();
    contentPanel.add(commentTextArea, cc.xy(4, y));

    y += 2;

    if (!unsupportedFields.isEmpty()) {
        String warning = issue.usesRest() ? "Unsupported fields (skipped): "
                : "Unsupported fields (original values copied): ";
        warning += StringUtils.join(unsupportedFields, ", ");
        contentPanel.add(new JLabel(warning), cc.xyw(2, y, 3, CellConstraints.LEFT, CellConstraints.CENTER));
    }

    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            contentPanel.validate();
        }
    });
}

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

License:Apache License

/**
 * Method generated by IntelliJ IDEA GUI Designer
 * >>> IMPORTANT!! <<<
 * DO NOT edit this method OR call it in your code!
 *
 * @noinspection ALL/*from w  w  w  .  j a va  2 s.co m*/
 */

private void setupUI() {
    CellConstraints cc = new CellConstraints();

    contentPane = new JPanel(new FormLayout("3dlu, fill:pref:grow, 3dlu",
            "3dlu, pref, 3dlu, pref, 3dlu, pref, 3dlu, pref, 3dlu, fill:pref:grow, 3dlu"));

    chkLogWork = new JCheckBox("Log Work", config.isActiveIssueLogWork() || !deactivateActiveIssue);
    contentPane.add(createTimePanel(), cc.xy(2, 6));

    if (deactivateActiveIssue) {
        timePanel.setBorder(
                BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Time Tracking"));

        contentPane.add(createWorkflowActionCombo(), cc.xy(2, 2));
        contentPane.add(chkLogWork, cc.xy(2, 4));
        chkCommitChanges = new JCheckBox("Commit Changes", config.isActiveIssueCommitChanges());
        //         contentPane.add(chkCommitChanges, cc.xy(2, 8));
        contentPane.add(createChangesetPanel(), cc.xy(2, 10));
        JPanel basePanel = new JPanel(new FormLayout("pref, 5dlu, pref, fill:pref:grow", "pref"));
        basePanel.add(chkCommitChanges, cc.xy(1, 1));

        cbCreateReviewAfterCommit = new JCheckBox("Create Review After Commit", false);
        //            contentPane.add(cbCreateReviewAfterCommit, cc.xy(3, 8));
        //            basePanel.add(cbCreateReviewAfterCommit, cc.xy(3, 1));

        contentPane.add(basePanel, cc.xy(2, 8));

        contentPane.setMinimumSize(new Dimension(800, 600));
        contentPane.setPreferredSize(new Dimension(800, 600));
    }
}

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

License:Apache License

private JPanel createChangesetPanel() {
    CellConstraints cc = new CellConstraints();

    changesetPanel = new JPanel(new FormLayout("3dlu, fill:pref:grow, 3dlu",
            "3dlu, fill:d:grow, 3dlu, pref, 3dlu, pref, 3dlu, pref, pref, pref, 3dlu"));
    changesetPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Changes"));
    changesPanel = new JPanel(new BorderLayout(0, 0));
    changesPanel.setPreferredSize(new Dimension(1, 1));
    changesetPanel.add(changesPanel, cc.xy(2, 2));

    JPanel labelPanel = new JPanel(new FormLayout("right:pref", "10dlu, pref:grow"));
    labelPanel.add(new JLabel("Comment:"), cc.xy(1, 1));

    copyIcon = IconLoader.getIcon("/actions/copy.png");
    copyButton = new JButton(copyIcon);
    copyButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent actionEvent) {
            if (chkLogWork.isSelected()) {
                issueComment.setText(comment.getText());
            }/*from  w ww .j  a  v a  2  s . co m*/
        }
    });
    labelPanel.add(copyButton, cc.xy(1, 2, CellConstraints.CENTER, CellConstraints.CENTER));
    commentPanel = new JPanel(new FormLayout("right:pref, fill:d:grow", "40dlu"));
    commentPanel.add(labelPanel, cc.xy(1, 1, CellConstraints.FILL, CellConstraints.FILL));
    comment = new JTextArea();
    comment.setLineWrap(true);
    final JScrollPane scroll = new JScrollPane();
    scroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scroll.setViewportView(comment);

    commentPanel.add(scroll, cc.xyw(2, 1, 1, CellConstraints.FILL, CellConstraints.FILL));
    changesetPanel.add(commentPanel, cc.xy(2, 4));

    btnChangeSetDoNothing = new JRadioButton("Leave the current change list active",
            config.getActiveIssueAfterCommit() == AfterCommit.DO_NOTHING.ordinal());
    btnChangeSetDeactivate = new JRadioButton(
            "Deactivate the currently active change list (activate the default change list)",
            config.getActiveIssueAfterCommit() == AfterCommit.DEACTIVATE_CHANGESET.ordinal());
    btnChangeSetRemove = new JRadioButton(
            "Remove the currently active change list (activate the default change list)",
            config.getActiveIssueAfterCommit() == AfterCommit.REMOVE_CHANGESET.ordinal());

    changeSetButtonGroup = new ButtonGroup();
    changeSetButtonGroup.add(btnChangeSetDoNothing);
    changeSetButtonGroup.add(btnChangeSetDeactivate);
    changeSetButtonGroup.add(btnChangeSetRemove);

    if (changeSetButtonGroup.getSelection() == null) {
        btnChangeSetDoNothing.setSelected(true);
    }

    changesetPanel.add(new JLabel("After Commit:"), cc.xy(2, 6));
    changesetPanel.add(btnChangeSetDoNothing, cc.xy(2, 8));
    changesetPanel.add(btnChangeSetDeactivate, cc.xy(2, 9));
    changesetPanel.add(btnChangeSetRemove, cc.xy(2, 10));

    UIUtil.setEnabled(changesetPanel, chkCommitChanges.isSelected(), true);
    enableChangesetRadioButtons(true);

    return changesetPanel;
}