@Override protected Object getNodeAtMousePosition() throws StepExecutionException { Point awtPoint = getRobot().getCurrentMousePosition(); final Point2D point = new Point2D(awtPoint.x, awtPoint.y); Object result = EventThreadQueuerJavaFXImpl.invokeAndWait( "getNodeAtMousePosition", new Callable<Object>() { // $NON-NLS-1$ @Override public Object call() throws Exception { // Update the layout coordinates otherwise // we would get old position values ((TreeTableView<?>) getRealComponent()).layout(); List<TreeTableCell> tCells = NodeTraverseHelper.getInstancesOf( (Parent) getRealComponent(), TreeTableCell.class); for (TreeTableCell cell : tCells) { if (NodeBounds.checkIfContains(point, cell)) { return cell; } } throw new StepExecutionException( "No tree node found at mouse position: " //$NON-NLS-1$ + "X: " + point.getX() // $NON-NLS-1$ + "Y: " + point.getY(), // $NON-NLS-1$ EventFactory.createActionError(TestErrorEvent.NOT_FOUND)); } }); return result; }
/** * Read the value of the cell under the mouse and store it in a variable in the Client * * @param variable the name of the variable * @return the text value. */ public String rcReadValueAtMousePosition(String variable) { return EventThreadQueuerJavaFXImpl.invokeAndWait( "rcVerifyCellTextAtMousePosition", new Callable<String>() { // $NON-NLS-1$ @Override public String call() throws Exception { TreeTableCell<?, ?> cell = (TreeTableCell<?, ?>) getNodeAtMousePosition(); return getContext().getRenderedText(cell); } }); }
/** * Verifies the text of the cell under the mouse * * @param txt the text * @param operator the operator */ public void rcVerifyCellTextAtMousePosition(String txt, String operator) { String result = EventThreadQueuerJavaFXImpl.invokeAndWait( "rcVerifyCellTextAtMousePosition", new Callable<String>() { // $NON-NLS-1$ @Override public String call() throws Exception { TreeTableCell<?, ?> cell = (TreeTableCell<?, ?>) getNodeAtMousePosition(); return getContext().getRenderedText(cell); } }); Verifier.match(result, txt, operator); }