Java 类com.google.gwt.dom.client.EventTarget 实例源码

项目:unitimes    文件:TimetableGrid.java   
public void onBrowserEvent(Event event) {
    EventTarget related = event.getRelatedEventTarget();
    switch (DOM.eventGetType(event)) {
    case Event.ONCLICK:
        if (getCell().hasId() && getCell().getType() == TimetableGridCell.Type.Class) {
            UniTimeFrameDialog.openDialog(MESSAGES.dialogSuggestions(), "suggestions.do?id=" + getCell().getId() + "&op=Reset","900","90%");
            select(false);
        }
        break;
    case Event.ONMOUSEOVER:
        if (related == null || !getElement().isOrHasChild((Element)related.cast())) {
            select(true);
        }
        break;
    case Event.ONMOUSEOUT:
        if (related == null || !getElement().isOrHasChild((Element)related.cast())) {
            select(false);
        }
        break;
    }

    super.onBrowserEvent(event);
}
项目:TreeGridGWT    文件:ExpandableCell.java   
/**
 * Called when an event occurs in a rendered instance of this Cell. The
 * parent element refers to the element that contains the rendered cell, NOT
 * to the outermost element that the Cell rendered.
 */
@Override
public void onBrowserEvent(com.google.gwt.cell.client.Cell.Context context,
        Element parent, String value, NativeEvent event,
        com.google.gwt.cell.client.ValueUpdater<String> valueUpdater) {

    // Let AbstractCell handle the keydown event.
    super.onBrowserEvent(context, parent, value, event, valueUpdater);

    // Handle the click event.
    if ("click".equals(event.getType())) {

        // Ignore clicks that occur outside of the outermost element.
        EventTarget eventTarget = event.getEventTarget();

        if (parent.isOrHasChild(Element.as(eventTarget))) {
            Element el = Element.as(eventTarget);
            if (el.getNodeName().equalsIgnoreCase("IMG")) {
                doAction(el.getParentElement().getAttribute("name"),
                        valueUpdater);
            }
        }
    }
}
项目:unitime    文件:TimetableGrid.java   
public void onBrowserEvent(Event event) {
    EventTarget related = event.getRelatedEventTarget();
    switch (DOM.eventGetType(event)) {
    case Event.ONCLICK:
        if (getCell().hasId() && getCell().getType() == TimetableGridCell.Type.Class) {
            UniTimeFrameDialog.openDialog(MESSAGES.dialogSuggestions(), "suggestions.do?id=" + getCell().getId() + "&op=Reset","900","90%");
            select(false);
        }
        break;
    case Event.ONMOUSEOVER:
        if (related == null || !getElement().isOrHasChild((Element)related.cast())) {
            select(true);
        }
        break;
    case Event.ONMOUSEOUT:
        if (related == null || !getElement().isOrHasChild((Element)related.cast())) {
            select(false);
        }
        break;
    }

    super.onBrowserEvent(event);
}
项目:appformer    文件:IconCell.java   
@Override
public void onBrowserEvent(final Context context,
                           final Element parent,
                           final String value,
                           final NativeEvent event,
                           final ValueUpdater<String> valueUpdater) {
    super.onBrowserEvent(context,
                         parent,
                         value,
                         event,
                         valueUpdater);
    if (CLICK.equals(event.getType())) {
        EventTarget eventTarget = event.getEventTarget();
        if (!Element.is(eventTarget)) {
            return;
        }
        if (parent.getFirstChildElement().isOrHasChild(Element.as(eventTarget))) {
            // Ignore clicks that occur outside of the main element.
            onEnterKeyDown(context,
                           parent,
                           value,
                           event,
                           valueUpdater);
        }
    }
}
项目:platypus-js    文件:DraggableHeader.java   
@Override
public void onBrowserEvent(Context context, Element targetCell, NativeEvent event) {
    if (BrowserEvents.DRAGSTART.equals(event.getType())) {
        event.stopPropagation();
        EventTarget et = event.getEventTarget();
        if (Element.is(et)) {
            DraggedColumn<?> col = new DraggedColumn<>(column, this, table, targetCell, Element.as(et));
            if ((col.isMove() && moveable) || (col.isResize() && resizable)) {
                event.getDataTransfer().<XDataTransfer> cast().setEffectAllowed("move");
                DraggedColumn.instance = col;
                event.getDataTransfer().setData(
                        "Text",
                        (table != null ? "grid-section-" + table.hashCode() : "not leaf") + "; column-" + (DraggedColumn.instance.isMove() ? "moved" : "resized")
                                + (table != null ? ":" + table.getColumnIndex(column) : ""));
            } else {
                event.getDataTransfer().<XDataTransfer> cast().setEffectAllowed("none");
            }
        }
    }
    super.onBrowserEvent(context, targetCell, event);
}
项目:platypus-js    文件:AutoCloseBox.java   
/**
 * Does the event target one of the partner elements?
 * 
 * @param event
 *            the native event
 * @return true if the event targets a partner
 */
