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;
}
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));
}
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();
}
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;
}
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;
}
Aggregations