public void paste() { JsonObject properties = new JsonObject(); properties.add("rowStart", this.cursorPosition.row); properties.add("columnStart", this.cursorPosition.column); properties.add("text", this.clipboard); getRemoteObject().call("insertText", properties); }
public void cut(TextSelection selection) { checkWidget(); if ((style & SWT.READ_ONLY) != 0) return; this.clipboard = selection.getText(); JsonObject properties = new JsonObject(); properties.add("rowStart", this.cursorPosition.row); properties.add("columnStart", this.cursorPosition.column); properties.add("text", this.clipboard); getRemoteObject().call("removeText", properties); }
/** * Sets the receiver's background color to the color specified by the argument, or to the default * system color for the control if the argument is null. * * @param color the new color (or null) * @exception IllegalArgumentException * <ul> * <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed * </ul> * * @exception SWTException * <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver * </ul> */ public void setBackground(Color color) { // super.setBackground(color); // This has no effect as the background // will // be hidden by the client script JsonObject properties = new JsonObject(); properties.add("R", color.getRed()); properties.add("G", color.getGreen()); properties.add("B", color.getBlue()); getRemoteObject().set("background", properties); }
@Test public void testFiresPresentationChangeToFullScreen() { environment.getRemoteObject().setHandler(new VideoOperationHandler(video)); video.addPresentationListener(presentationListener); JsonObject parameters = new JsonObject(); parameters.add(PROPERTY_PRESENTATION, Presentation.FULL_SCREEN.name()); environment.dispatchNotify(Constants.EVENT_PRESENTATION, parameters); verify(presentationListener).presentationChanged(Presentation.FULL_SCREEN); }
@Test public void testFiresPlaybackChange() { environment.getRemoteObject().setHandler(new VideoOperationHandler(video)); video.addPlaybackListener(playbackListener); JsonObject parameters = new JsonObject(); parameters.add(PROPERTY_PLAYBACK, Playback.ERROR.name()); environment.dispatchNotify(Constants.EVENT_PLAYBACK, parameters); verify(playbackListener).playbackChanged(Playback.ERROR); }
@Test public void testRendersPlaybackPlayOnce() { environment.getRemoteObject().setHandler(new VideoOperationHandler(video)); video.addPlaybackListener(playbackListener); environment.newRequest(); JsonObject parameters = new JsonObject(); parameters.add(PROPERTY_PLAYBACK, Playback.PLAY.name()); environment.dispatchNotify(Constants.EVENT_PLAYBACK, parameters); verify(playbackListener).playbackChanged(Playback.PLAY); assertFalse(hasOperation(WidgetUtil.getId(video), SET, null)); }
@Test public void testActivatesItemOnlyIfDifferentFromClientItem() { SwipeItemProvider itemProvider = mockProvider(2); mockSwipeItem(itemProvider, 0, true); mockSwipeItem(itemProvider, 1, true); Swipe swipe = new Swipe(shell, itemProvider); swipe.show(0); JsonObject properties = new JsonObject(); properties.add("item", 1); environment.dispatchNotify("Swipe", properties); verify(remoteObject, times(1)).set("active", 0); verify(remoteObject, never()).set("active", 1); }