How can I add an action Listener so that when an appointment on an agenda is clicked a new window with more details on that particular clicked appointment opens.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
It seems like Agenda has not api for that. You can see agenda's sources: AbstractAppointmentPane
has mouse event logic.
回答2:
lAgenda.selectedAppointments().addListener(new ListChangeListener< Appointment >() {
public void onChanged(Change<? extends Appointment> c) {
while (c.next()) {
if (c.wasPermutated()) {
for (int i = c.getFrom(); i < c.getTo(); ++i) {
//permutate
}
} else if (c.wasUpdated()) {
//update item
} else {
for (Appointment a : c.getRemoved()) {
}
for (Appointment a : c.getAddedSubList()) {
printAppointment(a);
}
}
}
}
});
Then print appointments:
private void printAppointment(Appointment a) {
System.out.println(a.getSummary());
System.out.println(a.getDescription());
}