Search in sources :

Example 11 with KeyDownEvent

use of com.google.gwt.event.dom.client.KeyDownEvent in project drools-wb by kiegroup.

the class KeyDownHandlerCommonTest method tabKeyCanvasActions.

@Test
public void tabKeyCanvasActions() {
    final KeyDownEvent e = mockKeyDownEvent(Optional.of(KeyCodes.KEY_TAB), Optional.of(false), Optional.of(false));
    handler.onKeyDown(e);
    verify(gridCell).flush();
    verify(e).preventDefault();
    verifyCommonActions();
}
Also used : KeyDownEvent(com.google.gwt.event.dom.client.KeyDownEvent) Test(org.junit.Test)

Example 12 with KeyDownEvent

use of com.google.gwt.event.dom.client.KeyDownEvent in project drools-wb by kiegroup.

the class KeyDownHandlerDatePickerTest method enterKeyCanvasActions.

@Test
public void enterKeyCanvasActions() {
    final KeyDownEvent e = mockKeyDownEvent(Optional.of(KeyCodes.KEY_ENTER), Optional.of(false), Optional.of(false));
    handler.onKeyDown(e);
    verify(gridCell, never()).flush();
    verify(gridCell, never()).destroyResources();
    verifyCommonActions();
}
Also used : KeyDownEvent(com.google.gwt.event.dom.client.KeyDownEvent) Test(org.junit.Test)

Example 13 with KeyDownEvent

use of com.google.gwt.event.dom.client.KeyDownEvent in project kie-wb-common by kiegroup.

the class AssignmentListItemWidgetViewImpl method init.

@PostConstruct
public void init() {
    // Configure dataType and customDataType controls
    dataTypeComboBox.init(this, false, dataType, customDataType, false, true, CUSTOM_PROMPT, ENTER_TYPE_PROMPT);
    // Configure processVar and constant controls
    processVarComboBox.init(this, false, processVar, constant, true, true, CONSTANT_PROMPT, ENTER_CONSTANT_PROMPT);
    name.setRegExp("^[a-zA-Z0-9\\-\\.\\_]*$", StunnerFormsClientFieldsConstants.INSTANCE.Removed_invalid_characters_from_name(), StunnerFormsClientFieldsConstants.INSTANCE.Invalid_character_in_name());
    customDataType.addKeyDownHandler(new KeyDownHandler() {

        @Override
        public void onKeyDown(KeyDownEvent event) {
            int iChar = event.getNativeKeyCode();
            if (iChar == ' ') {
                event.preventDefault();
            }
        }
    });
    name.addBlurHandler(new BlurHandler() {

        @Override
        public void onBlur(BlurEvent event) {
            if (!allowDuplicateNames) {
                String value = name.getText();
                if (isDuplicateName(value)) {
                    notification.fire(new NotificationEvent(duplicateNameErrorMessage, NotificationEvent.NotificationType.ERROR));
                    name.setValue("");
                    ValueChangeEvent.fire(name, "");
                }
            }
        }
    });
}
Also used : BlurHandler(com.google.gwt.event.dom.client.BlurHandler) KeyDownEvent(com.google.gwt.event.dom.client.KeyDownEvent) KeyDownHandler(com.google.gwt.event.dom.client.KeyDownHandler) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) BlurEvent(com.google.gwt.event.dom.client.BlurEvent) PostConstruct(javax.annotation.PostConstruct)

Example 14 with KeyDownEvent

use of com.google.gwt.event.dom.client.KeyDownEvent in project kie-wb-common by kiegroup.

the class VariableListItemWidgetViewImpl method init.

