本文整理汇总了Java中javafx.scene.control.TableRow.getIndex方法的典型用法代码示例。如果您正苦于以下问题:Java TableRow.getIndex方法的具体用法?Java TableRow.getIndex怎么用?Java TableRow.getIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.TableRow
的用法示例。
在下文中一共展示了TableRow.getIndex方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPoint
import javafx.scene.control.TableRow; //导入方法依赖的package包/类
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;
}
示例2: getVisibleCellAt
import javafx.scene.control.TableRow; //导入方法依赖的package包/类
public TableCell<?, ?> getVisibleCellAt(TableView<?> tableView, int row, int column) {
Set<Node> lookupAll = getTableCells(tableView);
TableCell<?, ?> cell = null;
for (Node node : lookupAll) {
TableCell<?, ?> cell1 = (TableCell<?, ?>) node;
TableRow<?> tableRow = cell1.getTableRow();
TableColumn<?, ?> tableColumn = cell1.getTableColumn();
if (tableRow.getIndex() == row && tableColumn == tableView.getColumns().get(column)) {
cell = cell1;
break;
}
}
if (cell != null) {
return cell;
}
return null;
}
示例3: recomputeVisibleIndexes
import javafx.scene.control.TableRow; //导入方法依赖的package包/类
private void recomputeVisibleIndexes() {
firstIndex = -1;
lastIndex = -1;
// Work out which of the rows are visible
double tblViewHeight = tableView.getHeight();
double headerHeight = tableView.lookup(".column-header-background").getBoundsInLocal().getHeight();
double viewPortHeight = tblViewHeight - headerHeight;
for(TableRow<T> r : rows) {
double minY = r.getBoundsInParent().getMinY();
double maxY = r.getBoundsInParent().getMaxY();
boolean hidden = (maxY < 0) || (minY > viewPortHeight);
// boolean fullyVisible = !hidden && (maxY <= viewPortHeight) && (minY >= 0);
if (!hidden) {
if (firstIndex < 0 || r.getIndex() < firstIndex) {
firstIndex = r.getIndex();
}
if (lastIndex < 0 || r.getIndex() > lastIndex) {
lastIndex = r.getIndex();
}
}
}
}
示例4: updateRowHighlight
import javafx.scene.control.TableRow; //导入方法依赖的package包/类
private void updateRowHighlight(TableRow<Map<String, String>> row) {
int r = 160;
int g = 160;
int b = 160;
if (highlightedRows.isEmpty()) {
r = 255;
g = 255;
b = 255;
} else if (highlightedRows.contains(row.getIndex())) {
r = 200;
g = 255;
b = 200;
}
if (row.getIndex() % 2 == 1) {
r = Math.max(0, r-16);
g = Math.max(0, g-16);
b = Math.max(0, b-16);
}
row.setBackground(new Background(new BackgroundFill(Color.rgb(r, g, b), null, null)));
}
示例5: call
import javafx.scene.control.TableRow; //导入方法依赖的package包/类
@Override
public TableCell<ObservableList<StringProperty>,String> call(TableColumn<ObservableList<StringProperty>,String> param) {
return new TextFieldTableCell<ObservableList<StringProperty>, String>(( new DefaultStringConverter() )) {
@Override
public void updateItem(String s, boolean b) {
super.updateItem(s, b);
TableRow row = getTableRow();
if (row != null && (row.getIndex()+1 == this.getTableView().getItems().size()) || (cutoff && row != null && row.getIndex() == 0)) {
setDisable(true);
setEditable(false);
this.setStyle("-fx-text-fill: grey");
}
}
};
}
示例6: updateCells
import javafx.scene.control.TableRow; //导入方法依赖的package包/类
protected void updateCells(boolean resetChildren) {
// To avoid a potential memory leak (when the TableColumns in the
// TableView are created/inserted/removed/deleted, we have a 'refresh
// counter' that when we reach 0 will delete all cells in this row
// and recreate all of them.
if (resetChildren) {
if (fullRefreshCounter == 0) {
recreateCells();
}
fullRefreshCounter--;
}
// if clear isn't called first, we can run into situations where the
// cells aren't updated properly.
final boolean cellsEmpty = cells.isEmpty();
cells.clear();
TableRow<T> skinnable = getSkinnable();
final int skinnableIndex = skinnable.getIndex();
final List<? extends TableColumnBase/* <T,?> */> visibleLeafColumns = getVisibleLeafColumns();
for (int i = 0, max = visibleLeafColumns.size(); i < max; i++) {
TableColumnBase<T, ?> col = visibleLeafColumns.get(i);
System.out.println(col.getText());
TableCell<T, ?> cell = null;
if (cellsMap.containsKey(col)) {
cell = cellsMap.get(col).get();
// the reference has been gc'd, remove key entry from map
if (cell == null) {
cellsMap.remove(col);
}
}
if (cell == null) {
// if the cell is null it means we don't have it in cache and
// need to create it
cell = createCell(col);
}
updateCell(cell, skinnable);
cell.updateIndex(skinnableIndex);
cells.add(cell);
}
// update children of each row
if (!fixedCellSizeEnabled && (resetChildren || cellsEmpty)) {
getChildren().setAll(cells);
}
}