use of com.google.gwt.event.dom.client.HasBlurHandlers in project ovirt-engine by oVirt.
the class AbstractPermissionsPopupPresenterWidget method init.
@Override
public void init(final M model) {
// Let the parent do its work
super.init(model);
getView().getSearchButton().setCommand(model.getSearchCommand());
registerHandler(getView().getSearchButton().addClickHandler(event -> {
getView().setLoadingState(LoadingState.LOADING);
getView().getSearchButton().getCommand().execute();
}));
model.getSearchInProgress().getEntityChangedEvent().addListener((ev, sender, args) -> getView().getSearchButton().getCommand().setIsExecutionAllowed(!model.getSearchInProgress().getEntity()));
registerHandler(getView().getKeyPressSearchInputBox().addKeyPressHandler(event -> {
if (KeyCodes.KEY_ENTER == event.getNativeEvent().getKeyCode()) {
model.setSearchString(getView().getSearchString().getValue());
getView().getSearchButton().getCommand().execute();
}
}));
registerHandler(getView().getEveryoneRadio().addClickHandler(event -> {
model.setSearchType(AdSearchType.EVERYONE);
getView().changeStateOfElementsWhenAccessIsForEveryoneOrMyGroups(true, false);
getView().userTypeChanged(UserOrGroup.User, false);
model.setItems(null);
}));
registerHandler(getView().getMyGroupsRadio().addClickHandler(event -> {
model.setSearchType(AdSearchType.MY_GROUPS);
getView().changeStateOfElementsWhenAccessIsForEveryoneOrMyGroups(false, true);
getModel().getSearchMyGroupsCommand().execute();
getView().userTypeChanged(UserOrGroup.Group, false);
model.setItems(null);
getView().setLoadingState(LoadingState.LOADING);
}));
registerHandler(getView().getSpecificUserRadio().addClickHandler(event -> {
model.setSearchType(AdSearchType.USER);
getView().changeStateOfElementsWhenAccessIsForEveryoneOrMyGroups(false, false);
getView().userTypeChanged(UserOrGroup.User, true);
model.setItems(null);
}));
registerHandler(getView().getSpecificGroupRadio().addClickHandler(event -> {
model.setSearchType(AdSearchType.GROUP);
getView().changeStateOfElementsWhenAccessIsForEveryoneOrMyGroups(false, false);
getView().userTypeChanged(UserOrGroup.Group, true);
model.setItems(null);
}));
model.getProfile().getSelectedItemChangedEvent().addListener((ev, sender, args) -> model.populateNamespaces());
model.getNamespace().getItemsChangedEvent().addListener((ev, sender, args) -> getView().getSearchButton().getCommand().setIsExecutionAllowed(model.availableNamespaces()));
model.getIsRoleListHiddenModel().getPropertyChangedEvent().addListener((ev, sender, args) -> getView().hideRoleSelection(Boolean.parseBoolean(model.getIsRoleListHiddenModel().getEntity().toString())));
getView().hideEveryoneSelection(model.getIsEveryoneSelectionHidden().getEntity());
model.getIsEveryoneSelectionHidden().getPropertyChangedEvent().addListener((ev, sender, args) -> getView().hideEveryoneSelection(Boolean.parseBoolean(model.getIsRoleListHiddenModel().getEntity().toString())));
HasHandlers searchStringEditor = getView().getSearchStringEditor();
if (searchStringEditor instanceof HasFocusHandlers) {
registerHandler(((HasFocusHandlers) searchStringEditor).addFocusHandler(event -> searchStringEditorHasFocus = true));
}
if (searchStringEditor instanceof HasBlurHandlers) {
registerHandler(((HasBlurHandlers) searchStringEditor).addBlurHandler(event -> searchStringEditorHasFocus = false));
}
}
Aggregations