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.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);/*from ww w  . j a  va 2s . com*/
    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));//from  w w w .  j  a  v a2 s  . c om
    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);
        }
    });

    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  a v a2s. c  o  m*/
    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();
}

From source file:com.audiveris.installer.BasicCompanionView.java

License:Open Source License

private JPanel defineLayout() {
    // Prepare layout elements
    final boolean optional = companion.getNeed() != Need.MANDATORY;
    final CellConstraints cst = new CellConstraints();
    final String colSpec = optional ? "pref,1dlu,center:pref" : "center:pref";
    final FormLayout layout = new FormLayout(colSpec, "center:20dlu");
    final JPanel panel = new MyPanel();
    final PanelBuilder builder = new PanelBuilder(layout, panel);

    // Now add the desired components, using provided order
    if (optional) {
        builder.add(needBox, cst.xy(1, 1));
        builder.add(titleLabel, cst.xy(3, 1));
    } else {/*from   w w  w  .  jav  a2  s  .c o m*/
        builder.add(titleLabel, cst.xy(1, 1));
    }

    panel.setPreferredSize(new Dimension(width, HEIGHT));
    panel.setOpaque(true);

    return panel;
}

From source file:com.audiveris.installer.BundleView.java

License:Open Source License

/**
 * Build the sub-panel that displays the sequence of companions.
 *
 * @return the companion panel//from  ww  w. ja  v  a 2  s . c  om
 */
private JPanel buildCompPanel() {
    // Prepare layout elements
    final String hGap = "$lcgap";
    final StringBuilder sbcol = new StringBuilder();

    for (Companion companion : bundle.getCompanions()) {
        sbcol.append("pref,").append(hGap).append(",");
    }

    final CellConstraints cst = new CellConstraints();
    final FormLayout layout = new FormLayout(sbcol.toString(), "pref");
    final JPanel panel = new JPanel();
    final PanelBuilder builder = new PanelBuilder(layout, panel);

    // Now add the desired components, using provided order
    int col = 1;

    for (Companion companion : bundle.getCompanions()) {
        CompanionView view = companion.getView();
        builder.add(view.getComponent(), cst.xy(col, 1));
        col += 2;
    }

    return panel;
}

From source file:com.audiveris.installer.BundleView.java

License:Open Source License

/**
 * Build the top panel that displays the sequence of companions,
 * the language selector and the install folder selector.
 *
 * @return the top panel/*from  w w  w.ja  v  a 2  s  . com*/
 */
private JPanel buildNorthPanel() {
    // Prepare layout elements
    final FormLayout layout = new FormLayout("$lcgap, fill:0:grow, $lcgap", "$rgap, pref, $rgap, pref, $rgap");
    final JPanel panel = new JPanel();
    final PanelBuilder builder = new PanelBuilder(layout, panel);
    final CellConstraints cst = new CellConstraints();

    int iRow = 0;

    // FolderSelector is currently disabled
    //        iRow +=2;
    //        // Add the folder selector
    //        FolderSelector dirSelector = new FolderSelector(bundle);
    //        builder.add(dirSelector.getComponent(), cst.xy(2, iRow));

    // Add the languages component
    iRow += 2;

    LangSelector langSelector = bundle.getOcrCompanion().getSelector();
    builder.add(langSelector.getComponent(), cst.xy(2, iRow));

    // Add the companions component
    iRow += 2;
    builder.add(buildCompPanel(), cst.xy(2, iRow));

    return panel;
}

From source file:com.audiveris.installer.FolderSelector.java

License:Open Source License

private JComponent defineLayout() {
    final JPanel comp = new JPanel();
    final FormLayout layout = new FormLayout("right:36dlu, $lcgap, fill:0:grow, $lcgap, 31dlu", "pref");
    final CellConstraints cst = new CellConstraints();
    final PanelBuilder builder = new PanelBuilder(layout, comp);

    // Label on left side
    builder.addROLabel("Folder", cst.xy(1, 1));

    // Path to folder
    builder.add(path, cst.xy(3, 1));/*from  www  . j a va2s.co m*/

    // "Select" button on left side
    builder.add(new JButton(new BrowseAction()), cst.xy(5, 1));

    return comp;
}

