Example usage for com.jgoodies.forms.layout FormLayout setRowGroups

List of usage examples for com.jgoodies.forms.layout FormLayout setRowGroups

Introduction

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

Prototype

public void setRowGroups(int[][] groupOfIndices) 

Source Link

Document

Sets the row groups, where each row in such a group gets the same group wide height.

Usage

From source file:jgnash.ui.register.invest.AddRemoveSharePanel.java

License:Open Source License

private void layoutMainPanel() {
    FormLayout layout = new FormLayout("right:d, $lcgap, 50dlu:g, 8dlu, right:d, $lcgap, max(65dlu;min)",
            "f:d, $nlgap, f:d, $nlgap, f:d");

    layout.setRowGroups(new int[][] { { 1, 3, 5 } });
    CellConstraints cc = new CellConstraints();

    setLayout(layout);//from w  ww.  java 2  s. co  m

    /* Create a sub panel to work around a column spanning problem in FormLayout */
    JPanel subPanel = buildHorizontalSubPanel("max(48dlu;min):g(0.5), 8dlu, d, $lcgap, max(48dlu;min):g(0.5)",
            ValidationFactory.wrap(priceField), "Label.Quantity", ValidationFactory.wrap(quantityField));

    add("Label.Security", cc.xy(1, 1));
    add(ValidationFactory.wrap(securityCombo), cc.xy(3, 1));
    add("Label.Date", cc.xy(5, 1));
    add(datePanel, cc.xy(7, 1));

    add("Label.Price", cc.xy(1, 3));
    add(subPanel, cc.xy(3, 3));
    add("Label.Total", cc.xy(5, 3));
    add(totalField, cc.xy(7, 3));

    add("Label.Memo", cc.xy(1, 5));
    add(memoField, cc.xy(3, 5));
    add(reconciledButton, cc.xyw(5, 5, 3));
}

From source file:jgnash.ui.register.invest.BuySharePanel.java

License:Open Source License

private void layoutMainPanel() {
    FormLayout layout = new FormLayout("right:d, $lcgap, 50dlu:g, 8dlu, right:d, $lcgap, max(65dlu;min)",
            "f:d, $nlgap, f:d, $nlgap, f:d, $nlgap, f:d");

    layout.setRowGroups(new int[][] { { 1, 3, 5, 7 } });
    CellConstraints cc = new CellConstraints();

    setLayout(layout);/*from  www  . j  ava 2  s .  c  om*/

    /* Create a sub panel to work around a column spanning problem in FormLayout */
    JPanel subPanel = buildHorizontalSubPanel("max(48dlu;min):g(0.5), 8dlu, d, $lcgap, max(48dlu;min):g(0.5)",
            ValidationFactory.wrap(priceField), "Label.Quantity", ValidationFactory.wrap(quantityField));

    add("Label.Security", cc.xy(1, 1));
    add(ValidationFactory.wrap(securityCombo), cc.xy(3, 1));
    add("Label.Date", cc.xy(5, 1));
    add(datePanel, cc.xy(7, 1));

    add("Label.Price", cc.xy(1, 3));
    add(subPanel, cc.xy(3, 3));
    add("Label.Fees", cc.xy(5, 3));
    add(feePanel, cc.xy(7, 3));

    add("Label.Memo", cc.xy(1, 5));
    add(memoField, cc.xy(3, 5));
    add("Label.Total", cc.xy(5, 5));
    add(totalField, cc.xy(7, 5));

    add("Label.Account", cc.xy(1, 7));

    add(accountExchangePanel, cc.xy(3, 7));
    add(reconciledButton, cc.xyw(5, 7, 3));
}

From source file:jgnash.ui.register.invest.DividendPanel.java

License:Open Source License

private void layoutPanel() {
    removeAll();/* www  .j a  va 2 s. c  o m*/

    FormLayout layout = new FormLayout("right:d, $lcgap, 50dlu:g, 8dlu, right:d, $lcgap, max(65dlu;min)",
            "f:d, $nlgap, f:d, $nlgap, f:d, $nlgap, f:d");

    layout.setRowGroups(new int[][] { { 1, 3, 5, 7 } });
    CellConstraints cc = new CellConstraints();

    setLayout(layout);

    add("Label.Security", cc.xy(1, 1));
    add(ValidationFactory.wrap(securityCombo), cc.xy(3, 1));
    add("Label.Date", cc.xy(5, 1));
    add(datePanel, cc.xy(7, 1));

    add("Label.Memo", cc.xy(1, 3));
    add(memoField, cc.xy(3, 3));
    add("Label.Dividend", cc.xy(5, 3));
    add(ValidationFactory.wrap(dividendField), cc.xy(7, 3));

    add("Label.IncomeAccount", cc.xy(1, 5));
    add(incomeExchangePanel, cc.xy(3, 5));
    add(reconciledButton, cc.xyw(5, 5, 3));

    add("Label.Account", cc.xy(1, 7));
    add(accountExchangePanel, cc.xy(3, 7));
}

