public void onChange(final ChangeEvent event) {
// by canceling the selection remain unchanged if the user does not confirm. If he does confirm
// the dialog gets destroyed anyway.
event.cancel();
final MissingPolicy newPolicy = MissingPolicy.valueOf((String) event.getValue());
String msg = MSG.view_adminConfig_missingResourcePolicy_confirm(getPolicyDisplay(newPolicy),
AncestryUtil.getFormattedType(type));
SC.ask(MSG.common_msg_areYouSure(), msg, new BooleanCallback() {
public void execute(Boolean value) {
if (Boolean.TRUE.equals(value)) {
// call server to flip flag on type
GWTServiceLookup.getResourceTypeGWTService().setResourceTypeMissingPolicy(type.getId(),
newPolicy, new AsyncCallback<Void>() {
public void onSuccess(Void result) {
// this type reference is inside our cache so make sure we update it
type.setMissingPolicy(newPolicy);
String msg = MSG.view_adminConfig_missingResourcePolicy_success(
getPolicyDisplay(newPolicy), type.getName());
CoreGUI.getMessageCenter().notify(new Message(msg));
// refresh the grid
recordClickEvent.getRecord()
.setAttribute(ATTR_POLICY, newPolicy.toString());
recordClickEvent.getViewer().markForRedraw();
MissingPolicyDialog.this.destroy();
}