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

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

Introduction

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

Prototype

public CellConstraints xy(int col, int row) 

Source Link

Document

Sets column and row origins; sets width and height to 1; uses the default alignments.

Examples:

 cc.xy(1, 1); cc.xy(1, 3); 

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 ww w . j a va  2  s. c o  m*/

    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.defaultCredentials.TestDefaultCredentialsDialog.java

License:Apache License

private synchronized void buildServerContent() {
    rootPanel.removeAll();//www  . j av 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.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));
    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);//from  w  w  w.j a  v  a2s .  com

        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//from   w w w  . ja v  a  2 s .c  o m
 */
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//from   ww  w  .j  av  a 2 s  .com
 */
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.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  ww  .j a  v  a 2 s .c  o 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());
            }/*  ww w  .  j  av  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;
}

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 w w . j  a va2s .  c o 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.atlassian.theplugin.idea.ToolWindowConfigPanel.java

License:Apache License

public ToolWindowConfigPanel(final Project project) {
    super(new GridBagLayout());

    JPanel panel = new JPanel(new FormLayout("c:p:g", "p, p, 8dlu, p, p"));

    GridBagConstraints c = new GridBagConstraints();
    c.anchor = GridBagConstraints.CENTER;
    this.add(panel, c);

    CellConstraints cc = new CellConstraints();
    JLabel l1 = new JLabel("No enabled JIRA or Bamboo servers found");
    l1.setFont(l1.getFont().deriveFont(Font.BOLD, 16));
    panel.add(l1, cc.xy(1, 1));
    panel.add(new JLabel("(Fisheye and Crucible servers do not have their own tool windows)"), cc.xy(1, 2));

    HyperlinkLabel projectSettingsLink = new HyperlinkLabel("Configure Plugin Project Settings");
    projectSettingsLink.addHyperlinkListener(new HyperlinkListener() {
        public void hyperlinkUpdate(HyperlinkEvent e) {

            Configurable component = project.getComponent(ProjectConfigurationComponent.class);
            ShowSettingsUtil.getInstance().editConfigurable(project, component);
        }//from  www. j  a  va  2  s.c  om
    });

    projectSettingsLink.setIcon(IconLoader.getIcon("/general/ideOptions.png"));

    panel.add(projectSettingsLink, cc.xy(1, 4));

    HyperlinkLabel globalSettingsLink = new HyperlinkLabel("Configure Plugin IDE Settings");
    globalSettingsLink.addHyperlinkListener(new HyperlinkListener() {
        public void hyperlinkUpdate(final HyperlinkEvent e) {
            ShowSettingsUtil.getInstance().editConfigurable(
                    IdeaHelper.getCurrentProject(
                            DataManager.getInstance().getDataContext(ToolWindowConfigPanel.this)),
                    IdeaHelper.getAppComponent());
        }
    });

    globalSettingsLink.setIcon(IconLoader.getIcon("/general/ideOptions.png"));

    panel.add(globalSettingsLink, cc.xy(1, 5));
}

From source file:com.atlassian.theplugin.idea.ui.ScrollableTwoColumnPanel.java

License:Apache License

public void updateContent(@Nullable Collection<Entry> entries) {
    panel.removeAll();/*from   w w w.j  av  a2 s. c om*/
    if (entries == null || entries.size() == 0) {
        panel.setLayout(new BorderLayout());
        final JLabel label = new JLabel("No Custom Filter Defined", JLabel.CENTER);
        panel.setPreferredSize(label.getPreferredSize());
        panel.add(label);
        return;
    }

    FormLayout layout = new FormLayout("4dlu, right:p, 4dlu, left:d, 4dlu");
    PanelBuilder builder = new PanelBuilder(layout, panel);

    int row = 1;
    CellConstraints cc = new CellConstraints();
    for (Entry entry : entries) {
        builder.appendRow("2dlu");
        builder.appendRow("p");
        cc.xy(2, row * 2).vAlign = CellConstraints.TOP;
        builder.addLabel(entry.getLabel() + ":", cc);
        cc.xy(VAL_COL, row * 2).vAlign = CellConstraints.TOP;
        if (entry.isError()) {
            builder.addLabel("<html>" + "<font color=\"red\">" + entry.getValue(), cc);
        } else {
            builder.addLabel("<html>" + entry.getValue(), cc);
        }
        row++;
    }
    // this lines (simulating JScrollPane resize)
    // are needed to more or less workaround the problem of revalidating whole scrollpane when more or fewer
    // rows could have been added. Without them you may end up with JScrollPane not completely showing its viewport
    panel.setPreferredSize(null);
    panel.setPreferredSize(new Dimension(getWidth(), panel.getPreferredSize().height));
    panel.validate();
    // it was needed here as sometimes panel was left with some old rubbish
    panel.repaint();
}