private boolean eventTargetsPartner(NativeEvent event) {
    if (autoHidePartners == null) {
        return false;
    }

    EventTarget target = event.getEventTarget();
    if (Element.is(target)) {
        for (Element elem : autoHidePartners) {
            if (elem.isOrHasChild(Element.as(target))) {
                return true;
            }
        }
    }
    return false;
}
项目:TreeGridGWT    文件:ExpandableCell.java   
/**
 * Called when an event occurs in a rendered instance of this Cell. The
 * parent element refers to the element that contains the rendered cell, NOT
 * to the outermost element that the Cell rendered.
 */
@Override
public void onBrowserEvent(com.google.gwt.cell.client.Cell.Context context,
        Element parent, String value, NativeEvent event,
        com.google.gwt.cell.client.ValueUpdater<String> valueUpdater) {

    // Let AbstractCell handle the keydown event.
    super.onBrowserEvent(context, parent, value, event, valueUpdater);

    // Handle the click event.
    if ("click".equals(event.getType())) {

        // Ignore clicks that occur outside of the outermost element.
        EventTarget eventTarget = event.getEventTarget();

        if (parent.isOrHasChild(Element.as(eventTarget))) {
            Element el = Element.as(eventTarget);
            if (el.getNodeName().equalsIgnoreCase("IMG")) {
                doAction(el.getParentElement().getAttribute("name"),
                        valueUpdater);
            }
        }
    }
}
项目:opennmszh    文件:TopologyViewImpl.java   
@Override
public void onBrowserEvent(final Event event) {
    super.onBrowserEvent(event);
    switch(DOM.eventGetType(event)) {
        case Event.ONCONTEXTMENU:

            EventTarget target = event.getEventTarget();

            if (target.equals( getSVGElement() )) {
                m_presenter.onContextMenu(null, event.getClientX(), event.getClientY(), "map");
            }
            event.preventDefault();
            event.stopPropagation();
            break;


        case Event.ONCLICK:
            if(event.getEventTarget().equals(getSVGElement())) {
                m_presenter.onBackgroundClick();
            }
            event.preventDefault();
            event.stopPropagation();
            break;

    }


}
项目:touchkit    文件:PopoverConnector.java   
@Override
public void onPreviewNativeEvent(NativePreviewEvent event) {
    EventTarget target = event.getNativeEvent().getEventTarget();
    Element targetElement = null;
    if (Element.is(target)) {
        targetElement = Element.as(target);
    }

    if (getWidget().getModalityCurtain().isOrHasChild(targetElement)
            && getWidget().isClosable()
            && (event.getTypeInt() & ACCEPTEDEVENTS) == 0) {
        /*
         * Close on events outside window. Special handling for mousemove
         * etc to aid compatibility with desktop (testing purposes).
         */
        rpc.close();
    }
}
项目:empiria.player    文件:AccessibleRadioButton.java   
/**
 * 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);
}
项目:calendar-component    文件:DateCellDayItem.java   
@Override
public void onMouseUp(MouseUpEvent event) {
    if (mouseMoveCanceled
            || event.getNativeButton() != NativeEvent.BUTTON_LEFT) {
        return;
    }

    Event.releaseCapture(getElement());
    setFocus(false);
    if (moveRegistration != null) {
        moveRegistration.removeHandler();
        moveRegistration = null;
    }

    int endX = event.getClientX();
    int endY = event.getClientY();
    int xDiff = 0, yDiff = 0;
    if (startX != -1 && startY != -1) {
        // Drag started
        xDiff = startX - endX;
        yDiff = startY - endY;
    }

    startX = -1;
    startY = -1;
    mouseMoveStarted = false;
    Style s = getElement().getStyle();
    s.setZIndex(1);

    if (!clickTargetsResize()) {

        // check if mouse has moved over threshold of 3 pixels
        boolean mouseMoved = (xDiff < -3 || xDiff > 3 || yDiff < -3 || yDiff > 3);

        if (!weekGrid.getCalendar().isDisabled() && mouseMoved) {
            // Item Move:
            // - calendar must be enabled
            // - calendar must not be in read-only mode
            weekGrid.itemMoved(this);

        } else if (!weekGrid.getCalendar().isDisabled() && getCalendarItem().isClickable()) {
            // Item Click:
            // - calendar must be enabled (read-only is allowed)
            EventTarget et = event.getNativeEvent().getEventTarget();
            Element e = Element.as(et);
            if (e == caption || e == eventContent
                    || e.getParentElement() == caption) {
                if (weekGrid.getCalendar().getItemClickListener() != null) {
                    weekGrid.getCalendar().getItemClickListener().itemClick(calendarItem);
                }
            }
        }

    } else {
        // click targeted resize bar
        removeGlobalResizeStyle();
        if (weekGrid.getCalendar().getItemResizeListener() != null) {
            weekGrid.getCalendar().getItemResizeListener().itemResized(calendarItem);
        }
        dateCell.recalculateItemWidths();
    }
}
项目:cuba    文件:CubaGridKeyPressEvent.java   
@Override
public Grid<?> getGrid() {
    EventTarget target = getNativeEvent().getEventTarget();
    if (!Element.is(target)) {
        return null;
    }
    return WidgetUtil.findWidget(Element.as(target), CubaGridWidget.class);
}
项目:cuba    文件:CubaGridClickEvent.java   
@Override
public Grid<?> getGrid() {
    EventTarget target = getNativeEvent().getEventTarget();
    if (!Element.is(target)) {
        return null;
    }
    return WidgetUtil.findWidget(Element.as(target), CubaGridWidget.class);
}
项目:cuba    文件:CubaGridDoubleClickEvent.java   
@Override
public Grid<?> getGrid() {
    EventTarget target = getNativeEvent().getEventTarget();
    if (!Element.is(target)) {
        return null;
    }
    return WidgetUtil.findWidget(Element.as(target), CubaGridWidget.class);
}
项目:cuba    文件:CubaGridKeyDownEvent.java   
@Override
public Grid<?> getGrid() {
    EventTarget target = getNativeEvent().getEventTarget();
    if (!Element.is(target)) {
        return null;
    }
    return WidgetUtil.findWidget(Element.as(target), CubaGridWidget.class);
}
项目:cuba    文件:CubaGridKeyUpEvent.java   
@Override
public Grid<?> getGrid() {
    EventTarget target = getNativeEvent().getEventTarget();
    if (!Element.is(target)) {
        return null;
    }
    return WidgetUtil.findWidget(Element.as(target), CubaGridWidget.class);
}
项目:cuba    文件:CubaSuggestionFieldWidget.java   
protected void handleOnBlur(BlurEvent event) {
    removeStyleName(MODIFIED_STYLENAME);

    if (BrowserInfo.get().isIE()) {
        if (iePreventBlur) {
            textField.setFocus(true);
            iePreventBlur = false;
        } else {
            resetComponentState();
        }
    } else {
        if (!suggestionsPopup.isShowing()) {
            resetComponentState();
            return;
        }

        EventTarget eventTarget = event.getNativeEvent().getRelatedEventTarget();
        if (eventTarget == null) {
            resetComponentState();
            return;
        }

        if (Element.is(eventTarget)) {
            Widget widget = WidgetUtil.findWidget(Element.as(eventTarget), null);
            if (widget != suggestionsContainer) {
                resetComponentState();
            }
        }
    }
}
项目:tree-grid    文件:TreeGridClickEvent.java   
@Override
public TreeGrid getGrid() {
    // Copied from AbstractGridMouseEvent.getGrid() and changed to find TreeGrid class
    EventTarget target = getNativeEvent().getEventTarget();
    if (!Element.is(target)) {
        return null;
    }
    return WidgetUtil.findWidget(Element.as(target), TreeGrid.class);
}
项目:tree-grid    文件:TreeGridClickEvent.java   
@Override
protected void dispatch(AbstractGridMouseEventHandler.GridClickHandler handler) {
    EventTarget target = getNativeEvent().getEventTarget();
    if (!Element.is(target)) {
        // Target is not an element
        return;
    }

    Grid<?> grid = getGrid();
    if (grid == null) {
        // Target is not an element of a grid
        return;
    }

    // Ignore event if originated from child widget
    // except when from hierarchy widget
    Element targetElement = Element.as(target);
    if (getGrid().isElementInChildWidget(targetElement) &&
            !HierarchyRenderer.isElementInHierarchyWidget(targetElement)) {
        return;
    }

    final RowContainer container = getGrid().getEscalator().findRowContainer(targetElement);
    if (container == null) {
        // No container for given element
        return;
    }

    GridConstants.Section section = GridConstants.Section.FOOTER;
    if (container == getGrid().getEscalator().getHeader()) {
        section = GridConstants.Section.HEADER;
    } else if (container == getGrid().getEscalator().getBody()) {
        section = GridConstants.Section.BODY;
    }

    doDispatch(handler, section);
}
项目:gwt-material-table    文件:AbstractDataTable.java   
@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;
    }
}
项目:wte4j    文件:PopupCell.java   
@Override
public void onBrowserEvent(Cell.Context context, Element parent, T value,
        NativeEvent event, ValueUpdater<T> valueUpdater) {
    contentCell.onBrowserEvent(context, parent, value, event, valueUpdater);
    EventTarget eventTarget = event.getEventTarget();
    if (!BrowserEvents.CLICK.equals(event.getType())) {
        return;
    }
    final Element domElement = Element.as(eventTarget);
    popupPanel.setPopupPositionAndShow(new PositionCallback() {
        @Override
        public void setPosition(int offsetWidth, int offsetHeight) {

            int positionLeft = domElement.getAbsoluteLeft();
            int outerleft = domElement.getAbsoluteLeft() + popupPanel.getOffsetWidth();
            if (outerleft > Window.getClientWidth()) {
                positionLeft = domElement.getAbsoluteLeft() - popupPanel.getOffsetWidth() + domElement.getOffsetWidth();
            }

            int positionTop = domElement.getAbsoluteTop();
            int outerTop = domElement.getAbsoluteTop() + popupPanel.getOffsetWidth();
            if (outerTop > Window.getClientHeight()) {
                positionTop = domElement.getAbsoluteTop() - popupPanel.getOffsetHeight() + domElement.getOffsetHeight();
            }
            popupPanel.setPopupPosition(positionLeft, positionTop);
        }
    });
}
项目:dataworks-zeus    文件:FileTreeGrid.java   
@Override
protected void onClick(Event event) {
  super.onClick(event);
  EventTarget eventTarget = event.getEventTarget();
  if (Element.is(eventTarget)) {
    FileModel m = store.get(getView().findRowIndex(Element.as(eventTarget)));
    if (m == null) {
      getSelectionModel().deselectAll();
    }
  }
}
项目:aggregate    文件:UIEnabledActionCell.java   
@Override
public void onBrowserEvent(Context context, Element parent, T value, NativeEvent event,
    ValueUpdater<T> valueUpdater) {
  super.onBrowserEvent(context, parent, value, event, valueUpdater);
  if ("click".equals(event.getType())) {
    EventTarget eventTarget = event.getEventTarget();
    if (!Element.is(eventTarget)) {
      return;
    }
    if (parent.getFirstChildElement().isOrHasChild(Element.as(eventTarget))) {
      // Ignore clicks that occur outside of the main element.
      onEnterKeyDown(context, parent, value, event, valueUpdater);
    }
  }
}
项目:vaadin-sliderpanel    文件:VSliderPanel.java   
/**
 * checks whether the event comes from an element within the slider dom tree
 * 
 * @param event NativeEvent
 * @return true when events comes from within
 */
