17
17
18
18
package javafxlibrary .keywords .AdditionalKeywords ;
19
19
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 ;
22
22
import javafx .collections .ObservableList ;
23
23
import javafx .css .PseudoClass ;
24
24
import javafx .geometry .BoundingBox ;
@@ -279,7 +279,7 @@ public String getNodeText(Object locator) {
279
279
@ RobotKeyword ("Returns image name and path of the node. \n \n "
280
280
+ "``locator`` is either a _query_ or _Object_ for a node whose getHeight method will be called, see "
281
281
+ "`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 "
283
283
+ "Note, impl_getUrl -method is deprecated! Support for this method will be removed from Java in the future." )
284
284
@ ArgumentNames ({"node" })
285
285
public String getNodeImageUrl (Object locator ) {
@@ -294,8 +294,7 @@ public String getNodeImageUrl(Object locator) {
294
294
try {
295
295
Object result = m .invoke (node , (Object ) null );
296
296
Image image = (Image ) result ;
297
- RobotLog .trace ("Calling deprecated method impl_getUrl() for image: \" " + image + "\" " );
298
- return image .impl_getUrl ();
297
+ return image .getUrl ();
299
298
} catch (Exception e ) {
300
299
throw new JavaFXLibraryNonFatalException ("Problem calling method: .getImage(): " + e .getMessage (), e );
301
300
}
@@ -480,13 +479,17 @@ public List<Object> getTableColumnCells(Object locator, int column) {
480
479
RobotLog .info ("Getting table \" " + locator + "\" cells from column \" " + column + "\" ." );
481
480
TableView table = (TableView ) objectToNode (locator );
482
481
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!" );
488
492
}
489
- return mapObjects (columnCells );
490
493
} catch (ClassCastException cce ) {
491
494
throw new JavaFXLibraryNonFatalException ("Unable to handle argument as TableView!" );
492
495
}
0 commit comments