in my current project i use the MVP-Pattern and i want to register a variable count of RegistrationHandlers for some checkboxes.
Something like this:
in my View.java i have:
public ArrayList<HandlerRegistration> getCheckBoxesHandlers(ClickHandler handler) {
ArrayList<HandlerRegistration> handlerRegistration= new ArrayList<HandlerRegistration>();
for (Widget checkBox : availableSets) {
handlerRegistration.add(((CheckBox)checkBox).addClickHandler(handler));
}
return handlerRegistration;
}
how can i handle this in my presenter? he following code doesn’t work, because i don’t know how to catch the handlers out of the array
display.getCheckBoxesHandlers(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
//TODO do something here
}
});
greetz,
destiny
We use element id.
for each Widget checkBox in availableSets. Set an id. checkBox.getElement().setId(“checkbox”+i)
Then in your presenter you can check which id has been fired on event.getSource(). Cast it to Widget and get the id.