List of usage examples for javafx.scene.control TableColumn getCellObservableValue
@Override public final ObservableValue<T> getCellObservableValue(S item)
From source file:com.ggvaidya.scinames.complexquery.ComplexQueryViewController.java
/** * Provide an export of the data in the TableView as a "table". In its * simplest Java representation, that is a list of columns, with each * column starting with a column header and then all the rest of the data. * //from ww w. j av a 2s. c o m * Warning: this can be a long-running function! * * @return A list of columns of data. */ public List<List<String>> getDataAsTable() { // What columns do we have? List<List<String>> result = new LinkedList<>(); List<TableColumn<NameCluster, ?>> columns = dataTableView.getColumns(); for (TableColumn<NameCluster, ?> col : columns) { List<String> column = new LinkedList<>(); // Add the header. column.add(col.getText()); // Add the data. for (int x = 0; x < dataTableView.getItems().size(); x++) { ObservableValue cellObservableValue = col.getCellObservableValue(x); column.add(cellObservableValue.getValue().toString()); } result.add(column); } ; return result; }
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 w w. jav a 2s . c o 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; }