use of jgnash.ui.components.DatePanel in project jgnash by ccavanaugh.
the class AmortizeDialog method initComponents.
private void initComponents() {
dateField = new DatePanel();
interestField = new JFloatField(0, 3, 2);
loanAmountField = new JFloatField();
loanTermField = new JIntegerField();
payPeriodsField = new JIntegerField();
intPeriodsField = new JIntegerField();
feesField = new JFloatField();
interestAccButton = new JButton(rb.getString("Word.None"));
bankAccButton = new JButton(rb.getString("Word.None"));
feesAccButton = new JButton(rb.getString("Word.None"));
payeeField = new JTextFieldEx();
memoField = new JTextFieldEx();
useDaysButton = new JCheckBox(rb.getString("Button.UseDailyRate"));
daysField = new JFloatField();
cancelButton = new JButton(rb.getString("Button.Cancel"));
okButton = new JButton(rb.getString("Button.Ok"));
}
use of jgnash.ui.components.DatePanel in project jgnash by ccavanaugh.
the class DateChkNumberDialog method initComponents.
private void initComponents() {
datePanel = new DatePanel();
numberCombo = new TransactionNumberComboBox(account);
okButton = new JButton(rb.getString("Button.Ok"));
cancelButton = new JButton(rb.getString("Button.Cancel"));
okButton.addActionListener(this);
cancelButton.addActionListener(this);
getRootPane().setDefaultButton(okButton);
}
use of jgnash.ui.components.DatePanel in project jgnash by ccavanaugh.
the class MonthBalanceCSV method getOptions.
private void getOptions() {
final DatePanel startField = new DatePanel();
final DatePanel endField = new DatePanel();
ButtonGroup group = new ButtonGroup();
JRadioButton vButton = new JRadioButton(rb.getString("Button.Vertical"));
JRadioButton hButton = new JRadioButton(rb.getString("Button.Horizontal"));
group.add(vButton);
group.add(hButton);
vButton.setSelected(true);
FormLayout layout = new FormLayout("right:p, 4dlu, p:g", "");
DefaultFormBuilder builder = new DefaultFormBuilder(layout);
builder.rowGroupingEnabled(true);
builder.append(rb.getString("Label.StartDate"), startField);
builder.append(rb.getString("Label.EndDate"), endField);
builder.append(rb.getString("Label.Layout"), vButton);
builder.append("", hButton);
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) {
startDate = startField.getLocalDate();
endDate = endField.getLocalDate();
}
vertical = vButton.isSelected();
}
use of jgnash.ui.components.DatePanel in project jgnash by ccavanaugh.
the class IncomeExpensePieChart method createPanel.
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("Button.ShowPercentValues"));
final Engine engine = EngineFactory.getEngine(EngineFactory.DEFAULT);
Objects.requireNonNull(engine);
combo = AccountListComboBox.getParentTypeInstance(engine.getRootAccount(), set);
final LocalDate dStart = DateUtils.getFirstDayOfTheMonth(LocalDate.now()).minusYears(1);
long start = pref.getLong(START_DATE, DateUtils.asEpochMilli(dStart));
startField.setDate(DateUtils.asLocalDate(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(e -> {
setCurrentAccount(combo.getSelectedAccount());
pref.putLong(START_DATE, DateUtils.asEpochMilli(startField.getLocalDate()));
});
refreshButton.addActionListener(e -> {
setCurrentAccount(currentAccount);
pref.putLong(START_DATE, DateUtils.asEpochMilli(startField.getLocalDate()));
});
showEmptyCheck.addActionListener(e -> setCurrentAccount(currentAccount));
showPercentCheck.addActionListener(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 (final Exception e) {
Logger.getLogger(IncomeExpensePieChart.class.getName()).log(Level.SEVERE, e.getLocalizedMessage(), e);
}
}
}
@Override
public void chartMouseMoved(ChartMouseEvent event) {
setChartCursor(chartPanel, event.getEntity(), event.getTrigger().getPoint());
}
};
chartPanel.addChartMouseListener(mouseListener);
return panel;
}
use of jgnash.ui.components.DatePanel in project jgnash by ccavanaugh.
the class CurrencyExchangeDialog method initComponents.
private void initComponents() {
baseCurrencyCombo = new CurrencyComboBox();
exchangeCurrencyCombo = new CurrencyComboBox();
dateField = new DatePanel();
baseCurrencyCombo.addActionListener(this);
exchangeCurrencyCombo.addActionListener(this);
model = new HistoryModel();
table = new HistoryTable();
table.setModel(model);
table.setPreferredScrollableViewportSize(new java.awt.Dimension(150, 150));
table.setCellSelectionEnabled(false);
table.setColumnSelectionAllowed(false);
table.setRowSelectionAllowed(true);
table.getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
table.setRowSorter(new TableRowSorter<>(model));
table.setFillsViewportHeight(true);
table.getSelectionModel().addListSelectionListener(this);
closeButton = new JButton(rb.getString("Button.Close"));
deleteButton = new JButton(rb.getString("Button.Delete"));
clearButton = new JButton(rb.getString("Button.Clear"));
addButton = new JButton(rb.getString("Button.Add"));
updateButton = new JButton(rb.getString("Button.UpdateOnline"));
updateButton.setIcon(IconUtils.getIcon("/jgnash/resource/applications-internet.png"));
progressBar = new JProgressBar();
stopButton = new JButton(rb.getString("Button.Stop"));
stopButton.setIcon(IconUtils.getIcon("/jgnash/resource/process-stop.png"));
stopButton.setEnabled(false);
addButton.addActionListener(this);
clearButton.addActionListener(this);
closeButton.addActionListener(this);
deleteButton.addActionListener(this);
updateButton.addActionListener(this);
stopButton.addActionListener(this);
EventQueue.invokeLater(CurrencyExchangeDialog.this::updateModel);
}
Aggregations