use of org.apache.pivot.wtk.DialogCloseListener in project pivot by apache.
the class ShutdownTest method shutdown.
@Override
public boolean shutdown(boolean optional) {
System.out.println("shutdown()");
if (alert == null) {
ArrayList<String> options = new ArrayList<>();
options.add("Yes");
options.add("No");
alert = new Alert(MessageType.QUESTION, "Cancel shutdown?", options);
alert.setModal(false);
alert.open(display, new DialogCloseListener() {
@Override
public void dialogClosed(Dialog dialog, boolean modal) {
if (!(dialog instanceof Alert)) {
return;
}
Alert alertLocal = (Alert) dialog;
if (alertLocal.getResult()) {
if (alertLocal.getSelectedOptionIndex() == 1) {
cancelShutdown = false;
DesktopApplicationContext.exit();
}
}
ShutdownTest.this.alert = null;
}
});
}
return cancelShutdown;
}
use of org.apache.pivot.wtk.DialogCloseListener 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