Example usage for javafx.scene.control TreeItem setExpanded

List of usage examples for javafx.scene.control TreeItem setExpanded

Introduction

In this page you can find the example usage for javafx.scene.control TreeItem setExpanded.

Prototype

public final void setExpanded(boolean value) 

Source Link

Document

Sets the expanded state of this TreeItem.

Usage

From source file:org.jevis.jeconfig.plugin.classes.ClassTree.java

public ClassTree(JEVisDataSource ds) {
    super();/*from   w w w  .jav  a2  s .c  o m*/
    try {
        _ds = ds;

        _itemCache = new HashMap<>();
        _graphicCache = new HashMap<>();
        _itemChildren = new HashMap<>();

        JEVisClass root = new JEVisRootClass(ds);
        TreeItem<JEVisClass> rootItem = buildItem(root);

        setShowRoot(true);
        rootItem.setExpanded(true);

        getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
        _editor.setTreeView(this);

        setCellFactory(new Callback<TreeView<JEVisClass>, TreeCell<JEVisClass>>() {

            //                @Override
            //                public TreeCell<JEVisClass> call(TreeView<JEVisClass> p) {
            //                    return new ClassCell();
            //                }
            @Override
            public TreeCell<JEVisClass> call(TreeView<JEVisClass> param) {
                return new TreeCell<JEVisClass>() {
                    //                        private ImageView imageView = new ImageView();

                    @Override
                    protected void updateItem(JEVisClass item, boolean empty) {
                        super.updateItem(item, empty);

                        if (!empty) {
                            ClassGraphic gc = getClassGraphic(item);

                            setContextMenu(gc.getContexMenu());
                            //                                setText(item);
                            setGraphic(gc.getGraphic());
                        } else {
                            setText(null);
                            setGraphic(null);
                        }
                    }
                };
            }
        });

        getSelectionModel().selectedItemProperty().addListener(new ChangeListener<TreeItem<JEVisClass>>() {

            @Override
            public void changed(ObservableValue<? extends TreeItem<JEVisClass>> ov, TreeItem<JEVisClass> t,
                    TreeItem<JEVisClass> t1) {
                try {
                    if (t1 != null) {
                        _editor.setJEVisClass(t1.getValue());
                    }
                } catch (Exception ex) {
                    System.out.println("Error while changing editor: " + ex);
                }

            }
        });

        addEventHandler(KeyEvent.KEY_RELEASED, new EventHandler<KeyEvent>() {

            @Override
            public void handle(KeyEvent t) {
                if (t.getCode() == KeyCode.F2) {
                    System.out.println("F2 rename event");
                    Platform.runLater(new Runnable() {
                        @Override
                        public void run() {
                            fireEventRename();
                        }
                    });

                } else if (t.getCode() == KeyCode.DELETE) {

                    fireDelete(getSelectionModel().getSelectedItem().getValue());
                }
            }

        });

        setId("objecttree");

        getStylesheets().add("/styles/Styles.css");
        setPrefWidth(500);

        setRoot(rootItem);
        setEditable(true);

    } catch (Exception ex) {
        //            Logger.getLogger(ObjectTree.class.getName()).log(Level.SEVERE, null, ex);
        ex.printStackTrace();
    }

}

From source file:org.jevis.jeconfig.plugin.classes.ClassTree.java

private void expandAll(List<TreeItem<JEVisClass>> list, TreeItem<JEVisClass> root) {
    //        System.out.println("expand all");
    for (final TreeItem<JEVisClass> item : root.getChildren()) {
        for (final TreeItem<JEVisClass> child : list) {
            try {
                if (item.getValue().getName().equals(child.getValue().getName())) {
                    Platform.runLater(new Runnable() {
                        @Override
                        public void run() {
                            item.setExpanded(true);
                        }//from w w w. j  a  va  2s  .c  om
                    });

                }
            } catch (JEVisException ex) {
                ex.printStackTrace();
            }
        }
        expandAll(list, item);
    }
}

From source file:de.dkfz.roddy.client.fxuiclient.RoddyUIController.java

/**
 * Recursive helper method to load projects from configuration files.
 *//* w  ww .  j ava2  s  .  c  o  m*/
