GWT: How to prevent a handler from receiving an event until user has selected a choice in a confirmation box?

This is an early draft of a widget I made to solve this problem. I later made a more generic wrapping subclass of SimplePanel that would wrap the click handlers of any widget.

This is an early draft of a widget I made to solve this problem. I later made a more generic wrapping subclass of SimplePanel that would wrap the click handlers of any widget. It works by switching in a substitute HandlerManager when addClickHandler is called, and only firing events along that HandlerManager when the confirmation dialog returns.

Public class ConfirmButton extends Button { private HandlerManager handlerManager = new HandlerManager(this); private String message = "Do you really want to do this? "; private ClickHandler myRealClickHandler = new ClickHandler() { @Override public void onClick(ClickEvent event) { if (Window. Confirm(message)) handlerManager.

FireEvent(event); } }; public ConfirmButton() { super(); addDomHandler(myRealClickHandler, ClickEvent.getType()); } public ConfirmButton(String text) { this(); setText(text); } public void setConfirmationPrompt(String prompt) { message = prompt; } @Override public HandlerRegistration addClickHandler(ClickHandler handler) { HandlerRegistration ret = handlerManager. AddHandler(ClickEvent.getType(), handler); return ret; } }.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions