/** * Create a default filename given the current date selection. If custom dates are selected, use * those dates; otherwise, use year and week numbers. * * @return The default filename. */ private String getDefaultFilename() { if (yearCB.getSelectedIndex() == 0 || weekCB.getSelectedIndex() == 0) return "timesheet-" + dateFormat.format(fromDate.getDate()).replaceAll("/", "") + "-" + dateFormat.format(toDate.getDate()).replaceAll("/", "") + ".txt"; return "timesheet-" + yearCB.getSelectedItem() + "wk" + weekCB.getSelectedItem() + ".txt"; }
/** * Returns the unique ID of a week prefixed with the year. * * @return Selected week's ID. */ String getSelectedWeekID() { String weekNo = weekCB.getSelectedItem().toString(); if (weekNo.length() == 1) weekNo = "0" + weekNo; return yearCB.getSelectedItem() + "wk" + weekNo; }