From source file:com.audiveris.installer.LangSelector.java

License:Open Source License

private JPanel defineLayout() {
    final JPanel comp = new JPanel();
    final FormLayout layout = new FormLayout("right:40dlu, $lcgap, fill:0:grow, $lcgap, 33dlu", "pref");
    final CellConstraints cst = new CellConstraints();
    final PanelBuilder builder = new PanelBuilder(layout, comp);

    // Label on left side
    builder.addROLabel("Languages", cst.xy(1, 1));

    // "Banner" for the center of the line
    banner = new Banner();
    builder.add(banner.getComponent(), cst.xy(3, 1));

    // "Add" button on right side
    JButton button = new JButton(new AddAction());
    builder.add(button, cst.xy(5, 1));//from w  w  w .  j  a v a 2  s  .  c  o m

    return comp;
}

From source file:com.aw.swing.mvp.cmp.pick.FrmPick.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.ja v a 2  s. c om
 */
private void $$$setupUI$$$() {
    createUIComponents();
    pnlMain = new JPanel();
    pnlMain.setLayout(new FormLayout(
            "left:25dlu:noGrow,fill:52dlu:noGrow,left:8dlu:noGrow,fill:85dlu:noGrow,left:58dlu:noGrow,fill:10px:noGrow,fill:50dlu:noGrow,left:22dlu:noGrow",
            "center:12dlu:noGrow,top:4dlu:noGrow,center:12dlu:noGrow,top:5dlu:noGrow,center:18px:noGrow,top:4dlu:noGrow,top:12dlu:noGrow,center:188dlu:noGrow,top:4dlu:noGrow,top:12dlu:noGrow,center:max(d;4dlu):noGrow,center:12dlu:noGrow"));
    pnlMain.setMinimumSize(new Dimension(501, 425));
    pnlMain.setOpaque(true);
    pnlMain.setPreferredSize(new Dimension(501, 425));
    lblSearch = new JLabel();
    lblSearch.setText("Descripcin");
    lblSearch.setDisplayedMnemonic('D');
    lblSearch.setDisplayedMnemonicIndex(0);
    CellConstraints cc = new CellConstraints();
    pnlMain.add(lblSearch, cc.xy(2, 3, CellConstraints.RIGHT, CellConstraints.DEFAULT));
    btnSearch = new JButton();
    btnSearch.setText("Buscar");
    btnSearch.setMnemonic('B');
    btnSearch.setDisplayedMnemonicIndex(0);
    pnlMain.add(btnSearch, cc.xy(7, 3));
    footerPanel.setLayout(
            new FormLayout("fill:73dlu:noGrow,left:191dlu:noGrow,fill:48dlu:noGrow", "center:12dlu:noGrow"));
    pnlMain.add(footerPanel, cc.xyw(1, 12, 8, CellConstraints.DEFAULT, CellConstraints.FILL));
    lblF10 = new JLabel();
    lblF10.setText(" [F10] Aceptar");
    footerPanel.add(lblF10, cc.xy(1, 1, CellConstraints.LEFT, CellConstraints.DEFAULT));
    lblEsc = new JLabel();
    lblEsc.setText(" [Esc] Salir");
    footerPanel.add(lblEsc, cc.xy(3, 1));
    sepCriterioBusqueda.setSeparatorTitle("Criterio de Bsqueda");
    pnlMain.add(sepCriterioBusqueda, cc.xyw(1, 1, 8, CellConstraints.FILL, CellConstraints.FILL));
    pnlTitGrid.setLayout(
            new FormLayout("fill:204dlu:noGrow,left:88dlu:noGrow,fill:15dlu:noGrow", "center:12dlu:noGrow"));
    pnlMain.add(pnlTitGrid, cc.xyw(1, 7, 8, CellConstraints.FILL, CellConstraints.FILL));
    lblTitGrid = new JLabel();
    lblTitGrid.setText(" Relacin :");
    lblTitGrid.setDisplayedMnemonic('R');
    lblTitGrid.setDisplayedMnemonicIndex(1);
    pnlTitGrid.add(lblTitGrid, cc.xy(1, 1, CellConstraints.LEFT, CellConstraints.DEFAULT));
    chkSel = new JCheckBox();
    chkSel.setBackground(new Color(-16747105));
    chkSel.setText("");
    pnlTitGrid.add(chkSel, cc.xy(3, 1));
    final JScrollPane scrollPane1 = new JScrollPane();
    scrollPane1.setMinimumSize(new Dimension(454, 418));
    pnlMain.add(scrollPane1, cc.xyw(1, 8, 8, CellConstraints.FILL, CellConstraints.FILL));
    tblGrid = new JTable();
    tblGrid.setMinimumSize(new Dimension(450, 400));
    scrollPane1.setViewportView(tblGrid);
    final JLabel label1 = new JLabel();
    label1.setText(" Nmero de Registros:");
    pnlMain.add(label1, cc.xyw(1, 10, 3));
    lblNumRegistros = new JLabel();
    lblNumRegistros.setText("Label");
    pnlMain.add(lblNumRegistros, cc.xyw(4, 10, 3));
    txtSearch = new JTextField();
    pnlMain.add(txtSearch, cc.xyw(4, 3, 2, CellConstraints.FILL, CellConstraints.DEFAULT));
    lblSearch2 = new JLabel();
    lblSearch2.setText("Descripcin2");
    lblSearch2.setDisplayedMnemonic('D');
    lblSearch2.setDisplayedMnemonicIndex(0);
    pnlMain.add(lblSearch2, cc.xy(2, 5, CellConstraints.RIGHT, CellConstraints.DEFAULT));
    cmbAlmacen = new JComboBox();
    pnlMain.add(cmbAlmacen, cc.xy(4, 5));
    lblSearch.setLabelFor(txtSearch);
    lblSearch2.setLabelFor(txtSearch);
}

