Search in sources :

Example 6 with Event

use of elemental2.dom.Event in project kie-wb-common by kiegroup.

the class DragAndDropHelper method onDragAreaMouseDown.

Object onDragAreaMouseDown(final Event e) {
    final MouseEvent event = (MouseEvent) e;
    if (!Objects.isNull(event.target)) {
        final Element grabber = ((Element) event.target).closest(".drag-grabber");
        if (Objects.isNull(grabber)) {
            return this;
        }
        draggingElement = (HTMLElement) grabber.closest(DRAGGABLE_ITEM_CLASS);
        clickedYPosition = (int) event.clientY;
        startYPosition = getTop(getDragging());
    }
    return this;
}
Also used : MouseEvent(elemental2.dom.MouseEvent) Element(elemental2.dom.Element) HTMLElement(elemental2.dom.HTMLElement)

Example 7 with Event

use of elemental2.dom.Event in project kie-wb-common by kiegroup.

the class DNDListComponentView method onStartDrag.

void onStartDrag(final Event event) {
    final HTMLElement target = (HTMLElement) event.target;
    final HTMLElement parent = (HTMLElement) target.parentNode;
    if (isGrip(target)) {
        holdDraggingElement(parent);
    }
}
Also used : HTMLElement(elemental2.dom.HTMLElement)

Example 8 with Event

use of elemental2.dom.Event in project kie-wb-common by kiegroup.

the class TimePicker method onViewElementBlur.

private Object onViewElementBlur(final Event event) {
    final FocusEvent focusEvent = (FocusEvent) event;
    onBlur(focusEvent, getInputBind());
    return this;
}
Also used : FocusEvent(elemental2.dom.FocusEvent)

Example 9 with Event

use of elemental2.dom.Event in project kie-wb-common by kiegroup.

the class DataTypeShortcuts method keyDownListener.

void keyDownListener(final Event e) {
    if (!(e instanceof KeyboardEvent)) {
        return;
    }
    final KeyboardEvent event = (KeyboardEvent) e;
    if (isNotEnabled()) {
        return;
    }
    switch(event.key) {
        case "Esc":
        /* IE/Edge specific value */
        case "Escape":
            listShortcuts.onEscape();
            return;
        case "Backspace":
            if (event.ctrlKey) {
                listShortcuts.onCtrlBackspace();
            }
            return;
        case "Tab":
            if (isSearchBarTarget(event)) {
                event.preventDefault();
                listShortcuts.onTab();
            }
            return;
        case "s":
            if (event.ctrlKey) {
                event.preventDefault();
                listShortcuts.onCtrlS();
            }
            return;
        case "b":
            if (event.ctrlKey) {
                event.preventDefault();
                listShortcuts.onCtrlB();
            }
            return;
        case "u":
            if (event.ctrlKey) {
                event.preventDefault();
                listShortcuts.onCtrlU();
            }
            return;
        case "d":
            if (event.ctrlKey) {
                event.preventDefault();
                listShortcuts.onCtrlD();
            }
            return;
        case "e":
            if (event.ctrlKey) {
                event.preventDefault();
                listShortcuts.onCtrlE();
            }
            return;
    }
    if (isInputEvent(event) && !isSearchBarTarget(event)) {
        return;
    }
    switch(event.key) {
        case "Down":
        /* IE/Edge specific value */
        case "ArrowDown":
            listShortcuts.onArrowDown();
            return;
        case "Up":
        /* IE/Edge specific value */
        case "ArrowUp":
            listShortcuts.onArrowUp();
            return;
        case "Left":
        /* IE/Edge specific value */
        case "ArrowLeft":
            listShortcuts.onArrowLeft();
            return;
        case "Right":
        /* IE/Edge specific value */
        case "ArrowRight":
            listShortcuts.onArrowRight();
    }
}
Also used : KeyboardEvent(elemental2.dom.KeyboardEvent)

Example 10 with Event

use of elemental2.dom.Event in project kie-wb-common by kiegroup.

the class DataTypeShortcuts method clickListener.

void clickListener(final Event event) {
    if (isNotEnabled()) {
        return;
    }
    if (tabContentContainsTarget(event) || dropdownMenuContainsTarget(event) || constraintModalFooterContainsTarget(event)) {
        final Element dataTypeElement = getDataTypeRowElement(event);
        if (dataTypeElement != null) {
            highlight(dataTypeElement);
        }
        listShortcuts.focusIn();
    } else {
        reset();
    }
}
Also used : Element(elemental2.dom.Element) HTMLInputElement(elemental2.dom.HTMLInputElement)

Aggregations

Test (org.junit.Test)50 HTMLElement (elemental2.dom.HTMLElement)27 Event (elemental2.dom.Event)26 KeyboardEvent (elemental2.dom.KeyboardEvent)19 Element (elemental2.dom.Element)18 MouseEvent (elemental2.dom.MouseEvent)16 HTMLDivElement (elemental2.dom.HTMLDivElement)15 HTMLInputElement (elemental2.dom.HTMLInputElement)13 HTMLButtonElement (elemental2.dom.HTMLButtonElement)12 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)10 BlurEvent (com.google.gwt.event.dom.client.BlurEvent)7 CSSStyleDeclaration (elemental2.dom.CSSStyleDeclaration)7 JQuery (org.uberfire.client.views.pfly.selectpicker.JQuery)7 DOMRect (elemental2.dom.DOMRect)5 DOMTokenList (elemental2.dom.DOMTokenList)5 DomGlobal (elemental2.dom.DomGlobal)5 LazyReverseView (com.github.mvp4g.mvp4g2.core.ui.LazyReverseView)4 AbstractCell (com.google.gwt.cell.client.AbstractCell)4 Elements.button (org.jboss.gwt.elemento.core.Elements.button)4 Elements.div (org.jboss.gwt.elemento.core.Elements.div)4