Java Code Examples for com.google.gwt.user.client.Event#ONMOUSEDOWN
The following examples show how to use
com.google.gwt.user.client.Event#ONMOUSEDOWN .
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 |
/** * Handles special behavior of the mouse down event. * * @param event */ private void handleMouseDownEvent(Event event) { /* * Prevent the keyboard focus from leaving the textfield by preventing * the default behaviour of the browser. Fixes #4285. */ if (event.getTypeInt() == Event.ONMOUSEDOWN) { debug("VComboBoxMultiselect: blocking mouseDown event to avoid blur"); event.preventDefault(); event.stopPropagation(); /* * In IE the above wont work, the blur event will still trigger. So, * we set a flag here to prevent the next blur event from happening. * This is not needed if do not already have focus, in that case * there will not be any blur event and we should not cancel the * next blur. */ if (BrowserInfo.get() .isIE() && this.focused) { this.preventNextBlurEventInIE = true; debug("VComboBoxMultiselect: Going to prevent next blur event on IE"); } } }
Example 2
Source File: CubaWindowWidget.java From cuba with Apache License 2.0 | 6 votes |
@Override public void onBrowserEvent(Event event) { if (contextMenuHandler != null && event.getTypeInt() == Event.ONCONTEXTMENU) { contextMenuHandler.onContextMenu(event); return; } if ((event.getTypeInt() == Event.ONCLICK || event.getTypeInt() == Event.ONMOUSEDOWN) && event.getButton() != NativeEvent.BUTTON_LEFT) { event.preventDefault(); event.stopPropagation(); return; } super.onBrowserEvent(event); }
Example 3
Source File: SessionDatesSelector.java From unitime with Apache License 2.0 | 6 votes |
@Override public void onBrowserEvent(Event event) { switch (DOM.eventGetType(event)) { case Event.ONMOUSEDOWN: SelectionMode mode = null; for (SelectionMode m: SelectionMode.values()) if (hasUnselectedDays(m)) { mode = m; break; } if (mode != null) setAllSelected(true, mode); else setAllSelected(false, SelectionMode.All); if (iCursor != null) iPanel.getWidget().setCursor(iCursor); event.preventDefault(); break; } super.onBrowserEvent(event); }
Example 4
Source File: SessionDatesSelector.java From unitime with Apache License 2.0 | 5 votes |
@Override public void onBrowserEvent(Event event) { switch (DOM.eventGetType(event)) { case Event.ONMOUSEDOWN: if (isEnabled()) { setValue(!getValue(), true); iPanel.getWidget().setCursor(iCursor); } event.preventDefault(); break; } super.onBrowserEvent(event); }
Example 5
Source File: TravelTimes.java From unitime with Apache License 2.0 | 5 votes |
@Override public void onBrowserEvent(Event event) { switch (DOM.eventGetType(event)) { case Event.ONMOUSEDOWN: MouseDownEvent.fireNativeEvent(event, this); event.stopPropagation(); event.preventDefault(); break; } }
Example 6
Source File: CubaResizableTextAreaWrapperWidget.java From cuba with Apache License 2.0 | 5 votes |
@Override public void onBrowserEvent(Event event) { switch (DOM.eventGetType(event)) { case Event.ONMOUSEDOWN: captureEvents(event); break; case Event.ONMOUSEUP: releaseCapture(event); break; case Event.ONMOUSEMOVE: handleResize(event); break; } }
Example 7
Source File: CubaFileUploadProgressWindow.java From cuba with Apache License 2.0 | 5 votes |
private void onDragEvent(Event event) { if (!WidgetUtil.isTouchEventOrLeftMouseButton(event)) { return; } switch (DOM.eventGetType(event)) { case Event.ONTOUCHSTART: if (event.getTouches().length() > 1) { return; } case Event.ONMOUSEDOWN: beginMovingWindow(event); break; case Event.ONMOUSEUP: case Event.ONTOUCHEND: case Event.ONTOUCHCANCEL: case Event.ONLOSECAPTURE: stopMovingWindow(); break; case Event.ONMOUSEMOVE: case Event.ONTOUCHMOVE: moveWindow(event); break; default: break; } }
Example 8
Source File: TextButton.java From incubator-retired-wave with Apache License 2.0 | 5 votes |
@Override public void onBrowserEvent(Event event) { if (mouseListener == null) { super.onBrowserEvent(event); return; } switch (event.getTypeInt()) { case Event.ONMOUSEDOWN: mouseListener.onMouseDown(); break; case Event.ONMOUSEOUT: mouseListener.onMouseLeave(); break; case Event.ONMOUSEOVER: mouseListener.onMouseEnter(); break; case Event.ONMOUSEUP: mouseListener.onMouseUp(); break; case Event.ONCLICK: mouseListener.onClick(); if (stopPropagation) { event.stopPropagation(); } break; } super.onBrowserEvent(event); }
Example 9
Source File: IntervalSelector.java From unitime with Apache License 2.0 | 5 votes |
@Override public void onBrowserEvent(Event event) { switch (DOM.eventGetType(event)) { case Event.ONMOUSEDOWN: MouseDownEvent.fireNativeEvent(event, this); event.stopPropagation(); event.preventDefault(); break; } }
Example 10
Source File: TextButton.java From swellrt with Apache License 2.0 | 5 votes |
@Override public void onBrowserEvent(Event event) { if (mouseListener == null) { super.onBrowserEvent(event); return; } switch (event.getTypeInt()) { case Event.ONMOUSEDOWN: mouseListener.onMouseDown(); break; case Event.ONMOUSEOUT: mouseListener.onMouseLeave(); break; case Event.ONMOUSEOVER: mouseListener.onMouseEnter(); break; case Event.ONMOUSEUP: mouseListener.onMouseUp(); break; case Event.ONCLICK: mouseListener.onClick(); if (stopPropagation) { event.stopPropagation(); } break; } super.onBrowserEvent(event); }
Example 11
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 12
Source File: CompositeFocusHelper.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 5 votes |
private void previewNativeEvent(NativePreviewEvent event) { if (event.isCanceled() || event.isConsumed()) { event.cancel(); return; } boolean eventTargetsContainerOrPartner = this.eventTargetsContainerOrPartner(event); int type = event.getTypeInt(); switch (type) { case Event.ONMOUSEDOWN: case Event.ONTOUCHSTART: if (!eventTargetsContainerOrPartner) { this.blur(); return; } break; case Event.ONFOCUS: // Not used because focus events are not previewed yet if (!eventTargetsContainerOrPartner) { this.blur(); } else { this.focus(); } break; default: break; } }
Example 13
Source File: ExtendedScrollTable.java From document-management-system with GNU General Public License v2.0 | 4 votes |
public void onBrowserEvent(Event event) { boolean headerFired = false; // Controls when event is fired by header // Case targe event is header must disable drag & drop if (headerTable.getEventTargetCell(event) != null) { headerFired = true; } // Selects the panel setSelectedPanel(true); // When de button mouse is released mouseX = DOM.eventGetClientX(event); mouseY = DOM.eventGetClientY(event); // On double click not sends event to onCellClicked across super.onBrowserEvent(); if (DOM.eventGetType(event) == Event.ONDBLCLICK) { // Disables the event propagation the sequence is: // Two time entry onCellClicked before entry on onBrowserEvent and disbles the // Tree onCellClicked that produces inconsistence error refreshing DOM.eventCancelBubble(event, true); if ((isDocumentSelected() || isAttachmentSelected()) && Main.get().workspaceUserProperties.getWorkspace().getAvailableOption().isDownloadOption()) { Main.get().mainPanel.search.searchBrowser.searchResult.searchCompactResult.downloadDocument(); } } else if (DOM.eventGetType(event) == Event.ONMOUSEDOWN) { switch (DOM.eventGetButton(event)) { case Event.BUTTON_RIGHT: if (!headerFired) { if (isDocumentSelected() || isAttachmentSelected()) { Main.get().mainPanel.search.searchBrowser.searchResult.searchCompactResult.menuPopup.menu.checkMenuOptionPermissions(getDocument()); } else if (isFolderSelected()) { Main.get().mainPanel.search.searchBrowser.searchResult.searchCompactResult.menuPopup.menu.checkMenuOptionPermissions(getFolder()); } else if (isMailSelected()) { Main.get().mainPanel.search.searchBrowser.searchResult.searchCompactResult.menuPopup.menu.checkMenuOptionPermissions(getMail()); } Main.get().mainPanel.search.searchBrowser.searchResult.searchCompactResult.menuPopup.menu.evaluateMenuOptions(); Main.get().mainPanel.search.searchBrowser.searchResult.searchCompactResult.showMenu(); DOM.eventPreventDefault(event); // Prevent to fire event to browser } break; default: break; } } super.onBrowserEvent(event); }
Example 14
Source File: CollapsibleSplitLayoutPanel.java From core with GNU Lesser General Public License v2.1 | 4 votes |
@Override public void onBrowserEvent(Event event) { switch (event.getTypeInt()) { case Event.ONMOUSEDOWN: mouseDown = true; /* * Resize glassElem to take up the entire scrollable window area, * which is the greater of the scroll size and the client size. */ int width = Math.max(Window.getClientWidth(), Document.get().getScrollWidth()); int height = Math.max(Window.getClientHeight(), Document.get().getScrollHeight()); glassElem.getStyle().setHeight(height, Style.Unit.PX); glassElem.getStyle().setWidth(width, Style.Unit.PX); Document.get().getBody().appendChild(glassElem); offset = getEventPosition(event) - getAbsolutePosition(); Event.setCapture(getElement()); event.preventDefault(); break; case Event.ONMOUSEUP: mouseDown = false; glassElem.removeFromParent(); // Handle double-clicks. // Fake them since the double-click event aren't fired. if (this.toggleDisplayAllowed) { double now = Duration.currentTimeMillis(); if (now - this.lastClick < DOUBLE_CLICK_TIMEOUT) { now = 0; toggleCollapsedState(); } this.lastClick = now; } Event.releaseCapture(getElement()); event.preventDefault(); break; case Event.ONMOUSEMOVE: if (mouseDown) { int size; if (reverse) { size = getTargetPosition() + getTargetSize() - getSplitterSize() - getEventPosition(event) + offset; } else { size = getEventPosition(event) - getTargetPosition() - offset; } ((LayoutData) target.getLayoutData()).hidden = false; setAssociatedWidgetSize(size); event.preventDefault(); } break; } }
Example 15
Source File: CubaFileUploadProgressWindow.java From cuba with Apache License 2.0 | 4 votes |
private void onResizeEvent(Event event) { if (resizable && WidgetUtil.isTouchEventOrLeftMouseButton(event)) { switch (event.getTypeInt()) { case Event.ONMOUSEDOWN: case Event.ONTOUCHSTART: showResizingCurtain(); if (BrowserInfo.get().isIE()) { resizeBox.getStyle().setVisibility(Style.Visibility.HIDDEN); } resizing = true; startX = WidgetUtil.getTouchOrMouseClientX(event); startY = WidgetUtil.getTouchOrMouseClientY(event); origW = getElement().getOffsetWidth(); origH = getElement().getOffsetHeight(); DOM.setCapture(getElement()); event.preventDefault(); break; case Event.ONMOUSEUP: case Event.ONTOUCHEND: setSize(event); case Event.ONTOUCHCANCEL: DOM.releaseCapture(getElement()); case Event.ONLOSECAPTURE: hideResizingCurtain(); if (BrowserInfo.get().isIE()) { resizeBox.getStyle().clearVisibility(); } resizing = false; break; case Event.ONMOUSEMOVE: case Event.ONTOUCHMOVE: if (resizing) { setSize(event); event.preventDefault(); } break; default: event.preventDefault(); break; } } }
Example 16
Source File: EventPreviewAutoHiderRegistrar.java From incubator-retired-wave with Apache License 2.0 | 4 votes |
@Override public void onPreviewNativeEvent(NativePreviewEvent previewEvent) { if (autoHiders.isEmpty()) { return; } // TODO(danilatos,user,user): Push signal down a layer - clean this up. Event event = Event.as(previewEvent.getNativeEvent()); int lowLevelType = event.getTypeInt(); // TODO(danilatos): Insert this logic deeply rather than // sprinkling it in event handlers. Also the return value // of onEventPreview is the reverse of signal handlers. SignalEvent signal = SignalEventImpl.create(event, false); if (signal == null) { return; } // Key events (excluding escape) and mousewheel events use hideTopmostAutoHiderForKeyEvent if (lowLevelType == Event.ONMOUSEWHEEL || signal.isKeyEvent()) { if (hideTopmostAutoHiderForKeyEvent(false)) { // TODO(user): We don't call previewEvent.cancel() here, since for the floating-buttons // menu we want, for example, space-bar to still shift focus to the next blip. // The to-do is to audit the previewEvent.cancel call below and see why it's there (and if // it's not needed, eliminate it). return; } } // Pressing escape at any time causes us to close and discard the event. if (signal.getKeySignalType() == KeySignalType.NOEFFECT && event.getKeyCode() == KeyCodes.KEY_ESCAPE) { if (hideTopmostAutoHiderForKeyEvent(true)) { previewEvent.cancel(); return; } } // Click events and mouse-wheel events that fall through use hideAllAfter. if (lowLevelType == Event.ONMOUSEDOWN || lowLevelType == Event.ONMOUSEWHEEL) { hideAllAfter(signal.getTarget()); } // Otherwise we don't do anything and the event continues as usual. }
Example 17
Source File: EventPreviewAutoHiderRegistrar.java From swellrt with Apache License 2.0 | 4 votes |
@Override public void onPreviewNativeEvent(NativePreviewEvent previewEvent) { if (autoHiders.isEmpty()) { return; } // TODO(danilatos,user,user): Push signal down a layer - clean this up. Event event = Event.as(previewEvent.getNativeEvent()); int lowLevelType = event.getTypeInt(); // TODO(danilatos): Insert this logic deeply rather than // sprinkling it in event handlers. Also the return value // of onEventPreview is the reverse of signal handlers. SignalEvent signal = SignalEventImpl.create(event, false); if (signal == null) { return; } // Key events (excluding escape) and mousewheel events use hideTopmostAutoHiderForKeyEvent if (lowLevelType == Event.ONMOUSEWHEEL || signal.isKeyEvent()) { if (hideTopmostAutoHiderForKeyEvent(false)) { // TODO(user): We don't call previewEvent.cancel() here, since for the floating-buttons // menu we want, for example, space-bar to still shift focus to the next blip. // The to-do is to audit the previewEvent.cancel call below and see why it's there (and if // it's not needed, eliminate it). return; } } // Pressing escape at any time causes us to close and discard the event. if (signal.getKeySignalType() == KeySignalType.NOEFFECT && event.getKeyCode() == KeyCodes.KEY_ESCAPE) { if (hideTopmostAutoHiderForKeyEvent(true)) { previewEvent.cancel(); return; } } // Click events and mouse-wheel events that fall through use hideAllAfter. if (lowLevelType == Event.ONMOUSEDOWN || lowLevelType == Event.ONMOUSEWHEEL) { hideAllAfter(signal.getTarget()); } // Otherwise we don't do anything and the event continues as usual. }
Example 18
Source File: ExtendedFlexTable.java From document-management-system with GNU General Public License v2.0 | 4 votes |
public void onBrowserEvent(Event event) { int selectedRow = 0; if (DOM.eventGetType(event) == Event.ONDBLCLICK || DOM.eventGetType(event) == Event.ONMOUSEDOWN) { Element td = getMouseEventTargetCell(event); if (td == null) return; Element tr = DOM.getParent(td); Element body = DOM.getParent(tr); selectedRow = DOM.getChildIndex(body, tr); } // Only if selectedRow >= 0, indicates a document row value and must apear menu or double click action if (selectedRow >= 0) { // When de button mouse is released mouseX = DOM.eventGetClientX(event); mouseY = DOM.eventGetClientY(event); // On double click not sends event to onCellClicked across super.onBrowserEvent(); if (DOM.eventGetType(event) == Event.ONDBLCLICK) { // Disables the event propagation the sequence is: // Two time entry onCellClicked before entry on onBrowserEvent and disables the // Tree onCellClicked that produces inconsistence error refreshing DOM.eventCancelBubble(event, true); MessagingToolBarBox.get().messageDashboard.messageStack.proposedQueryReceived.refreshProposedQueries(); } else if (DOM.eventGetType(event) == Event.ONMOUSEDOWN) { switch (DOM.eventGetButton(event)) { case Event.BUTTON_RIGHT: markSelectedRow(selectedRow); MessagingToolBarBox.get().messageDashboard.messageStack.proposedQueryReceived.menuPopup.setPopupPosition(mouseX, mouseY); MessagingToolBarBox.get().messageDashboard.messageStack.proposedQueryReceived.menuPopup.show(); DOM.eventPreventDefault(event); // Prevent to fire event to browser break; default: break; } } } super.onBrowserEvent(event); }
Example 19
Source File: PopupButtonConnector.java From cuba with Apache License 2.0 | 4 votes |
public void onPreviewNativeEvent(NativePreviewEvent event) { if (isEnabled()) { Element target = Element .as(event.getNativeEvent().getEventTarget()); switch (event.getTypeInt()) { case Event.ONCLICK: if (getWidget().isOrHasChildOfButton(target)) { if (getState().popupVisible && getState().buttonClickTogglesPopupVisibility) { getWidget().sync(); rpc.setPopupVisible(false); } } break; case Event.ONMOUSEDOWN: if (!getWidget().isOrHasChildOfPopup(target) && !getWidget().isOrHasChildOfConsole(target) && !getWidget().isOrHasChildOfButton(target) && getState().closePopupOnOutsideClick) { if (getState().popupVisible) { getWidget().sync(); rpc.setPopupVisible(false); } } break; case Event.ONKEYPRESS: if (getWidget().isOrHasChildOfPopup(target)) { // Catch children that use keyboard, so we can unfocus // them // when // hiding getWidget().addToActiveChildren(target); } break; case Event.ONKEYDOWN: if (getState().popupVisible) { getWidget().onKeyDownOnVisiblePopup(event.getNativeEvent(), this); } break; default: break; } } }
Example 20
Source File: FreeTimePicker.java From unitime with Apache License 2.0 | 4 votes |
private void processMouseEvent(int eventType, int day, int period) { if (!isEnabled()) return; switch (eventType) { case Event.ONMOUSEDOWN: iDownDay = day; iDownPeriod = period; iOverDay = day; iOverPeriod = period; break; case Event.ONMOUSEUP: if (iDownDay>=0 && iOverDay>=0) { int d0 = (iDownDay < iOverDay ? iDownDay : iOverDay); int d1 = (iDownDay < iOverDay ? iOverDay : iDownDay); int p0 = (iDownPeriod < iOverPeriod ? iDownPeriod : iOverPeriod); int p1 = (iDownPeriod < iOverPeriod ? iOverPeriod : iDownPeriod); boolean allSelected = true; boolean mwfDown = (iDownDay % 2 == 0); all: for (int d=d0; d<=d1; d++) { if (d1 - d0 <= 0 || (d % 2 == 0) == mwfDown) { for (int p=p0; p<=p1; p++) if (!iSelected[d][p]) { allSelected = false; break all; } } } long ts = iTime++; for (int d=d0; d<=d1; d++) { if (d1 - d0 <= 1 || (d % 2 == 0) == mwfDown) { for (int p=p0; p<=p1; p++) { iSelected[d][p] = !allSelected; iLastSelectedTime[d][p] = ts; } } } } iDownDay = -1; iDownPeriod = -1; iOverDay = -1; iOverPeriod = -1; generatePriorities(); ValueChangeEvent.fire(this, getValue()); break; case Event.ONMOUSEOVER: iOverDay = day; iOverPeriod = period; break; case Event.ONMOUSEOUT: iOverDay = -1; iOverPeriod = -1; break; } update(); }