Example usage for javafx.scene.control TableView getColumns

List of usage examples for javafx.scene.control TableView getColumns

Introduction

In this page you can find the example usage for javafx.scene.control TableView getColumns.

Prototype

public final ObservableList<TableColumn<S, ?>> getColumns() 

Source Link

Document

The TableColumns that are part of this TableView.

Usage

From source file:jp.ac.tohoku.ecei.sb.metabolome.lims.gui.MainWindowController.java

@FXML
void onShowCompoundIntensityTable(MouseEvent event) {
    if (tableCompound.getSelectionModel().isEmpty())
        return;// w  w  w .jav a 2 s  .  com

    IntensityMatrixImpl intensityMatrix = dataManager.getIntensityMatrix();

    for (CompoundImpl compound : tableCompound.getSelectionModel().getSelectedItems()) {

        TableView<IntensityValue> tableView = new TableView<>(
                FXCollections
                        .observableArrayList(intensityMatrix
                                .getColumnKeys().stream().map(it -> new IntensityValue(it.getPlate(),
                                        it.getSample(), it, intensityMatrix.get(compound, it)))
                                .collect(Collectors.toList())));

        Arrays.asList("Plate", "Sample", "Injection", "Intensity").forEach(it -> {
            TableColumn<IntensityValue, Double> column = new TableColumn<>();
            column.setText(it);
            //noinspection unchecked
            column.setCellValueFactory(new PropertyValueFactory(it));
            tableView.getColumns().add(column);
        });

        Scene scene = new Scene(tableView);
        Stage stage = new Stage(StageStyle.UTILITY);
        stage.setScene(scene);
        stage.setWidth(800);
        stage.setHeight(600);
        stage.setTitle(compound.toString());
        stage.show();
    }

}

From source file:com.ggvaidya.scinames.dataset.DatasetSceneController.java

