Search in sources :

Example 51 with FormLayout

use of com.jgoodies.forms.layout.FormLayout in project jgnash by ccavanaugh.

the class AccountExchangePanel method layoutRatePanel.

private JPanel layoutRatePanel() {
    ResourceBundle rb = ResourceUtils.getBundle();
    CellConstraints cc = new CellConstraints();
    FormLayout layout = new FormLayout("d, 6dlu, right:d, $lcgap, max(48dlu;min)", "f:d");
    JPanel panel = new JPanel(layout);
    panel.setBorder(Borders.DLU2);
    panel.add(conversionLabel, cc.xy(1, 1));
    panel.add(new JLabel(rb.getString("Label.ExchangeRate")), cc.xy(3, 1));
    panel.add(exchangeRateField, cc.xy(5, 1));
    return panel;
}
Also used : FormLayout(com.jgoodies.forms.layout.FormLayout) JPanel(javax.swing.JPanel) JLabel(javax.swing.JLabel) ResourceBundle(java.util.ResourceBundle) CellConstraints(com.jgoodies.forms.layout.CellConstraints)

Example 52 with FormLayout

use of com.jgoodies.forms.layout.FormLayout in project jgnash by ccavanaugh.

the class AdjustmentPanel method layoutMainPanel.

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);
    setBorder(Borders.DIALOG);
    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.Memo", cc.xy(1, 3));
    add(memoField, cc.xy(3, 3));
    add("Label.Date", cc.xy(5, 3));
    add(datePanel, cc.xy(7, 3));
    add(getReconcileCheckBox(), cc.xywh(1, 5, 3, 1));
    add("Label.Amount", cc.xy(5, 5));
    add(ValidationFactory.wrap(amountField), cc.xy(7, 5));
    add(StaticUIMethods.buildHelpBar(convertButton, enterButton, cancelButton), cc.xywh(1, 7, 7, 1));
}
Also used : FormLayout(com.jgoodies.forms.layout.FormLayout) CellConstraints(com.jgoodies.forms.layout.CellConstraints)

Example 53 with FormLayout

use of com.jgoodies.forms.layout.FormLayout in project jgnash by ccavanaugh.

the class AbstractTransactionEntryPanel method layoutMainPanel.

private void layoutMainPanel() {
    init();
    FormLayout layout = new FormLayout("d, 4dlu, d:g, 8dlu, d, 4dlu, 45dlu", "f:d, $nlgap, f:d, $nlgap, f:d");
    layout.setRowGroups(new int[][] { { 1, 3, 5 } });
    CellConstraints cc = new CellConstraints();
    setLayout(layout);
    setBorder(Borders.DIALOG);
    add("Label.Account", cc.xy(1, 1));
    add(accountPanel, cc.xy(3, 1));
    add("Label.Amount", cc.xy(5, 1));
    add(amountField, cc.xy(7, 1));
    add("Label.Memo", cc.xy(1, 3));
    add(memoField, cc.xywh(3, 3, 5, 1));
    add(createBottomPanel(), cc.xywh(1, 5, 7, 1));
    clearForm();
}
Also used : FormLayout(com.jgoodies.forms.layout.FormLayout) CellConstraints(com.jgoodies.forms.layout.CellConstraints)

Example 54 with FormLayout

use of com.jgoodies.forms.layout.FormLayout in project jgnash by ccavanaugh.

the class MonthlyAccountBalanceChart method createPanel.

