Example usage for com.jgoodies.forms.builder DefaultFormBuilder append

List of usage examples for com.jgoodies.forms.builder DefaultFormBuilder append

Introduction

In this page you can find the example usage for com.jgoodies.forms.builder DefaultFormBuilder append.

Prototype

public JLabel append(String textWithMnemonic, Component component) 

Source Link

Document

Adds a text label and component to the panel.

Usage

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

License:Open Source License

private void layoutPanel() {
    FormLayout layout = new FormLayout("55dlu:g, 1px, min", "f:p");
    DefaultFormBuilder builder = new DefaultFormBuilder(layout, this);
    builder.append(gainsField, gainsButton);
}

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

License:Open Source License

private JPanel layoutPanel() {
    final FormLayout layout = new FormLayout("75dlu:g, 8dlu, p", "f:p:g(1.0)");

    final DefaultFormBuilder builder = new DefaultFormBuilder(layout);

    final JScrollPane scrollPane = new JScrollPane(list);

    builder.append(scrollPane, layoutButtonPanel());
    builder.nextLine();/*from w  w w .  j a v a2  s.  c  o m*/
    builder.appendRelatedComponentsGapRow();
    builder.nextLine();
    builder.append(entryField, insertButton);
    return builder.getPanel();
}

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

License:Open Source License

/**
 * Creates a report control panel. May return null if a panel is not used
 *
 * @return control panel/*from  w w w . j av a  2  s .  co m*/
 */
@Override
public JPanel getReportController() {
    FormLayout layout = new FormLayout(
            "p, 4dlu, max(p;45dlu), 8dlu, p, 4dlu, max(p;45dlu), 8dlu, p, 4dlu, p, 8dlu, p, p", "");

    DefaultFormBuilder builder = new DefaultFormBuilder(layout);

    builder.setDefaultDialogBorder();
    builder.append(rb.getString("Label.StartDate"), startDateField);
    builder.append(rb.getString("Label.EndDate"), endDateField);
    builder.append(rb.getString("Label.Resolution"), resolutionList);
    builder.append(refreshButton);
    builder.nextLine();
    builder.append(rb.getString("Label.SortOrder"), sortOrderList);
    builder.append(showLongNamesCheckBox, 4);
    builder.append(hideZeroBalanceAccounts, 4);

    return builder.getPanel();
}

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

License:Open Source License

/**
 * Creates a report control panel.  May return null if a panel is not used
 *
 * @return control panel/* ww  w.  j  a va2  s. c  o m*/
 */
@Override
public JPanel getReportController() {
    FormLayout layout = new FormLayout("p, $lcgap, max(p;55dlu), 8dlu, p, $lcgap, max(p;55dlu), 8dlu, p", "");

    DefaultFormBuilder builder = new DefaultFormBuilder(layout);

    builder.setDefaultDialogBorder();
    builder.append(rb.getString("Label.StartDate"), startDateField);
    builder.append(rb.getString("Label.EndDate"), endDateField);

    builder.append(refreshButton);

    builder.nextLine();
    builder.append(hideZeroBalanceAccounts, 9);

    return builder.getPanel();
}

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

License:Open Source License

/**
 * Creates a report control panel.  May return null if a panel is not used
 * The ReportController is responsible for dynamic report options with the exception
 * of page format options//from   w  w  w .  j  a va  2 s.  com
 *
 * @return control panel
 */
@Override
public JPanel getReportController() {
    FormLayout layout = new FormLayout("p, $lcgap, p:g, 8dlu, p, 8dlu, p", "f:d, $lgap, f:d");
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);

    builder.setDefaultDialogBorder();
    builder.append(rb.getString("Label.Account"), accountCombo);
    builder.append(refreshButton, 3);
    builder.nextLine();
    builder.nextLine();
    builder.append(createDatePanel(), 5);
    builder.append(detailSplitsCheckBox);
    builder.nextLine();
    builder.append(createFilterPanel(), 3);
    layout.addGroupedRow(1);
    layout.addGroupedRow(3);
    layout.addGroupedRow(5);

    return builder.getPanel();
}

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

License:Open Source License

private JPanel createDatePanel() {
    FormLayout layout = new FormLayout("p, $lcgap, max(48dlu;min), 8dlu, p, $lcgap, max(48dlu;min)", "");
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);

    builder.append(rb.getString("Label.StartDate"), startDateField);
    builder.append(rb.getString("Label.EndDate"), endDateField);

    return builder.getPanel();
}

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

License:Open Source License

