@Override public void onMouseDown(MouseDownEvent event) { this.onMouseUp(null); Icon dragIcon = (Icon) event.getSource(); this.selectedRow = (TableRow<T>) dragIcon.getParent().getParent(); this.body = (TableEditorBody<T>) this.selectedRow.getParent(); this.overRegistration = new HandlerRegistrationCollection(); this.upRegistration = RootPanel.get().addDomHandler(this, MouseUpEvent.getType()); this.rows = Lists.newArrayList(this.body.getRows()); for (TableRow<T> row : this.rows) { this.overRegistration.add(row.addDomHandler(this, MouseOverEvent.getType())); } TableOrder.this.disableTextSelection(true); RootPanel.get().getElement().getStyle().setCursor(Style.Cursor.MOVE); StyleUtils.addStyle(this.selectedRow, TableOrder.STYLE_ROW_DRAGING); }
/** * Trigger action when mouse up event fired * * @param event */ protected void onMouseUp(MouseUpEvent event) { // Test if Right Click if (event.getNativeButton() == NativeEvent.BUTTON_RIGHT) { logger.info( "Handle NativeEvent.BUTTON_RIGHT begin >"); event.stopPropagation(); event.preventDefault(); logger.info("Handle NativeEvent.BUTTON_RIGHT end <"); return; } if ( !lockDrawConnection && inDragBuildConnection ) { logger.info( "draw connection lock: " + lockDrawConnection ); NodeShape shape = (NodeShape) getShapeUnderMouse(); if (shape != null && shape instanceof InNodeShape) { Connection c = connfactory.buildConnection(this, startShape, shape); if (c == null) { Window.alert("Connection can't be build"); } else { c.draw(); connDrawSet.add(c); ((NodeShape) startShape).onConnectionEnd(c); shape.onConnectionEnd(c); } }else { ((NodeShape) startShape).onConnectionCancel(); } deleteConnection(buildConnection); inDragBuildConnection = false; buildConnection = null; } }
@Override public void onMouseUp(MouseUpEvent event) { super.onMouseUp(event); if (event.getNativeButton() == NativeEvent.BUTTON_RIGHT) { NodeShape shape = (NodeShape) getShapeUnderMouse(); if (shape instanceof OutNodeShape) { OutNodeShape outShape = (OutNodeShape)shape; int x = outShape.getOffsetLeft() + 2*outShape.getRadius(); int y = outShape.getOffsetTop() + 2*outShape.getRadius(); outShape.getContextMenu().setPopupPosition(x,y); outShape.getContextMenu().show(); } } }
private void registerHandlers() { if(BrowserUtils.isMobile) { registerHandler(this.addDomHandler(this, TouchStartEvent.getType())); registerHandler(this.addDomHandler(this, TouchEndEvent.getType())); } else { registerHandler(this.addDomHandler(this, MouseDownEvent.getType())); registerHandler(this.addDomHandler(this, MouseUpEvent.getType())); registerHandler(this.addDomHandler(this, MouseOutEvent.getType())); } registerHandler(this.addHandler(this, DragStartEvent.getType())); registerHandler(this.addHandler(this, DragMoveEvent.getType())); registerHandler(this.addHandler(this, DragEndEvent.getType())); registerHandler(this.addHandler(this, DragCancelEvent.getType())); }
private TabBarItemComponent createSystemTabItem(EnumSystemTabItemType itemType) { TabBarItem tabBarItem = null; TabBarItemComponent component = null; AutoBean<TabBarItem> TabBarItemBean = AutoBeanService.getInstance().getFactory().tabBarItem(); tabBarItem = TabBarItemBean.as(); switch (itemType) { case PREVIOUS: tabBarItem.setName("<"); break; case NEXT: tabBarItem.setName(">"); break; } component = new TabBarItemComponent(tabBarItem, itemType); // Add handlers as not created by usual mechanism if(BrowserUtils.isMobile) { systemTabHandlers.add(component.addDomHandler(this, TouchStartEvent.getType())); systemTabHandlers.add(component.addDomHandler(this, TouchEndEvent.getType())); } else { systemTabHandlers.add(component.addDomHandler(this, MouseDownEvent.getType())); systemTabHandlers.add(component.addDomHandler(this, MouseUpEvent.getType())); systemTabHandlers.add(component.addDomHandler(this, MouseOutEvent.getType())); } systemTabHandlers.add(component.addHandler(component, TapEvent.getType())); return component; }
@Override protected void endDragging(MouseUpEvent event) { if (this.dragMode >= 0 && this.resizable) { DOM.releaseCapture(getElement()); this.dragX = event.getClientX() - this.dragX; this.dragY = event.getClientY() - this.dragY; this.dragMode = -1; this.updateCursor(this.dragMode); RootPanel.get().getElement().getStyle().setCursor(Cursor.AUTO); } else { super.endDragging(event); } }
protected void setupDelegatingMouseUpHandler() { widgetContainer.addDomHandler(new MouseUpHandler() { @Override public void onMouseUp(final MouseUpEvent event) { gridLayer.onNodeMouseUp(new NodeMouseUpEvent(event) { @Override public int getX() { //Adjust the x-coordinate (relative to the DOM Element) to be relative to the GridCanvas. return super.getX() + widgetContainer.getElement().getOffsetLeft(); } @Override public int getY() { //Adjust the y-coordinate (relative to the DOM Element) to be relative to the GridCanvas. return super.getY() + widgetContainer.getElement().getOffsetTop(); } }); } }, MouseUpEvent.getType()); }
@Test public void testMouseUpEvent() { final MouseDownEvent md0 = mock(MouseDownEvent.class); when(md0.getRelativeX(any(Element.class))).thenReturn(0); when(md0.getRelativeY(any(Element.class))).thenReturn(0); final NodeMouseDownEvent nmd0 = new NodeMouseDownEvent(md0); final MouseUpEvent mu0 = mock(MouseUpEvent.class); final NodeMouseUpEvent nmu0 = new NodeMouseUpEvent(mu0); mediator.handleEvent(nmd0); mediator.handleEvent(nmu0); verify(vpStyle, times(1)).setCursor(eq(Style.Cursor.MOVE)); verify(vpStyle, times(1)).setCursor(eq(Style.Cursor.DEFAULT)); }
@Override public void onMouseUp( MouseUpEvent event ) { DOM.releaseCapture( getElement() ); RootPanel.get().remove( this ); if( fDragging ) { RootPanel.get().remove( ghost ); event.preventDefault(); event.stopPropagation(); Element target = DOM.eventGetTarget( DOM.eventGetCurrentEvent() ); ghost.signalFinish( target ); } else { } }
@Override public void onMouseUp(MouseUpEvent event) { if (isDownPosition(event)) { Geometry point = new Geometry(Geometry.POINT, 0, -1); Coordinate coordinate = getLocation(event, RenderSpace.WORLD); point.setCoordinates(new Coordinate[] { coordinate }); GeomajasServerExtension .getInstance() .getServerFeatureService() .search(mapPresenter, point, calculateBufferFromPixelTolerance(), ServerFeatureService.QueryType.INTERSECTS, ServerFeatureService.SearchLayerType.SEARCH_ALL_LAYERS, -1, new SelectionCallback() ); } }
@Override public void onMouseUp(MouseUpEvent event) { GWT.log("onMouseUp(MouseUpEvent)"); if (event.getNativeButton() == NativeEvent.BUTTON_LEFT) { GanttWidget.this.onTouchOrMouseUp(event.getNativeEvent()); } else { if (secondaryClickOnNextMouseUp) { Element bar = getBar(event.getNativeEvent()); if (bar != null && isEnabled()) { getRpc().stepClicked(getStepUid(bar), event.getNativeEvent(), bar); } } secondaryClickOnNextMouseUp = true; } }
@Override public void onMouseUp(MouseUpEvent event) { final int x = event.getX(); final int y = event.getY(); // System.out.println("onMouseUp(" + x + "," + y + ")"); if (lastStroke == null) { return; } addPointToLastStroke(x, y); if (lastStroke.size() >= 2) { strokes.add(lastStroke); strokeCanvasListener.onStrokeFinished(); } lastStroke = null; updateCanvas(); }
/** Set a new point on the distance-line. */ public void onMouseUp(MouseUpEvent event) { if (event.getNativeButton() != NativeEvent.BUTTON_RIGHT) { Coordinate coordinate = getWorldPosition(event); if (distanceLine.getOriginalLocation() == null) { distanceLine.setGeometry(getFactory().createLineString(new Coordinate[] { coordinate })); mapWidget.registerWorldPaintable(distanceLine); mapWidget.registerWorldPaintable(lineSegment); dispatchState(State.START); } else { Geometry geometry = (Geometry) distanceLine.getOriginalLocation(); InsertCoordinateOperation op = new InsertCoordinateOperation(geometry.getNumPoints(), coordinate); geometry = op.execute(geometry); distanceLine.setGeometry(geometry); tempLength = (float) geometry.getLength(); updateMeasure(event, true); dispatchState(State.CLICK); } mapWidget.render(mapWidget.getMapModel(), RenderGroup.VECTOR, RenderStatus.UPDATE); } }
/** * First mouse button: publish a toggle event on the selection topic for the referenced MapWidget. Second mouse * button opens a menu. * * @param event * event */ @Override public void onMouseUp(MouseUpEvent event) { // handle click if any? if (dragging) { // shift or CTRL is used when depressed either at beginning or end: shiftOrCtrl = (event.isShiftKeyDown() || event.isControlKeyDown()); if (timestamp + clickTimeout > new Date().getTime() && (bounds.getWidth() < pixelTolerance || bounds.getHeight() < pixelTolerance)) { stopDragging(); // click behavior instead of drag ToggleSelectionAction action = new ToggleSelectionAction(mapWidget, priorityToSelectedLayer, pixelTolerance); action.toggle(getScreenPosition(event), !shiftOrCtrl); return; } } // normal "rectangle" handling super.onMouseUp(event); }
@Override public void onMouseUp(MouseUpEvent event) { if (controller != null) { controller.onMouseUp(event); if (!controller.isBusy()) { panController.onMouseUp(event); } } else { if (event.getNativeButton() != Event.BUTTON_RIGHT) { boolean moving = panController.isMoving(); panController.onMouseUp(event); if (!moving) { // Check if we can toggle selection on a feature: ToggleSelectionAction action = new ToggleSelectionAction(mapWidget, pixelTolerance); action.toggle(getScreenPosition(event), true); } } } }
/** * Update event caches to keep track of the latest event of each instance. * @param the event to cache */ private void updateEventCaches(Event<?> event){ if(event == null){ return; } if(event instanceof DoubleClickEvent){ doubleClickEvent = new org.gz.gwt.mousemanager.client.event.DoubleClickEvent((DoubleClickEvent)event, target); } if(event instanceof ClickEvent){ clickEvent = new org.gz.gwt.mousemanager.client.event.ClickEvent((ClickEvent)event, target); } if(event instanceof MouseUpEvent){ mouseUpEvent = new org.gz.gwt.mousemanager.client.event.MouseUpEvent((MouseUpEvent)event, target); } if(event instanceof MouseDownEvent){ mouseDownEvent = new org.gz.gwt.mousemanager.client.event.MouseDownEvent((MouseDownEvent)event, target); } if(event instanceof MouseMoveEvent){ mouseMoveEvent = new org.gz.gwt.mousemanager.client.event.MouseMoveEvent((MouseMoveEvent)event, target); } if(event instanceof MouseOverEvent){ mouseOverEvent = new org.gz.gwt.mousemanager.client.event.MouseOverEvent((MouseOverEvent)event, target); } if(event instanceof MouseOutEvent){ mouseOutEvent = new org.gz.gwt.mousemanager.client.event.MouseOutEvent((MouseOutEvent)event, target); } if(event instanceof MouseWheelEvent){ mouseWheelEvent = new org.gz.gwt.mousemanager.client.event.MouseWheelEvent((MouseWheelEvent)event, target); } if(event instanceof ContextMenuEvent){ contextMenuEvent = new org.gz.gwt.mousemanager.client.event.ContextMenuEvent(); } }
@Override public void mouseUp(MouseUpEvent event) { // Check if there is a current connector UI ui = getModel().getTempDrawUI(); if (ui != null && ui instanceof IntermediateConnectorUI) { IntermediateConnectorUI connector = (IntermediateConnectorUI) ui; // First level of verification: // Do not handle 0 length connectors (source == target) if (this.equals(connector.getSourcePort())) { return; } // Let a chance to the target port to validate the connection if (isValid(connector)) { // The server-side is responsible for maintaining the real state getModel().getServerRpc().createConnector( connector.getSourcePort().getId(), this.getId() ); } } }
private void onDraggerMouseUp(HumanInputEvent event, double relativeY) { if( m_isMouseDown ) { Event.releaseCapture(Magnifier.this.m_dragger.getElement()); event.preventDefault(); //--- DRK > Pretty hacky, but I can't figure out how to "forward" the event up the DOM so tooltip can get it. if( event instanceof MouseUpEvent ) { m_viewContext.toolTipMngr.onMouseUp((MouseUpEvent)event); } double mouseY = relativeY; Magnifier.this.setDraggerPositionFromMouse(mouseY + m_mouseDownOffset); m_isMouseDown = false; } }
/** * @param note * the note to render */ public NoteView(Note note) { this.note = note; setStyleName("note"); note.setObserver(this); final Element elem = getElement(); elem.getStyle().setProperty("position", "absolute"); titleElement = elem.appendChild(Document.get().createDivElement()); titleElement.setClassName("note-title"); content.setStyleName("note-content"); content.addValueChangeHandler(this); setWidget(content); render(); addDomHandler(this, MouseDownEvent.getType()); addDomHandler(this, MouseMoveEvent.getType()); addDomHandler(this, MouseUpEvent.getType()); }
private void addEntryExamplePanelHandler() { this.explanationView.addEntryExamplePanelHandler(new MouseUpHandler() { @Override public void onMouseUp(MouseUpEvent event) { entryDescriptionSoundController.playOrStopEntrySound(entry.getEntrySound()); } }); }
@Override public void onMouseUp(MouseUpEvent event) { if (event.getSource() == clickTargetWidget && clickTargetWidget instanceof WeeklyLongItemsDateCell && !calendar.isDisabled()) { CalendarItem calendarItem = ((WeeklyLongItemsDateCell) clickTargetWidget) .getItem(); if (calendar.getItemClickListener() != null) { calendar.getItemClickListener().itemClick(calendarItem); } } }
private void registerHandlers() { if(BrowserUtils.isMobile) { registerHandler(this.addDomHandler(this, TouchStartEvent.getType())); registerHandler(this.addDomHandler(this, TouchEndEvent.getType())); registerHandler(this.addDomHandler(this, TouchMoveEvent.getType())); } else { registerHandler(this.addDomHandler(this, MouseDownEvent.getType())); registerHandler(this.addDomHandler(this, MouseUpEvent.getType())); registerHandler(this.addDomHandler(this, MouseOutEvent.getType())); registerHandler(this.addDomHandler(this, MouseMoveEvent.getType())); } }
@Override public void onMouseUp(MouseUpEvent event) { if (startEvent != null) { event.stopPropagation(); PressEndEvent endEvent = new PressEndEvent(event); eventBus.fireEvent(startEvent); eventBus.fireEvent(endEvent); reset(); } }
@Override public void onMouseUp(MouseUpEvent event) { event.stopPropagation(); PressEndEvent endEvent = new PressEndEvent(event); eventBus.fireEvent(endEvent); this.fireEvent(endEvent); reset(); }
@Override boolean dispatch(MouseUpEvent event, Element target) { //walkaround of event.getNativeButton() wrong return: //remember what button is unpressed removePressedMouseButtons(event.getNativeButton()); super.dispatch(event, target); return true; }
/** * Constructs a {@PopupMenuItem} * * @param text The text label for the item. * @param cmd The command to run when the item is clicked. * @param isEnabled True if this menu item is enabled. * @param hide True if clicking this menu item should hide the popup. */ public PopupMenuItem(String text, Command command, boolean isEnabled, boolean hide) { super(text, false); this.command = command; this.defaultEnabled = isEnabled; this.hide = hide; setStyleName(CSS.item()); if (isPreClicked) { // If this menu is pre-clicked it doesn't require a full click to select // an item, just a mouseup over the item. If the user then does click the // item then that will also give a mouseup so this handler will deal with // that case as well. addMouseUpHandler(new MouseUpHandler() { @Override public void onMouseUp(MouseUpEvent event) { onClicked(); } }); } else { addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent e) { onClicked(); } }); } // Ensure that clicking this menu item doesn't affect the current selection. addMouseDownHandler(PREVENT_DEFAULT_HANDLER); }
public void onMouseUp(MouseUpEvent event) { String selection=getCodeMirror().getSelection(); if(selection!=null && !"".equals(selection.trim())){ selectRun.enable(); }else{ selectRun.disable(); } }
public void onMouseUp(MouseUpEvent event) { ChartState chartInfo = getChartState(event); Chart chart = chartInfo.chart; XYPlot plot = chart.getPlot(); int x = getLocalX(event); int y = getLocalY(event); OverviewAxisMouseMoveHandler.setHiliteRelativeGrabX(Double.NaN); CompoundUIAction uiAction = chartInfo.getCompoundUIAction(); if (uiAction.isSelecting()) { chart.setAnimating(false); chart.zoomToHighlight(); } else if (uiAction.getSource() != null && uiAction.isDragging(uiAction.getSource()) && x != uiAction.getDragStartX()) { if (uiAction.getSource() instanceof Overlay) { ((Overlay) uiAction.getSource()).fire(new ChartDragEndEvent(plot, x)); } else { HistoryManager.pushHistory(); } chart.setAnimating(false); // FIXME: this produces several unneeded redraws, if we remove this, dragging does not // redraw correctly, so algorithm in mouse move should be reviewd ((DefaultXYPlot) chart.getPlot()).redraw(true); } chartInfo.getCompoundUIAction().cancel(); chart.setCursor(Cursor.DEFAULT); if (event.getNativeButton() == Event.BUTTON_RIGHT) { ((DefaultXYPlot) chart.getPlot()).fireContextMenuEvent(x, y); } else { // fire click, in mouse up events this fixes click on flash view. chart.click(x, y); } chartInfo.setHandled(true); }
public void onMouseUp(MouseUpEvent e) { e.preventDefault(); mouseDragging=false; // click to clear selection if (tempMouseMode == MODE_SELECT && selectedArea == null) clearSelection(); tempMouseMode = mouseMode; selectedArea = null; dragging = false; boolean circuitChanged = false; if (heldSwitchElm != null) { heldSwitchElm.mouseUp(); heldSwitchElm = null; circuitChanged = true; } if (dragElm != null) { // if the element is zero size then don't create it // IES - and disable any previous selection if (dragElm.x == dragElm.x2 && dragElm.y == dragElm.y2) { dragElm.delete(); if (mouseMode == MODE_SELECT || mouseMode == MODE_DRAG_SELECTED) clearSelection(); } else { elmList.addElement(dragElm); dragElm.draggingDone(); circuitChanged = true; } dragElm = null; } if (circuitChanged) needAnalyze(); if (dragElm != null) dragElm.delete(); dragElm = null; // cv.repaint(); }
public void onMouseUp(MouseUpEvent e){ // GWT.log("Up"); e.preventDefault(); Event.releaseCapture(can.getElement()); if (enabled && dragging) { val=calcValueFromPos(e.getX()); dragging=false; draw(); if (command!=null) command.execute(); } }
public void onMouseUp(MouseUpEvent event) { endDragging(event); if (lastFocused != null) { lastFocused.setFocus(true); } }
private void addDomHandlers() { panel.addDomHandler(this, MouseOverEvent.getType()); panel.addDomHandler(this, MouseOutEvent.getType()); panel.addDomHandler(this, MouseDownEvent.getType()); panel.addDomHandler(this, MouseUpEvent.getType()); panel.addDomHandler(this, ClickEvent.getType()); }
public PanListener(Widget widget) { this.widget = widget; widget.addDomHandler(this, MouseDownEvent.getType()); widget.addDomHandler(this, MouseUpEvent.getType()); widget.addDomHandler(this, MouseMoveEvent.getType()); widget.addDomHandler(this, TouchStartEvent.getType()); widget.addDomHandler(this, TouchEndEvent.getType()); widget.addDomHandler(this, TouchMoveEvent.getType()); }
@Override public void onMouseUp(MouseUpEvent p_event) { p_event.preventDefault(); UserAction userAction = UserAction.Primary; if (p_event.isControlKeyDown() || p_event.getNativeButton() == NativeEvent.BUTTON_RIGHT) { userAction = UserAction.Secondary; } onUp(userAction, p_event.getX(), p_event.getY()); }
@Override public void onMouseUp(MouseUpEvent p_event) { if( p_event.getSource() == canvas ) { int hexPositionX = (int)(((float)p_event.getX() * GameEngine.model().getGame().getLandWidth()) / FmpConstant.miniMapWidth); int hexPositionY = (int)(((float)p_event.getY() * GameEngine.model().getGame().getLandHeight()) / FmpConstant.miniMapHeight); MAppBoard.s_instance.setScrollPosition( hexPositionX, hexPositionY ); } }
private void attachDragProxyHandlers(final LienzoPanel floatingPanel, final ShapeDragProxy proxy) { final Style style = floatingPanel.getElement().getStyle(); final HandlerRegistration[] handlerRegs = new HandlerRegistration[2]; //MouseMoveEvents handlerRegs[0] = RootPanel.get().addDomHandler(new MouseMoveHandler() { @Override public void onMouseMove(final MouseMoveEvent mouseMoveEvent) { style.setLeft(mouseMoveEvent.getX() - (floatingPanel.getWidth() / 2), Style.Unit.PX); style.setTop(mouseMoveEvent.getY() - (floatingPanel.getHeight() / 2), Style.Unit.PX); proxy.onDragPreview(mouseMoveEvent.getX(), mouseMoveEvent.getY()); } }, MouseMoveEvent.getType()); //MouseUpEvent handlerRegs[1] = RootPanel.get().addDomHandler(new MouseUpHandler() { @Override public void onMouseUp(final MouseUpEvent mouseUpEvent) { handlerRegs[0].removeHandler(); handlerRegs[1].removeHandler(); RootPanel.get().remove(floatingPanel); proxy.onDragComplete(mouseUpEvent.getX(), mouseUpEvent.getY()); } }, MouseUpEvent.getType()); }
public void setMouseReleased(JavaScriptObject aValue) { if (mouseReleased != aValue) { if (mouseUpReg != null) { mouseUpReg.removeHandler(); mouseUpReg = null; } mouseReleased = aValue; if (mouseReleased != null) { MouseUpHandler handler = new MouseUpHandler() { @Override public void onMouseUp(MouseUpEvent event) { // if (mouseState == MOUSE.PRESSED) // Event.releaseCapture(event.getRelativeElement()); if (mouseReleased != null) { event.stopPropagation(); mouseState = MOUSE.NULL; executeEvent(mouseReleased, EventsPublisher.publish(event)); } } }; if (component instanceof Widget) mouseUpReg = ((Widget) component).addDomHandler(handler, MouseUpEvent.getType()); else if (component instanceof HasMouseUpHandlers) mouseUpReg = ((HasMouseUpHandlers) component).addMouseUpHandler(handler); } } }
public static MouseUpHandler createOnMouseUpListener(final EventListenerGVO ev, final List<InputVariableGVO> input) { return new MouseUpHandler() { public void onMouseUp(MouseUpEvent event) { Map<String,String> mouseInfo = getMouseInfo(event); CallbackHandler.createCallBack(event.getSource(), QAMLConstants.EVENT_ONMOUSE_UP, ev, input, mouseInfo); } }; }