Java 类javafx.scene.control.TreeTableView 实例源码

项目:openjfx-8u-dev-tests    文件:CommonTreeTableTest.java   
/**
 * 8158784: [TEST BUG] Need test for JDK-8157398
 */
@Test
public void testCollapsedNodeGraphicVisible() throws Exception {
    Color nodeColor = new Color(Math.random(), Math.random(), Math.random(), 1);
    TreeTableView treeTable = (TreeTableView) testedControl.getControl();
    TreeItem<String> root = new TreeItem<>("Root Node");
    TreeItem<String> child = new TreeItem<>("Child", new Rectangle(10, 10, nodeColor));
    TreeTableColumn<String, String> column = new TreeTableColumn<>("Column");
    column.setCellValueFactory(item -> new SimpleStringProperty("Whatever"));
    treeTable.getColumns().setAll(column);
    root.getChildren().add(child);
    root.setExpanded(true);
    treeTable.setShowRoot(true);
    runAndWait(() -> {
        treeTable.setRoot(root);
    });
    Wrap nodeGraphic = parent.lookup(node -> node == child.getGraphic()).wrap();
    Wrap sceneWrap = Root.ROOT.lookup().wrap();
    waitForColor(nodeGraphic, 1, 1, nodeColor);
    Bounds graphicBounds = child.getGraphic().localToScene(child.getGraphic().getBoundsInLocal());
    root.setExpanded(false);
    waitForColor(sceneWrap,
            (int) (graphicBounds.getMinX() + graphicBounds.getWidth() / 2),
            (int) (graphicBounds.getMinY() + graphicBounds.getHeight() / 2), Color.WHITE);
}
项目:marathonv5    文件:JavaFXElementPropertyAccessor.java   
@SuppressWarnings("unchecked") private String getTreeTableItemText(TreeTableView<?> treeTableView,
        TreeItem<?> lastPathComponent) {
    @SuppressWarnings("rawtypes")
    TreeTableColumn treeTableColumn = treeTableView.getTreeColumn();
    if (treeTableColumn == null) {
        treeTableColumn = treeTableView.getColumns().get(0);
    }
    ObservableValue<?> cellObservableValue = treeTableColumn.getCellObservableValue(lastPathComponent);
    String original = cellObservableValue.getValue().toString();
    String itemText = original;
    int suffixIndex = 0;
    TreeItem<?> parent = lastPathComponent.getParent();
    if (parent == null)
        return itemText;
    ObservableList<?> children = parent.getChildren();
    for (int i = 0; i < children.indexOf(lastPathComponent); i++) {
        TreeItem<?> child = (TreeItem<?>) children.get(i);
        cellObservableValue = treeTableColumn.getCellObservableValue(child);
        String current = cellObservableValue.getValue().toString();
        if (current.equals(original)) {
            itemText = String.format("%s(%d)", original, ++suffixIndex);
        }
    }
    return itemText;
}
项目:marathonv5    文件:JavaFXElementPropertyAccessor.java   
@SuppressWarnings("unchecked") protected void selectTreeTableCells(TreeTableView<?> treeTableView, String value) {
    @SuppressWarnings("rawtypes")
    TreeTableViewSelectionModel selectionModel = treeTableView.getSelectionModel();
    JSONObject cells = new JSONObject(value);
    JSONArray object = (JSONArray) cells.get("cells");
    for (int i = 0; i < object.length(); i++) {
        JSONArray jsonArray = object.getJSONArray(i);
        int rowIndex = getTreeTableNodeIndex(treeTableView, jsonArray.getString(0));
        int columnIndex = getTreeTableColumnIndex(treeTableView, jsonArray.getString(1));
        @SuppressWarnings("rawtypes")
        TreeTableColumn column = treeTableView.getColumns().get(columnIndex);
        if (getVisibleCellAt(treeTableView, rowIndex, columnIndex) == null) {
            treeTableView.scrollToColumn(column);
            treeTableView.scrollTo(rowIndex);
        }
        selectionModel.select(rowIndex, column);
    }
}
项目:marathonv5    文件:JavaFXTreeTableViewElement.java   
@Override public List<IJavaFXElement> getByPseudoElement(String selector, Object[] params) {
    if (selector.equals("root")) {
        return Arrays.asList(new JavaFXTreeTableViewCellElement(this, 0, 0));
    } else if (selector.equals("mnth-cell")) {
        return Arrays.asList(new JavaFXTreeTableViewCellElement(this, ((Integer) params[0]).intValue() - 1,
                ((Integer) params[1]).intValue() - 1));
    } else if (selector.equals("all-cells")) {
        TreeTableView<?> tableView = (TreeTableView<?>) getComponent();
        int rowCount = tableView.getExpandedItemCount();
        int columnCount = tableView.getColumns().size();
        ArrayList<IJavaFXElement> r = new ArrayList<>();
        for (int i = 0; i < rowCount; i++) {
            for (int j = 0; j < columnCount; j++) {
                r.add(new JavaFXTreeTableViewCellElement(this, i, j));
            }
        }
        return r;
    } else if (selector.equals("select-by-properties")) {
        return findSelectByProperties(new JSONObject((String) params[0]));
    }
    return super.getByPseudoElement(selector, params);
}
项目:marathonv5    文件:JavaFXTreeTableViewElementTest.java   
@SuppressWarnings("unchecked") @Test public void selectAllCells() {
    TreeTableView<?> treeTableNode = (TreeTableView<?>) getPrimaryStage().getScene().getRoot().lookup(".tree-table-view");
    Platform.runLater(() -> {
        TreeTableViewSelectionModel<?> selectionModel = treeTableNode.getSelectionModel();
        selectionModel.setCellSelectionEnabled(true);
        selectionModel.setSelectionMode(SelectionMode.MULTIPLE);
        selectionModel.selectRange(0, getTreeTableColumnAt(treeTableNode, 0), treeTableNode.getExpandedItemCount() - 1,
                getTreeTableColumnAt(treeTableNode, 1));
        treeTable.marathon_select("all");
    });
    new Wait("Waiting for all cells to be selected") {
        @Override public boolean until() {
            return treeTableNode.getSelectionModel().getSelectedCells().size() == treeTableNode.getExpandedItemCount()
                    * treeTableNode.getColumns().size();
        }
    };
}
项目:marathonv5    文件:ChoiceBoxTreeTableSampleApp.java   
@Override public void start(Stage primaryStage) {
    primaryStage.setTitle("TreeTable View Sample");
    primaryStage.setScene(new Scene(new ChoiceBoxTreeTableSample()));
    primaryStage.sizeToScene();
    primaryStage.show();
    TreeTableView<?> treeTableView = (TreeTableView<?>) primaryStage.getScene().getRoot().lookup(".tree-table-view");
    treeTableView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
}
项目:marathonv5    文件:TreeTableSampleApp.java   
@Override public void start(Stage primaryStage) {
    primaryStage.setTitle("TreeTable View Sample");
    primaryStage.setScene(new Scene(new TreeTableSample()));
    primaryStage.sizeToScene();
    primaryStage.show();
    TreeTableView<?> treeTableView = (TreeTableView<?>) primaryStage.getScene().getRoot().lookup(".tree-table-view");
    treeTableView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
}
项目:marathonv5    文件:RFXComponentTest.java   
protected Point2D getPoint(TreeTableView<?> treeTableView, int rowIndex, int columnIndex) {
    Set<Node> treeTableRowCell = treeTableView.lookupAll(".tree-table-row-cell");
    TreeTableRow<?> row = null;
    for (Node tableRow : treeTableRowCell) {
        TreeTableRow<?> r = (TreeTableRow<?>) tableRow;
        if (r.getIndex() == rowIndex) {
            row = r;
            break;
        }
    }
    Set<Node> cells = row.lookupAll(".tree-table-cell");
    for (Node node : cells) {
        TreeTableCell<?, ?> cell = (TreeTableCell<?, ?>) node;
        if (treeTableView.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;
}
项目:marathonv5    文件:RFXTreeTableViewTest.java   
@Test public void selectAllRows() {
    TreeTableView<?> treeTableView = (TreeTableView<?>) getPrimaryStage().getScene().getRoot().lookup(".tree-table-view");
    LoggingRecorder lr = new LoggingRecorder();
    Platform.runLater(() -> {
        treeTableView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
        RFXTreeTableView rfxTreeTableView = new RFXTreeTableView(treeTableView, null, null, lr);
        int count = treeTableView.getExpandedItemCount();
        for (int i = 0; i < count; i++) {
            treeTableView.getSelectionModel().select(i);
        }
        rfxTreeTableView.focusLost(null);
    });
    List<Recording> recordings = lr.waitAndGetRecordings(1);
    Recording recording = recordings.get(0);
    AssertJUnit.assertEquals("recordSelect", recording.getCall());
    AssertJUnit.assertEquals("all", recording.getParameters()[0]);
}
项目:marathonv5    文件:RFXTreeTableViewTest.java   
@SuppressWarnings("unchecked") @Test public void selectMultipleCells() {
    TreeTableView<?> treeTableView = (TreeTableView<?>) getPrimaryStage().getScene().getRoot().lookup(".tree-table-view");
    LoggingRecorder lr = new LoggingRecorder();
    Platform.runLater(() -> {
        TreeTableViewSelectionModel<?> selectionModel = treeTableView.getSelectionModel();
        selectionModel.setCellSelectionEnabled(true);
        selectionModel.setSelectionMode(SelectionMode.MULTIPLE);
        Point2D point = getPoint(treeTableView, 1, 0);
        RFXTreeTableView rfxTreeTableView = new RFXTreeTableView(treeTableView, null, point, lr);
        rfxTreeTableView.focusGained(null);
        @SuppressWarnings("rawtypes")
        TreeTableColumn column = getTreeTableColumnAt(treeTableView, 0);
        selectionModel.select(1, column);
        selectionModel.select(3, getTreeTableColumnAt(treeTableView, 1));
        rfxTreeTableView.focusLost(null);
    });
    List<Recording> recordings = lr.waitAndGetRecordings(1);
    Recording recording = recordings.get(0);
    AssertJUnit.assertEquals("recordSelect", recording.getCall());
    AssertJUnit.assertEquals(
            "{\"cells\":[[\"/Sales Department/Ethan Williams\",\"Employee\"],[\"/Sales Department/Michael Brown\",\"Email\"]]}",
            recording.getParameters()[0]);
}
项目:marathonv5    文件:RFXTreeTableViewTest.java   
@SuppressWarnings("unchecked") @Test public void selectACell() {
    TreeTableView<?> treeTableView = (TreeTableView<?>) getPrimaryStage().getScene().getRoot().lookup(".tree-table-view");
    LoggingRecorder lr = new LoggingRecorder();
    Platform.runLater(() -> {
        TreeTableViewSelectionModel<?> selectionModel = treeTableView.getSelectionModel();
        selectionModel.setCellSelectionEnabled(true);
        Point2D point = getPoint(treeTableView, 1, 0);
        RFXTreeTableView rfxTreeTableView = new RFXTreeTableView(treeTableView, null, point, lr);
        rfxTreeTableView.focusGained(null);
        @SuppressWarnings("rawtypes")
        TreeTableColumn column = getTreeTableColumnAt(treeTableView, 0);
        selectionModel.select(1, column);
        rfxTreeTableView.focusLost(null);
    });
    List<Recording> recordings = lr.waitAndGetRecordings(1);
    Recording recording = recordings.get(0);
    AssertJUnit.assertEquals("recordSelect", recording.getCall());
    AssertJUnit.assertEquals("{\"cells\":[[\"/Sales Department/Ethan Williams\",\"Employee\"]]}", recording.getParameters()[0]);
}
项目:marathonv5    文件:RFXTreeTableViewTest.java   
@SuppressWarnings("unchecked") @Test public void selectAllCells() {
    TreeTableView<?> treeTableView = (TreeTableView<?>) getPrimaryStage().getScene().getRoot().lookup(".tree-table-view");
    LoggingRecorder lr = new LoggingRecorder();
    Platform.runLater(() -> {
        treeTableView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
        RFXTreeTableView rfxTreeTableView = new RFXTreeTableView(treeTableView, null, null, lr);
        int count = treeTableView.getExpandedItemCount();
        treeTableView.getSelectionModel().selectRange(0, getTreeTableColumnAt(treeTableView, 0), count - 1,
                getTreeTableColumnAt(treeTableView, 1));
        rfxTreeTableView.focusLost(null);
    });
    List<Recording> recordings = lr.waitAndGetRecordings(1);
    Recording recording = recordings.get(0);
    AssertJUnit.assertEquals("recordSelect", recording.getCall());
    AssertJUnit.assertEquals("all", recording.getParameters()[0]);
}
项目:marathonv5    文件:RFXTreeTableViewTest.java   
@Test public void getText() {
    TreeTableView<?> treeTableView = (TreeTableView<?>) getPrimaryStage().getScene().getRoot().lookup(".tree-table-view");
    LoggingRecorder lr = new LoggingRecorder();
    List<String> text = new ArrayList<>();
    Platform.runLater(() -> {
        RFXTreeTableView rfxTreeTableView = new RFXTreeTableView(treeTableView, null, null, lr);
        treeTableView.getSelectionModel().select(2);
        rfxTreeTableView.focusLost(null);
        text.add(rfxTreeTableView.getAttribute("text"));
    });
    new Wait("Waiting for tree table view text.") {
        @Override public boolean until() {
            return text.size() > 0;
        }
    };
    AssertJUnit.assertEquals("{\"rows\":[\"/Sales Department/Emma Jones\"]}", text.get(0));
}
项目:openjfx-8u-dev-tests    文件:TreeTableAsOldTableApp.java   
/**
 * A container containing the tested UI.
 *
 * @return
 */
protected Node getTestContainer() {
    content = new Pane();
    content.setId(CONTENT_PANE_ID);
    content.setMinSize(500, 500);
    content.setMaxSize(500, 500);
    content.setPrefSize(500, 500);
    treeTableView = new TreeTableView<Data>();
    treeTableView.setId(TESTED_CONTROL_ID);
    treeTableView.setRoot(new TreeItem<Data>(new Data("fictive", 50, 10)));
    treeTableView.getRoot().setExpanded(true);
    treeTableView.setMinSize(400, 400);
    treeTableView.setMaxSize(400, 400);
    treeTableView.setPrefSize(400, 400);
    reset(DATA_ITEMS_NUM - 1, DATA_FIELDS_NUM, 0);// -1, as we have root.
    content.getChildren().add(treeTableView);
    treeTableView.setTranslateX(50);
    treeTableView.setTranslateY(50);
    return content;
}
项目:openjfx-8u-dev-tests    文件:TreeTableAsOldTreeApp.java   
@Override
protected Node getTestContainer() {
    treeOrTreeTableView = new TreeTableView<Data>();
    treeOrTreeTableView.setMinSize(300, 500);
    treeOrTreeTableView.setMaxSize(300, 500);
    treeOrTreeTableView.setPrefSize(300, 500);
    TreeTableColumn<Data, Node> column = new TreeTableColumn<Data, Node>("Items' name");
    column.setCellValueFactory(new Callback<TreeTableColumn.CellDataFeatures<Data, Node>, ObservableValue<Node>>() {
        @Override
        public ObservableValue<Node> call(final TreeTableColumn.CellDataFeatures<Data, Node> p) {
            SimpleObjectProperty<Node> text = new SimpleObjectProperty<Node>();
            text.setValue(new Label(p.getValue().getValue().getData()));
            return text;
        }
    });
    column.setPrefWidth(150);
    ((TreeTableView) treeOrTreeTableView).getColumns().add(column);
    reset(0);
    return treeOrTreeTableView;
}
项目:openjfx-8u-dev-tests    文件:TreeViewCommonFunctionality.java   
protected static void clickOnFirstCell(final Wrap<? extends Control> testedControl) {
    String item = new GetAction<String>() {
        @Override
        public void run(Object... os) throws Exception {
            TreeItem root;
            Control control = testedControl.getControl();
            if (control instanceof TreeView) {
                root = ((TreeView) control).getRoot();
            } else {
                root = ((TreeTableView) control).getRoot();
            }
            setResult(root.getValue().toString());
        }
    }.dispatch(Root.ROOT.getEnvironment(), testedControl);
    Wrap<Text> cellWrap = getCellWrap(testedControl, item);
    cellWrap.as(Showable.class).shower().show();
    cellWrap.mouse().click(1, cellWrap.getClickPoint(), Mouse.MouseButtons.BUTTON1);
}
项目:openjfx-8u-dev-tests    文件:TreeViewCommonFunctionality.java   
protected static Wrap<Text> getCellWrap(final Wrap<? extends Control> testedControl, final Integer index) {
    final String content = new GetAction<String>() {
        @Override
        public void run(Object... os) throws Exception {
            Control control = testedControl.getControl();
            TreeItem item;
            if (control instanceof TreeView) {
                item = ((TreeView) control).getTreeItem(index);
            } else {
                item = ((TreeTableView) control).getTreeItem(index);
            }
            setResult(item.getValue().toString());
        }
    }.dispatch(Root.ROOT.getEnvironment());

    scrollTo(testedControl, 0, index);

    return getCellWrap(testedControl, content);
}
项目:openjfx-8u-dev-tests    文件:TreeViewCommonFunctionality.java   
protected static HashSet<Point> getSelected(final Wrap<? extends Control> testedControl) {

        return new GetAction<HashSet<Point>>() {
            @Override
            public void run(Object... parameters) throws Exception {
                HashSet<Point> selected = new HashSet<Point>();
                final Control control = testedControl.getControl();
                MultipleSelectionModel model;
                if (control instanceof TreeView) {
                    model = ((TreeView) control).getSelectionModel();
                } else {
                    model = ((TreeTableView) control).getSelectionModel();
                }
                for (Object obj : model.getSelectedIndices()) {
                    Integer pos = (Integer) obj;
                    selected.add(new Point(-1, pos));
                }
                setResult(selected);
            }
        }.dispatch(Root.ROOT.getEnvironment());
    }
项目:openjfx-8u-dev-tests    文件:ApplicationInteractionFunctions.java   
protected Collection<TableColumnBase> getTopLevelColumns() {
    return new GetAction<Collection<TableColumnBase>>() {

        @Override
        public void run(Object... parameters) throws Exception {
            Collection<TableColumnBase> cols;
            Control control = testedControl.getControl();

            if (isTableTests) {
                cols = ((TableView) control).getColumns();
            } else {
                cols = ((TreeTableView) control).getColumns();
            }
            setResult(cols);
        }
    }.dispatch(testedControl.getEnvironment());
}
项目:openjfx-8u-dev-tests    文件:ApplicationInteractionFunctions.java   
protected void setShowRoot(final boolean value) {
    if (!isTableTests) {
        new GetAction<Object>() {

            @Override
            public void run(Object... os) throws Exception {
                ((TreeTableView) testedControl.getControl()).setShowRoot(value);
            }
        }.dispatch(testedControl.getEnvironment());

        try {
            TimeUnit.MILLISECONDS.sleep(1000);
        } catch (Exception e) {
        }
    }
}
项目:openjfx-8u-dev-tests    文件:ApplicationInteractionFunctions.java   
protected void sortColumnsByName(final boolean isAscending) {
    new GetAction<Object>() {
        private Comparator<TableColumnBase> comparator = new Comparator<TableColumnBase>() {
            public int compare(TableColumnBase o1, TableColumnBase o2) {
                int result = o1.getText().compareTo(o2.getText());
                return isAscending ? result : -result;
            }
        };

        @Override
        public void run(Object... os) throws Exception {
            if (isTableTests) {
                FXCollections.sort(((TableView) testedControl.getControl()).getColumns(), comparator);
            } else {
                FXCollections.sort(((TreeTableView) testedControl.getControl()).getColumns(), comparator);
            }
        }
    }.dispatch(testedControl.getEnvironment());

    try {
        TimeUnit.MILLISECONDS.sleep(1000);
    } catch (Exception e) {
    }
}
项目:openjfx-8u-dev-tests    文件:TestBase.java   
void resizeColumn(final int index, final double delta) {

        final double initialWidth = getColumnWidth(index);

        new GetAction<Void>() {
            @Override
            public void run(Object... os) throws Exception {
                if (isTableTests) {
                    TableView table = (TableView) testedControl.getControl();
                    table.resizeColumn((TableColumn) table.getColumns().get(index), delta);
                } else {
                    TreeTableView treeTable = (TreeTableView) testedControl.getControl();
                    treeTable.resizeColumn((TreeTableColumn) treeTable.getColumns().get(index), delta);
                }
            }
        }.dispatch(testedControl.getEnvironment());

        new Waiter(new Timeout("", 1000)).waitState(new State<Boolean>() {
            public Boolean reached() {
                return (Math.abs(getColumnWidth(index) - initialWidth - delta) <= 1e-7) ? Boolean.TRUE : null;
            }
        });
    }
项目:ReqTraq    文件:TreeTablePane.java   
public TreeTablePane()
{
    tree = new TreeTableView<>();
    tree.setShowRoot(false);
    tree.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    tree.setEditable(true);
    tree.setColumnResizePolicy(TreeTableView.CONSTRAINED_RESIZE_POLICY);
    FX.style(tree, CssTools.NO_HORIZONTAL_SCROLL_BAR, TREE);

    handler = new TreeTableHandler<Page>(tree);

    setupActions();

    addColumn(Page.Field.TITLE, "Title");
    addColumn(Page.Field.TIME_CREATED, "Created");
    addColumn(Page.Field.STATUS, "Status");

    setCenter(tree);
}
项目:JttDesktop    文件:TestTableView.java   
/**
 * Method to construct the table.
 * @param database the {@link JenkinsDatabase} providing the {@link TestClass}es.
 */
public void constructLayout( JenkinsDatabase database ) {
   root = new TreeItem<>();
   root.setExpanded( true );

   database.testClasses().forEach( test -> {
      createBranch( root, test );
   } );

   TreeTableView< TestTableItem > treeTableView = new TreeTableView<>( root );
   treeTableView.setEditable( false );
   treeTableView.getSelectionModel().setSelectionMode( SelectionMode.MULTIPLE );

   createDescriptionColumn( treeTableView, DESCRIPTION_COLUMN_NAME, DESCRIPTION_COLUMN_INDEX, DESCRIPTION_COLUMN_WIDTH );
   createDescriptionColumn( treeTableView, STATUS_COLUMN_NAME, STATUS_COLUMN_INDEX, COMMON_COLUMN_WIDTH );
   createDescriptionColumn( treeTableView, SKIPPED_COLUMN_NAME, SKIPPED_COLUMN_INDEX, COMMON_COLUMN_WIDTH );
   createDescriptionColumn( treeTableView, AGE_COLUMN_NAME, AGE_COLUMN_INDEX, COMMON_COLUMN_WIDTH );
   createDescriptionColumn( treeTableView, DURATION_COLUMN_NAME, DURATION_COLUMN_INDEX, COMMON_COLUMN_WIDTH );

   treeTableView.setShowRoot( false );
   treeTableView.setTableMenuButtonVisible( true );
   setCenter( treeTableView );
}
项目:JttDesktop    文件:AssignmentDetailControllerTest.java   
@Before public void initialiseSystemUnderTest(){
   TestApplication.startPlatform();
   MockitoAnnotations.initMocks( this );

   assignmentA = new UserAssignment( new JenkinsUserImpl( "A" ), 0, "", "" );
   assignmentB = new UserAssignment( new JenkinsUserImpl( "B" ), 0, "", "" );

   itemA = new AssignedTreeItem( assignmentA );
   itemB = new AssignedTreeItem( assignmentB );
   tree = new TreeTableView<>();
   tree.getSelectionModel().setSelectionMode( SelectionMode.MULTIPLE );
   tree.setRoot( new TreeItem<>() );
   tree.getRoot().setExpanded( true );
   tree.getRoot().getChildren().add( new TreeItem<>( itemA ) );
   tree.getRoot().getChildren().add( new TreeItem<>( itemB ) );

   systemUnderTest = new AssignmentDetailController( tree, area );
}
项目:qupath    文件:QuPathGUI.java   
/**
 * Make an effort at updating all the trees, tables or lists that we can find.
 * 
 * @param parent
 */
private static void updateListsAndTables(final Parent parent) {
    if (parent == null)
        return;
    for (Node child : parent.getChildrenUnmodifiable()) {
        if (child instanceof TreeView<?>)
            ((TreeView)child).refresh();
        else if (child instanceof ListView<?>)
            ((ListView)child).refresh();
        else if (child instanceof TableView<?>)
            ((TableView)child).refresh();
        else if (child instanceof TreeTableView<?>)
            ((TreeTableView)child).refresh();
        else if (child instanceof Parent)
            updateListsAndTables((Parent)child);
    }
}
项目:jfx-torrent    文件:FileTreeViewer.java   
/**
 * Create a file tree view from a torrent's file tree.
 *
 * @param fileTreeView Action handler tree for the created view.
 * @param fileTree A bean containing the torrent's meta data and progress.
 * @return A view to the torrent's data.
 */
public TreeItem<TorrentFileEntry> createTreeView(final TreeTableView<TorrentFileEntry> fileTreeView,
                                                 final FileTree fileTree) {
    currentTree = fileTreeView;
    final TreeItem<TorrentFileEntry> root;

    if(fileTree.isSingleFile()) {
        //Handle single file torrent mode
        root = buildSingleFileTree(fileTree);

    }
    else {
        //Handle multiple files torrent mode
        root = buildMultiFileTree(fileTree);
    }

    root.setExpanded(true);
    return root;
}
项目:honest-profiler    文件:TreeViewQuickFilterTest.java   
private void checkResult(FxRobot robot, ScenarioStraightFilter... filters)
{
    asList(ThreadGrouping.values()).forEach(tg ->
    {
        asList(FrameGrouping.values()).forEach(fg ->
        {
            selectThreadGrouping(robot, tg, "#tree");
            selectFrameGrouping(robot, fg, "#tree");
            clickExpandAll(robot, "#tree");

            TreeTableView<Node> tableView = getTreeTableView(robot);

            scenario.checkTreeAggregation(
                new TreeTableViewCheckAdapter(tg, fg, tableView),
                filters);
        });
    });
}
项目:honest-profiler    文件:TreeDiffViewTest.java   
@Test
public void testTreeDiffViewScenario()
{
    FxRobot robot = new FxRobot();

    waitUntil(asyncFx(() -> getMainStage().setMaximized(true)));

    newProfileTab(robot, app(), 0, "Base : " + baseScenario.getName(), baseScenario, LOG);
    newProfileTab(robot, app(), 1, "New : " + newScenario.getName(), newScenario, LOG);
    selectTab(robot, 1);
    selectCtxMenu(robot, "#compareButton", 0, "Base : " + baseScenario.getName());
    selectTab(robot, 2);
    selectView(robot, TREE);
    selectFrameGrouping(robot, frameGrouping, "#tree");
    selectThreadGrouping(robot, threadGrouping, "#tree");

    clickExpandAll(robot, "#tree");

    TreeTableView<DiffNode> tableView = getTreeDiffTableView(robot);

    newScenario.checkTreeDiffAggregation(
        baseScenario,
        new TreeDiffTableViewCheckAdapter(threadGrouping, frameGrouping, tableView));
}
项目:honest-profiler    文件:TreeViewTest.java   
@Test
public void testTreeViewScenario()
{
    FxRobot robot = new FxRobot();

    newProfileTab(robot, app(), 0, scenario.getName(), scenario, LOG);

    selectView(robot, TREE);
    selectThreadGrouping(robot, threadGrouping, "#tree");
    selectFrameGrouping(robot, frameGrouping, "#tree");

    clickExpandAll(robot, "#tree");

    TreeTableView<Node> tableView = getTreeTableView(robot);

    runLater(() -> scenario.checkTreeAggregation(
        new TreeTableViewCheckAdapter(threadGrouping, frameGrouping, tableView)));
}
项目:honest-profiler    文件:TreeTableViewCheckAdapter.java   
public TreeTableViewCheckAdapter(ThreadGrouping threadGrouping,
                                 FrameGrouping frameGrouping,
                                 TreeTableView<Node> treeTable)
{
    super();

    this.threadGrouping = threadGrouping;
    this.frameGrouping = frameGrouping;

    this.treeTable = treeTable;
    keyToRowIndexMap = new HashMap<>();

    int i = 0;

    while (!isEmpty((String)treeTable.getColumns().get(0).getCellData(i)))
    {
        keyToRowIndexMap.put((String)treeTable.getColumns().get(0).getCellData(i), i);
        i++;
    }
}
项目:honest-profiler    文件:TreeDiffTableViewCheckAdapter.java   
public TreeDiffTableViewCheckAdapter(ThreadGrouping threadGrouping,
                                     FrameGrouping frameGrouping,
                                     TreeTableView<DiffNode> treeTable)
{
    super();

    this.threadGrouping = threadGrouping;
    this.frameGrouping = frameGrouping;

    this.treeTable = treeTable;
    keyToRowIndexMap = new HashMap<>();

    int i = 0;

    while (!isEmpty((String)treeTable.getColumns().get(0).getCellData(i)))
    {
        keyToRowIndexMap.put((String)treeTable.getColumns().get(0).getCellData(i), i);
        i++;
    }
}
项目:marathonv5    文件:JavaFXElementPropertyAccessor.java   
public String getTreeTableCellText(TreeTableView<?> treeTableView, int row, int column) {
    if (column == -1 || row == -1) {
        return null;
    }
    String scolumn = getTreeTableColumnName(treeTableView, column);
    if (scolumn == null || "".equals(scolumn)) {
        scolumn = "" + column;
    }
    return new JSONObject()
            .put("cell", new JSONArray()
                    .put(getTreeTableNodePath(treeTableView, treeTableView.getSelectionModel().getModelItem(row))).put(scolumn))
            .toString();
}
项目:marathonv5    文件:JavaFXElementPropertyAccessor.java   
public TreeTableCell<?, ?> getTreeTableCellAt(TreeTableView<?> treeTableView, Point2D point) {
    point = treeTableView.localToScene(point);
    Set<Node> lookupAll = getTreeTableCells(treeTableView);
    TreeTableCell<?, ?> selected = null;
    for (Node cellNode : lookupAll) {
        Bounds boundsInScene = cellNode.localToScene(cellNode.getBoundsInLocal(), true);
        if (boundsInScene.contains(point)) {
            selected = (TreeTableCell<?, ?>) cellNode;
            break;
        }
    }
    return selected;
}
项目:marathonv5    文件:JavaFXElementPropertyAccessor.java   
protected int getTreeTableColumnAt(TreeTableView<?> treeTableView, Point2D point) {
    TreeTableCell<?, ?> selected = getTreeTableCellAt(treeTableView, point);
    if (selected == null) {
        return -1;
    }
    return treeTableView.getColumns().indexOf(selected.getTableColumn());
}
项目:marathonv5    文件:JavaFXElementPropertyAccessor.java   
protected int getTreeTableRowAt(TreeTableView<?> treeTableView, Point2D point) {
    TreeTableCell<?, ?> selected = getTreeTableCellAt(treeTableView, point);
    if (selected == null) {
        return -1;
    }
    return selected.getTreeTableRow().getIndex();
}
项目:marathonv5    文件:JavaFXElementPropertyAccessor.java   
@SuppressWarnings("rawtypes") public TreeTableCell getVisibleCellAt(TreeTableView<?> treeTableView, int row, int column) {
    Set<Node> lookupAll = getTreeTableCells(treeTableView);
    TreeTableCell cell = null;
    for (Node node : lookupAll) {
        TreeTableCell<?, ?> cell1 = (TreeTableCell<?, ?>) node;
        TreeTableRow<?> tableRow = cell1.getTreeTableRow();
        TreeTableColumn<?, ?> tableColumn = cell1.getTableColumn();
        if (tableRow.getIndex() == row && tableColumn == treeTableView.getColumns().get(column)) {
            cell = cell1;
            break;
        }
    }
    return cell;
}
项目:marathonv5    文件:JavaFXElementPropertyAccessor.java   
private Set<Node> getTreeTableCells(TreeTableView<?> treeTableView) {
    Set<Node> l = treeTableView.lookupAll("*");
    Set<Node> r = new HashSet<>();
    for (Node node : l) {
        if (node instanceof TreeTableCell<?, ?>) {
            r.add(node);
        }
    }
    return r;
}
项目:marathonv5    文件:JavaFXElementPropertyAccessor.java   
public String getTextForTreeTableNode(TreeTableView<?> treeTableView, TreeItem<?> selectedItem) {
    StringBuilder sb = new StringBuilder();
    Object[] treePath = buildTreePath(selectedItem);
    int start = treeTableView.isShowRoot() ? 0 : 1;
    for (int i = start; i < treePath.length; i++) {
        String pathString = escapeSpecialCharacters(getTextForTreeTableNodeObject(treeTableView, (TreeItem<?>) treePath[i]));
        sb.append("/").append(pathString);
    }
    return sb.toString();
}
项目:marathonv5    文件:JavaFXElementPropertyAccessor.java   
public JSONArray getTreeTableNodeText(TreeTableView<?> treeTableView, ObservableList<?> selectedItems) {
    JSONArray pa = new JSONArray();
    for (Object object : selectedItems) {
        pa.put(getTextForTreeTableNode(treeTableView, (TreeItem<?>) object));
    }
    return pa;
}