本文整理汇总了Java中javafx.scene.control.TreeTablePosition.getRow方法的典型用法代码示例。如果您正苦于以下问题:Java TreeTablePosition.getRow方法的具体用法?Java TreeTablePosition.getRow怎么用?Java TreeTablePosition.getRow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.TreeTablePosition
的用法示例。
在下文中一共展示了TreeTablePosition.getRow方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTreeTableSelection
import javafx.scene.control.TreeTablePosition; //导入方法依赖的package包/类
public String getTreeTableSelection(TreeTableView<?> treeTableView) {
TreeTableViewSelectionModel<?> selectionModel = treeTableView.getSelectionModel();
ObservableList<Integer> selectedIndices = selectionModel.getSelectedIndices();
ObservableList<?> selectedCells = selectionModel.getSelectedCells();
int rowCount = treeTableView.getExpandedItemCount();
int columnCount = treeTableView.getColumns().size();
if (selectedIndices.size() == 0 || selectedCells.size() == 0) {
return "";
} else if (!selectionModel.isCellSelectionEnabled() && selectedIndices.size() == treeTableView.getExpandedItemCount()
|| selectionModel.isCellSelectionEnabled() && selectedCells.size() == rowCount * columnCount) {
return "all";
} else if (!selectionModel.isCellSelectionEnabled()) {
return getTreeTableRowSelectionText(treeTableView, selectionModel.getSelectedItems());
} else {
int[] rows = new int[selectedCells.size()];
int[] columns = new int[selectedCells.size()];
JSONObject cells = new JSONObject();
JSONArray value = new JSONArray();
for (int i = 0; i < selectedCells.size(); i++) {
TreeTablePosition<?, ?> cell = (TreeTablePosition<?, ?>) selectedCells.get(i);
rows[i] = cell.getRow();
columns[i] = cell.getColumn();
List<String> cellValue = new ArrayList<>();
cellValue.add(getTreeTableNodePath(treeTableView, selectionModel.getModelItem(cell.getRow())));
cellValue.add(getTreeTableColumnName(treeTableView, cell.getColumn()));
value.put(cellValue);
}
cells.put("cells", value);
return cells.toString();
}
}
示例2: RFXTreeTableView
import javafx.scene.control.TreeTablePosition; //导入方法依赖的package包/类
public RFXTreeTableView(Node source, JSONOMapConfig omapConfig, Point2D point, IJSONRecorder recorder) {
super(source, omapConfig, point, recorder);
TreeTableView<?> treeTableView = (TreeTableView<?>) source;
if (source == null) {
return;
}
if (treeTableView.getEditingCell() != null) {
TreeTablePosition<?, ?> editingCell = treeTableView.getEditingCell();
row = editingCell.getRow();
column = editingCell.getColumn();
} else {
if (point != null) {
column = getTreeTableColumnAt(treeTableView, point);
row = getTreeTableRowAt(treeTableView, point);
} else {
ObservableList<?> selectedCells = treeTableView.getSelectionModel().getSelectedCells();
for (Object cell : selectedCells) {
TreeTablePosition<?, ?> tablePosition = (TreeTablePosition<?, ?>) cell;
column = tablePosition.getColumn();
row = tablePosition.getRow();
}
}
}
cellInfo = getTreeTableCellText(treeTableView, row, column);
if (row == -1 || column == -1) {
row = column = -1;
}
}