List of usage examples for com.google.gwt.user.client Window getClientWidth
public static int getClientWidth()
From source file:ch.unifr.pai.twice.dragndrop.client.configuration.DragConfiguration.java
License:Apache License
/** * @return the boundaries of permitted drags - if no boundary box is provided, this equals to the client width *///from w w w . j a v a 2 s .com public int getMaxX() { return boundaryBox != null ? boundaryBox.getAbsoluteLeft() + boundaryBox.getOffsetWidth() : Window.getClientWidth(); }
From source file:ch.unifr.pai.twice.multipointer.client.ExtendedWebsocketControl.java
License:Apache License
/** * As soon as the web socket channel is opened, the component sends its screen dimensions to the server *///from w w w. j a v a 2 s. com private void onOpen() { this.opened = true; send(websocket, UUID.get() + "@s@" + Window.getClientWidth() + "@" + Window.getClientHeight()); // Window.alert("Multi cursor control started!"); }
From source file:ch.unifr.pai.twice.multipointer.client.ExtendedWebsocketControl.java
License:Apache License
/** * If the screen of the shared device is resized, the component updates the information on the server side. * //from w w w. ja va 2 s . c om * @see com.google.gwt.event.logical.shared.ResizeHandler#onResize(com.google.gwt.event.logical.shared.ResizeEvent) */ @Override public void onResize(ResizeEvent event) { if (opened && websocket != null) { send(websocket, UUID.get() + "@r@" + Window.getClientWidth() + "@" + Window.getClientHeight()); } }
From source file:ch.unifr.pai.twice.multipointer.client.MouseCursor.java
License:Apache License
/** * Reposition the mouse pointer to x and y coordinates * //from ww w . ja v a 2 s. co m * @param x * @param y */ private void move(int x, int y) { this.x = x; this.y = y; Element e = getElementFromPoint(x, y); int shrinkX = x + image.getOffsetWidth() - Window.getClientWidth() - Window.getScrollLeft(); int shrinkY = y + image.getOffsetHeight() - Window.getClientHeight() - Window.getScrollTop(); setWidth(Math.max(0, (image.getOffsetWidth() - (shrinkX > 0 ? shrinkX : 0))) + "px"); setHeight(Math.max(0, (image.getOffsetHeight() - (shrinkY > 0 ? shrinkY : 0))) + "px"); int clientX = x + Window.getScrollLeft(); int clientY = y + Window.getScrollTop(); if (!e.equals(oldElement)) { if (oldElement != null) fireMouseEvent("mouseout", uuid, color, oldElement, clientX, clientY); fireMouseEvent("mouseover", uuid, color, e, clientX, clientY); } fireMouseEvent("mousemove", uuid, color, e, clientX, clientY); oldElement = e; getElement().getStyle().setLeft(x, Unit.PX); getElement().getStyle().setTop(y, Unit.PX); if (storage != null) { storage.setItem("ch.unifr.pai.mice.multicursor.position." + fileName + ".x", String.valueOf(x)); storage.setItem("ch.unifr.pai.mice.multicursor.position." + fileName + ".y", String.valueOf(y)); } }
From source file:ch.unifr.pai.twice.multipointer.client.WebsocketControl.java
License:Apache License
private void onOpen() { this.opened = true; send(websocket, UUID.get() + "@s@" + Window.getClientWidth() + "@" + Window.getClientHeight()); // Window.alert("Multi cursor control started!"); }
From source file:ch.unifr.pai.twice.multipointer.client.WebsocketControl.java
License:Apache License
@Override public void onResize(ResizeEvent event) { if (opened && websocket != null) { send(websocket, UUID.get() + "@r@" + Window.getClientWidth() + "@" + Window.getClientHeight()); }/*w ww .j a v a2 s.c om*/ }
From source file:ch.unifr.pai.twice.multipointer.provider.client.MouseCursor.java
License:Apache License
/** * Reposition the mouse pointer to x and y coordinates * //from w ww . j a v a 2 s .c o m * @param event */ void move(RemoteMouseMoveEvent event) { genericEventHandling(event); this.x = event.x; this.y = event.y; Element e = getElementFromPoint(x, y); int shrinkX = x + image.getOffsetWidth() - Window.getClientWidth() - Window.getScrollLeft(); int shrinkY = y + image.getOffsetHeight() - Window.getClientHeight() - Window.getScrollTop(); setWidth(Math.max(0, (image.getOffsetWidth() - (shrinkX > 0 ? shrinkX : 0))) + "px"); setHeight(Math.max(0, (image.getOffsetHeight() - (shrinkY > 0 ? shrinkY : 0))) + "px"); int clientX = x + Window.getScrollLeft(); int clientY = y + Window.getScrollTop(); if (!e.equals(oldElement)) { if (oldElement != null) fireMouseEvent("mouseout", uuid, color, oldElement, clientX, clientY); fireMouseEvent("mouseover", uuid, color, e, clientX, clientY); } fireMouseEvent("mousemove", uuid, color, e, clientX, clientY); oldElement = e; getElement().getStyle().setLeft(x, Unit.PX); getElement().getStyle().setTop(y, Unit.PX); if (storage != null) { storage.setItem("ch.unifr.pai.mice.multicursor.position." + fileName + ".x", String.valueOf(x)); //old version mice storage.setItem("ch.unifr.pai.mice.multicursor.position." + fileName + ".y", String.valueOf(y)); //old version mice } show(); }
From source file:ch.unifr.pai.twice.multipointer.provider.client.MultiCursorController.java
License:Apache License
/** * Looks up the assigned mouse pointer for a specific device (by the uuid) and returns it. If no mouse pointer is assigned to this UUID, a new cursor is * assigned to this device and returned. This method also informs the web socket server about the new assignment for passing through that information to the * according client.//from w w w . ja v a2 s.c o m * * @param uuid * @return */ private MouseCursor getOrCreateCursor(String uuid) { MouseCursor m = assignedMouseCursors.get(uuid); // If a cursor is already assigned to the uuid, return this one if (m != null) return m; // else create a new cursor with the next color currentCursor++; if (currentCursor >= cursorColors.size()) { currentCursor = 0; } CursorColor c = cursorColors.get(currentCursor); m = defineMouseCursor(c.cursor, c.colorCode); m.setUuid(uuid); assignedMouseCursors.put(uuid, m); if (storage != null) storage.setItem("ch.unifr.pai.mice.multicursor.assignedCursor." + m.getFileName(), uuid); //"ch.unifr.pai.mice.multicursor.assignedCursor." CommunicationManager.getBidirectionalEventBus().fireEvent(InformationUpdateEvent .changeColorAndResize(m.getColor(), Window.getClientWidth(), Window.getClientHeight(), uuid)); return m; }
From source file:ch.unifr.pai.twice.multipointer.provider.client.MultiCursorController.java
License:Apache License
/** * If the screen of the shared device is resized, the component updates the information on the server side. * //from w w w . j av a 2 s. co m * @see com.google.gwt.event.logical.shared.ResizeHandler#onResize(com.google.gwt.event.logical.shared.ResizeEvent) */ @Override public void onResize(ResizeEvent event) { CommunicationManager.getBidirectionalEventBus() .fireEvent(InformationUpdateEvent.resize(Window.getClientWidth(), Window.getClientHeight())); }
From source file:ch.unifr.pai.twice.utils.cursorSimulator.client.RandomCursor.java
License:Apache License
/** * Move the mouse pointer randomly (the mouse pointer does not move every time but decides on if to move within this interval depending on a random boolean * choice as well./*www . j a va2 s .c o m*/ */ private void move() { int newX; int newY; if (Random.nextBoolean()) { newX = Random.nextInt(Window.getClientWidth() - RandomCursor.this.getOffsetWidth()); newY = Random.nextInt(Window.getClientHeight() - RandomCursor.this.getOffsetHeight()); } else { newX = RandomCursor.this.getAbsoluteLeft(); newY = RandomCursor.this.getAbsoluteTop(); } move(newX, newY, interval, moveCallback); }