Java Code Examples for com.google.gwt.user.client.DOM#eventGetTarget()
The following examples show how to use
com.google.gwt.user.client.DOM#eventGetTarget() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VComboBoxMultiselect.java From vaadin-combobox-multiselect with Apache License 2.0 | 6 votes |
@Override public void onBrowserEvent(Event event) { debug("VComboBoxMultiselect.SP: onBrowserEvent()"); if (event.getTypeInt() == Event.ONCLICK) { final Element target = DOM.eventGetTarget(event); if (target == this.up || target == DOM.getChild(this.up, 0)) { this.lazyPageScroller.scrollUp(); } else if (target == this.down || target == DOM.getChild(this.down, 0)) { this.lazyPageScroller.scrollDown(); } } /* * Prevent the keyboard focus from leaving the textfield by * preventing the default behaviour of the browser. Fixes #4285. */ handleMouseDownEvent(event); }
Example 2
Source File: ExtendedFlexTable.java From document-management-system with GNU General Public License v2.0 | 6 votes |
/** * Method originally copied from HTMLTable superclass where it was defined private * Now implemented differently to only return target cell if it'spart of 'this' table */ private Element getMouseEventTargetCell(Event event) { Element td = DOM.eventGetTarget(event); //locate enclosing td element while (!DOM.getElementProperty(td, "tagName").equalsIgnoreCase("td")) { // If we run out of elements, or run into the table itself, then give up. if ((td == null) || td == getElement()) return null; td = DOM.getParent(td); } //test if the td is actually from this table Element tr = DOM.getParent(td); Element body = DOM.getParent(tr); if (body == this.getBodyElement()) { return td; } //Didn't find appropriate cell return null; }
Example 3
Source File: ExtendedFlexTable.java From document-management-system with GNU General Public License v2.0 | 6 votes |
/** * Method originally copied from HTMLTable superclass where it was defined private * Now implemented differently to only return target cell if it'spart of 'this' table */ private Element getMouseEventTargetCell(Event event) { Element td = DOM.eventGetTarget(event); //locate enclosing td element while (!DOM.getElementProperty(td, "tagName").equalsIgnoreCase("td")) { // If we run out of elements, or run into the table itself, then give up. if ((td == null) || td == getElement()) return null; td = DOM.getParent(td); } //test if the td is actually from this table Element tr = DOM.getParent(td); Element body = DOM.getParent(tr); if (body == this.getBodyElement()) { return td; } //Didn't find appropriate cell return null; }
Example 4
Source File: ExtendedFlexTable.java From document-management-system with GNU General Public License v2.0 | 6 votes |
/** * Method originally copied from HTMLTable superclass where it was defined private * Now implemented differently to only return target cell if it'spart of 'this' table */ private Element getMouseEventTargetCell(Event event) { Element td = DOM.eventGetTarget(event); //locate enclosing td element while (!DOM.getElementProperty(td, "tagName").equalsIgnoreCase("td")) { // If we run out of elements, or run into the table itself, then give up. if ((td == null) || td == getElement()) return null; td = DOM.getParent(td); } //test if the td is actually from this table Element tr = DOM.getParent(td); Element body = DOM.getParent(tr); if (body == this.getBodyElement()) { return td; } //Didn't find appropriate cell return null; }
Example 5
Source File: ExtendedFlexTable.java From document-management-system with GNU General Public License v2.0 | 6 votes |
/** * Method originally copied from HTMLTable superclass where it was defined private * Now implemented differently to only return target cell if it'spart of 'this' table */ private Element getMouseEventTargetCell(Event event) { Element td = DOM.eventGetTarget(event); //locate enclosing td element while (!DOM.getElementProperty(td, "tagName").equalsIgnoreCase("td")) { // If we run out of elements, or run into the table itself, then give up. if ((td == null) || td == getElement()) return null; td = DOM.getParent(td); } //test if the td is actually from this table Element tr = DOM.getParent(td); Element body = DOM.getParent(tr); if (body == this.getBodyElement()) { return td; } //Didn't find appropriate cell return null; }
Example 6
Source File: ExtendedFlexTable.java From document-management-system with GNU General Public License v2.0 | 6 votes |
/** * Method originally copied from HTMLTable superclass where it was defined private * Now implemented differently to only return target cell if it'spart of 'this' table */ private Element getMouseEventTargetCell(Event event) { Element td = DOM.eventGetTarget(event); //locate enclosing td element while (!DOM.getElementProperty(td, "tagName").equalsIgnoreCase("td")) { // If we run out of elements, or run into the table itself, then give up. if ((td == null) || td == getElement()) return null; td = DOM.getParent(td); } //test if the td is actually from this table Element tr = DOM.getParent(td); Element body = DOM.getParent(tr); if (body == this.getBodyElement()) { return td; } //Didn't find appropriate cell return null; }
Example 7
Source File: ExtendedFlexTable.java From document-management-system with GNU General Public License v2.0 | 6 votes |
/** * Method originally copied from HTMLTable superclass where it was defined private * Now implemented differently to only return target cell if it'spart of 'this' table */ private Element getMouseEventTargetCell(Event event) { Element td = DOM.eventGetTarget(event); //locate enclosing td element while (!DOM.getElementProperty(td, "tagName").equalsIgnoreCase("td")) { // If we run out of elements, or run into the table itself, then give up. if ((td == null) || td == getElement()) return null; td = DOM.getParent(td); } //test if the td is actually from this table Element tr = DOM.getParent(td); Element body = DOM.getParent(tr); if (body == this.getBodyElement()) { return td; } //Didn't find appropriate cell return null; }
Example 8
Source File: ExtendedFlexTable.java From document-management-system with GNU General Public License v2.0 | 6 votes |
/** * Method originally copied from HTMLTable superclass where it was defined private * Now implemented differently to only return target cell if it'spart of 'this' table */ private Element getMouseEventTargetCell(Event event) { Element td = DOM.eventGetTarget(event); //locate enclosing td element while (!DOM.getElementProperty(td, "tagName").equalsIgnoreCase("td")) { // If we run out of elements, or run into the table itself, then give up. if ((td == null) || td == getElement()) return null; td = DOM.getParent(td); } //test if the td is actually from this table Element tr = DOM.getParent(td); Element body = DOM.getParent(tr); if (body == this.getBodyElement()) { return td; } //Didn't find appropriate cell return null; }
Example 9
Source File: VComboBoxMultiselect.java From vaadin-combobox-multiselect with Apache License 2.0 | 6 votes |
@Override public void onBrowserEvent(Event event) { debug("VComboBoxMultiselect.SP: onBrowserEvent()"); if (event.getTypeInt() == Event.ONCLICK) { final Element target = DOM.eventGetTarget(event); if (target == this.up || target == DOM.getChild(this.up, 0)) { this.lazyPageScroller.scrollUp(); } else if (target == this.down || target == DOM.getChild(this.down, 0)) { this.lazyPageScroller.scrollDown(); } } /* * Prevent the keyboard focus from leaving the textfield by * preventing the default behaviour of the browser. Fixes #4285. */ handleMouseDownEvent(event); }
Example 10
Source File: CubaGroupBoxWidget.java From cuba with Apache License 2.0 | 6 votes |
@Override public void onBrowserEvent(Event event) { if (DOM.eventGetType(event) == Event.ONCLICK && isEnabled()) { if (collapsable && (DOM.eventGetTarget(event) == expander || DOM.eventGetTarget(event) == captionNode.getChild(1))) { toggleExpanded(event); } else if (DOM.eventGetTarget(event) == contextHelpIcon && contextHelpClickHandler != null) { contextHelpClickHandler.accept(event); } else { super.onBrowserEvent(event); } } else { super.onBrowserEvent(event); } }
Example 11
Source File: CubaSideMenuWidget.java From cuba with Apache License 2.0 | 6 votes |
@Override public void onBrowserEvent(Event event) { super.onBrowserEvent(event); if (isEnabled()) { switch (DOM.eventGetType(event)) { case Event.ONMOUSEOVER: Element targetElement = DOM.eventGetTarget(event); Object targetWidget = WidgetUtil.findWidget(targetElement, null); if (targetWidget instanceof MenuItemWidget) { setFocusedItem((MenuItemWidget) targetWidget); } break; case Event.ONMOUSEOUT: if (!focused) { setFocusedItem(null); } break; } } }
Example 12
Source File: CubaTokenListLabelWidget.java From cuba with Apache License 2.0 | 5 votes |
@Override public void onBrowserEvent(Event event) { if (DOM.eventGetType(event) == Event.ONCLICK && handler != null) { if (DOM.eventGetTarget(event) == closeDiv && editable) { handler.remove(); } } }
Example 13
Source File: FilterBox.java From unitime with Apache License 2.0 | 5 votes |
@Override public void onBrowserEvent(Event event) { Element target = DOM.eventGetTarget(event); switch (DOM.eventGetType(event)) { case Event.ONMOUSEDOWN: boolean open = iFilterOpen.getElement().equals(target); boolean close = iFilterClose.getElement().equals(target); boolean clear = iFilterClear.getElement().equals(target); boolean filter = iFilter.getElement().equals(target); if (isFilterPopupShowing() || close) { hideFilterPopup(); } else if (open) { hideSuggestions(); showFilterPopup(); } if (clear) { iFilter.setText(""); removeAllChips(); setAriaLabel(toAriaString()); ValueChangeEvent.fire(FilterBox.this, getValue()); } if (!filter) { event.stopPropagation(); event.preventDefault(); Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { iFilter.setFocus(true); } }); } break; } }
Example 14
Source File: CubaLabelWidget.java From cuba with Apache License 2.0 | 5 votes |
@Override public void onBrowserEvent(Event event) { if (DOM.eventGetType(event) == Event.ONCLICK && contextHelpClickHandler != null && DOM.eventGetTarget(event) == contextHelpIcon) { contextHelpClickHandler.accept(event); } else { super.onBrowserEvent(event); } }
Example 15
Source File: Wizard.java From appinventor-extensions with Apache License 2.0 | 5 votes |
@Override public boolean onEventPreview(Event event) { // Always allow event if capturing is enabled if (DOM.getCaptureElement() != null) { return true; } // If this is a modal wizard then only allow it if the target element is a child of this wizard if (modal) { Element target = DOM.eventGetTarget(event); return (target != null && DOM.isOrHasChild(getElement(), target)); } else { return super.onEventPreview(event); } }
Example 16
Source File: SuggestionsContainer.java From cuba with Apache License 2.0 | 4 votes |
@Override public void onBrowserEvent(Event event) { if (getElement() == DOM.eventGetTarget(event)) { return; } SuggestionItem item = findItem(DOM.eventGetTarget(event)); switch (DOM.eventGetType(event)) { case Event.ONMOUSEDOWN: { if (BrowserInfo.get().isIE()) { suggestionFieldWidget.iePreventBlur = true; } break; } case Event.ONCLICK: { if (event.getButton() == NativeEvent.BUTTON_LEFT) { performItemCommand(item); } break; } case Event.ONMOUSEOVER: { if (item != null) { selectItem(item); } break; } case Event.ONKEYDOWN: { int keyCode = KeyCodes.maybeSwapArrowKeysForRtl( event.getKeyCode(), LocaleInfo.getCurrentLocale().isRTL() ); switch (keyCode) { case KeyCodes.KEY_UP: selectPrevItem(); preventEvent(event); break; case KeyCodes.KEY_DOWN: selectNextItem(); preventEvent(event); break; case KeyCodes.KEY_ESCAPE: selectItem(null); preventEvent(event); break; case KeyCodes.KEY_TAB: selectItem(null); break; case KeyCodes.KEY_ENTER: performItemCommand(item); preventEvent(event); break; } break; } } super.onBrowserEvent(event); }
Example 17
Source File: CubaFileUploadProgressWindow.java From cuba with Apache License 2.0 | 4 votes |
@Override public void onBrowserEvent(final Event event) { boolean bubble = true; final int type = event.getTypeInt(); final Element target = DOM.eventGetTarget(event); if (resizing || resizeBox == target) { onResizeEvent(event); bubble = false; } else if (isClosable() && target == closeBox) { if (type == Event.ONCLICK) { closeWindow(); } bubble = false; } else if (header.isOrHasChild(target) && !dragging) { // dblclick handled in connector if (type != Event.ONDBLCLICK && draggable) { if (type == Event.ONMOUSEDOWN) { /* * Prevents accidental selection of window caption or * content. (#12726) */ event.preventDefault(); headerDragPending = event; } else if (type == Event.ONMOUSEMOVE && headerDragPending != null) { // ie won't work unless this is set here dragging = true; onDragEvent(headerDragPending); onDragEvent(event); headerDragPending = null; } else { headerDragPending = null; } bubble = false; } } else if (dragging || !contents.isOrHasChild(target)) { onDragEvent(event); bubble = false; } /* * If clicking on other than the content, move focus to the window. * After that this windows e.g. gets all keyboard shortcuts. */ if (type == Event.ONMOUSEDOWN && !contentPanel.getElement().isOrHasChild(target) && target != closeBox) { contentPanel.focus(); } if (!bubble) { event.stopPropagation(); } else { // Super.onBrowserEvent takes care of Handlers added by the // ClickEventHandler super.onBrowserEvent(event); } }
Example 18
Source File: TimeGrid.java From unitime with Apache License 2.0 | 4 votes |
public void onBrowserEvent(Event event) { if (iDummy) return; Element target = DOM.eventGetTarget(event); boolean anchor = false; for (; target != null; target = DOM.getParent(target)) { String tag = target.getPropertyString("tagName"); if ("a".equalsIgnoreCase(tag)) { anchor = true; break; } else if ("div".equalsIgnoreCase(tag)) { break; } } EventTarget related = event.getRelatedEventTarget(); switch (DOM.eventGetType(event)) { case Event.ONCLICK: select(false); if (!anchor) { MeetingClickEvent e = new MeetingClickEvent(Meeting.this); for (MeetingClickHandler h: iMeetingClickHandlers) h.onMeetingClick(e); } 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; case Event.ONMOUSEMOVE: int relativeX = event.getClientX() - getElement().getAbsoluteLeft() + getElement().getScrollLeft() + getElement().getOwnerDocument().getScrollLeft(); if (iRTL) relativeX = iCellWidth - relativeX; if (relativeX < iLeft - 6 - getDay() * iCellWidth || relativeX > iLeft - 2 - getDay() * iCellWidth + iWidth) { select(false); } break; } super.onBrowserEvent(event); }
Example 19
Source File: EventWrapper.java From swellrt with Apache License 2.0 | 4 votes |
/** * @return The element that was the actual target of the event. */ public Element getTarget() { return DOM.eventGetTarget(event); }
Example 20
Source File: EventWrapper.java From incubator-retired-wave with Apache License 2.0 | 4 votes |
/** * @return The element that was the actual target of the event. */ public Element getTarget() { return DOM.eventGetTarget(event); }