private void setupTableWithChanges(TableView<Change> tv, Dataset tp) {
    tv.setEditable(true);/*w w w  .  j  ava2 s .  co m*/
    tv.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    tv.getColumns().clear();

    TableColumn<Change, ChangeType> colChangeType = new TableColumn<>("Type");
    colChangeType.setCellFactory(ComboBoxTableCell.forTableColumn(new ChangeTypeStringConverter(),
            ChangeType.ADDITION, ChangeType.DELETION, ChangeType.RENAME, ChangeType.LUMP, ChangeType.SPLIT,
            ChangeType.COMPLEX, ChangeType.ERROR));
    colChangeType.setCellValueFactory(new PropertyValueFactory<>("type"));
    colChangeType.setPrefWidth(100.0);
    colChangeType.setEditable(true);
    tv.getColumns().add(colChangeType);

    TableColumn<Change, ObservableSet<Name>> colChangeFrom = new TableColumn<>("From");
    colChangeFrom.setCellFactory(TextFieldTableCell.forTableColumn(new NameSetStringConverter()));
    colChangeFrom.setCellValueFactory(new PropertyValueFactory<>("from"));
    colChangeFrom.setPrefWidth(200.0);
    colChangeFrom.setEditable(true);
    tv.getColumns().add(colChangeFrom);

    TableColumn<Change, ObservableSet<Name>> colChangeTo = new TableColumn<>("To");
    colChangeTo.setCellFactory(TextFieldTableCell.forTableColumn(new NameSetStringConverter()));
    colChangeTo.setCellValueFactory(new PropertyValueFactory<>("to"));
    colChangeTo.setPrefWidth(200.0);
    colChangeTo.setEditable(true);
    tv.getColumns().add(colChangeTo);

    TableColumn<Change, String> colExplicit = new TableColumn<>("Explicit or implicit?");
    colExplicit.setCellValueFactory(
            (TableColumn.CellDataFeatures<Change, String> features) -> new ReadOnlyStringWrapper(
                    features.getValue().getDataset().isChangeImplicit(features.getValue()) ? "Implicit"
                            : "Explicit"));
    tv.getColumns().add(colExplicit);

    ChangeFilter cf = datasetView.getProjectView().getProject().getChangeFilter();
    TableColumn<Change, String> colFiltered = new TableColumn<>("Eliminated by filter?");
    colFiltered.setCellValueFactory(
            (TableColumn.CellDataFeatures<Change, String> features) -> new ReadOnlyStringWrapper(
                    cf.test(features.getValue()) ? "Allowed" : "Eliminated"));
    tv.getColumns().add(colFiltered);

    TableColumn<Change, String> colNote = new TableColumn<>("Note");
    colNote.setCellFactory(TextFieldTableCell.forTableColumn());
    colNote.setCellValueFactory(new PropertyValueFactory<>("note"));
    colNote.setPrefWidth(100.0);
    colNote.setEditable(true);
    tv.getColumns().add(colNote);

    TableColumn<Change, String> colCitations = new TableColumn<>("Citations");
    colCitations.setCellValueFactory(
            (TableColumn.CellDataFeatures<Change, String> features) -> new ReadOnlyStringWrapper(
                    features.getValue().getCitationStream().map(citation -> citation.getCitation()).sorted()
                            .collect(Collectors.joining("; "))));
    tv.getColumns().add(colCitations);

    TableColumn<Change, String> colGenera = new TableColumn<>("Genera");
    colGenera.setCellValueFactory(
            (TableColumn.CellDataFeatures<Change, String> features) -> new ReadOnlyStringWrapper(
                    String.join(", ", features.getValue().getAllNames().stream().map(n -> n.getGenus())
                            .distinct().sorted().collect(Collectors.toList()))));
    tv.getColumns().add(colGenera);

    TableColumn<Change, String> colSpecificEpithet = new TableColumn<>("Specific epithets");
    colSpecificEpithet.setCellValueFactory(
            (TableColumn.CellDataFeatures<Change, String> features) -> new ReadOnlyStringWrapper(String
                    .join(", ", features.getValue().getAllNames().stream().map(n -> n.getSpecificEpithet())
                            .filter(s -> s != null).distinct().sorted().collect(Collectors.toList()))));
    tv.getColumns().add(colSpecificEpithet);

    // The infraspecific string.
    TableColumn<Change, String> colInfraspecificEpithet = new TableColumn<>("Infraspecific epithets");
    colInfraspecificEpithet.setCellValueFactory(
            (TableColumn.CellDataFeatures<Change, String> features) -> new ReadOnlyStringWrapper(
                    String.join(", ",
                            features.getValue().getAllNames().stream()
                                    .map(n -> n.getInfraspecificEpithetsAsString()).filter(s -> s != null)
                                    .distinct().sorted().collect(Collectors.toList()))));
    tv.getColumns().add(colInfraspecificEpithet);

    // The very last epithet of all
    TableColumn<Change, String> colTerminalEpithet = new TableColumn<>("Terminal epithet");
    colTerminalEpithet.setCellValueFactory(
            (TableColumn.CellDataFeatures<Change, String> features) -> new ReadOnlyStringWrapper(
                    String.join(", ", features.getValue().getAllNames().stream().map(n -> {
                        List<Name.InfraspecificEpithet> infraspecificEpithets = n.getInfraspecificEpithets();
                        if (!infraspecificEpithets.isEmpty()) {
                            return infraspecificEpithets.get(infraspecificEpithets.size() - 1).getValue();
                        } else {
                            return n.getSpecificEpithet();
                        }
                    }).filter(s -> s != null).distinct().sorted().collect(Collectors.toList()))));
    tv.getColumns().add(colTerminalEpithet);

    // Properties
    TableColumn<Change, String> colProperties = new TableColumn<>("Properties");
    colProperties.setCellValueFactory(
            (TableColumn.CellDataFeatures<Change, String> features) -> new ReadOnlyStringWrapper(
                    features.getValue().getProperties().entrySet().stream()
                            .map(entry -> entry.getKey() + ": " + entry.getValue()).sorted()
                            .collect(Collectors.joining("; "))));
    tv.getColumns().add(colProperties);

    fillTableWithChanges(tv, tp);

    // When someone selects a cell in the Table, try to select the appropriate data in the
    // additional data view.
    tv.getSelectionModel().getSelectedItems().addListener((ListChangeListener<Change>) lcl -> {
        AdditionalData aData = additionalDataCombobox.getSelectionModel().getSelectedItem();

        if (aData != null) {
            aData.onSelectChange(tv.getSelectionModel().getSelectedItems());
        }
    });

    // Create a right-click menu for table rows.
    changesTableView.setRowFactory(table -> {
        TableRow<Change> row = new TableRow<>();

        row.setOnContextMenuRequested(event -> {
            if (row.isEmpty())
                return;

            // We don't currently use the clicked change, since currently all options
            // change *all* the selected changes, but this may change in the future.
            Change change = row.getItem();

            ContextMenu changeMenu = new ContextMenu();

            Menu searchForName = new Menu("Search for name");
            searchForName.getItems().addAll(
                    change.getAllNames().stream().sorted().map(n -> createMenuItem(n.getFullName(), action -> {
                        datasetView.getProjectView().openDetailedView(n);
                    })).collect(Collectors.toList()));
            changeMenu.getItems().add(searchForName);
            changeMenu.getItems().add(new SeparatorMenuItem());

            changeMenu.getItems().add(createMenuItem("Edit note", action -> {
                List<Change> changes = new ArrayList<>(changesTableView.getSelectionModel().getSelectedItems());

                String combinedNotes = changes.stream().map(ch -> ch.getNote().orElse("").trim()).distinct()
                        .collect(Collectors.joining("\n")).trim();

                Optional<String> result = askUserForTextArea(
                        "Modify the note for these " + changes.size() + " changes:", combinedNotes);

                if (result.isPresent()) {
                    String note = result.get().trim();
                    LOGGER.info("Using 'Edit note' to set note to '" + note + "' on changes " + changes);
                    changes.forEach(ch -> ch.noteProperty().set(note));
                }
            }));
            changeMenu.getItems().add(new SeparatorMenuItem());

            // Create a submenu for tags and urls.
            String note = change.noteProperty().get();

            Menu removeTags = new Menu("Tags");
            removeTags.getItems().addAll(change.getTags().stream().sorted()
                    .map(tag -> new MenuItem(tag.getName())).collect(Collectors.toList()));

            Menu lookupURLs = new Menu("Lookup URL");
            change.getURIs().stream().sorted().map(uri -> {
                return createMenuItem(uri.toString(), evt -> {
                    try {
                        Desktop.getDesktop().browse(uri);
                    } catch (IOException ex) {
                        LOGGER.warning("Could not open URL '" + uri + "': " + ex);
                    }
                });
            }).forEach(mi -> lookupURLs.getItems().add(mi));
            changeMenu.getItems().add(lookupURLs);

            changeMenu.getItems().add(new SeparatorMenuItem());
            changeMenu.getItems().add(createMenuItem("Prepend text to all notes", action -> {
                List<Change> changes = new ArrayList<>(changesTableView.getSelectionModel().getSelectedItems());

                Optional<String> result = askUserForTextField(
                        "Enter tags to prepend to notes in " + changes.size() + " changes:");

                if (result.isPresent()) {
                    String tags = result.get().trim();
                    changes.forEach(ch -> {
                        String prevValue = change.getNote().orElse("").trim();

                        LOGGER.info("Prepending tags '" + tags + "' to previous value '" + prevValue
                                + "' for change " + ch);

                        ch.noteProperty().set((tags + " " + prevValue).trim());
                    });
                }
            }));
            changeMenu.getItems().add(createMenuItem("Append text to all notes", action -> {
                List<Change> changes = new ArrayList<>(changesTableView.getSelectionModel().getSelectedItems());
                Optional<String> result = askUserForTextField(
                        "Enter tags to append to notes in " + changes.size() + " changes:");

                if (result.isPresent()) {
                    String tags = result.get().trim();
                    changes.forEach(ch -> {
                        String prevValue = ch.getNote().orElse("").trim();

                        LOGGER.info("Appending tags '" + tags + "' to previous value '" + prevValue
                                + "' for change " + ch);

                        ch.noteProperty().setValue((prevValue + " " + tags).trim());
                    });
                }
            }));

            changeMenu.show(datasetView.getScene().getWindow(), event.getScreenX(), event.getScreenY());

        });

        return row;
    });

    LOGGER.info("setupTableWithChanges() completed");
}