From source file:jgnash.ui.register.invest.ReinvestDividendPanel.java

License:Open Source License

private void layoutMainPanel() {
    FormLayout layout = new FormLayout("right:d, $lcgap, 50dlu:g, 8dlu, right:d, $lcgap, max(65dlu;min)",
            "f:d, $nlgap, f:d, $nlgap, f:d, $nlgap, f:d");

    layout.setRowGroups(new int[][] { { 1, 3, 5, 7 } });
    CellConstraints cc = new CellConstraints();

    setLayout(layout);/*from   w  w w.  j av  a2 s .  c  o  m*/

    /* Create a sub panel to work around a column spanning problem in FormLayout */
    JPanel subPanel = buildHorizontalSubPanel(
            "max(48dlu;min):g(0.5), 8dlu, d, $lcgap, max(48dlu;min):g(0.5), 8dlu, d, 4dlu, max(48dlu;min)",
            ValidationFactory.wrap(priceField), "Label.Quantity", ValidationFactory.wrap(quantityField),
            "Label.Gains", gainsPanel);

    add("Label.Security", cc.xy(1, 1));
    add(ValidationFactory.wrap(securityCombo), cc.xy(3, 1));
    add("Label.Date", cc.xy(5, 1));
    add(datePanel, cc.xy(7, 1));

    add("Label.Price", cc.xy(1, 3));
    add(subPanel, cc.xy(3, 3));
    add("Label.Fees", cc.xy(5, 3));
    add(feePanel, cc.xy(7, 3));

    add("Label.Memo", cc.xy(1, 5));
    add(memoField, cc.xy(3, 5));
    add("Label.Total", cc.xy(5, 5));
    add(totalField, cc.xy(7, 5));

    add(reconciledButton, cc.xyw(1, 7, 5));
}

From source file:jgnash.ui.register.invest.ReturnOfCapitalPanel.java

License:Open Source License

private void layoutPanel() {
    removeAll();/*from  w  w  w.  j  av a  2 s  .  c o m*/

    FormLayout layout = new FormLayout("right:d, $lcgap, 50dlu:g, 8dlu, right:d, $lcgap, max(65dlu;min)",
            "f:d, $nlgap, f:d, $nlgap, f:d, $nlgap, f:d");

    layout.setRowGroups(new int[][] { { 1, 3, 5, 7 } });
    CellConstraints cc = new CellConstraints();

    setLayout(layout);

    add("Label.Security", cc.xy(1, 1));
    add(ValidationFactory.wrap(securityCombo), cc.xy(3, 1));
    add("Label.Date", cc.xy(5, 1));
    add(datePanel, cc.xy(7, 1));

    add("Label.Memo", cc.xy(1, 3));
    add(memoField, cc.xy(3, 3));
    add("Label.ReturnOfCapital", cc.xy(5, 3));
    add(ValidationFactory.wrap(dividendField), cc.xy(7, 3));

    add("Label.IncomeAccount", cc.xy(1, 5));
    add(incomeExchangePanel, cc.xy(3, 5));
    add(reconciledButton, cc.xyw(5, 5, 3));

    add("Label.Account", cc.xy(1, 7));
    add(accountExchangePanel, cc.xy(3, 7));
}

From source file:jgnash.ui.register.invest.SellSharePanel.java

License:Open Source License