private JPanel createPanel() {
    LocalDate end = DateUtils.getLastDayOfTheMonth(endDateField.getLocalDate());
    LocalDate start = end.minusYears(1);
    startDateField.setDate(start);
    JButton refreshButton = new JButton(rb.getString("Button.Refresh"));
    refreshButton.setIcon(IconUtils.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 = e -> {
        try {
            Account account = combo.getSelectedAccount();
            if (account == null) {
                return;
            }
            updateSubAccountBox();
            chartPanel.setChart(createVerticalXYBarChart(account));
            panel.validate();
        } catch (final Exception ex) {
            Logger.getLogger(MonthlyAccountBalanceChart.class.getName()).log(Level.SEVERE, ex.getLocalizedMessage(), ex);
        }
    };
    combo.addActionListener(listener);
    hideLockedAccountCheckBox.addActionListener(e -> {
        combo.setHideLocked(hideLockedAccountCheckBox.isSelected());
        try {
            Account account = combo.getSelectedAccount();
            if (account == null) {
                return;
            }
            updateSubAccountBox();
            chartPanel.setChart(createVerticalXYBarChart(account));
            panel.validate();
        } catch (final Exception ex) {
            Logger.getLogger(MonthlyAccountBalanceChart.class.getName()).log(Level.SEVERE, ex.getLocalizedMessage(), ex);
        }
    });
    hidePlaceholderAccountCheckBox.addActionListener(e -> {
        combo.setHidePlaceholder(hidePlaceholderAccountCheckBox.isSelected());
        try {
            Account account = combo.getSelectedAccount();
            if (account == null) {
                return;
            }
            updateSubAccountBox();
            chartPanel.setChart(createVerticalXYBarChart(account));
            panel.validate();
        } catch (final Exception ex) {
            Logger.getLogger(MonthlyAccountBalanceChart.class.getName()).log(Level.SEVERE, ex.getLocalizedMessage(), ex);
        }
    });
    refreshButton.addActionListener(listener);
    updateSubAccountBox();
    return panel;
}
Also used : FormLayout(com.jgoodies.forms.layout.FormLayout) ActionListener(java.awt.event.ActionListener) AccountBalanceDisplayManager(jgnash.ui.register.AccountBalanceDisplayManager) TimeSeriesCollection(org.jfree.data.time.TimeSeriesCollection) Date(java.util.Date) DefaultFormBuilder(com.jgoodies.forms.builder.DefaultFormBuilder) IconUtils(jgnash.ui.util.IconUtils) ResourceUtils(jgnash.util.ResourceUtils) SimpleDateFormat(java.text.SimpleDateFormat) NumberAxis(org.jfree.chart.axis.NumberAxis) NumberFormat(java.text.NumberFormat) Level(java.util.logging.Level) BigDecimal(java.math.BigDecimal) TimeSeries(org.jfree.data.time.TimeSeries) ResourceBundle(java.util.ResourceBundle) JFreeChart(org.jfree.chart.JFreeChart) AccountType(jgnash.engine.AccountType) DateTickMarkPosition(org.jfree.chart.axis.DateTickMarkPosition) XYBarRenderer(org.jfree.chart.renderer.xy.XYBarRenderer) DateFormat(java.text.DateFormat) CurrencyNode(jgnash.engine.CurrencyNode) EventQueue(java.awt.EventQueue) FilteredAccountListComboBox(jgnash.ui.components.FilteredAccountListComboBox) DateUtils(jgnash.time.DateUtils) DateTickUnit(org.jfree.chart.axis.DateTickUnit) JButton(javax.swing.JButton) Comparators(jgnash.engine.Comparators) RowSpec(com.jgoodies.forms.layout.RowSpec) XYPlot(org.jfree.chart.plot.XYPlot) Logger(java.util.logging.Logger) GenericCloseDialog(jgnash.ui.components.GenericCloseDialog) List(java.util.List) DateAxis(org.jfree.chart.axis.DateAxis) DatePanel(jgnash.ui.components.DatePanel) FormLayout(com.jgoodies.forms.layout.FormLayout) LocalDate(java.time.LocalDate) JCheckBox(javax.swing.JCheckBox) Account(jgnash.engine.Account) TemporalAdjusters(java.time.temporal.TemporalAdjusters) ChartPanel(org.jfree.chart.ChartPanel) Collections(java.util.Collections) StandardXYToolTipGenerator(org.jfree.chart.labels.StandardXYToolTipGenerator) Month(org.jfree.data.time.Month) JPanel(javax.swing.JPanel) DateTickUnitType(org.jfree.chart.axis.DateTickUnitType) Account(jgnash.engine.Account) JPanel(javax.swing.JPanel) ChartPanel(org.jfree.chart.ChartPanel) JButton(javax.swing.JButton) LocalDate(java.time.LocalDate) JFreeChart(org.jfree.chart.JFreeChart) JCheckBox(javax.swing.JCheckBox) ActionListener(java.awt.event.ActionListener) DefaultFormBuilder(com.jgoodies.forms.builder.DefaultFormBuilder)

Example 55 with FormLayout

use of com.jgoodies.forms.layout.FormLayout in project jgnash by ccavanaugh.

the class MonthlyAccountBalanceChartCompare method createPanel.

private JPanel createPanel() {
    LocalDate end = DateUtils.getLastDayOfTheMonth(endDateField.getLocalDate());
    LocalDate start = end.minusYears(1);
    startDateField.setDate(start);
    JButton refreshButton = new JButton(rb.getString("Button.Refresh"));
    refreshButton.setIcon(IconUtils.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"));
    jcb_compare = new JCheckBox(rb.getString("Button.Compare"));
    jcb_compare.setSelected(true);
    Account a = combo1.getSelectedAccount();
    Account a2 = combo2.getSelectedAccount();
    JFreeChart chart = createVerticalXYBarChart(a, a2);
    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"), combo1);
    builder.nextLine();
    builder.append(rb.getString("Label.Compare"), combo2);
    builder.nextLine();
    builder.append(jcb_compare);
    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 = e -> {
        try {
            if (e.getSource() == jcb_compare) {
                combo2.setEnabled(jcb_compare.isSelected());
            }
            Account account = combo1.getSelectedAccount();
            if (account == null) {
                return;
            }
            Account account2 = combo2.getSelectedAccount();
            if (jcb_compare.isSelected() && account2 == null) {
                return;
            }
            updateSubAccountBox();
            chartPanel.setChart(createVerticalXYBarChart(account, account2));
            panel.validate();
        } catch (final Exception ex) {
            Logger.getLogger(MonthlyAccountBalanceChartCompare.class.getName()).log(Level.SEVERE, ex.getLocalizedMessage(), ex);
        }
    };
    combo1.addActionListener(listener);
    combo2.addActionListener(listener);
    jcb_compare.addActionListener(listener);
    subAccountCheckBox.addActionListener(listener);
    hideLockedAccountCheckBox.addActionListener(e -> {
        combo1.setHideLocked(hideLockedAccountCheckBox.isSelected());
        combo2.setHideLocked(hideLockedAccountCheckBox.isSelected());
        try {
            Account account = combo1.getSelectedAccount();
            if (account == null) {
                return;
            }
            Account account2 = combo2.getSelectedAccount();
            if (jcb_compare.isSelected() && account2 == null) {
                return;
            }
            updateSubAccountBox();
            chartPanel.setChart(createVerticalXYBarChart(account, account2));
            panel.validate();
        } catch (final Exception ex) {
            Logger.getLogger(MonthlyAccountBalanceChartCompare.class.getName()).log(Level.SEVERE, ex.getLocalizedMessage(), ex);
        }
    });
    hidePlaceholderAccountCheckBox.addActionListener(e -> {
        combo1.setHidePlaceholder(hidePlaceholderAccountCheckBox.isSelected());
        combo2.setHidePlaceholder(hidePlaceholderAccountCheckBox.isSelected());
        try {
            Account account = combo1.getSelectedAccount();
            if (account == null) {
                return;
            }
            Account account2 = combo2.getSelectedAccount();
            if (jcb_compare.isSelected() && account2 == null) {
                return;
            }
            updateSubAccountBox();
            chartPanel.setChart(createVerticalXYBarChart(account, account2));
            panel.validate();
        } catch (final Exception ex) {
            Logger.getLogger(MonthlyAccountBalanceChartCompare.class.getName()).log(Level.SEVERE, ex.getLocalizedMessage(), ex);
        }
    });
    refreshButton.addActionListener(listener);
    updateSubAccountBox();
    return panel;
}
Also used : FormLayout(com.jgoodies.forms.layout.FormLayout) ActionListener(java.awt.event.ActionListener) AccountBalanceDisplayManager(jgnash.ui.register.AccountBalanceDisplayManager) TimeSeriesCollection(org.jfree.data.time.TimeSeriesCollection) Date(java.util.Date) DefaultFormBuilder(com.jgoodies.forms.builder.DefaultFormBuilder) IconUtils(jgnash.ui.util.IconUtils) ResourceUtils(jgnash.util.ResourceUtils) SimpleDateFormat(java.text.SimpleDateFormat) NumberAxis(org.jfree.chart.axis.NumberAxis) NumberFormat(java.text.NumberFormat) Level(java.util.logging.Level) BigDecimal(java.math.BigDecimal) TimeSeries(org.jfree.data.time.TimeSeries) ResourceBundle(java.util.ResourceBundle) JFreeChart(org.jfree.chart.JFreeChart) AccountType(jgnash.engine.AccountType) DateTickMarkPosition(org.jfree.chart.axis.DateTickMarkPosition) DateFormat(java.text.DateFormat) CurrencyNode(jgnash.engine.CurrencyNode) EventQueue(java.awt.EventQueue) FilteredAccountListComboBox(jgnash.ui.components.FilteredAccountListComboBox) DateUtils(jgnash.time.DateUtils) DateTickUnit(org.jfree.chart.axis.DateTickUnit) JButton(javax.swing.JButton) Comparators(jgnash.engine.Comparators) RowSpec(com.jgoodies.forms.layout.RowSpec) XYPlot(org.jfree.chart.plot.XYPlot) Logger(java.util.logging.Logger) GenericCloseDialog(jgnash.ui.components.GenericCloseDialog) List(java.util.List) DateAxis(org.jfree.chart.axis.DateAxis) DatePanel(jgnash.ui.components.DatePanel) FormLayout(com.jgoodies.forms.layout.FormLayout) LocalDate(java.time.LocalDate) JCheckBox(javax.swing.JCheckBox) Account(jgnash.engine.Account) ClusteredXYBarRenderer(org.jfree.chart.renderer.xy.ClusteredXYBarRenderer) TemporalAdjusters(java.time.temporal.TemporalAdjusters) ChartPanel(org.jfree.chart.ChartPanel) StandardXYToolTipGenerator(org.jfree.chart.labels.StandardXYToolTipGenerator) Month(org.jfree.data.time.Month) JPanel(javax.swing.JPanel) DateTickUnitType(org.jfree.chart.axis.DateTickUnitType) Account(jgnash.engine.Account) JPanel(javax.swing.JPanel) ChartPanel(org.jfree.chart.ChartPanel) JButton(javax.swing.JButton) LocalDate(java.time.LocalDate) JFreeChart(org.jfree.chart.JFreeChart) JCheckBox(javax.swing.JCheckBox) ActionListener(java.awt.event.ActionListener) DefaultFormBuilder(com.jgoodies.forms.builder.DefaultFormBuilder)

Aggregations

FormLayout (com.jgoodies.forms.layout.FormLayout)318 CellConstraints (com.jgoodies.forms.layout.CellConstraints)136 DefaultFormBuilder (com.jgoodies.forms.builder.DefaultFormBuilder)128 JPanel (javax.swing.JPanel)109 JScrollPane (javax.swing.JScrollPane)76 PanelBuilder (com.jgoodies.forms.builder.PanelBuilder)63 JLabel (javax.swing.JLabel)55 JButton (javax.swing.JButton)41 BorderLayout (java.awt.BorderLayout)32 FormBuilder (com.jgoodies.forms.builder.FormBuilder)19 JTextField (javax.swing.JTextField)19 ButtonBarBuilder (com.jgoodies.forms.builder.ButtonBarBuilder)18 JCheckBox (javax.swing.JCheckBox)18 Dimension (java.awt.Dimension)12 ActionEvent (java.awt.event.ActionEvent)12 DatePanel (jgnash.ui.components.DatePanel)11 TextAdapter (org.apache.cayenne.modeler.util.TextAdapter)11 JRadioButton (javax.swing.JRadioButton)10 ActionListener (java.awt.event.ActionListener)9 AbstractAction (javax.swing.AbstractAction)9