@Override public void onBrowserEvent(Event event) { if (event.getType().equals(eventType)) { if (event.getEventTarget().equals(img)) { assertFalse("Expecting img to receive the event only once", imgReceived); imgReceived = true; } else if (event.getEventTarget().equals(parent)) { fail("Not expecting parent to receive the event"); } } }
@Override public void onBrowserEvent(Event event) { if (cancelled) { return; } assertEquals(eventType, event.getType()); if (event.getEventTarget().equals(child)) { assertFalse("Expecting child to receive the event only once", childReceived); childReceived = true; } else if (event.getEventTarget().equals(parent)) { fail("Not expecting parent to receive the event"); } }
/** {@inheritDoc} */ @Override public void onBrowserEvent(Event event) { super.onBrowserEvent(event); if ((event.getTypeInt() != Event.ONCLICK) && ((Element) event.getEventTarget().cast()).isOrHasChild(file.dom)) { button.onBrowserEvent(event); } }
protected void onTargetOver(Event ce) { if (disabled || !target.getElement().isOrHasChild(ce.getEventTarget().<Element>cast())) { return; } clearTimer("hide"); targetXY = new Point(ce.getClientX(), ce.getClientY()); delayShow(); }
/** Return the element that was the actual target of the element. */ private Element getEventTarget(Event e) { EventTarget eventTarget = e.getEventTarget(); if (!Element.is(eventTarget)) { return null; } return Element.as(eventTarget); }
private boolean searchResultsMouseOut(Event e) { Element targetEl = e.getEventTarget().cast(); GQuery $e = $(targetEl); if ($e.hasClass(css.activeResult()) || $e.parents("." + css.activeResult()).length() > 0) { resultClearHighlight(); } return false; }
private void choiceDestroyLinkClick(Event e) { e.preventDefault(); if (!isDisabled) { pendingDestroyClick = true; Element target = e.getEventTarget().cast(); choiceDestroy($(target)); } else { e.stopPropagation(); } }
private boolean containerMouseUp(Event e) { Element target = e.getEventTarget().cast(); GQuery $e = $(target); if (!$e.isEmpty() && "ABBR".equalsIgnoreCase($e.get(0).getNodeName()) && !isDisabled) { resultsReset(e); return false; } return true; }
private boolean testActiveClick(Event e) { Element target = e.getEventTarget().cast(); GQuery $e = $(target); if ($e.parents("#" + containerId).length() > 0) { activeField = true; } else { closeField(); } return false; }
private boolean searchResultsMouseUp(Event e) { Element targetEvent = e.getEventTarget().cast(); GQuery $e = $(targetEvent); GQuery target = $e.hasClass(css.activeResult()) ? $e : $e.parents("." + css.activeResult()).first(); if (!target.isEmpty()) { resultHighlight = target; resultSelect(e); } return false; }
@Override public void onBrowserEvent(Event event) { final com.google.gwt.dom.client.Element target = Element.as(event.getEventTarget()); for (int i = 0; i < count; i++) { if (aElements[i] == target) { onStarClicked(i); break; } } }
private boolean choicesClick(Event e) { e.preventDefault(); Element target = e.getEventTarget().cast(); GQuery $e = $(target); if (activeField && !($e.hasClass(css.searchChoice()) || !$e.parents("." + css.searchChoice()).isEmpty()) && !resultsShowing) { resultsShow(); } return false; }
/** * Blurs the time box if the user clicks outside of it. * * <p> * * @param event the native preview event */ protected void previewNativeEvent(NativePreviewEvent event) { Event nativeEvent = Event.as(event.getNativeEvent()); if ((nativeEvent.getTypeInt() == Event.ONCLICK)) { EventTarget target = nativeEvent.getEventTarget(); if (!Element.is(target)) { return; } Element element = Element.as(target); if (!m_time.getElement().isOrHasChild(element)) { m_time.blur(); } } }
@Override public void onBrowserEvent(Event event) { PerfTimer timer = PerfTimer.get(this, "onBrowserEvent"); Element target = Element.as(event.getEventTarget()); int index = getTargetItemIndex(target); if (index != -1) { // Don't need to support de-select since there is no gesture modifier Element.as(getElement().getChildNodes().getItem(selected)) .removeClassName(AppResources.INSTANCE.css().selected()); Element.as(getElement().getChildNodes().getItem(index)) .addClassName(AppResources.INSTANCE.css().selected()); SelectionEvent.fire(this, data.get(index)); this.selected = index; } timer.end(); }
@Override public void onBrowserEvent(Event event) { super.onBrowserEvent(event); switch (DOM.eventGetType(event)) { case Event.ONCONTEXTMENU: EventTarget target = event.getEventTarget(); Element svg = this.getElement().getElementsByTagName("svg").getItem(0); if (target.equals(svg)) { m_client.getContextMenu().showAt(this, event.getClientX(), event.getClientY()); event.preventDefault(); event.stopPropagation(); } break; case Event.ONMOUSEDOWN: break; case Event.ONMOUSEWHEEL: double delta = event.getMouseWheelVelocityY() / 30.0; double oldScale = m_scale; final double newScale = oldScale + delta; final int clientX = event.getClientX(); final int clientY = event.getClientY(); // broken now need to fix it // Command cmd = new Command() { // // public void execute() { // m_client.updateVariable(m_paintableId, "mapScale", newScale, false); // m_client.updateVariable(m_paintableId, "clientX", clientX, false); // m_client.updateVariable(m_paintableId, "clientY", clientY, false); // // m_client.sendPendingVariableChanges(); // } // }; // // if(BrowserInfo.get().isWebkit()) { // Scheduler.get().scheduleDeferred(cmd); // }else { // cmd.execute(); // } break; } }
@Override public boolean onEventPreview(Event event) { if (dragging) { onDragEvent(event); return false; } else if (resizing) { onResizeEvent(event); return false; } // TODO This is probably completely unnecessary as the modality curtain // prevents events from reaching other windows and any security check // must be done on the server side and not here. // The code here is also run many times as each VWindow has an event // preview but we cannot check only the current VWindow here (e.g. // if(isTopMost) {...}) because PopupPanel will cause all events that // are not cancelled here and target this window to be consume():d // meaning the event won't be sent to the rest of the preview handlers. if (getTopmostWindow().vaadinModality) { // Topmost window is modal. Cancel the event if it targets something // outside that window (except debug console...) if (DOM.getCaptureElement() != null) { // Allow events when capture is set return true; } final Element target = event.getEventTarget().cast(); if (!DOM.isOrHasChild(getTopmostWindow().getElement(), target)) { // not within the modal window, but let's see if it's in the // debug window Widget w = Util.findWidget(target, null); while (w != null) { if (w instanceof VDebugWindow) { return true; // allow debug-window clicks } else if (ConnectorMap.get(client).isConnector(w)) { return false; } w = w.getParent(); } return false; } } return true; }
@Override public void onBrowserEvent(Event event) { switch (DOM.eventGetType(event)) { case Event.ONCLICK: { // tabs can be closed by (a) middle mouse (anywhere), or (b) // left click on close element if (event.getButton() == Event.BUTTON_MIDDLE || (Element.as(event.getEventTarget()) == closeElement_ && event.getButton() == Event.BUTTON_LEFT)) { closeHandler_.onTabClose(); event.stopPropagation(); event.preventDefault(); } break; } } super.onBrowserEvent(event); }
private boolean containerMouseDown(Event e) { if (isDisabled) { return true; } Element target = e.getEventTarget().cast(); GQuery $e = $(target); boolean targetCloseLink = $e.hasClass(css.searchChoiceClose()); if (!resultsShowing) { e.stopPropagation(); } if (!pendingDestroyClick && !targetCloseLink) { if (!activeField) { if (isMultiple) { searchField.val(""); } $(document).click(clickTestAction); resultsShow(); } else if (!isMultiple && !$e.isEmpty() && ($e.get(0) == selectedItem.get(0) || $e.parents("a." + css.chznSingle()).length() > 0)) { e.preventDefault(); resultsToggle(); } activateField(e); } else { pendingDestroyClick = false; } return false; }