use of com.toedter.calendar.JDateChooser in project processdash by dtuma.
the class TeamMemberListTable method showCustomizationWindow.
/**
* Display a dialog window, allowing the user to customize aspects of the
* team schedule. If they click OK, apply the changes they have made.
*/
private void showCustomizationWindow() {
TeamMemberList tml = getTeamMemberList();
boolean readOnly = tml.isReadOnly() || tml.getOnlyEditableFor() != null;
int currentDOW = tml.getStartOnDayOfWeek();
JComboBox weekSelector = new JComboBox();
String selectedDayName = null;
String[] dayNames = new DateFormatSymbols().getWeekdays();
for (int i = 0; i < DAYS_OF_THE_WEEK.length; i++) {
int dow = DAYS_OF_THE_WEEK[i];
weekSelector.addItem(dayNames[dow]);
if (dow == currentDOW)
weekSelector.setSelectedItem(selectedDayName = dayNames[dow]);
}
Box wb = Box.createHorizontalBox();
wb.add(Box.createHorizontalStrut(25));
wb.add(readOnly ? new JLabel(selectedDayName) : weekSelector);
Object[] contents = new Object[] { resources.getString("Customize.Start_Day"), wb };
if (readOnly) {
JOptionPane.showMessageDialog(this, contents, //
resources.getString("Customize.Title_Read_Only"), JOptionPane.PLAIN_MESSAGE);
return;
}
JDateChooser newStartDate = new JDateChooser((Date) null);
contents = new Object[] { contents, BoxUtils.vbox(5), resources.getString("Customize.Move_Dates"), BoxUtils.hbox(25, newStartDate) };
if (JOptionPane.OK_OPTION == JOptionPane.showConfirmDialog(this, contents, resources.getString("Customize.Title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE)) {
Object selectedDay = weekSelector.getSelectedItem();
for (int i = 0; i < dayNames.length; i++) {
if (selectedDay.equals(dayNames[i]))
tml.setStartOnDayOfWeek(i);
}
if (newStartDate.getDate() != null)
tml.moveAllStartDates(newStartDate.getDate());
updateCustomizationHyperlinkText();
getTableHeader().repaint();
}
}
use of com.toedter.calendar.JDateChooser in project processdash by dtuma.
the class TimeLogEditor method addDateField.
private JDateChooser addDateField(JPanel retPanel, String labelKey) {
JLabel label = new JLabel(getResource(labelKey) + " ");
retPanel.add(label);
retPanel.add(Box.createHorizontalStrut(5));
JDateChooser result = new JDateChooser(null, DATE_FORMAT);
result.setPreferredSize(new Dimension(DATE_CHOOSER_WIDTH, result.getPreferredSize().height));
label.setLabelFor(result);
result.setMaximumSize(result.getPreferredSize());
retPanel.add(result);
retPanel.add(Box.createHorizontalStrut(5));
return result;
}
Aggregations