当前位置: 首页>>代码示例>>Java>>正文


Java TreeTablePosition类代码示例

本文整理汇总了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();
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:32,代码来源:JavaFXElementPropertyAccessor.java

示例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;
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:29,代码来源:RFXTreeTableView.java

示例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());
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:14,代码来源:TreeTableViewWrap.java


注:本文中的javafx.scene.control.TreeTablePosition类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。