@PostConstruct
public void init() {
    // Configure dataType and customDataType controls
    dataTypeComboBox.init(this, true, dataType, customDataType, false, true, CUSTOM_PROMPT, ENTER_TYPE_PROMPT);
    name.setRegExp("^[a-zA-Z0-9\\-\\.\\_]*$", "Removed invalid characters from name", "Invalid character in name");
    customDataType.addKeyDownHandler(new KeyDownHandler() {

        @Override
        public void onKeyDown(final KeyDownEvent event) {
            int iChar = event.getNativeKeyCode();
            if (iChar == ' ') {
                event.preventDefault();
            }
        }
    });
    name.addBlurHandler(new BlurHandler() {

        @Override
        public void onBlur(final BlurEvent event) {
            if (!allowDuplicateNames) {
                String value = name.getText();
                if (isDuplicateName(value)) {
                    notification.fire(new NotificationEvent(duplicateNameErrorMessage, NotificationEvent.NotificationType.ERROR));
                    name.setValue("");
                    ValueChangeEvent.fire(name, "");
                }
            }
            notifyModelChanged();
        }
    });
}
Also used : BlurHandler(com.google.gwt.event.dom.client.BlurHandler) KeyDownEvent(com.google.gwt.event.dom.client.KeyDownEvent) KeyDownHandler(com.google.gwt.event.dom.client.KeyDownHandler) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) BlurEvent(com.google.gwt.event.dom.client.BlurEvent) PostConstruct(javax.annotation.PostConstruct)

Example 15 with KeyDownEvent

use of com.google.gwt.event.dom.client.KeyDownEvent in project che by eclipse.

the class View method handleEvents.

private void handleEvents() {
    KeyDownHandler handler = new KeyDownHandler() {

        @Override
        public void onKeyDown(KeyDownEvent event) {
            if (KeyboardEvent.KeyCode.ESC == event.getNativeEvent().getKeyCode()) {
                event.stopPropagation();
                event.preventDefault();
                if (delegate != null) {
                    delegate.onEscapeKey();
                }
            } else if (KeyboardEvent.KeyCode.ENTER == event.getNativeEvent().getKeyCode()) {
                event.stopPropagation();
                event.preventDefault();
                if (delegate != null) {
                    delegate.onEnterKey();
                }
            }
        }
    };
    focusPanel.addDomHandler(handler, KeyDownEvent.getType());
    closeButton.addDomHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            if (delegate != null) {
                delegate.onClose();
            }
            event.stopPropagation();
        }
    }, ClickEvent.getType());
    /* Don't start moving the window when clicking close button */
    closeButton.addDomHandler(new MouseDownHandler() {

        @Override
        public void onMouseDown(MouseDownEvent event) {
            event.preventDefault();
            event.stopPropagation();
        }
    }, MouseDownEvent.getType());
    MouseHandler mouseHandler = new MouseHandler();
    header.addDomHandler(mouseHandler, MouseDownEvent.getType());
    header.addDomHandler(mouseHandler, MouseUpEvent.getType());
    header.addDomHandler(mouseHandler, MouseMoveEvent.getType());
}
Also used : KeyDownEvent(com.google.gwt.event.dom.client.KeyDownEvent) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) KeyDownHandler(com.google.gwt.event.dom.client.KeyDownHandler) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) MouseDownEvent(com.google.gwt.event.dom.client.MouseDownEvent) MouseDownHandler(com.google.gwt.event.dom.client.MouseDownHandler)

Aggregations

KeyDownEvent (com.google.gwt.event.dom.client.KeyDownEvent)29 KeyDownHandler (com.google.gwt.event.dom.client.KeyDownHandler)15 Test (org.junit.Test)12 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)4 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)4 KeyPressEvent (com.google.gwt.event.dom.client.KeyPressEvent)3 KeyUpEvent (com.google.gwt.event.dom.client.KeyUpEvent)3 WindowEx (org.rstudio.core.client.dom.WindowEx)3 CanFocus (org.rstudio.core.client.widget.CanFocus)3 FindTextBox (org.rstudio.core.client.widget.FindTextBox)3 BlurEvent (com.google.gwt.event.dom.client.BlurEvent)2 BlurHandler (com.google.gwt.event.dom.client.BlurHandler)2 KeyPressHandler (com.google.gwt.event.dom.client.KeyPressHandler)2 KeyUpHandler (com.google.gwt.event.dom.client.KeyUpHandler)2 PostConstruct (javax.annotation.PostConstruct)2 ToolbarButton (org.rstudio.core.client.widget.ToolbarButton)2 ToolbarLabel (org.rstudio.core.client.widget.ToolbarLabel)2 RSConnectPublishButton (org.rstudio.studio.client.rsconnect.ui.RSConnectPublishButton)2 NotificationEvent (org.uberfire.workbench.events.NotificationEvent)2 AccountInfo (com.google.gerrit.client.info.AccountInfo)1