Search in sources :

Example 1 with VirtualFlow

use of com.sun.javafx.scene.control.skin.VirtualFlow in project JavaFXLibrary by eficode.

the class ConvenienceKeywords method getTableColumnCells.

@RobotKeyword("Returns a list of *visible* cells(Nodes) of the given table column.\n\n" + "``locator`` is either a _query_ or _Object:Node_ for identifying the TableView element, see " + "`3. Locating or specifying UI elements`. \n\n" + "``column`` Integer value for the column")
@ArgumentNames({ "table", "column" })
public List<Object> getTableColumnCells(Object locator, int column) {
    try {
        TableView table = (TableView) objectToNode(locator);
        List<Object> columnCells = new ArrayList<>();
        VirtualFlow<?> vf = (VirtualFlow<?>) ((TableViewSkin<?>) table.getSkin()).getChildren().get(1);
        for (int i = vf.getFirstVisibleCell().getIndex(); i < vf.getLastVisibleCell().getIndex() + 1; i++) {
            robotLog("INFO", "index number: " + Integer.toString(i));
            columnCells.add(mapObject(vf.getCell(i).getChildrenUnmodifiable().get(column)));
        }
        return mapObjects(columnCells);
    } catch (ClassCastException cce) {
        throw new JavaFXLibraryNonFatalException("Unable to handle argument as TableView!");
    }
}
Also used : JavaFXLibraryNonFatalException(javafxlibrary.exceptions.JavaFXLibraryNonFatalException) TableViewSkin(com.sun.javafx.scene.control.skin.TableViewSkin) VirtualFlow(com.sun.javafx.scene.control.skin.VirtualFlow) RobotKeyword(org.robotframework.javalib.annotation.RobotKeyword) ArgumentNames(org.robotframework.javalib.annotation.ArgumentNames)

Aggregations

TableViewSkin (com.sun.javafx.scene.control.skin.TableViewSkin)1 VirtualFlow (com.sun.javafx.scene.control.skin.VirtualFlow)1 JavaFXLibraryNonFatalException (javafxlibrary.exceptions.JavaFXLibraryNonFatalException)1 ArgumentNames (org.robotframework.javalib.annotation.ArgumentNames)1 RobotKeyword (org.robotframework.javalib.annotation.RobotKeyword)1