private boolean eventTargetsPopup(NativeEvent event) {
    EventTarget target = event.getEventTarget();
    if (Element.is(target)) {
        return getElement().isOrHasChild(Element.as(target));
    }
    return false;
}
项目:vaadin-sliderpanel    文件:VSliderPanel.java   
/**
 * checks whether the event come's from a elements that lays visually within the slider<br>
 * it doesn't lay directly in the dom tree - for example dropdown popups
 * 
 * @param event NativeEvent
 * @return true when events comes from within
 */
private boolean eventTargetsInnerElementsPopover(NativeEvent event) {
    EventTarget target = event.getEventTarget();
    if (Element.is(target)) {
        Element targetElement = Element.as(target);

        int absoluteLeft = targetElement.getAbsoluteLeft();
        int absoluteTop = targetElement.getAbsoluteTop();

        return contentNode.getAbsoluteLeft() <= absoluteLeft && contentNode.getAbsoluteRight() >= absoluteLeft && contentNode.getAbsoluteTop() <= absoluteTop
                && contentNode.getAbsoluteBottom() >= absoluteTop;
    }
    return false;
}
项目:che    文件:NativeTreeEvent.java   
/**
 * Returns <code>true</code> if the target of this event equals or is a child of the given
 * element.
 *
 * @param element the element
 * @param toElement true to use {@link com.google.gwt.user.client.Event#getRelatedEventTarget()}
 * @return the within state
 */