private void loadProjectsRecursivelyFromXMLFiles(final TreeItem<FXICCWrapper> root,
        List<InformationalConfigurationContent> availableProjectConfigurations) {
    int count = 0;
    String path = Roddy.getApplicationProperty(RunMode.UI,
            RoddyUIController.APP_PROPERTY_LAST_OPEN_PROJECT_PATH, "");

    for (InformationalConfigurationContent icc : availableProjectConfigurations) {
        FXICCWrapper fpw = new FXICCWrapper(icc, count++);
        TreeItem<FXICCWrapper> newItem = new TreeItem<>(fpw);
        root.getChildren().add(newItem);
        try {

            Map<String, String> analyses = fpw.getAnalyses();
            for (String analysisID : analyses.keySet()) {
                FXICCWrapper fpwAnalysis = new FXICCWrapper(icc, analysisID, count++);
                newItem.getChildren().add(new TreeItem<>(fpwAnalysis));
            }
            loadProjectsRecursivelyFromXMLFiles(newItem, icc.getSubContent());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    //Add an expand listener to the topmost nodes
    if (root.getValue() != null) {
        for (final TreeItem<FXICCWrapper> treeItem : root.getChildren()) {
            treeItem.setExpanded(true);
        }
        return;
    }
    for (final TreeItem<FXICCWrapper> treeItem : root.getChildren()) {

        treeItem.expandedProperty().addListener(new ChangeListener<Boolean>() {
            @Override
            public void changed(ObservableValue<? extends Boolean> observableValue, Boolean aBoolean,
                    Boolean newValue) {
                if (!newValue)
                    return;

                //Upon expand close all other nodes.
                for (TreeItem<FXICCWrapper> sister : root.getChildren()) {
                    if (treeItem == sister) {
                        Roddy.setApplicationProperty(RunMode.UI,
                                RoddyUIController.APP_PROPERTY_LAST_OPEN_PROJECT_PATH,
                                treeItem.getValue().getID());

                    } else {
                        sister.setExpanded(false);
                    }
                }
            }
        });
        if (treeItem.getValue().getID().equals(path))
            treeItem.setExpanded(true);
    }

}

From source file:de.dkfz.roddy.client.fxuiclient.RoddyUIController.java

private TreeItem<FXICCWrapper> isProcessable(TreeItem<FXICCWrapper> currentNode, boolean hideUnprocessable,
        String idFilter, String analysisIDFilter) {
    WildcardFileFilter wffID = new WildcardFileFilter(idFilter);
    WildcardFileFilter wffAID = new WildcardFileFilter(analysisIDFilter);
    FXICCWrapper cWrapper = currentNode.getValue();
    boolean isVisible = false;
    TreeItem<FXICCWrapper> copyOfTreeItem = new TreeItem<>(currentNode.getValue());
    copyOfTreeItem.setExpanded(currentNode.isExpanded());
    //        System.out.println(currentNode.getValue().getID() + " " + currentNode.getChildren().size());
    //At first: Check, if the node has children and if one of those children is visible.
    for (TreeItem<FXICCWrapper> treeItem : currentNode.getChildren()) {
        TreeItem<FXICCWrapper> childVisible = isProcessable(treeItem, hideUnprocessable, idFilter,
                analysisIDFilter);//from w w  w  .  ja v a  2 s.co m
        if (childVisible != null)
            copyOfTreeItem.getChildren().add(childVisible);
    }

    //If there are no visible children, then check the node itself.
    if (copyOfTreeItem.getChildren().size() == 0) {
        //            System.out.println(cWrapper.getID());
        //Is this a project node or an analysis node?
        isVisible = wffID.accept(new File(cWrapper.getID()));
        if (!isVisible)
            return null;
        if (cWrapper.isAnalysisWrapper()) {
            isVisible = wffAID.accept(new File(cWrapper.getAnalysisID()));
            if (!isVisible)
                return null;
        } else {
            if (hideUnprocessable) {
                isVisible = false;
                return null;
            } else {
                if (cWrapper.hasAnalyses())
                    return null;
            }
        }
        //            if (isVisible && !cWrapper.hasAnalyses()) {
        //                if (currentNode.getChildren().size() > 0)
        //                    isVisible = false;
        //            }
    } else {
        isVisible = true;
    }

    if (isVisible)
        return copyOfTreeItem;
    return null;
}

From source file:net.rptools.tokentool.controller.TokenTool_Controller.java

private TreeItem<Path> cacheOverlays(File dir, TreeItem<Path> parent, int THUMB_SIZE) throws IOException {
    log.info("Caching " + dir.getAbsolutePath());

    TreeItem<Path> root = new TreeItem<>(dir.toPath());
    root.setExpanded(false);
    File[] files = dir.listFiles();
    final String I18N_CACHE_TEXT = I18N.getString("TokenTool.treeview.caching");

    final Task<Void> task = new Task<Void>() {
        @Override//from  w ww .j  a v a2s. co  m
        protected Void call() throws Exception {
            for (File file : files) {
                if (loadOverlaysThread.isInterrupted())
                    break;

                if (file.isDirectory()) {
                    cacheOverlays(file, root, THUMB_SIZE);
                } else {
                    Path filePath = file.toPath();
                    TreeItem<Path> imageNode = new TreeItem<>(filePath,
                            ImageUtil.getOverlayThumb(new ImageView(), filePath));
                    root.getChildren().add(imageNode);
                    loadCount.getAndIncrement();
                    overlayTreeProgressBar.progressProperty().set(loadCount.doubleValue() / overlayCount);
                }
            }

            if (parent != null) {
                // When we show the overlay image, the TreeItem value is empty so we need to
                // sort those to the bottom for a cleaner look and keep sub dir's at the top.
                // If a node has no children then it's an overlay, otherwise it's a directory...
                root.getChildren().sort(new Comparator<TreeItem<Path>>() {
                    @Override
                    public int compare(TreeItem<Path> o1, TreeItem<Path> o2) {
                        if (o1.getChildren().size() == 0 && o2.getChildren().size() == 0)
                            return 0;
                        else if (o1.getChildren().size() == 0)
                            return Integer.MAX_VALUE;
                        else if (o2.getChildren().size() == 0)
                            return Integer.MIN_VALUE;
                        else
                            return o1.getValue().compareTo(o2.getValue());
                    }
                });

                parent.getChildren().add(root);

                parent.getChildren().sort(new Comparator<TreeItem<Path>>() {
                    @Override
                    public int compare(TreeItem<Path> o1, TreeItem<Path> o2) {
                        if (o1.getChildren().size() == 0 && o2.getChildren().size() == 0)
                            return 0;
                        else if (o1.getChildren().size() == 0)
                            return Integer.MAX_VALUE;
                        else if (o2.getChildren().size() == 0)
                            return Integer.MIN_VALUE;
                        else
                            return o1.getValue().compareTo(o2.getValue());
                    }
                });
            }

            return null;
        }
    };

    overlayTreeProgressBar.progressProperty().addListener(observable -> {
        Platform.runLater(() -> progressBarLabel
                .setText(I18N_CACHE_TEXT + Math.round(overlayCount - loadCount.doubleValue()) + "..."));
    });

    // Only add this listener to the parent task so it's only called once
    if (parent == null) {
        overlayTreeProgressBar.progressProperty().addListener(observable -> {
            Platform.runLater(() -> {
                if (overlayTreeProgressBar.getProgress() >= 1)
                    treeViewFinish();
            });
        });
    }

    executorService.execute(task);
    return root;
}

From source file:com.cdd.bao.editor.EditSchema.java

private void fillTreeGroup(Schema schema, Schema.Group group, TreeItem<Branch> parent) {
    for (Schema.Assignment assn : group.assignments) {
        TreeItem<Branch> item = new TreeItem<>(new Branch(this, assn, schema.locatorID(assn)));
        parent.getChildren().add(item);/*from ww  w.  j av  a2  s  .  c  om*/
    }
    for (Schema.Group subgrp : group.subGroups) {
        TreeItem<Branch> item = new TreeItem<>(new Branch(this, subgrp, schema.locatorID(subgrp)));
        item.setExpanded(true);
        parent.getChildren().add(item);
        fillTreeGroup(schema, subgrp, item);
    }
}

From source file:org.eclipse.jubula.rc.javafx.tester.adapter.TreeOperationContext.java

@Override
public void collapseNode(final Object node) {
    scrollNodeToVisible(node);/*from ww w  .j  a va  2  s . c  o m*/
    Object result = EventThreadQueuerJavaFXImpl.invokeAndWait("collapseNode", new Callable<Object>() { //$NON-NLS-1$

        @Override
        public Object call() throws Exception {
            List<? extends TreeCell> tCells = ComponentHandler.getAssignableFrom(TreeCell.class);
            for (TreeCell<?> cell : tCells) {
                TreeItem<?> item = cell.getTreeItem();
                if (item != null && item.equals(node) && item.isExpanded()) {
                    TreeView<?> tree = ((TreeView<?>) getTree());
                    // Update the layout coordinates otherwise
                    // we would get old position values
                    tree.layout();
                    return cell.getDisclosureNode();
                }
            }
            return null;
        }
    });
    if (result != null) {
        getRobot().click(result, null, ClickOptions.create().setClickCount(1).setMouseButton(1));
    }
    EventThreadQueuerJavaFXImpl.invokeAndWait("collapseNodeCheckIfCollapsed", new Callable<Void>() { //$NON-NLS-1$

        @Override
        public Void call() throws Exception {
            TreeItem<?> item = (TreeItem<?>) node;
            if (!((TreeView<?>) getTree()).isDisabled() && item.isExpanded()) {
                log.warn("Collapse node fallback used for: " //$NON-NLS-1$
                        + item.getValue());

                item.setExpanded(false);
            }
            return null;
        }
    });
}

From source file:UI.MainStageController.java

@FXML
/**/*from ww  w  . j  a  v  a2  s .  c  o m*/
 * <h1>Collapses all nodes in the treeview element</h1>
 * Does not effect the current extended state of the treeitems
 */
public void collapseAll() {
    //If no sample has been loaded yet
    if (treeViewFiles.getRoot() == null || treeViewFiles.getRoot().getChildren().isEmpty()) {
        collapseAllButton.disarm();
        collapseAllButton.setSelected(false);
    } else {
        if (collapseAllButton.isSelected()) {
            for (TreeItem<String> treeItem : treeViewFiles.getRoot().getChildren()) {
                treeItem.setExpanded(false);
            }
            collapseAllButton.disarm();
            collapseAllButton.setSelected(false);
        } else {
            for (TreeItem<String> treeItem : treeViewFiles.getRoot().getChildren()) {
                treeItem.setExpanded(true);
            }
            collapseAllButton.setSelected(true);
            collapseAllButton.arm();
        }
    }
}

From source file:org.eclipse.jubula.rc.javafx.tester.adapter.TreeOperationContext.java

@Override
public void expandNode(final Object node) {
    scrollNodeToVisible(node);//from w ww  .  ja v  a 2 s  . c om
    Object result = EventThreadQueuerJavaFXImpl.invokeAndWait("expandNode", //$NON-NLS-1$
            new Callable<Object>() {

                @Override
                public Object call() throws Exception {
                    List<? extends TreeCell> tCells = ComponentHandler.getAssignableFrom(TreeCell.class);
                    for (TreeCell<?> cell : tCells) {
                        TreeItem<?> item = cell.getTreeItem();
                        if (item != null && item.equals(node) && !item.isExpanded()) {
                            TreeView<?> tree = ((TreeView<?>) getTree());
                            // Update the layout coordinates otherwise
                            // we would get old position values
                            tree.layout();
                            return cell.getDisclosureNode();
                        }
                    }
                    return null;
                }
            });
    if (result != null) {
        getRobot().click(result, null, ClickOptions.create().setClickCount(1).setMouseButton(1));
    }
    EventThreadQueuerJavaFXImpl.invokeAndWait("expandNodeCheckIfExpanded", //$NON-NLS-1$
            new Callable<Void>() {

                @Override
                public Void call() throws Exception {
                    TreeItem<?> item = (TreeItem<?>) node;
                    if (!((TreeView<?>) getTree()).isDisabled() && !item.isExpanded()) {
                        log.warn("Expand node fallback used for: " //$NON-NLS-1$
                                + item.getValue());

                        item.setExpanded(true);
                    }
                    return null;
                }
            });
}

From source file:qupath.lib.gui.tma.TMASummaryViewer.java

private void initialize() {

    model = new TMATableModel();

    groupByIDProperty.addListener((v, o, n) -> refreshTableData());

    MenuBar menuBar = new MenuBar();
    Menu menuFile = new Menu("File");
    MenuItem miOpen = new MenuItem("Open...");
    miOpen.setAccelerator(new KeyCodeCombination(KeyCode.O, KeyCombination.SHORTCUT_DOWN));
    miOpen.setOnAction(e -> {/*from w ww . j a  v  a2 s. co  m*/
        File file = QuPathGUI.getDialogHelper(stage).promptForFile(null, null, "TMA data files",
                new String[] { "qptma" });
        if (file == null)
            return;
        setInputFile(file);
    });

    MenuItem miSave = new MenuItem("Save As...");
    miSave.setAccelerator(
            new KeyCodeCombination(KeyCode.S, KeyCombination.SHORTCUT_DOWN, KeyCombination.SHIFT_DOWN));
    miSave.setOnAction(
            e -> SummaryMeasurementTableCommand.saveTableModel(model, null, Collections.emptyList()));

    MenuItem miImportFromImage = new MenuItem("Import from current image...");
    miImportFromImage.setAccelerator(
            new KeyCodeCombination(KeyCode.I, KeyCombination.SHORTCUT_DOWN, KeyCombination.SHIFT_DOWN));
    miImportFromImage.setOnAction(e -> setTMAEntriesFromOpenImage());

    MenuItem miImportFromProject = new MenuItem("Import from current project... (experimental)");
    miImportFromProject.setAccelerator(
            new KeyCodeCombination(KeyCode.P, KeyCombination.SHORTCUT_DOWN, KeyCombination.SHIFT_DOWN));
    miImportFromProject.setOnAction(e -> setTMAEntriesFromOpenProject());

    MenuItem miImportClipboard = new MenuItem("Import from clipboard...");
    miImportClipboard.setOnAction(e -> {
        String text = Clipboard.getSystemClipboard().getString();
        if (text == null) {
            DisplayHelpers.showErrorMessage("Import scores", "Clipboard is empty!");
            return;
        }
        int n = importScores(text);
        if (n > 0) {
            setTMAEntries(new ArrayList<>(entriesBase));
        }
        DisplayHelpers.showMessageDialog("Import scores", "Number of scores imported: " + n);
    });

    Menu menuEdit = new Menu("Edit");
    MenuItem miCopy = new MenuItem("Copy table to clipboard");
    miCopy.setOnAction(e -> {
        SummaryMeasurementTableCommand.copyTableContentsToClipboard(model, Collections.emptyList());
    });

    combinedPredicate.addListener((v, o, n) -> {
        // We want any other changes triggered by this to have happened, 
        // so that the data has already been updated
        Platform.runLater(() -> handleTableContentChange());
    });

    // Reset the scores for missing cores - this ensures they will be NaN and not influence subsequent results
    MenuItem miResetMissingScores = new MenuItem("Reset scores for missing cores");
    miResetMissingScores.setOnAction(e -> {
        int changes = 0;
        for (TMAEntry entry : entriesBase) {
            if (!entry.isMissing())
                continue;
            boolean changed = false;
            for (String m : entry.getMeasurementNames().toArray(new String[0])) {
                if (!TMASummaryEntry.isSurvivalColumn(m) && !Double.isNaN(entry.getMeasurementAsDouble(m))) {
                    entry.putMeasurement(m, null);
                    changed = true;
                }
            }
            if (changed)
                changes++;
        }
        if (changes == 0) {
            logger.info("No changes made when resetting scores for missing cores!");
            return;
        }
        logger.info("{} change(s) made when resetting scores for missing cores!", changes);
        table.refresh();
        updateSurvivalCurves();
        if (scatterPane != null)
            scatterPane.updateChart();
        if (histogramDisplay != null)
            histogramDisplay.refreshHistogram();
    });
    menuEdit.getItems().add(miResetMissingScores);

    QuPathGUI.addMenuItems(menuFile, miOpen, miSave, null, miImportClipboard, null, miImportFromImage,
            miImportFromProject);
    menuBar.getMenus().add(menuFile);
    menuEdit.getItems().add(miCopy);
    menuBar.getMenus().add(menuEdit);

    menuFile.setOnShowing(e -> {
        boolean imageDataAvailable = QuPathGUI.getInstance() != null
                && QuPathGUI.getInstance().getImageData() != null
                && QuPathGUI.getInstance().getImageData().getHierarchy().getTMAGrid() != null;
        miImportFromImage.setDisable(!imageDataAvailable);
        boolean projectAvailable = QuPathGUI.getInstance() != null
                && QuPathGUI.getInstance().getProject() != null
                && !QuPathGUI.getInstance().getProject().getImageList().isEmpty();
        miImportFromProject.setDisable(!projectAvailable);
    });

    // Double-clicking previously used for comments... but conflicts with tree table expansion
    //      table.setOnMouseClicked(e -> {
    //         if (!e.isPopupTrigger() && e.getClickCount() > 1)
    //            promptForComment();
    //      });

    table.setPlaceholder(new Text("Drag TMA data folder onto window, or choose File -> Open"));
    table.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);

    BorderPane pane = new BorderPane();
    pane.setTop(menuBar);
    menuBar.setUseSystemMenuBar(true);

    // Create options
    ToolBar toolbar = new ToolBar();
    Label labelMeasurementMethod = new Label("Combination method");
    labelMeasurementMethod.setLabelFor(comboMeasurementMethod);
    labelMeasurementMethod
            .setTooltip(new Tooltip("Method whereby measurements for multiple cores with the same "
                    + TMACoreObject.KEY_UNIQUE_ID + " will be combined"));

    CheckBox cbHidePane = new CheckBox("Hide pane");
    cbHidePane.setSelected(hidePaneProperty.get());
    cbHidePane.selectedProperty().bindBidirectional(hidePaneProperty);

    CheckBox cbGroupByID = new CheckBox("Group by ID");
    entriesBase.addListener((Change<? extends TMAEntry> event) -> {
        if (!event.getList().stream().anyMatch(e -> e.getMetadataValue(TMACoreObject.KEY_UNIQUE_ID) != null)) {
            cbGroupByID.setSelected(false);
            cbGroupByID.setDisable(true);
        } else {
            cbGroupByID.setDisable(false);
        }
    });
    cbGroupByID.setSelected(groupByIDProperty.get());
    cbGroupByID.selectedProperty().bindBidirectional(groupByIDProperty);

    CheckBox cbUseSelected = new CheckBox("Use selection only");
    cbUseSelected.selectedProperty().bindBidirectional(useSelectedProperty);

    CheckBox cbSkipMissing = new CheckBox("Hide missing cores");
    cbSkipMissing.selectedProperty().bindBidirectional(skipMissingCoresProperty);
    skipMissingCoresProperty.addListener((v, o, n) -> {
        table.refresh();
        updateSurvivalCurves();
        if (histogramDisplay != null)
            histogramDisplay.refreshHistogram();
        updateSurvivalCurves();
        if (scatterPane != null)
            scatterPane.updateChart();
    });

    toolbar.getItems().addAll(labelMeasurementMethod, comboMeasurementMethod,
            new Separator(Orientation.VERTICAL), cbHidePane, new Separator(Orientation.VERTICAL), cbGroupByID,
            new Separator(Orientation.VERTICAL), cbUseSelected, new Separator(Orientation.VERTICAL),
            cbSkipMissing);
    comboMeasurementMethod.getItems().addAll(MeasurementCombinationMethod.values());
    comboMeasurementMethod.getSelectionModel().select(MeasurementCombinationMethod.MEDIAN);
    selectedMeasurementCombinationProperty.addListener((v, o, n) -> table.refresh());

    ContextMenu popup = new ContextMenu();
    MenuItem miSetMissing = new MenuItem("Set missing");
    miSetMissing.setOnAction(e -> setSelectedMissingStatus(true));

    MenuItem miSetAvailable = new MenuItem("Set available");
    miSetAvailable.setOnAction(e -> setSelectedMissingStatus(false));

    MenuItem miExpand = new MenuItem("Expand all");
    miExpand.setOnAction(e -> {
        if (table.getRoot() == null)
            return;
        for (TreeItem<?> item : table.getRoot().getChildren()) {
            item.setExpanded(true);
        }
    });
    MenuItem miCollapse = new MenuItem("Collapse all");
    miCollapse.setOnAction(e -> {
        if (table.getRoot() == null)
            return;
        for (TreeItem<?> item : table.getRoot().getChildren()) {
            item.setExpanded(false);
        }
    });
    popup.getItems().addAll(miSetMissing, miSetAvailable, new SeparatorMenuItem(), miExpand, miCollapse);
    table.setContextMenu(popup);

    table.setRowFactory(e -> {
        TreeTableRow<TMAEntry> row = new TreeTableRow<>();

        //         // Make rows invisible if they don't pass the predicate
        //         row.visibleProperty().bind(Bindings.createBooleanBinding(() -> {
        //               TMAEntry entry = row.getItem();
        //               if (entry == null || (entry.isMissing() && skipMissingCoresProperty.get()))
        //                     return false;
        //               return entries.getPredicate() == null || entries.getPredicate().test(entry);
        //               },
        //               skipMissingCoresProperty,
        //               entries.predicateProperty()));

        // Style rows according to what they contain
        row.styleProperty().bind(Bindings.createStringBinding(() -> {
            if (row.isSelected())
                return "";
            TMAEntry entry = row.getItem();
            if (entry == null || entry instanceof TMASummaryEntry)
                return "";
            else if (entry.isMissing())
                return "-fx-background-color:rgb(225,225,232)";
            else
                return "-fx-background-color:rgb(240,240,245)";
        }, row.itemProperty(), row.selectedProperty()));
        //         row.itemProperty().addListener((v, o, n) -> {
        //            if (n == null || n instanceof TMASummaryEntry || row.isSelected())
        //               row.setStyle("");
        //            else if (n.isMissing())
        //               row.setStyle("-fx-background-color:rgb(225,225,232)");            
        //            else
        //               row.setStyle("-fx-background-color:rgb(240,240,245)");            
        //         });
        return row;
    });

    BorderPane paneTable = new BorderPane();
    paneTable.setTop(toolbar);
    paneTable.setCenter(table);

    MasterDetailPane mdTablePane = new MasterDetailPane(Side.RIGHT, paneTable, createSidePane(), true);

    mdTablePane.showDetailNodeProperty().bind(Bindings.createBooleanBinding(
            () -> !hidePaneProperty.get() && !entriesBase.isEmpty(), hidePaneProperty, entriesBase));
    mdTablePane.setDividerPosition(2.0 / 3.0);

    pane.setCenter(mdTablePane);

    model.getEntries().addListener(new ListChangeListener<TMAEntry>() {
        @Override
        public void onChanged(ListChangeListener.Change<? extends TMAEntry> c) {
            if (histogramDisplay != null)
                histogramDisplay.refreshHistogram();
            updateSurvivalCurves();
            if (scatterPane != null)
                scatterPane.updateChart();
        }
    });

    Label labelPredicate = new Label();
    labelPredicate.setPadding(new Insets(5, 5, 5, 5));
    labelPredicate.setAlignment(Pos.CENTER);
    //      labelPredicate.setStyle("-fx-background-color: rgba(20, 120, 20, 0.15);");
    labelPredicate.setStyle("-fx-background-color: rgba(120, 20, 20, 0.15);");

    labelPredicate.textProperty().addListener((v, o, n) -> {
        if (n.trim().length() > 0)
            pane.setBottom(labelPredicate);
        else
            pane.setBottom(null);
    });
    labelPredicate.setMaxWidth(Double.MAX_VALUE);
    labelPredicate.setMaxHeight(labelPredicate.getPrefHeight());
    labelPredicate.setTextAlignment(TextAlignment.CENTER);
    predicateMeasurements.addListener((v, o, n) -> {
        if (n == null)
            labelPredicate.setText("");
        else if (n instanceof TablePredicate) {
            TablePredicate tp = (TablePredicate) n;
            if (tp.getOriginalCommand().trim().isEmpty())
                labelPredicate.setText("");
            else
                labelPredicate.setText("Predicate: " + tp.getOriginalCommand());
        } else
            labelPredicate.setText("Predicate: " + n.toString());
    });
    //      predicate.set(new TablePredicate("\"Tumor\" > 100"));

    scene = new Scene(pane);

    scene.addEventHandler(KeyEvent.KEY_PRESSED, e -> {
        KeyCode code = e.getCode();
        if ((code == KeyCode.SPACE || code == KeyCode.ENTER) && entrySelected != null) {
            promptForComment();
            return;
        }
    });

}