From source file:ninja.javafx.smartcsv.fx.SmartCSVController.java

/**
 * Adds a column with the given name to the tableview
 * @param header name of the column header
 * @param tableView the tableview// ww w  . j  a v  a2 s .c  o  m
 */
private void addColumn(final String header, TableView tableView) {
    TableColumn column = new TableColumn(header);
    column.setCellValueFactory(new ObservableMapValueFactory(header));
    column.setCellFactory(cellFactory);
    column.setEditable(true);
    column.setSortable(false);

    ContextMenu contextMenu = contextMenuForColumn(header);
    column.setContextMenu(contextMenu);

    column.setOnEditCommit(new EventHandler<TableColumn.CellEditEvent<CSVRow, CSVValue>>() {
        @Override
        public void handle(TableColumn.CellEditEvent<CSVRow, CSVValue> event) {
            event.getTableView().getItems().get(event.getTablePosition().getRow()).getColumns().get(header)
                    .setValue(event.getNewValue());
            runLater(() -> {
                currentCsvFile.setFileChanged(true);
            });
        }
    });

    tableView.getColumns().add(column);
}

From source file:jp.ac.tohoku.ecei.sb.metabolome.lims.gui.MainWindowController.java

@SuppressWarnings("unchecked")
private void initializeTable(TableView tableView, Class clazz) {
    ArrayList<TableColumn> columns = new ArrayList<>();
    HashSet<String> methodNames = new HashSet<>();
    method: for (Method one : clazz.getMethods()) {
        for (String black : new String[] { "getClass", "getAttributeKeySet" })
            if (one.getName().equals(black))
                continue method;
        if (!one.getName().startsWith("get") && !one.getName().startsWith("is"))
            continue;
        if (one.getParameterCount() != 0)
            continue;
        if (methodNames.contains(one.getName()))
            continue;
        methodNames.add(one.getName());// w w w  .j  a v  a  2s  .c  o  m

        TableColumn oneColumn = new TableColumn();
        String name = one.getName().substring(3);
        if (one.getName().startsWith("is")) {
            name = one.getName().substring(2);
        }
        oneColumn.setText(name);
        oneColumn.setCellValueFactory(new PropertyValueFactory(name));

        if (one.getName().equals("getId"))
            columns.add(0, oneColumn);
        else
            columns.add(oneColumn);
    }

    tableView.getColumns().addAll(columns.toArray());
}

