Java Code Examples for javafx.scene.control.TableView#lookupAll()

The following examples show how to use javafx.scene.control.TableView#lookupAll() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JavaFXTableViewElementScrollTest.java    From marathonv5 with Apache License 2.0 7 votes vote down vote up
public Point2D getPoint(TableView<?> tableView, int columnIndex, int rowIndex) {
    Set<Node> tableRowCell = tableView.lookupAll(".table-row-cell");
    TableRow<?> row = null;
    for (Node tableRow : tableRowCell) {
        TableRow<?> r = (TableRow<?>) tableRow;
        if (r.getIndex() == rowIndex) {
            row = r;
            break;
        }
    }
    Set<Node> cells = row.lookupAll(".table-cell");
    for (Node node : cells) {
        TableCell<?, ?> cell = (TableCell<?, ?>) node;
        if (tableView.getColumns().indexOf(cell.getTableColumn()) == columnIndex) {
            Bounds bounds = cell.getBoundsInParent();
            Point2D localToParent = cell.localToParent(bounds.getWidth() / 2, bounds.getHeight() / 2);
            Point2D rowLocal = row.localToScene(localToParent, true);
            return rowLocal;
        }
    }
    return null;
}
 
Example 2
Source File: JavaFXElementPropertyAccessor.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
public Point2D getPoint(TableView<?> tableView, int columnIndex, int rowIndex) {
    Set<Node> tableRowCell = tableView.lookupAll(".table-row-cell");
    TableRow<?> row = null;
    for (Node tableRow : tableRowCell) {
        TableRow<?> r = (TableRow<?>) tableRow;
        if (!r.isEmpty() && r.getIndex() == rowIndex) {
            row = r;
            break;
        }
    }
    Set<Node> cells = row.lookupAll(".table-cell");
    for (Node node : cells) {
        TableCell<?, ?> cell = (TableCell<?, ?>) node;
        if (cell.isEmpty())
            continue;
        if (tableView.getColumns().indexOf(cell.getTableColumn()) == columnIndex) {
            Bounds bounds = cell.getBoundsInParent();
            Point2D localToParent = cell.localToParent(bounds.getWidth() / 2, bounds.getHeight() / 2);
            Point2D rowLocal = row.localToScene(localToParent, true);
            return rowLocal;
        }
    }
    return null;
}
 
Example 3
Source File: RFXComponentTest.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
public Point2D getPoint(TableView<?> tableView, int columnIndex, int rowIndex) {
    Set<Node> tableRowCell = tableView.lookupAll(".table-row-cell");
    TableRow<?> row = null;
    for (Node tableRow : tableRowCell) {
        TableRow<?> r = (TableRow<?>) tableRow;
        if (r.getIndex() == rowIndex) {
            row = r;
            break;
        }
    }
    Set<Node> cells = row.lookupAll(".table-cell");
    for (Node node : cells) {
        TableCell<?, ?> cell = (TableCell<?, ?>) node;
        if (tableView.getColumns().indexOf(cell.getTableColumn()) == columnIndex) {
            Bounds bounds = cell.getBoundsInParent();
            Point2D localToParent = cell.localToParent(bounds.getWidth() / 2, bounds.getHeight() / 2);
            Point2D rowLocal = row.localToScene(localToParent, true);
            return rowLocal;
        }
    }
    return null;
}
 
Example 4
Source File: JavaFXElementPropertyAccessor.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
private Set<Node> getTableCells(TableView<?> tableView) {
    Set<Node> l = tableView.lookupAll("*");
    Set<Node> r = new HashSet<>();
    for (Node node : l) {
        if (node instanceof TableCell<?, ?>) {
            if (!((TableCell<?, ?>) node).isEmpty())
                r.add(node);
        }
    }
    return r;
}
 
Example 5
Source File: ScenarioConfigEditorFX.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
private ScrollBar getVerticalScrollbar(TableView<?> table) {
	ScrollBar result = null;
	for (Node n : table.lookupAll(".scroll-bar")) {
		if (n instanceof ScrollBar) {
			ScrollBar bar = (ScrollBar) n;
			if (bar.getOrientation().equals(Orientation.VERTICAL)) {
				result = bar;
			}
		}
	}
	return result;
}