List of usage examples for com.google.gwt.event.dom.client MouseEvent getClientX
public int getClientX()
From source file:com.ait.lienzo.client.core.shape.wires.EventMockUtils.java
License:Open Source License
private static void setUpMouseEvent(final MouseEvent<?> mouseEvent, final double x, final double y) { final int _x = (int) x; final int _y = (int) y; when(mouseEvent.getX()).thenReturn(_x); when(mouseEvent.getClientX()).thenReturn(_x); when(mouseEvent.getRelativeX(any(Element.class))).thenReturn(_x); when(mouseEvent.getRelativeY(any(Element.class))).thenReturn(_y); when(mouseEvent.getY()).thenReturn(_y); when(mouseEvent.getClientY()).thenReturn(_y); when(mouseEvent.isAltKeyDown()).thenReturn(false); when(mouseEvent.isControlKeyDown()).thenReturn(false); when(mouseEvent.isMetaKeyDown()).thenReturn(false); when(mouseEvent.isShiftKeyDown()).thenReturn(false); }
From source file:com.ponysdk.core.terminal.ui.PTWidget.java
License:Apache License
protected void triggerMouseEvent(final DomHandlerType domHandlerType, final MouseEvent<?> event) { final PTInstruction eventInstruction = buildEventInstruction(domHandlerType); final JSONArray eventInfo = new JSONArray(); eventInfo.set(0, new JSONNumber(event.getClientX())); eventInfo.set(1, new JSONNumber(event.getClientY())); eventInfo.set(2, new JSONNumber(event.getX())); eventInfo.set(3, new JSONNumber(event.getY())); eventInfo.set(4, new JSONNumber(event.getNativeButton())); eventInfo.set(5, JSONBoolean.getInstance(event.isControlKeyDown())); eventInfo.set(6, JSONBoolean.getInstance(event.isAltKeyDown())); eventInfo.set(7, JSONBoolean.getInstance(event.isShiftKeyDown())); eventInfo.set(8, JSONBoolean.getInstance(event.isMetaKeyDown())); eventInstruction.put(ClientToServerModel.EVENT_INFO, eventInfo); final JSONArray widgetInfo = new JSONArray(); widgetInfo.set(0, new JSONNumber(uiObject.getAbsoluteLeft())); widgetInfo.set(1, new JSONNumber(uiObject.getAbsoluteTop())); widgetInfo.set(2, new JSONNumber(uiObject.getOffsetHeight())); widgetInfo.set(3, new JSONNumber(uiObject.getOffsetWidth())); eventInstruction.put(ClientToServerModel.WIDGET_POSITION, widgetInfo); uiBuilder.sendDataToServer(uiObject, eventInstruction); preventOrStopEvent(event);// ww w . j a va 2s.com }
From source file:com.preferanser.client.geom.Point.java
License:Open Source License
public static Point FromMouseEvent(MouseEvent event) { return new Point(event.getClientX(), event.getClientY()); }
From source file:com.qualogy.qafe.gwt.client.ui.renderer.events.EventFactory.java
License:Apache License
private static Map<String, String> getMouseInfo(MouseEvent event) { Map<String, String> mouseInfo = new HashMap<String, String>(); int posX = -1; int posY = -1; try {// ww w .ja v a 2 s .co m // In QTree class a SelectionEvent is translated to a ClickEvent, // so position X and Y are not present (nativeEvent is null, is used to get the clientX and clientY) posX = event.getClientX(); posY = event.getClientY(); } catch (Exception e) { // Ignore } mouseInfo.put(EventDataI.MOUSE_X, String.valueOf(posX)); mouseInfo.put(EventDataI.MOUSE_Y, String.valueOf(posY)); return mouseInfo; }
From source file:gwt.g2d.client.input.MouseManager.java
License:Apache License
/** * Notifies this MouseManager that a MouseEvent is being handled. * Stores the mouse position and prevent the default action from taking * place if isPreventDefault() is true./*from w w w . j a v a2 s. c om*/ * * @param <H> * @param event */ private <H extends EventHandler> void handleMouseEvent(MouseEvent<H> event) { clientX = event.getClientX(); clientY = event.getClientY(); screenX = event.getScreenX(); screenY = event.getScreenY(); x = event.getX(); y = event.getY(); handleEvent(event); }
From source file:io.apiman.manager.ui.client.local.pages.common.PolicyList.java
License:Apache License
/** * Called when the user begins dragging a policy. * @param event//from ww w. j a v a2s .co m * @param row */ protected void onStartDragging(MouseEvent<?> event, PolicyRow row) { int index = getWidgetIndex(row); insert(dropHolder, index); // put the row at the end of the list and then fix its position remove(row); add(row); row.getElement().getStyle().setPosition(Position.FIXED); row.getElement().getStyle().setWidth(getElement().getClientWidth(), Unit.PX); row.getElement().getStyle().setOpacity(0.85); row.getElement().getStyle().setBackgroundColor("white"); //$NON-NLS-1$ row.getElement().getStyle().setLeft(event.getClientX(), Unit.PX); }
From source file:org.geomajas.gwt.client.controller.AbstractGraphicsController.java
License:Open Source License
protected Coordinate getClientPosition(MouseEvent<?> event) { return new Coordinate(event.getClientX(), event.getClientY()); }
From source file:org.openelis.ui.widget.Balloon.java
License:Open Source License
private static void setTarget(final HasBalloon widget, Element element, MouseEvent<?> mouseEvent) { targetWidget = (HasBalloon) widget;//from ww w . j av a 2s. c o m targetElement = element; if (mouseEvent instanceof CellMouseOverEvent) { x = ((CellMouseOverEvent) mouseEvent).getX(); y = ((CellMouseOverEvent) mouseEvent).getY(); } else { x = mouseEvent.getClientX(); y = mouseEvent.getClientY(); } }
From source file:org.openremote.web.console.event.press.PressCancelEvent.java
License:Open Source License
public PressCancelEvent(MouseEvent<MouseOutHandler> sourceEvent) { super(sourceEvent); clientXPos = sourceEvent.getClientX(); clientYPos = sourceEvent.getClientY(); screenXPos = sourceEvent.getScreenX(); screenYPos = sourceEvent.getScreenY(); }
From source file:org.overlord.sramp.ui.client.local.widgets.common.DropdownMenu.java
License:Apache License
/** * Shows the menu relative to the mouse position. Requires a mouse event * to figure out where the mouse pointer currently is located. * @param event//ww w.jav a2 s. co m */ public void showAtCurrentMouseLocation(MouseEvent<?> event) { rootPanel.add(glass); rootPanel.add(this); Style style = this.getElement().getStyle(); style.setPosition(Position.ABSOLUTE); style.setTop(event.getY(), Unit.PX); style.setLeft(event.getClientX(), Unit.PX); dropdown.getElement().getStyle().setDisplay(Display.BLOCK); }