From source file:UI.MainStageController.java

/**
 * shows the correlation table in the analysis view
 *//*from w  w  w. jav a  2 s.c  o m*/
@FXML
private void displayCorrelationTable() {
    //Delete whatever's been in the table before
    TableView<String[]> analysisTable = new TableView<>();

    //We want to display correlations and p-Values of every node combination
    double[][] correlationMatrix = AnalysisData.getCorrelationMatrix().getData();
    double[][] pValueMatrix = AnalysisData.getPValueMatrix().getData();
    LinkedList<TaxonNode> taxonList = SampleComparison.getUnifiedTaxonList(LoadedData.getSamplesToAnalyze(),
            AnalysisData.getLevelOfAnalysis());

    //Table will consist of strings
    String[][] tableValues = new String[correlationMatrix.length][correlationMatrix[0].length + 1];

    //Add the values as formatted strings
    for (int i = 0; i < tableValues.length; i++) {
        tableValues[i][0] = taxonList.get(i).getName();
        for (int j = 1; j < tableValues[0].length; j++) {
            tableValues[i][j] = String.format("%.3f", correlationMatrix[i][j - 1]).replace(",", ".") + "\n("
                    + String.format("%.2f", pValueMatrix[i][j - 1]).replace(",", ".") + ")";
        }
    }

    for (int i = 0; i < tableValues[0].length; i++) {
        String columnTitle;
        if (i > 0) {
            columnTitle = taxonList.get(i - 1).getName();
        } else {
            columnTitle = "";
        }
        TableColumn<String[], String> column = new TableColumn<>(columnTitle);
        final int columnIndex = i;
        column.setCellValueFactory(cellData -> {
            String[] row = cellData.getValue();
            return new SimpleStringProperty(row[columnIndex]);
        });
        analysisTable.getColumns().add(column);

        //First column contains taxon names and should be italic
        if (i == 0)
            column.setStyle("-fx-font-style:italic;");
    }

    for (int i = 0; i < tableValues.length; i++) {
        analysisTable.getItems().add(tableValues[i]);
    }

    //Display table on a new stage
    Stage tableStage = new Stage();
    tableStage.setTitle("Correlation Table");
    BorderPane tablePane = new BorderPane();
    Button exportCorrelationsButton = new Button("Save correlation table to CSV");
    Button exportPValuesButton = new Button("Save p-value table to CSV");
    exportCorrelationsButton.setOnAction(e -> exportTableToCSV(tableValues, false));
    exportPValuesButton.setOnAction(e -> exportTableToCSV(tableValues, true));
    HBox exportBox = new HBox(exportCorrelationsButton, exportPValuesButton);
    exportBox.setPadding(new Insets(10));
    exportBox.setSpacing(10);
    tablePane.setTop(exportBox);
    tablePane.setCenter(analysisTable);
    Scene tableScene = new Scene(tablePane);
    tableStage.setScene(tableScene);
    tableStage.show();
}

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

