use of org.apache.pivot.wtk.CalendarButtonSelectionListener in project pivot by apache.
the class ComponentInspectorSkin method addCalendarDateControl.
private static Component addCalendarDateControl(final Dictionary<String, Object> dictionary, final String key, Form.Section section) {
CalendarDate calendarDate = (CalendarDate) dictionary.get(key);
CalendarButton calendarButton = new CalendarButton();
calendarButton.setMinimumWidth(75);
calendarButton.setSelectedDate(calendarDate);
section.add(calendarButton);
Form.setLabel(calendarButton, key);
calendarButton.getCalendarButtonSelectionListeners().add(new CalendarButtonSelectionListener() {
@Override
public void selectedDateChanged(CalendarButton calendarButtonArgument, CalendarDate previousSelectedDate) {
try {
dictionary.put(key, calendarButtonArgument.getSelectedDate());
} catch (Exception exception) {
displayErrorMessage(exception, calendarButtonArgument.getWindow());
dictionary.put(key, previousSelectedDate);
}
}
});
return calendarButton;
}
use of org.apache.pivot.wtk.CalendarButtonSelectionListener in project pivot by apache.
the class Pivot714 method getWindow.
public Window getWindow(final Window ownerArgument) {
this.owner = ownerArgument;
final BXMLSerializer bxmlSerializer = new BXMLSerializer();
try {
result = (Dialog) bxmlSerializer.readObject(Pivot714.class.getResource("pivot_714.bxml"));
} catch (IOException e) {
e.printStackTrace();
} catch (SerializationException e) {
e.printStackTrace();
}
final ListButton motif = (ListButton) bxmlSerializer.getNamespace().get("motif");
ArrayList<String> al = new ArrayList<>();
al.add("One");
al.add("Two");
motif.setListData(al);
CalendarButton cbDate = (CalendarButton) bxmlSerializer.getNamespace().get("date");
dcl = (new DialogCloseListener() {
@Override
public void dialogClosed(Dialog dialog, boolean modal) {
// empty block
}
});
cbDate.getCalendarButtonSelectionListeners().add(new CalendarButtonSelectionListener() {
@Override
public void selectedDateChanged(CalendarButton calendarButton, CalendarDate previousSelectedDate) {
// empty block
}
});
return result;
}
Aggregations