-
FEATURED COMPONENTS
First time here? Check out the FAQ!
1 | initial version | |
@Command
public void someMethod() {
final Object bean = this;
EventListener<ClickEvent> clickListener = new EventListener<Messagebox.ClickEvent>() {
public void onEvent(ClickEvent event) throws Exception {
if(Messagebox.Button.YES.equals(event.getButton())) {
// ...
BindUtils.postNotifyChange(null, null, bean, "yourIDhere");
}
}
};
Messagebox.show("Question?", "Title", new Messagebox.Button[]{Messagebox.Button.YES, Messagebox.Button.NO }, Messagebox.QUESTION, clickListener);
}
Just wanted to share a "trick" that I had to use... If you have anonymous class, e.g. listener as in the code above, and you want to notify for a change, the @NotifyChange annotation will not help you. Or it just didn't work in my case - it doesn't matter if it's above the "delete()" method or above the "onEvent". In this case the "BindUtils.postNotifyChange" can be used, BUT the bean reference must be passed as a parameter, initialized outside the anonymous class.
2 | No.2 Revision |
@Command
public void someMethod() {
final Object bean = this;
EventListener<ClickEvent> clickListener = new EventListener<Messagebox.ClickEvent>() {
public void onEvent(ClickEvent event) throws Exception {
if(Messagebox.Button.YES.equals(event.getButton())) {
// ...
BindUtils.postNotifyChange(null, null, bean, "yourIDhere");
}
}
};
Messagebox.show("Question?", "Title", new Messagebox.Button[]{Messagebox.Button.YES, Messagebox.Button.NO }, Messagebox.QUESTION, clickListener);
}
Just wanted to share a "trick" that I had to use... If you have anonymous local class, e.g. listener as in the code above, and you want to notify for a change, the @NotifyChange annotation will not help you. Or it just didn't work in my case - it doesn't matter if it's above the "delete()" method or above the "onEvent". In this case the "BindUtils.postNotifyChange" can be used, BUT the bean reference must be passed as a parameter, initialized outside the anonymous class.