private Pane getCustomizeTablePane() {
    TableView<TreeTableColumn<TMAEntry, ?>> tableColumns = new TableView<>();
    tableColumns.setPlaceholder(new Text("No columns available"));
    tableColumns.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    tableColumns.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);

    SortedList<TreeTableColumn<TMAEntry, ?>> sortedColumns = new SortedList<>(
            table.getColumns().filtered(p -> !p.getText().trim().isEmpty()));
    sortedColumns.setComparator((c1, c2) -> c1.getText().compareTo(c2.getText()));
    tableColumns.setItems(sortedColumns);
    sortedColumns.comparatorProperty().bind(tableColumns.comparatorProperty());
    //      sortedColumns.comparatorProperty().bind(tableColumns.comparatorProperty());

    TableColumn<TreeTableColumn<TMAEntry, ?>, String> columnName = new TableColumn<>("Column");
    columnName.setCellValueFactory(v -> v.getValue().textProperty());
    TableColumn<TreeTableColumn<TMAEntry, ?>, Boolean> columnVisible = new TableColumn<>("Visible");
    columnVisible.setCellValueFactory(v -> v.getValue().visibleProperty());
    //      columnVisible.setCellValueFactory(col -> {
    //         SimpleBooleanProperty prop = new SimpleBooleanProperty(col.getValue().isVisible());
    //         prop.addListener((v, o, n) -> col.getValue().setVisible(n));
    //         return prop;
    //      });/*from ww  w .j  av a 2s.c  om*/
    tableColumns.setEditable(true);
    columnVisible.setCellFactory(v -> new CheckBoxTableCell<>());
    tableColumns.getColumns().add(columnName);
    tableColumns.getColumns().add(columnVisible);
    ContextMenu contextMenu = new ContextMenu();

    Action actionShowSelected = new Action("Show selected", e -> {
        for (TreeTableColumn<?, ?> col : tableColumns.getSelectionModel().getSelectedItems()) {
            if (col != null)
                col.setVisible(true);
            else {
                // Not sure why this happens...?
                logger.trace("Selected column is null!");
            }
        }
    });

    Action actionHideSelected = new Action("Hide selected", e -> {
        for (TreeTableColumn<?, ?> col : tableColumns.getSelectionModel().getSelectedItems()) {
            if (col != null)
                col.setVisible(false);
            else {
                // Not sure why this happens...?
                logger.trace("Selected column is null!");
            }
        }
    });

    contextMenu.getItems().addAll(ActionUtils.createMenuItem(actionShowSelected),
            ActionUtils.createMenuItem(actionHideSelected));
    tableColumns.setContextMenu(contextMenu);
    tableColumns.setTooltip(
            new Tooltip("Show or hide table columns - right-click to change multiple columns at once"));

    BorderPane paneColumns = new BorderPane(tableColumns);
    paneColumns.setBottom(PanelToolsFX.createColumnGridControls(ActionUtils.createButton(actionShowSelected),
            ActionUtils.createButton(actionHideSelected)));

    VBox paneRows = new VBox();

    // Create a box to filter on some metadata text
    ComboBox<String> comboMetadata = new ComboBox<>();
    comboMetadata.setItems(metadataNames);
    comboMetadata.getSelectionModel().getSelectedItem();
    comboMetadata.setPromptText("Select column");
    TextField tfFilter = new TextField();
    CheckBox cbExact = new CheckBox("Exact");
    // Set listeners
    cbExact.selectedProperty().addListener(
            (v, o, n) -> setMetadataTextPredicate(comboMetadata.getSelectionModel().getSelectedItem(),
                    tfFilter.getText(), cbExact.isSelected(), !cbExact.isSelected()));
    tfFilter.textProperty().addListener(
            (v, o, n) -> setMetadataTextPredicate(comboMetadata.getSelectionModel().getSelectedItem(),
                    tfFilter.getText(), cbExact.isSelected(), !cbExact.isSelected()));
    comboMetadata.getSelectionModel().selectedItemProperty().addListener(
            (v, o, n) -> setMetadataTextPredicate(comboMetadata.getSelectionModel().getSelectedItem(),
                    tfFilter.getText(), cbExact.isSelected(), !cbExact.isSelected()));

    GridPane paneMetadata = new GridPane();
    paneMetadata.add(comboMetadata, 0, 0);
    paneMetadata.add(tfFilter, 1, 0);
    paneMetadata.add(cbExact, 2, 0);
    paneMetadata.setPadding(new Insets(10, 10, 10, 10));
    paneMetadata.setVgap(2);
    paneMetadata.setHgap(5);
    comboMetadata.setMaxWidth(Double.MAX_VALUE);
    GridPane.setHgrow(tfFilter, Priority.ALWAYS);
    GridPane.setFillWidth(comboMetadata, Boolean.TRUE);
    GridPane.setFillWidth(tfFilter, Boolean.TRUE);

    TitledPane tpMetadata = new TitledPane("Metadata filter", paneMetadata);
    tpMetadata.setExpanded(false);
    //      tpMetadata.setCollapsible(false);
    Tooltip tooltipMetadata = new Tooltip(
            "Enter text to filter entries according to a selected metadata column");
    Tooltip.install(paneMetadata, tooltipMetadata);
    tpMetadata.setTooltip(tooltipMetadata);
    paneRows.getChildren().add(tpMetadata);

    // Add measurement predicate
    TextField tfCommand = new TextField();
    tfCommand.setTooltip(new Tooltip("Predicate used to filter entries for inclusion"));

    TextFields.bindAutoCompletion(tfCommand, e -> {
        int ind = tfCommand.getText().lastIndexOf("\"");
        if (ind < 0)
            return Collections.emptyList();
        String part = tfCommand.getText().substring(ind + 1);
        return measurementNames.stream().filter(n -> n.startsWith(part)).map(n -> "\"" + n + "\" ")
                .collect(Collectors.toList());
    });

    String instructions = "Enter a predicate to filter entries.\n"
            + "Only entries passing the test will be included in any results.\n"
            + "Examples of predicates include:\n" + "    \"Num Tumor\" > 200\n"
            + "    \"Num Tumor\" > 100 && \"Num Stroma\" < 1000";
    //      labelInstructions.setTooltip(new Tooltip("Note: measurement names must be in \"inverted commands\" and\n" + 
    //            "&& indicates 'and', while || indicates 'or'."));

    BorderPane paneMeasurementFilter = new BorderPane(tfCommand);
    Label label = new Label("Predicate: ");
    label.setAlignment(Pos.CENTER);
    label.setMaxHeight(Double.MAX_VALUE);
    paneMeasurementFilter.setLeft(label);

    Button btnApply = new Button("Apply");
    btnApply.setOnAction(e -> {
        TablePredicate predicateNew = new TablePredicate(tfCommand.getText());
        if (predicateNew.isValid()) {
            predicateMeasurements.set(predicateNew);
        } else {
            DisplayHelpers.showErrorMessage("Invalid predicate",
                    "Current predicate '" + tfCommand.getText() + "' is invalid!");
        }
        e.consume();
    });
    TitledPane tpMeasurementFilter = new TitledPane("Measurement filter", paneMeasurementFilter);
    tpMeasurementFilter.setExpanded(false);
    Tooltip tooltipInstructions = new Tooltip(instructions);
    tpMeasurementFilter.setTooltip(tooltipInstructions);
    Tooltip.install(paneMeasurementFilter, tooltipInstructions);
    paneMeasurementFilter.setRight(btnApply);

    paneRows.getChildren().add(tpMeasurementFilter);

    logger.info("Predicate set to: {}", predicateMeasurements.get());

    VBox pane = new VBox();
    //      TitledPane tpColumns = new TitledPane("Select column", paneColumns);
    //      tpColumns.setMaxHeight(Double.MAX_VALUE);
    //      tpColumns.setCollapsible(false);
    pane.getChildren().addAll(paneColumns, new Separator(), paneRows);
    VBox.setVgrow(paneColumns, Priority.ALWAYS);

    return pane;
}

