Search in sources :

Example 1 with HasHandlers

use of com.google.gwt.event.shared.HasHandlers in project rstudio by rstudio.

the class WindowEx method fireFocusHandlers.

private static void fireFocusHandlers() {
    NativeEvent nativeEvent = Document.get().createFocusEvent();
    FocusEvent.fireNativeEvent(nativeEvent, new HasHandlers() {

        public void fireEvent(GwtEvent<?> event) {
            handlers_.fireEvent(event);
        }
    });
}
Also used : HasHandlers(com.google.gwt.event.shared.HasHandlers) NativeEvent(com.google.gwt.dom.client.NativeEvent)

Example 2 with HasHandlers

use of com.google.gwt.event.shared.HasHandlers in project rstudio by rstudio.

the class WindowEx method fireBlurHandlers.

private static void fireBlurHandlers() {
    NativeEvent nativeEvent = Document.get().createBlurEvent();
    BlurEvent.fireNativeEvent(nativeEvent, new HasHandlers() {

        public void fireEvent(GwtEvent<?> event) {
            handlers_.fireEvent(event);
        }
    });
}
Also used : HasHandlers(com.google.gwt.event.shared.HasHandlers) NativeEvent(com.google.gwt.dom.client.NativeEvent)

Example 3 with HasHandlers

use of com.google.gwt.event.shared.HasHandlers 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));
    }
}
Also used : AdElementListModel(org.ovirt.engine.ui.uicommonweb.models.users.AdElementListModel) EventBus(com.google.gwt.event.shared.EventBus) UserOrGroup(org.ovirt.engine.core.searchbackend.VdcUserConditionFieldAutoCompleter.UserOrGroup) HasUiCommandClickHandlers(org.ovirt.engine.ui.common.widget.HasUiCommandClickHandlers) AdSearchType(org.ovirt.engine.ui.uicommonweb.models.users.AdElementListModel.AdSearchType) HasValue(com.google.gwt.user.client.ui.HasValue) LoadingState(com.google.gwt.user.cellview.client.LoadingStateChangeEvent.LoadingState) NativeEvent(com.google.gwt.dom.client.NativeEvent) HasKeyPressHandlers(com.google.gwt.event.dom.client.HasKeyPressHandlers) HasClickHandlers(com.google.gwt.event.dom.client.HasClickHandlers) HasFocusHandlers(com.google.gwt.event.dom.client.HasFocusHandlers) HasBlurHandlers(com.google.gwt.event.dom.client.HasBlurHandlers) KeyCodes(com.google.gwt.event.dom.client.KeyCodes) HasHandlers(com.google.gwt.event.shared.HasHandlers) AbstractModelBoundPopupPresenterWidget(org.ovirt.engine.ui.common.presenter.AbstractModelBoundPopupPresenterWidget) HasFocusHandlers(com.google.gwt.event.dom.client.HasFocusHandlers) HasBlurHandlers(com.google.gwt.event.dom.client.HasBlurHandlers) HasHandlers(com.google.gwt.event.shared.HasHandlers)

Aggregations

NativeEvent (com.google.gwt.dom.client.NativeEvent)3 HasHandlers (com.google.gwt.event.shared.HasHandlers)3 HasBlurHandlers (com.google.gwt.event.dom.client.HasBlurHandlers)1 HasClickHandlers (com.google.gwt.event.dom.client.HasClickHandlers)1 HasFocusHandlers (com.google.gwt.event.dom.client.HasFocusHandlers)1 HasKeyPressHandlers (com.google.gwt.event.dom.client.HasKeyPressHandlers)1 KeyCodes (com.google.gwt.event.dom.client.KeyCodes)1 EventBus (com.google.gwt.event.shared.EventBus)1 LoadingState (com.google.gwt.user.cellview.client.LoadingStateChangeEvent.LoadingState)1 HasValue (com.google.gwt.user.client.ui.HasValue)1 UserOrGroup (org.ovirt.engine.core.searchbackend.VdcUserConditionFieldAutoCompleter.UserOrGroup)1 AbstractModelBoundPopupPresenterWidget (org.ovirt.engine.ui.common.presenter.AbstractModelBoundPopupPresenterWidget)1 HasUiCommandClickHandlers (org.ovirt.engine.ui.common.widget.HasUiCommandClickHandlers)1 AdElementListModel (org.ovirt.engine.ui.uicommonweb.models.users.AdElementListModel)1 AdSearchType (org.ovirt.engine.ui.uicommonweb.models.users.AdElementListModel.AdSearchType)1