public final boolean within(Element element, boolean toElement) {
  if (Element.is(element)) {
    EventTarget target = toElement ? getRelatedEventTarget() : getEventTarget();
    if (Element.is(target)) {
      return element.isOrHasChild((Element) target.cast());
    }
  }
  return false;
}
项目:platypus-js    文件:AutoCloseBox.java   
/**
 * Does the event target this popup?
 * 
 * @param event
 *            the native event
 * @return true if the event targets the popup
 */
private boolean eventTargetsPopup(NativeEvent event) {
    EventTarget target = event.getEventTarget();
    if (Element.is(target)) {
        return getElement().isOrHasChild(Element.as(target));
    }
    return false;
}
项目:rtgov-ui    文件:CallTraceWidget.java   
/**
 * @see com.google.gwt.user.client.ui.Widget#onBrowserEvent(com.google.gwt.user.client.Event)
 */
@Override
public void onBrowserEvent(Event event) {
    super.onBrowserEvent(event);
    EventTarget target = event.getEventTarget();
    Element elem = (Element) target.cast();
    String nodeId = elem.getAttribute("data-nodeid"); //$NON-NLS-1$

    if (nodeMap.containsKey(nodeId)) {
        TraceNodeBean bean = nodeMap.get(nodeId);
        SelectionEvent.fire(this, bean);
    }
}
项目:zeus3    文件:FileTreeGrid.java   
@Override
protected void onClick(Event event) {
  super.onClick(event);
  EventTarget eventTarget = event.getEventTarget();
  if (Element.is(eventTarget)) {
    FileModel m = store.get(getView().findRowIndex(Element.as(eventTarget)));
    if (m == null) {
      getSelectionModel().deselectAll();
    }
  }
}
项目:gwt-gantt    文件:TaskGridNameCell1.java   
private void editEvent(Context context, Element parent, ViewData viewData,
                NativeEvent event, ValueUpdater<TaskGridNameCellDetails> valueUpdater) {
        String type = event.getType();
        boolean keyUp = "keyup".equals(type);
        boolean keyDown = "keydown".equals(type);
        if (keyUp || keyDown) {
                int keyCode = event.getKeyCode();
                if (keyUp && keyCode == KeyCodes.KEY_ENTER) {
                        // Commit the change.
                        commit(context, parent, viewData, valueUpdater);
                } else if (keyUp && keyCode == KeyCodes.KEY_ESCAPE) {
                        // Cancel edit mode.
                        TaskGridNameCellDetails originalText = viewData.getTask();
                        if (viewData.isEditingAgain()) {
                                viewData.setText(originalText.getName());
                                viewData.setEditing(false);
                        } else {
                                setViewData(context.getKey(), null);
                        }
                        cancel(context, parent, originalText);
                } else {
                        // Update the text in the view data on each key.
                        updateViewData(parent, viewData, true);
                }
        } else if ("blur".equals(type)) {
                // Commit the change. Ensure that we are blurring the input element
                // and
                // not the parent element itself.
                EventTarget eventTarget = event.getEventTarget();
                if (Element.is(eventTarget)) {
                        Element target = Element.as(eventTarget);
                        if ("input".equals(target.getTagName().toLowerCase())) {
                                commit(context, parent, viewData, valueUpdater);
                        }
                }
        }
}
项目:gwt-gantt    文件:CellTextImpl.java   
private void editEvent(Context context, Element parent, ViewData viewData,
    NativeEvent event, ValueUpdater<String> valueUpdater) {
  String type = event.getType();
  boolean keyUp = "keyup".equals(type);
  boolean keyDown = "keydown".equals(type);
  if (keyUp || keyDown) {
    int keyCode = event.getKeyCode();
    if (keyUp && keyCode == KeyCodes.KEY_ENTER) {
      // Commit the change.
      commit(context, parent, viewData, valueUpdater);
    } else if (keyUp && keyCode == KeyCodes.KEY_ESCAPE) {
      // Cancel edit mode.
      String originalText = viewData.getOriginal();
      if (viewData.isEditingAgain()) {
        viewData.setText(originalText);
        viewData.setEditing(false);
      } else {
        setViewData(context.getKey(), null);
      }
      cancel(context, parent, originalText);
    } else {
      // Update the text in the view data on each key.
      updateViewData(parent, viewData, true);
    }
  } else if ("blur".equals(type)) {
    // Commit the change. Ensure that we are blurring the input element and
    // not the parent element itself.
    EventTarget eventTarget = event.getEventTarget();
    if (Element.is(eventTarget)) {
      Element target = Element.as(eventTarget);
      if ("input".equals(target.getTagName().toLowerCase())) {
        commit(context, parent, viewData, valueUpdater);
      }
    }
  }
}
项目:gwt-gantt    文件:TaskGridNameCell.java   
private void editEvent(Context context, Element parent, ViewData viewData,
                NativeEvent event, ValueUpdater<Task> valueUpdater) {
        String type = event.getType();
        boolean keyUp = "keyup".equals(type);
        boolean keyDown = "keydown".equals(type);
        if (keyUp || keyDown) {
                int keyCode = event.getKeyCode();
                if (keyUp && keyCode == KeyCodes.KEY_ENTER) {
                        // Commit the change.
                        commit(context, parent, viewData, valueUpdater);
                } else if (keyUp && keyCode == KeyCodes.KEY_ESCAPE) {
                        // Cancel edit mode.
                        Task originalText = viewData.getTask();
                        if (viewData.isEditingAgain()) {
                                viewData.setText(originalText.getName());
                                viewData.setEditing(false);
                        } else {
                                setViewData(context.getKey(), null);
                        }
                        cancel(context, parent, originalText);
                } else {
                        // Update the text in the view data on each key.
                        updateViewData(parent, viewData, true);
                }
        } else if ("blur".equals(type)) {
                // Commit the change. Ensure that we are blurring the input element
                // and
                // not the parent element itself.
                EventTarget eventTarget = event.getEventTarget();
                if (Element.is(eventTarget)) {
                        Element target = Element.as(eventTarget);
                        if ("input".equals(target.getTagName().toLowerCase())) {
                                commit(context, parent, viewData, valueUpdater);
                        }
                }
        }
}
项目:zico    文件:HostListPanel.java   
@Override
public void onBrowserEvent(Context context, Element parent, HostListObject v,
                           NativeEvent event, ValueUpdater<HostListObject> valueUpdater) {
    super.onBrowserEvent(context, parent, v, event, valueUpdater);
    EventTarget eventTarget = event.getEventTarget();
    if (v instanceof HostGroup && Element.is(eventTarget)) {
        Element target = eventTarget.cast();
        if ("IMG".equalsIgnoreCase(target.getTagName())) {
            ((HostGroup)v).toggleExpanded();
            redrawHostList();
        }
    }
}
项目:zico    文件:TraceCallTreePanel.java   
@Override
public void onBrowserEvent(Context context, Element parent, TraceRecordInfo rec,
                           NativeEvent event, ValueUpdater<TraceRecordInfo> valueUpdater) {
    super.onBrowserEvent(context, parent, rec, event, valueUpdater);
    EventTarget eventTarget = event.getEventTarget();
    if (Element.is(eventTarget)) {
        Element target = eventTarget.cast();
        if ("IMG".equalsIgnoreCase(target.getTagName())) {
            toggleSubtree(rec);
        }
    }
}
项目:avro-ui    文件:FormPopup.java   
private boolean isCaptionEvent(NativeEvent event) {
    EventTarget target = event.getEventTarget();
    if (Element.is(target)) {
        com.google.gwt.dom.client.Element element = Element.as(target);
        if (decPanel.getElement().isOrHasChild(element)) {
            String tag = element.getTagName();
            String className = element.getClassName();
            if (tag.equalsIgnoreCase("tr")) {
                if ("top".equalsIgnoreCase(className)) {
                    return true;
                }
            } else if (tag.equalsIgnoreCase("td")) {
                if ("topLeft".equalsIgnoreCase(className)
                        || "topCenter".equalsIgnoreCase(className)
                        || "topRight".equalsIgnoreCase(className)) {
                    return true;
                }
            } else if (tag.equalsIgnoreCase("div")) {
                if ("topLeftInner".equalsIgnoreCase(className)
                        || "topCenterInner".equalsIgnoreCase(className)
                        || "topRightInner".equalsIgnoreCase(className)) {
                    return true;
                }
            }
        }
    }
    return false;
}
项目:putnami-web-toolkit    文件:SimpleDropdown.java   
private boolean eventTargetsDropDown(NativePreviewEvent event) {
    Event nativeEvent = Event.as(event.getNativeEvent());
    EventTarget target = nativeEvent.getEventTarget();
    if (Element.is(target)) {
        return this.getElement().isOrHasChild(Element.as(target));
    }
    return false;
}
项目:putnami-web-toolkit    文件:CompositeFocusHelper.java   
private boolean eventTargetsContainerOrPartner(NativePreviewEvent event) {
    Event nativeEvent = Event.as(event.getNativeEvent());
    EventTarget target = nativeEvent.getEventTarget();
    if (Element.is(target)) {
        return this.isOrHasChildOfContainerOrPartner(Element.as(target));
    }
    return false;
}
项目:putnami-web-toolkit    文件:InputBoolean.java   
private boolean eventTargetsLabelOrChild(DomEvent<?> event) {
    Event nativeEvent = Event.as(event.getNativeEvent());
    EventTarget target = nativeEvent.getEventTarget();
    if (Element.is(target)) {
        return this.labelElement.isOrHasChild(Element.as(target));
    }
    return false;
}
项目:edal-java    文件:DialogBoxWithCloseButton.java   
/**
 * Function checks if event was inside a given widget
 * 
 * @param event
 *            - current event
 * @param w
 *            - widget to prove if event was inside
 * @return - true if event inside the given widget
 */
protected boolean isWidgetEvent(NativeEvent event, Widget w) {
    EventTarget target = event.getEventTarget();

    if (Element.is(target)) {
        boolean t = w.getElement().isOrHasChild(Element.as(target));
        // GWT.log("isWidgetEvent:" + w + ':' + target + ':' + t);
        return t;
    }
    return false;
}
项目:geomajas-project-client-gwt    文件:AbstractGraphicsController.java   
@Override
public Element getTarget(HumanInputEvent<?> event) {
    EventTarget target = event.getNativeEvent().getEventTarget();
    if (Element.is(target)) {
        return Element.as(target);
    }
    return null;
}