From source file:org.simmi.GeneSetHead.java

License:asdf

public int searchTable(TableView table, String text, int i, boolean back, int... columns) {
    int v;//from w ww.  ja va 2  s  .co  m
    if (back) {
        v = i - 1;
        if (v == -1)
            v = table.getItems().size();
    } else
        v = (i + 1) % table.getItems().size();
    if (isGeneview()) {
        while (v != i) {
            //int m = table.convertRowIndexToModel(v);
            //if( m != -1 ) {
            //Gene g = geneset.genelist.get(m);
            //String name = column == 7 || column[0] == 8 ? g.getGeneGroup().getCommonSymbol() + ", " + g.getGeneGroup().getCommonKOName( ko2name ) + ", " +  : g.getGeneGroup().getCommonName();

            ObservableList<TableColumn> cc = table.getColumns();
            String name = "";
            for (int k : columns) {
                TableColumn tc = cc.get(k);
                String val = tc.getCellObservableValue(v).toString();
                name += val;//table.getValueAt(v, k);
            }

            if (name.toLowerCase().contains(text)) {
                //int r = table.convertRowIndexToView(v);
                table.scrollTo(v);
                //Rectangle rect = table.getCellRect(v, 0, true);
                //table.scrollRectToVisible( rect );
                break;
            }
            if (back) {
                v--;
                if (v == -1)
                    v = table.getItems().size() - 1;
            } else
                v = (v + 1) % table.getItems().size();

            //} else break;
        }
    } else {
        while (v != i) {
            //int m = table.convertRowIndexToModel(v);
            //if( m != -1 ) {

            //GeneGroup gg = allgenegroups.get(m);
            //String name = gg.getCommonName();
            ObservableList<TableColumn> cc = table.getColumns();
            String name = "";
            for (int k : columns) {
                TableColumn tc = cc.get(k);
                String val = tc.getCellObservableValue(v).toString();
                name += val;
                //name += table.getValueAt(v, k);
            }

            if (name.toLowerCase().contains(text)) {
                //int r = table.convertRowIndexToView(i);
                //Rectangle rect = table.getCellRect(v, 0, true);
                //table.scrollRectToVisible( rect );
                table.scrollTo(v);
                break;
            }
            if (back) {
                v--;
                if (v == -1)
                    v = table.getItems().size() - 1;
            } else
                v = (v + 1) % table.getItems().size();

            //} else break;
        }
    }
    return v;
}