本文整理汇总了Java中javafx.scene.control.TreeTablePosition类的典型用法代码示例。如果您正苦于以下问题:Java TreeTablePosition类的具体用法?Java TreeTablePosition怎么用?Java TreeTablePosition使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TreeTablePosition类属于javafx.scene.control包,在下文中一共展示了TreeTablePosition类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
}
示例3: getSelectedCells
import javafx.scene.control.TreeTablePosition; //导入依赖的package包/类
@Property(SELECTED_CELLS_PROP_NAME)
public List<Point> getSelectedCells() {
return new GetAction<java.util.List<Point>>() {
@Override
public void run(Object... parameters) throws Exception {
java.util.List<Point> res = new ArrayList<Point>();
for (TreeTablePosition tp : (java.util.List<TreeTablePosition>) getControl().getSelectionModel().getSelectedCells()) {
res.add(new Point(tp.getColumn(), tp.getRow()));
}
setResult(res);
}
}.dispatch(getEnvironment());
}