Java Code Examples for com.google.gwt.user.client.Event#ONMOUSEMOVE
The following examples show how to use
com.google.gwt.user.client.Event#ONMOUSEMOVE .
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: ImageHover.java From document-management-system with GNU General Public License v2.0 | 6 votes |
public void onBrowserEvent(Event event) { switch (DOM.eventGetType(event)) { case Event.ONMOUSEDOWN: case Event.ONMOUSEUP: case Event.ONMOUSEMOVE: case Event.ONMOUSEOVER: if (!super.getUrl().equals(urlHover)) { super.setUrl(urlHover); } break; case Event.ONMOUSEOUT: { if (!super.getUrl().equals(url)) { super.setUrl(url); } break; } } super.onBrowserEvent(event); }
Example 2
Source File: HorizontalPanelWithHint.java From unitime with Apache License 2.0 | 6 votes |
public void onBrowserEvent(Event event) { int x = 10 + event.getClientX() + getElement().getOwnerDocument().getScrollLeft(); int y = 10 + event.getClientY() + getElement().getOwnerDocument().getScrollTop(); switch (DOM.eventGetType(event)) { case Event.ONMOUSEMOVE: if (iHint.isShowing()) { iHint.setPopupPosition(x, y); } else { iShowHint.cancel(); iHint.setPopupPosition(x, y); iShowHint.schedule(1000); } break; case Event.ONMOUSEOUT: iShowHint.cancel(); if (iHint.isShowing()) iHideHint.schedule(1000); break; } }
Example 3
Source File: InfoPanelImpl.java From unitime with Apache License 2.0 | 6 votes |
public void onBrowserEvent(Event event) { if (iHint.getText().isEmpty()) return; iX = 10 + event.getClientX() + getElement().getOwnerDocument().getScrollLeft(); iY = 10 + event.getClientY() + getElement().getOwnerDocument().getScrollTop(); switch (DOM.eventGetType(event)) { case Event.ONMOUSEMOVE: if (iInfoPanel.isShowing()) { int maxX = Window.getScrollLeft() + Window.getClientWidth() - iInfoPanel.getOffsetWidth() - 10; iInfoPanel.setPopupPosition(Math.min(iX, maxX), iY); } else if (iInfo.getRowCount() > 0) { iShowInfo.cancel(); iShowInfo.schedule(1000); } break; case Event.ONMOUSEOUT: iShowInfo.cancel(); if (iInfoPanel.isShowing()) iHideInfo.schedule(1000); break; } }
Example 4
Source File: MockComponent.java From appinventor-extensions with Apache License 2.0 | 5 votes |
/** * Invoked by GWT whenever a browser event is dispatched to this component. */ @Override public void onBrowserEvent(Event event) { if (!shouldCancel(event)) return; switch (event.getTypeInt()) { case Event.ONTOUCHSTART: case Event.ONTOUCHEND: if (isForm()) { select(); } case Event.ONTOUCHMOVE: case Event.ONTOUCHCANCEL: cancelBrowserEvent(event); DomEvent.fireNativeEvent(event, handlers); break; case Event.ONMOUSEDOWN: case Event.ONMOUSEUP: case Event.ONMOUSEMOVE: case Event.ONMOUSEOVER: case Event.ONMOUSEOUT: cancelBrowserEvent(event); mouseListeners.fireMouseEvent(this, event); break; case Event.ONCLICK: cancelBrowserEvent(event); select(); break; default: // Ignore unexpected events break; } }
Example 5
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 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: EventWrapper.java From swellrt with Apache License 2.0 | 5 votes |
public static String asString(Event event) { // Start with the event type string String string = DOM.eventGetTypeString(event); // Next type-specific fields switch (event.getTypeInt()) { case Event.ONKEYPRESS: case Event.ONKEYUP: case Event.ONKEYDOWN: string += key(event) + modifiers(event); break; case Event.ONCLICK: case Event.ONDBLCLICK: case Event.ONMOUSEMOVE: string += mousePoint(event) + modifiers(event); break; case Event.ONMOUSEDOWN: case Event.ONMOUSEUP: string += mousePoint(event) + mouseButtons(event) + modifiers(event); break; case Event.ONMOUSEOUT: string += mousePoint(event) + modifiers(event) + " to: " + getToElement(event); break; case Event.ONMOUSEOVER: string += mousePoint(event) + modifiers(event) + " from: " + getFromElement(event); break; case Event.ONMOUSEWHEEL: string += " " + getMouseWheelVelocityY(event) + mousePoint(event) + modifiers(event); break; case Event.ONFOCUS: case Event.ONBLUR: case Event.ONCHANGE: case Event.ONERROR: case Event.ONLOAD: case Event.ONLOSECAPTURE: case Event.ONSCROLL: break; } return string; }
Example 8
Source File: InputSlider.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void onBrowserEvent(Event event) { super.onBrowserEvent(event); if (!this.isStateValid()) { return; } switch (DOM.eventGetType(event)) { case Event.ONMOUSEDOWN: case Event.ONTOUCHSTART: this.handleWidget.setFocus(true); this.dragHandler.onMouseDown(event); break; case Event.ONMOUSEUP: case Event.ONTOUCHEND: this.dragHandler.onMouseUp(event); break; case Event.ONMOUSEMOVE: case Event.ONTOUCHMOVE: this.dragHandler.onMouseMove(event); break; case Event.ONMOUSEWHEEL: if (this.handleWidget.focused) { this.dragHandler.onMouseWheel(event); } break; default: break; } }
Example 9
Source File: EventWrapper.java From incubator-retired-wave with Apache License 2.0 | 5 votes |
public static String asString(Event event) { // Start with the event type string String string = DOM.eventGetTypeString(event); // Next type-specific fields switch (event.getTypeInt()) { case Event.ONKEYPRESS: case Event.ONKEYUP: case Event.ONKEYDOWN: string += key(event) + modifiers(event); break; case Event.ONCLICK: case Event.ONDBLCLICK: case Event.ONMOUSEMOVE: string += mousePoint(event) + modifiers(event); break; case Event.ONMOUSEDOWN: case Event.ONMOUSEUP: string += mousePoint(event) + mouseButtons(event) + modifiers(event); break; case Event.ONMOUSEOUT: string += mousePoint(event) + modifiers(event) + " to: " + getToElement(event); break; case Event.ONMOUSEOVER: string += mousePoint(event) + modifiers(event) + " from: " + getFromElement(event); break; case Event.ONMOUSEWHEEL: string += " " + getMouseWheelVelocityY(event) + mousePoint(event) + modifiers(event); break; case Event.ONFOCUS: case Event.ONBLUR: case Event.ONCHANGE: case Event.ONERROR: case Event.ONLOAD: case Event.ONLOSECAPTURE: case Event.ONSCROLL: break; } return string; }
Example 10
Source File: ExtendedTree.java From document-management-system with GNU General Public License v2.0 | 4 votes |
@Override public void onBrowserEvent(Event event) { // When de button mouse is released if (DOM.eventGetType(event) == Event.ONMOUSEDOWN) { // When de button mouse is released mouseX = DOM.eventGetClientX(event); mouseY = DOM.eventGetClientY(event); // remove dragable item Main.get().draggable.clear(); switch (DOM.eventGetButton(event)) { case Event.BUTTON_RIGHT: DOM.eventPreventDefault(event); // Prevent to fire event to browser flagPopup = true; mouseDownX = 0; mouseDownY = 0; dragged = false; Main.get().activeFolderTree.menuPopup.disableAllOptions(); fireSelection(elementClicked(DOM.eventGetTarget(event))); break; default: flagPopup = false; // dragging is enable only if cursor is inside actual item dragged = isCursorInsideActualItem(elementClicked(DOM.eventGetTarget(event))); mouseDownX = event.getScreenX(); mouseDownY = event.getClientY(); } } else if (DOM.eventGetType(event) == Event.ONMOUSEMOVE) { mouseX = DOM.eventGetClientX(event); mouseY = DOM.eventGetClientY(event); if (Main.get().activeFolderTree.canDrag() && dragged && mouseDownX > 0 && mouseDownY > 0 && evalDragPixelSensibility()) { TreeItem actualItem = Main.get().activeFolderTree.getActualItem(); Main.get().draggable.show(actualItem.getHTML(), OriginPanel.TREE_ROOT); Main.get().activeFolderTree.fileBrowserRefreshDone(); mouseDownX = 0; mouseDownY = 0; dragged = false; } } else if (DOM.eventGetType(event) == Event.ONMOUSEUP || DOM.eventGetType(event) == Event.ONCLICK || DOM.eventGetType(event) == Event.ONDBLCLICK) { mouseDownX = 0; mouseDownY = 0; dragged = false; // Always disabling the popup flag } // Prevent folder creation or renaming propagate actions to other tree nodes int action = Main.get().activeFolderTree.getFolderAction(); if (action != FolderTree.ACTION_CREATE && action != FolderTree.ACTION_RENAME) { super.onBrowserEvent(event); } }
Example 11
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 12
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 13
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 14
Source File: TimeGrid.java From unitime with Apache License 2.0 | 4 votes |
@Override public void onBrowserEvent(Event event) { if (Event.ONMOUSEMOVE == DOM.eventGetType(event) && !iSelection.isActive() && iMoving != null) { iMoving.onBrowserEvent(event); if (iMoving.iCursor != null) getElement().getStyle().setCursor(iMoving.iCursor); return; } double x = event.getClientX() - getAbsoluteLeft() + Window.getScrollLeft(); double y = event.getClientY() - getAbsoluteTop() + Window.getScrollTop(); int slot = 3 * Math.min(Math.max(0, (int)Math.round(4 * (y - 1 + iStart * iCellHeight) / iCellHeight)), 96); int day = Math.min(Math.max(0, (int)Math.floor((x - 2) / iCellWidth)), iDays.length - 1); int weeks = (isSingleRoom() ? iSelectedWeeks.size() : iRoomResources.size()); int week = Math.min(Math.max(0, (int)Math.floor(weeks * (x - 2 - iCellWidth * day) / (iCellWidth - 6))), weeks - 1); if (iRTL) { day = iDays.length - day - 1; week = weeks - week - 1; } int dayOfWeek = iDays[day]; int h = slot / 12; int m = 5 * (slot % 12); String time = (CONSTANTS.useAmPm() ? (h == 0 ? "12": h <= 12 ? h : h-12) : h) + ":" + (m < 10 ? "0" : "") + m + (CONSTANTS.useAmPm() ? (h <= 11 ? "a" : "p") : ""); int dayInv = (iDayOfWeeks == null ? (7 + dayOfWeek - iPropertiesProvider.getFirstDayOfWeek()) % 7 : dayOfWeek); String text = (iDayOfWeeks == null ? CONSTANTS.longDays()[dayOfWeek] : iDayOfWeeks.get(dayOfWeek)) + " " + (isSingleRoom() ? iSelectedWeeks.get(week) : iSelectedWeeks.get(0)).getDayNames().get(dayInv) + " " + time + (isSingleRoom() ? "" : " " + iRoomResources.get(week).getName()); ResourceInterface room = (isSingleRoom() ? iRoomResources.get(0) : iRoomResources.get(week)); iPopup.setPopupPosition(event.getClientX() + Window.getScrollLeft(), event.getClientY() + Window.getScrollTop()); getElement().getStyle().setCursor(Cursor.CROSSHAIR); switch (DOM.eventGetType(event)) { case Event.ONMOUSEDOWN: iSelection.setStart(dayOfWeek, slot, week); iSelection.setEnd(dayOfWeek, slot, week); iSelection.setVisible(true); iSelection.setActive(true); break; case Event.ONMOUSEMOVE: iSelection.setEnd(dayOfWeek, slot, week); if (!iPopup.isShowing()) iPopup.show(); if (!room.getId().equals(iLastRoomId)) { RoomHint.showHint(iPopup.getElement(), room.getId(), "", (room.hasDistance() ? String.valueOf(Math.round(room.getDistance())) : ""), false); iLastRoomId = room.getId(); } break; case Event.ONMOUSEUP: onMouseUp(); break; case Event.ONMOUSEOVER: if (!iPopup.isShowing() && (iSelection.isActive() || iMoving == null)) iPopup.show(); if (iSelection.isActive() && !iSelection.isVisible()) { iSelection.setVisible(true); } if (!room.getId().equals(iLastRoomId)) { RoomHint.showHint(iPopup.getElement(), room.getId(), "", (room.hasDistance() ? String.valueOf(Math.round(room.getDistance())) : ""), false); iLastRoomId = room.getId(); } break; case Event.ONMOUSEOUT: Element child = DOM.eventGetToElement(event); if (child != null && !getElement().isOrHasChild(child)) { if (iPopup.isShowing()) { iPopup.hide(); RoomHint.hideHint(); iLastRoomId = null; } iSelection.setVisible(false); } /* if (iSelection.isActive() && !DOM.isOrHasChild(TimeGrid.this.getElement(), DOM.eventGetToElement(event))) { iSelection.setActive(false); } */ break; } iHint.setText((iSelection.isVisible() && iSelection.isActive() ? iSelection.toString() : text)); event.preventDefault(); event.stopPropagation(); }
Example 15
Source File: FinderPanel.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 16
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; } }