private void layoutMainPanel() {
    FormLayout layout = new FormLayout("right:d, $lcgap, 50dlu:g, 8dlu, right:d, $lcgap, max(65dlu;min)",
            "f:d, $nlgap, f:d, $nlgap, f:d, $nlgap, f:d");

    layout.setRowGroups(new int[][] { { 1, 3, 5, 7 } });
    CellConstraints cc = new CellConstraints();

    setLayout(layout);//from   w w w  .  j av  a2 s.co  m

    /* Create a sub panel to work around a column spanning problem in FormLayout */
    JPanel subPanel = buildHorizontalSubPanel(
            "max(48dlu;min):g(0.5), 8dlu, d, $lcgap, max(48dlu;min):g(0.5), 8dlu, d, 4dlu, max(48dlu;min)",
            ValidationFactory.wrap(priceField), "Label.Quantity", ValidationFactory.wrap(quantityField),
            "Label.Gains", gainsPanel);

    add("Label.Security", cc.xy(1, 1));
    add(ValidationFactory.wrap(securityCombo), cc.xy(3, 1));
    add("Label.Date", cc.xy(5, 1));
    add(datePanel, cc.xy(7, 1));

    add("Label.Price", cc.xy(1, 3));
    add(subPanel, cc.xy(3, 3));
    add("Label.Fees", cc.xy(5, 3));
    add(feePanel, cc.xy(7, 3));

    add("Label.Memo", cc.xy(1, 5));
    add(memoField, cc.xy(3, 5));

    add("Label.Total", cc.xy(5, 5));
    add(totalField, cc.xy(7, 5));

    add(reconciledButton, cc.xyw(5, 7, 3));

    add("Label.Account", cc.xy(1, 7));
    add(accountExchangePanel, cc.xy(3, 7));
}

From source file:jgnash.ui.register.invest.SplitMergeSharePanel.java

License:Open Source License

private void layoutMainPanel() {

    FormLayout layout = new FormLayout("right:d, $lcgap, 50dlu:g, 8dlu, right:d, $lcgap, max(65dlu;min)",
            "f:d, $nlgap, f:d, $nlgap, f:d");

    layout.setRowGroups(new int[][] { { 1, 3, 5 } });
    CellConstraints cc = new CellConstraints();

    setLayout(layout);/*from  www .  j a  v a2 s. co  m*/

    /* Create a sub panel to work around a column spanning problem in FormLayout */
    JPanel subPanel = buildHorizontalSubPanel("max(48dlu;min):g(0.5), 8dlu, d, $lcgap, max(48dlu;min):g(0.5)",
            ValidationFactory.wrap(priceField), "Label.Quantity", ValidationFactory.wrap(quantityField));

    add("Label.Security", cc.xy(1, 1));
    add(ValidationFactory.wrap(securityCombo), cc.xy(3, 1));
    add("Label.Date", cc.xy(5, 1));
    add(datePanel, cc.xy(7, 1));

    add("Label.Price", cc.xy(1, 3));
    add(subPanel, cc.xy(3, 3));
    add("Label.Total", cc.xy(5, 3));
    add(totalField, cc.xy(7, 3));

    add("Label.Memo", cc.xy(1, 5));
    add(memoField, cc.xy(3, 5));
    add(reconciledButton, cc.xyw(5, 5, 3));
}

From source file:jgnash.ui.register.TransactionPanel.java

License:Open Source License

private void layoutMainPanel() {
    FormLayout layout = new FormLayout("right:d, $lcgap, m:g, 8dlu, right:d, $lcgap, max(48dlu;min)",
            "f:d, $nlgap, f:d, $nlgap, f:d, $nlgap, f:d");
    layout.setRowGroups(new int[][] { { 1, 3, 5, 7 } });
    CellConstraints cc = new CellConstraints();

    setLayout(layout);//ww w  .  j av a  2s  .  c  o m
    setBorder(Borders.DIALOG_BORDER);

    JPanel sub = buildHorizontalSubPanel("48dlu:g, $lcgap, d", accountPanel, splitsButton);

    add("Label.Payee", cc.xy(1, 1));
    add(payeeField, cc.xy(3, 1));
    add("Label.Number", cc.xy(5, 1));
    add(numberField, cc.xy(7, 1));

    add("Label.Account", cc.xy(1, 3));
    add(sub, cc.xy(3, 3));
    add("Label.Date", cc.xy(5, 3));
    add(datePanel, cc.xy(7, 3));

    add("Label.Memo", cc.xy(1, 5));
    add(memoField, cc.xy(3, 5));
    add("Label.Amount", cc.xy(5, 5));
    add(ValidationFactory.wrap(amountField), cc.xy(7, 5));

    add(createBottomPanel(), cc.xyw(1, 7, 7));

    clearForm();
}

From source file:jgnash.ui.register.TransferPanel.java

License:Open Source License