private JPanel createFilterPanel() {
    FormLayout layout = new FormLayout("p, $lcgap, p:g", "");
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);

    builder.append(filterCheckBox, txtFilter);

    return builder.getPanel();
}

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/*from  www. j  a va2s  .co 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;
}

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

License:Open Source License

private Date[] getDates() {

    Date[] dates;//from ww  w.j av  a2 s.  c  o  m

    DatePanel startField = new DatePanel();
    DatePanel endField = new DatePanel();

    ButtonGroup group = new ButtonGroup();
    JRadioButton vert = new JRadioButton(rb.getString("Button.Vertical"));
    JRadioButton horiz = new JRadioButton(rb.getString("Button.Horizontal"));

    group.add(vert);
    group.add(horiz);
    vert.setSelected(true);

    FormLayout layout = new FormLayout("right:p, 4dlu, p:g", "");
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.setRowGroupingEnabled(true);

    builder.append(rb.getString("Label.StartDate"), startField);
    builder.append(rb.getString("Label.EndDate"), endField);
    builder.append(rb.getString("Label.Layout"), vert);
    builder.append("", horiz);
    builder.nextLine();
    builder.appendUnrelatedComponentsGapRow();
    builder.nextLine();

    JPanel panel = builder.getPanel();

    int option = JOptionPane.showConfirmDialog(null, new Object[] { panel },
            rb.getString("Message.StartEndDate"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);

    if (option == JOptionPane.OK_OPTION) {
        dates = getLastDays(startField.getDate(), endField.getDate());
    } else {
        dates = null;
    }

    vertical = vert.isSelected();

    return dates;

}

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

License:Open Source License

private JPanel createPanel() {
    Date end = DateUtils.getLastDayOfTheMonth(endDateField.getDate());
    Date start = DateUtils.subtractYear(end);
    startDateField.setDate(start);//from  w  w  w .j av a 2 s  . co m

    JButton refreshButton = new JButton(rb.getString("Button.Refresh"));
    refreshButton.setIcon(Resource.getIcon("/jgnash/resource/view-refresh.png"));

    subAccountCheckBox = new JCheckBox(rb.getString("Button.IncludeSubAccounts"));
    subAccountCheckBox.setSelected(true);

    hideLockedAccountCheckBox = new JCheckBox(rb.getString("Button.HideLockedAccount"));
    hidePlaceholderAccountCheckBox = new JCheckBox(rb.getString("Button.HidePlaceholderAccount"));

    Account a = combo.getSelectedAccount();
    JFreeChart chart = createVerticalXYBarChart(a);
    final ChartPanel chartPanel = new ChartPanel(chart);

    FormLayout layout = new FormLayout("p, 4dlu, p:g", "");
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);

    FormLayout dLayout = new FormLayout("p, 4dlu, p, 8dlu, p, 4dlu, p, 8dlu, p", "");
    DefaultFormBuilder dBuilder = new DefaultFormBuilder(dLayout);

    dBuilder.append(rb.getString("Label.StartDate"), startDateField);
    dBuilder.append(rb.getString("Label.EndDate"), endDateField);
    dBuilder.append(refreshButton);

    FormLayout cbLayout = new FormLayout("p, 4dlu, p, 4dlu, p, 4dlu", "");
    DefaultFormBuilder cbBuilder = new DefaultFormBuilder(cbLayout);

    cbBuilder.append(subAccountCheckBox);
    cbBuilder.append(hideLockedAccountCheckBox);
    cbBuilder.append(hidePlaceholderAccountCheckBox);

    builder.append(rb.getString("Label.Account"), combo);
    builder.nextLine();
    builder.append(" ");
    builder.append(cbBuilder.getPanel());
    builder.nextLine();
    builder.appendRelatedComponentsGapRow();
    builder.nextLine();
    builder.append(dBuilder.getPanel(), 3);
    builder.nextLine();
    builder.appendUnrelatedComponentsGapRow();
    builder.nextLine();

    builder.appendRow(RowSpec.decode("fill:p:g"));
    builder.append(chartPanel, 3);

    final JPanel panel = builder.getPanel();

    ActionListener listener = new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            try {
                Account account = combo.getSelectedAccount();
                if (account == null) {
                    return;
                }

                updateSubAccountBox();

                chartPanel.setChart(createVerticalXYBarChart(account));
                panel.validate();
            } catch (Exception ex) {
                System.out.println(ex);
            }
        }
    };

    combo.addActionListener(listener);

    hideLockedAccountCheckBox.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(final ActionEvent e) {
            combo.setHideLocked(hideLockedAccountCheckBox.isSelected());
            try {
                Account account = combo.getSelectedAccount();
                if (account == null) {
                    return;
                }

                updateSubAccountBox();

                chartPanel.setChart(createVerticalXYBarChart(account));
                panel.validate();
            } catch (Exception ex) {
                System.out.println(ex);
            }
        }
    });

    hidePlaceholderAccountCheckBox.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(final ActionEvent e) {
            combo.setHidePlaceholder(hidePlaceholderAccountCheckBox.isSelected());
            try {
                Account account = combo.getSelectedAccount();
                if (account == null) {
                    return;
                }

                updateSubAccountBox();

                chartPanel.setChart(createVerticalXYBarChart(account));
                panel.validate();
            } catch (Exception ex) {
                System.out.println(ex);
            }
        }
    });
    refreshButton.addActionListener(listener);

    updateSubAccountBox();

    return panel;
}