当前位置: 首页>>代码示例>>Java>>正文


Java Event.getEventTarget方法代码示例

本文整理汇总了Java中com.google.gwt.user.client.Event.getEventTarget方法的典型用法代码示例。如果您正苦于以下问题:Java Event.getEventTarget方法的具体用法?Java Event.getEventTarget怎么用?Java Event.getEventTarget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.gwt.user.client.Event的用法示例。


在下文中一共展示了Event.getEventTarget方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onEventPreview

import com.google.gwt.user.client.Event; //导入方法依赖的package包/类
@Override
public boolean onEventPreview(Event event) {
    int type = DOM.eventGetType(event);

    if ((type == Event.ONCLICK || type == Event.ONTOUCHEND)
            && event.getEventTarget() != null) {
        Element target = Element.as(event.getEventTarget());
        if (target.getClassName() != null && target.getClassName().contains(CUBA_NOTIFICATION_MODALITY_CURTAIN)) {
            hide();
            return false;
        }
    }

    if (type == Event.ONKEYDOWN && event.getKeyCode() == KeyCodes.KEY_ESCAPE) {
        if (!getElement().getClassName().contains(TRAY_STYLE)) {
            hide();
            return false;
        }
    }

    return super.onEventPreview(event);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:23,代码来源:CubaNotification.java

示例2: onBrowserEvent

import com.google.gwt.user.client.Event; //导入方法依赖的package包/类
/**
 * Overridden to send ValueChangeEvents only when appropriate.
 */
@Override
public void onBrowserEvent(Event event) {
    switch (DOM.eventGetType(event)) {
        case Event.ONMOUSEUP:
        case Event.ONBLUR:
        case Event.ONKEYDOWN:
            // Note the old value for onValueChange purposes (in ONCLICK case)
            oldValue = getValue();
            break;

        case Event.ONCLICK:
            EventTarget target = event.getEventTarget();
            if (Element.is(target) && labelElem.isOrHasChild(Element.as(target))) {

                // They clicked the label. Note our pre-click value, and
                // short circuit event routing so that other click handlers
                // don't hear about it
                oldValue = getValue();
                return;
            }

            // It's not the label. Let our handlers hear about the
            // click...
            super.onBrowserEvent(event);
            // ...and now maybe tell them about the change
            ValueChangeEvent.fireIfNotEqual(AccessibleRadioButton.this, oldValue, getValue());
            return;
    }

    super.onBrowserEvent(event);
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:35,代码来源:AccessibleRadioButton.java

示例3: onBrowserEvent

import com.google.gwt.user.client.Event; //导入方法依赖的package包/类
@Override
public void onBrowserEvent(Event event) {
    CellBasedWidgetImpl.get().onBrowserEvent(this, event);

    // Ignore spurious events (such as onblur) while we refresh the table.
    if (refreshing) {
        return;
    }

    // Verify that the target is still a child of this widget. IE fires focus
    // events even after the element has been removed from the DOM.
    EventTarget eventTarget = event.getEventTarget();
    if (!Element.is(eventTarget)) {
        return;
    }
    Element target = Element.as(eventTarget);
    if (!getElement().isOrHasChild(Element.as(eventTarget))) {
        return;
    }
    super.onBrowserEvent(event);

    String eventType = event.getType();
    if (BrowserEvents.FOCUS.equals(eventType)) {
        // Remember the focus state.
        focused = true;
        onFocus();
    } else if (BrowserEvents.BLUR.equals(eventType)) {
        // Remember the blur state.
        focused = false;
        onBlur();
    } else if (BrowserEvents.KEYDOWN.equals(eventType)) {
        // A key event indicates that we already have focus.
        focused = true;
    } else if (BrowserEvents.MOUSEDOWN.equals(eventType)
            && CellBasedWidgetImpl.get().isFocusable(Element.as(target))) {
        // If a natively focusable element was just clicked, then we must have
        // focus.
        focused = true;
    }
}
 
开发者ID:GwtMaterialDesign,项目名称:gwt-material-table,代码行数:41,代码来源:AbstractDataTable.java


注:本文中的com.google.gwt.user.client.Event.getEventTarget方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。