From source file:com.aw.swing.mvp.cmp.pick.FrmPickDocVenta.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 a  v  a 2 s .  c  o  m*/
 */
private void $$$setupUI$$$() {
    createUIComponents();
    pnlMain = new JPanel();
    pnlMain.setLayout(new FormLayout(
            "left:25dlu:noGrow,fill:52dlu:noGrow,left:8dlu:noGrow,fill:56dlu:noGrow,left:4dlu:noGrow,fill:36px:noGrow,fill:max(d;4px):noGrow,left:57dlu:noGrow,fill:10px:noGrow,fill:54dlu:noGrow,left:16dlu:noGrow",
            "center:12dlu:noGrow,top:4dlu:noGrow,center:12dlu:noGrow,top:6dlu:noGrow,top:12dlu:noGrow,top:4dlu:noGrow,center:12dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,top:12dlu:noGrow,center:146dlu:noGrow,top:4dlu:noGrow,top:12dlu:noGrow,center:max(d;4dlu):noGrow,center:12dlu:noGrow"));
    pnlMain.setMinimumSize(new Dimension(501, 425));
    pnlMain.setOpaque(true);
    pnlMain.setPreferredSize(new Dimension(501, 425));
    lblSearch = new JLabel();
    lblSearch.setHorizontalAlignment(4);
    lblSearch.setText("Descripcin");
    lblSearch.setDisplayedMnemonic('D');
    lblSearch.setDisplayedMnemonicIndex(0);
    CellConstraints cc = new CellConstraints();
    pnlMain.add(lblSearch, cc.xyw(1, 3, 2, CellConstraints.FILL, CellConstraints.DEFAULT));
    btnSearch = new JButton();
    btnSearch.setText("Buscar");
    btnSearch.setMnemonic('B');
    btnSearch.setDisplayedMnemonicIndex(0);
    pnlMain.add(btnSearch, cc.xy(10, 3));
    footerPanel.setLayout(
            new FormLayout("fill:73dlu:noGrow,left:191dlu:noGrow,fill:48dlu:noGrow", "center:12dlu:noGrow"));
    pnlMain.add(footerPanel, cc.xyw(1, 15, 11, CellConstraints.DEFAULT, CellConstraints.FILL));
    lblF10 = new JLabel();
    lblF10.setText(" [F10] Aceptar");
    footerPanel.add(lblF10, cc.xy(1, 1, CellConstraints.LEFT, CellConstraints.DEFAULT));
    lblEsc = new JLabel();
    lblEsc.setText(" [Esc] Salir");
    footerPanel.add(lblEsc, cc.xy(3, 1));
    sepCriterioBusqueda.setSeparatorTitle("Criterio de Bsqueda");
    pnlMain.add(sepCriterioBusqueda, cc.xyw(1, 1, 11, CellConstraints.FILL, CellConstraints.FILL));
    pnlTitGrid.setLayout(
            new FormLayout("fill:204dlu:noGrow,left:88dlu:noGrow,fill:15dlu:noGrow", "center:12dlu:noGrow"));
    pnlMain.add(pnlTitGrid, cc.xyw(1, 10, 11, CellConstraints.FILL, CellConstraints.FILL));
    lblTitGrid = new JLabel();
    lblTitGrid.setText(" Relacin :");
    lblTitGrid.setDisplayedMnemonic('R');
    lblTitGrid.setDisplayedMnemonicIndex(1);
    pnlTitGrid.add(lblTitGrid, cc.xy(1, 1, CellConstraints.LEFT, CellConstraints.DEFAULT));
    chkSel = new JCheckBox();
    chkSel.setBackground(new Color(-16747105));
    chkSel.setText("");
    pnlTitGrid.add(chkSel, cc.xy(3, 1));
    final JScrollPane scrollPane1 = new JScrollPane();
    scrollPane1.setMinimumSize(new Dimension(454, 418));
    pnlMain.add(scrollPane1, cc.xyw(1, 11, 11, CellConstraints.FILL, CellConstraints.FILL));
    tblGrid = new JTable();
    tblGrid.setMinimumSize(new Dimension(450, 400));
    scrollPane1.setViewportView(tblGrid);
    final JLabel label1 = new JLabel();
    label1.setText(" Nmero de Registros:");
    pnlMain.add(label1, cc.xyw(1, 13, 3));
    lblNumRegistros = new JLabel();
    lblNumRegistros.setText("Label");
    pnlMain.add(lblNumRegistros, cc.xyw(4, 13, 6));
    txtSearch = new JTextField();
    pnlMain.add(txtSearch, cc.xyw(4, 3, 5, CellConstraints.FILL, CellConstraints.DEFAULT));
    lblFecIni = new JLabel();
    lblFecIni.setText("Fecha del");
    pnlMain.add(lblFecIni, cc.xy(2, 5, CellConstraints.RIGHT, CellConstraints.CENTER));
    lblFecFin = new JLabel();
    lblFecFin.setText("al");
    pnlMain.add(lblFecFin, cc.xy(6, 5, CellConstraints.RIGHT, CellConstraints.CENTER));
    txtFecIni = new JTextField();
    pnlMain.add(txtFecIni, cc.xy(4, 5, CellConstraints.FILL, CellConstraints.DEFAULT));
    txtFecFin = new JTextField();
    pnlMain.add(txtFecFin, cc.xy(8, 5, CellConstraints.FILL, CellConstraints.DEFAULT));
    lblEntInm = new JLabel();
    lblEntInm.setHorizontalAlignment(4);
    lblEntInm.setText("Entrega Inmediata");
    pnlMain.add(lblEntInm, cc.xyw(1, 7, 2, CellConstraints.FILL, CellConstraints.CENTER));
    cmbEntInm = new JComboBox();
    pnlMain.add(cmbEntInm, cc.xy(4, 7));
    lblSearch.setLabelFor(txtSearch);
    lblFecIni.setLabelFor(txtSearch);
    lblFecFin.setLabelFor(txtSearch);
    lblEntInm.setLabelFor(txtSearch);
}