1717
1818package javafxlibrary .keywords .AdditionalKeywords ;
1919
20- import com . sun . javafx .scene .control .skin .TableViewSkin ;
21- import com . sun . javafx .scene .control .skin .VirtualFlow ;
20+ import javafx .scene .control .skin .TableViewSkin ;
21+ import javafx .scene .control .skin .VirtualFlow ;
2222import javafx .collections .ObservableList ;
2323import javafx .css .PseudoClass ;
2424import javafx .geometry .BoundingBox ;
@@ -279,7 +279,7 @@ public String getNodeText(Object locator) {
279279 @ RobotKeyword ("Returns image name and path of the node. \n \n "
280280 + "``locator`` is either a _query_ or _Object_ for a node whose getHeight method will be called, see "
281281 + "`3. Locating JavaFX Nodes`. \n \n "
282- + "Returns full image path by subsequently calling impl_getUrl -method. \n \n "
282+ + "Returns full image path by subsequently calling getUrl -method. \n \n "
283283 + "Note, impl_getUrl -method is deprecated! Support for this method will be removed from Java in the future." )
284284 @ ArgumentNames ({"node" })
285285 public String getNodeImageUrl (Object locator ) {
@@ -294,8 +294,7 @@ public String getNodeImageUrl(Object locator) {
294294 try {
295295 Object result = m .invoke (node , (Object ) null );
296296 Image image = (Image ) result ;
297- RobotLog .trace ("Calling deprecated method impl_getUrl() for image: \" " + image + "\" " );
298- return image .impl_getUrl ();
297+ return image .getUrl ();
299298 } catch (Exception e ) {
300299 throw new JavaFXLibraryNonFatalException ("Problem calling method: .getImage(): " + e .getMessage (), e );
301300 }
@@ -480,13 +479,17 @@ public List<Object> getTableColumnCells(Object locator, int column) {
480479 RobotLog .info ("Getting table \" " + locator + "\" cells from column \" " + column + "\" ." );
481480 TableView table = (TableView ) objectToNode (locator );
482481 List <Object > columnCells = new ArrayList <>();
483- VirtualFlow <?> vf = (VirtualFlow <?>) ((TableViewSkin <?>) table .getSkin ()).getChildren ().get (1 );
484-
485- for (int i = vf .getFirstVisibleCell ().getIndex (); i < vf .getLastVisibleCell ().getIndex () + 1 ; i ++) {
486- RobotLog .info ("Index number: " + i );
487- columnCells .add (mapObject (vf .getCell (i ).getChildrenUnmodifiable ().get (column )));
482+ Optional <VirtualFlow > vf = table .getChildrenUnmodifiable ().stream ().filter (node -> node instanceof VirtualFlow ).map (VirtualFlow .class ::cast ).findFirst ();
483+ if (vf .isPresent ()) {
484+ VirtualFlow virtualFlow = vf .get ();
485+ for (int i = virtualFlow .getFirstVisibleCell ().getIndex (); i < virtualFlow .getLastVisibleCell ().getIndex () + 1 ; i ++) {
486+ RobotLog .info ("Index number: " + i );
487+ columnCells .add (mapObject (virtualFlow .getCell (i ).getChildrenUnmodifiable ().get (column )));
488+ }
489+ return mapObjects (columnCells );
490+ } else {
491+ throw new JavaFXLibraryNonFatalException ("Could not find VirtualFlow from Tableview!" );
488492 }
489- return mapObjects (columnCells );
490493 } catch (ClassCastException cce ) {
491494 throw new JavaFXLibraryNonFatalException ("Unable to handle argument as TableView!" );
492495 }
0 commit comments