Java Code Examples for com.google.gwt.user.client.Event#ONMOUSEUP
The following examples show how to use
com.google.gwt.user.client.Event#ONMOUSEUP .
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: 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 3
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 4
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 5
Source File: Button.java From incubator-retired-wave with Apache License 2.0 | 5 votes |
/** * Overrides the same method as per Label. Updates the CSS style on the parent * DIV, and then passes on control to the superclass implementation. * * @see com.google.gwt.user.client.ui.Label#onBrowserEvent(com.google.gwt.user.client.Event) */ @Override public void onBrowserEvent(Event event) { switch (event.getTypeInt()) { case Event.ONMOUSEDOWN: me.replaceClassName(ButtonStyle.mouseUp, ButtonStyle.mouseDown); if (cancelMouseDownBubble) { event.stopPropagation(); } if (preventMouseDownDefault) { event.preventDefault(); } break; case Event.ONMOUSEUP: me.replaceClassName(ButtonStyle.mouseDown, ButtonStyle.mouseUp); break; case Event.ONMOUSEOVER: me.replaceClassName(ButtonStyle.mouseOut, ButtonStyle.mouseOver); break; case Event.ONMOUSEOUT: me.replaceClassName(ButtonStyle.mouseOver, ButtonStyle.mouseOut); break; } // Call to super to handle all event generation. super.onBrowserEvent(event); }
Example 6
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 7
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 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 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 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: Button.java From swellrt with Apache License 2.0 | 5 votes |
/** * Overrides the same method as per Label. Updates the CSS style on the parent * DIV, and then passes on control to the superclass implementation. * * @see com.google.gwt.user.client.ui.Label#onBrowserEvent(com.google.gwt.user.client.Event) */ @Override public void onBrowserEvent(Event event) { switch (event.getTypeInt()) { case Event.ONMOUSEDOWN: me.replaceClassName(ButtonStyle.mouseUp, ButtonStyle.mouseDown); if (cancelMouseDownBubble) { event.stopPropagation(); } if (preventMouseDownDefault) { event.preventDefault(); } break; case Event.ONMOUSEUP: me.replaceClassName(ButtonStyle.mouseDown, ButtonStyle.mouseUp); break; case Event.ONMOUSEOVER: me.replaceClassName(ButtonStyle.mouseOut, ButtonStyle.mouseOver); break; case Event.ONMOUSEOUT: me.replaceClassName(ButtonStyle.mouseOver, ButtonStyle.mouseOut); break; } // Call to super to handle all event generation. super.onBrowserEvent(event); }
Example 12
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 13
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 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: 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(); }
Example 16
Source File: ViewClientCriterion.java From hawkbit with Eclipse Public License 1.0 | 4 votes |
@Override // Exception squid:S1604 - GWT 2.7 does not support Java 8 @SuppressWarnings("squid:S1604") public void accept(final VDragEvent drag, final UIDL configuration, final VAcceptCallback callback) { if (isDragStarting(drag)) { final NativePreviewHandler nativeEventHandler = new NativePreviewHandler() { @Override public void onPreviewNativeEvent(final NativePreviewEvent event) { if (isEscKey(event) || isMouseUp(event)) { try { hideDropTargetHints(configuration); } finally { nativeEventHandlerRegistration.removeHandler(); } } } }; nativeEventHandlerRegistration = Event.addNativePreviewHandler(nativeEventHandler); setMultiRowDragDecoration(drag); } final int childCount = configuration.getChildCount(); accepted = false; for (int childIndex = 0; childIndex < childCount; childIndex++) { final VAcceptCriterion crit = getCriteria(configuration, childIndex); crit.accept(drag, configuration.getChildUIDL(childIndex), this); if (Boolean.TRUE.equals(accepted)) { callback.accepted(drag); return; } } // if no VAcceptCriterion accepts and the mouse is release, an error // message is shown if (Event.ONMOUSEUP == Event.getTypeInt(drag.getCurrentGwtEvent().getType())) { showErrorNotification(drag); } errorMessage = configuration.getStringAttribute(ERROR_MESSAGE); }
Example 17
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 18
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 19
Source File: ViewClientCriterion.java From hawkbit with Eclipse Public License 1.0 | 2 votes |
/** * Checks if the given event is of type <code>Event.ONMOUSEUP</code>. * * @param event * the event to analyze * @return <code>true</code> if the given event is of type * <code>Event.ONMOUSEUP</code>, otherwise <code>false</code>. */ private static boolean isMouseUp(final NativePreviewEvent event) { return Event.ONMOUSEUP == Event.getTypeInt(event.getNativeEvent().getType()); }