private void layoutMainPanel() {
    FormLayout layout = new FormLayout("right:d, $lcgap, 50dlu:g, 8dlu, right:d, $lcgap, max(48dlu;min)",
            "f:d, $nlgap, f:d, $nlgap, f:d, $nlgap, f:d");

    layout.setRowGroups(new int[][] { { 1, 3, 5, 7 } });
    CellConstraints cc = new CellConstraints();

    setLayout(layout);//w  ww.  j  a v a2 s  .  c  o m
    setBorder(Borders.DIALOG_BORDER);

    add("Label.TransferTo", cc.xy(1, 1));
    add(accountPanel, cc.xy(3, 1));
    add("Label.Date", cc.xy(5, 1));
    add(datePanel, cc.xy(7, 1));

    add("Label.Memo", cc.xy(1, 3));
    add(memoField, cc.xy(3, 3));
    add("Label.Amount", cc.xy(5, 3));
    add(ValidationFactory.wrap(amountField), cc.xy(7, 3));

    add(createBottomPanel(), cc.xyw(1, 7, 7));
}

From source file:jgnash.ui.report.compiled.IncomeExpensePieChart.java

License:Open Source License

private JPanel createPanel() {
    EnumSet<AccountType> set = EnumSet.of(AccountType.INCOME, AccountType.EXPENSE);

    JButton refreshButton = new JButton(rb.getString("Button.Refresh"));

    startField = new DatePanel();

    endField = new DatePanel();

    showEmptyCheck = new JCheckBox(rb.getString("Label.ShowEmptyAccounts"));

    showPercentCheck = new JCheckBox(rb.getString("Label.ShowPercentValues"));

    combo = AccountListComboBox// ww  w. java 2s.  c  o m
            .getParentTypeInstance(EngineFactory.getEngine(EngineFactory.DEFAULT).getRootAccount(), set);

    Date dStart = DateUtils.subtractYear(DateUtils.getFirstDayOfTheMonth(new Date()));

    long start = pref.getLong(STARTDATE, dStart.getTime());

    startField.setDate(new Date(start));

    currentAccount = combo.getSelectedAccount();
    JFreeChart chart = createPieChart(currentAccount);
    chartPanel = new ChartPanel(chart, true, true, true, false, true);
    //                         (chart, properties, save, print, zoom, tooltips)

    FormLayout layout = new FormLayout("p, 4dlu, 70dlu, 8dlu, p, 4dlu, 70dlu, 8dlu, p, 4dlu:g, left:p",
            "f:d, 3dlu, f:d, 6dlu, f:p:g");
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    layout.setRowGroups(new int[][] { { 1, 3 } });

    builder.append(combo, 9);
    builder.append(showEmptyCheck);
    builder.nextLine();

    builder.nextLine();

    builder.append(rb.getString("Label.StartDate"), startField);
    builder.append(rb.getString("Label.EndDate"), endField);
    builder.append(refreshButton);

    builder.append(showPercentCheck);
    builder.nextLine();
    builder.nextLine();

    builder.append(chartPanel, 11);

    JPanel panel = builder.getPanel();

    combo.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(final ActionEvent e) {
            setCurrentAccount(combo.getSelectedAccount());
            pref.putLong(STARTDATE, startField.getDate().getTime());
        }
    });

    refreshButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(final ActionEvent e) {
            setCurrentAccount(currentAccount);
            pref.putLong(STARTDATE, startField.getDate().getTime());
        }
    });

    showEmptyCheck.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(final ActionEvent e) {
            setCurrentAccount(currentAccount);
        }
    });

    showPercentCheck.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(final ActionEvent e) {
            ((PiePlot) chartPanel.getChart().getPlot())
                    .setLabelGenerator(showPercentCheck.isSelected() ? percentLabels : defaultLabels);
        }
    });

    ChartMouseListener mouseListener = new ChartMouseListener() {

        @Override
        public void chartMouseClicked(final ChartMouseEvent event) {
            MouseEvent me = event.getTrigger();
            if (me.getID() == MouseEvent.MOUSE_CLICKED && me.getClickCount() == 1) {
                try {
                    ChartEntity entity = event.getEntity();
                    // expand sections if interesting, back out if in nothing
                    if (entity instanceof PieSectionEntity) {
                        Account a = (Account) ((PieSectionEntity) entity).getSectionKey();
                        if (a.getChildCount() > 0) {
                            setCurrentAccount(a);
                        }
                    } else if (entity == null) {
                        Account parent = currentAccount;
                        if (parent == null) {
                            return;
                        }
                        parent = parent.getParent();
                        if (parent == null || parent instanceof RootAccount) {
                            return;
                        }
                        setCurrentAccount(parent);
                    }
                } catch (Exception ex) {
                    System.err.println(ex);
                }
            }
        }

        @Override
        public void chartMouseMoved(ChartMouseEvent event) {
            setChartCursor(chartPanel, event.getEntity(), event.getTrigger().getPoint());
        }
    };

    chartPanel.addChartMouseListener(mouseListener);

    return panel;
}