txtInvoiceNo.setPreferredSize(new Dimension(120,20));
txtInvoiceNo.setMaximumSize(new Dimension(200,20));
txtInvoiceNo.setText(Util.ReverseDateFormat.format(new Date()));
}
private void addExportPanel() {
final JXPanel datePanel = new JXPanel();
final GroupLayout groupLayout = new GroupLayout(datePanel);
groupLayout.setAutoCreateGaps(true);
datePanel.setLayout(groupLayout);
exportPanel.setLayout(new BoxLayout(exportPanel, BoxLayout.Y_AXIS));
exportPanel.setBorder(BorderFactory.createTitledBorder("Export Timesheet"));
final JLabel fromLabel = new JLabel("From");
final JLabel toLabel = new JLabel("To");
final JLabel invoiceLabel = new JLabel("Invoice No");
groupLayout.setHorizontalGroup(
groupLayout.createSequentialGroup()
.addGroup(groupLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(fromLabel)
.addComponent(toLabel))
.addGroup(groupLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(fromDate)
.addComponent(toDate)));
groupLayout.setVerticalGroup(
groupLayout.createSequentialGroup()
.addGroup(groupLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
.addComponent(fromLabel).addComponent(fromDate))
.addGroup(groupLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
.addComponent(toLabel).addComponent(toDate)));
// from date is -x days from current date (x is defined in config)
final Calendar c = Calendar.getInstance();
c.setTime(fromDate.getDate());
Integer days = Config.getDefaultReportDuration();
if (days == null) {
days = 0;
}
c.add(Calendar.DAY_OF_YEAR, -days);
fromDate.setDate(c.getTime());
datePanel.setAlignmentX(LEFT_ALIGNMENT);
btnExport.setMnemonic('x');
btnExport.setAlignmentX(LEFT_ALIGNMENT);
chkSkipEmptyRecords.setMnemonic('s');
chkSkipEmptyRecords.setAlignmentX(LEFT_ALIGNMENT);
chkSkipEmptyRecords.setSelected(true);