Example usage for javafx.scene.control TableColumn setCellValueFactory

List of usage examples for javafx.scene.control TableColumn setCellValueFactory

Introduction

In this page you can find the example usage for javafx.scene.control TableColumn setCellValueFactory.

Prototype

public final void setCellValueFactory(Callback<CellDataFeatures<S, T>, ObservableValue<T>> value) 

Source Link

Usage

From source file:ch.unibas.fittingwizard.presentation.fitting.FitResultPage.java

private void setupTable() {
    atomsTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<FitResultViewModel>() {
        @Override/*from  www  . ja v  a 2 s  .  c  o  m*/
        public void changed(ObservableValue<? extends FitResultViewModel> observableValue,
                FitResultViewModel fitResultViewModel, FitResultViewModel type) {
            setSelectedAtomType(type);
        }
    });

    atomTypeColumn.setCellValueFactory(new PropertyValueFactory<FitResultViewModel, String>("atomTypeName"));

    for (final String chargeType : ChargeTypes.all) {
        TableColumn<FitResultViewModel, FitResultViewModel.FitValue> column = new TableColumn<>(chargeType);

        column.setPrefWidth(80);
        column.setMinWidth(80);
        column.setCellValueFactory(
                new Callback<TableColumn.CellDataFeatures<FitResultViewModel, FitResultViewModel.FitValue>, ObservableValue<FitResultViewModel.FitValue>>() {
                    @Override
                    public ObservableValue<FitResultViewModel.FitValue> call(
                            TableColumn.CellDataFeatures<FitResultViewModel, FitResultViewModel.FitValue> data) {
                        return data.getValue().getChargeValueFor(chargeType);
                    }
                });
        column.setCellFactory(new ColoredCellCallback());

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

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//from   ww  w  . j a  v  a2 s.co  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:memoryaid.SetReminderController.java

@FXML
public void buildReminderTableData() throws SQLException {
    System.out.println("In builddata");

    DbConnection db = new DbConnection();
    Connection conn = db.connect();
    String SQL = "select RId,ReminderName,ReminderType,StartDate,EndDate,ReminderTime from reminders";
    ResultSet rs = conn.createStatement().executeQuery(SQL);

    TableColumn rIdCol = new TableColumn("RId");
    rIdCol.setCellValueFactory(new PropertyValueFactory<>("reminderId"));

    TableColumn reminderNameCol = new TableColumn("ReminderName");
    reminderNameCol.setCellValueFactory(new PropertyValueFactory<>("reminderName"));

    TableColumn reminderTypeCol = new TableColumn("ReminderType");
    reminderTypeCol.setCellValueFactory(new PropertyValueFactory<>("reminderType"));

    TableColumn startDateCol = new TableColumn("StartDate");
    startDateCol.setCellValueFactory(new PropertyValueFactory<>("startDate"));

    TableColumn endDateCol = new TableColumn("EndDate");
    endDateCol.setCellValueFactory(new PropertyValueFactory<>("endDate"));

    TableColumn reminderTimeCol = new TableColumn("ReminderTime");
    reminderTimeCol.setCellValueFactory(new PropertyValueFactory<>("reminderTime"));

    reminderTable.getColumns().add(rIdCol);
    reminderTable.getColumns().add(reminderNameCol);
    reminderTable.getColumns().add(reminderTypeCol);
    reminderTable.getColumns().add(startDateCol);
    reminderTable.getColumns().add(endDateCol);
    reminderTable.getColumns().add(reminderTimeCol);

    ObservableList<Object> data = FXCollections.observableArrayList();

    while (rs.next()) {
        String rId = String.valueOf(rs.getInt("RId"));

        data.add(new ReminderModel(rId, rs.getString("ReminderName"), rs.getString("ReminderType"),
                rs.getString("StartDate"), rs.getString("EndDate"), rs.getString("ReminderTime")));
    }/*from   w w w .  j a va  2s .co m*/
    rs.close();
    conn.close();

    Callback<TableColumn<ReminderModel, String>, TableCell<ReminderModel, String>> cellFactory = (
            TableColumn<ReminderModel, String> p) -> new EditingCell();

    //Code For Reminder Name update

    reminderNameCol.setCellValueFactory(new PropertyValueFactory<>("reminderName"));
    reminderNameCol.setCellFactory(cellFactory);
    reminderNameCol.setOnEditCommit(new EventHandler<CellEditEvent<ReminderModel, String>>() {

        @Override
        public void handle(CellEditEvent<ReminderModel, String> t) {
            ((ReminderModel) t.getTableView().getItems().get(t.getTablePosition().getRow()))
                    .setReminderName(t.getNewValue());

            System.out.println("*******" + t.getNewValue());
            ReminderModel selectedItem = (ReminderModel) reminderTable.getSelectionModel().getSelectedItem();
            System.out.println(selectedItem);
            String rIdToUpdate = selectedItem.getReminderId();
            Statement stmt = null;
            DbConnection db = new DbConnection();
            Connection conn = db.connect();

            try {
                stmt = conn.createStatement();

                String updateSql = "UPDATE Reminders set ReminderName = '" + t.getNewValue() + "'"
                        + "WHERE RId = '" + rIdToUpdate + "'";

                stmt.executeUpdate(updateSql);
            } catch (SQLException ex) {
                Logger.getLogger(SetReminderController.class.getName()).log(Level.SEVERE, null, ex);
            }

        }

    });

    //For ReminderType Column Update

    reminderTypeCol.setCellValueFactory(new PropertyValueFactory<>("reminderType"));
    reminderTypeCol.setCellFactory(cellFactory);
    reminderTypeCol.setOnEditCommit(new EventHandler<CellEditEvent<ReminderModel, String>>() {

        @Override
        public void handle(CellEditEvent<ReminderModel, String> t) {
            ((ReminderModel) t.getTableView().getItems().get(t.getTablePosition().getRow()))
                    .setReminderType(t.getNewValue());

            System.out.println("*******" + t.getNewValue());
            ReminderModel selectedItem = (ReminderModel) reminderTable.getSelectionModel().getSelectedItem();
            System.out.println(selectedItem);
            String rIdToUpdate = selectedItem.getReminderId();
            Statement stmt = null;
            DbConnection db = new DbConnection();
            Connection conn = db.connect();

            try {
                stmt = conn.createStatement();

                String updateSql = "UPDATE Reminders set ReminderType = '" + t.getNewValue() + "'"
                        + "WHERE RId = '" + rIdToUpdate + "'";

                stmt.executeUpdate(updateSql);
            } catch (SQLException ex) {
                Logger.getLogger(SetReminderController.class.getName()).log(Level.SEVERE, null, ex);
            }

        }

    });

    //For reminderTime Column Update

    reminderTimeCol.setCellValueFactory(new PropertyValueFactory<>("reminderTime"));
    reminderTimeCol.setCellFactory(cellFactory);
    reminderTimeCol.setOnEditCommit(new EventHandler<CellEditEvent<ReminderModel, String>>() {

        @Override
        public void handle(CellEditEvent<ReminderModel, String> t) {
            ((ReminderModel) t.getTableView().getItems().get(t.getTablePosition().getRow()))
                    .setReminderTime(t.getNewValue());

            System.out.println("*******" + t.getNewValue());
            ReminderModel selectedItem = (ReminderModel) reminderTable.getSelectionModel().getSelectedItem();
            System.out.println(selectedItem);
            String rIdToUpdate = selectedItem.getReminderId();
            Statement stmt = null;
            DbConnection db = new DbConnection();
            Connection conn = db.connect();

            try {
                stmt = conn.createStatement();

                String updateSql = "UPDATE Reminders set ReminderTime = '" + t.getNewValue() + "'"
                        + "WHERE RId = '" + rIdToUpdate + "'";

                stmt.executeUpdate(updateSql);
            } catch (SQLException ex) {
                Logger.getLogger(SetReminderController.class.getName()).log(Level.SEVERE, null, ex);
            }

        }

    });

    reminderTable.setItems(data);

}

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

@FXML
void onShowCompoundIntensityTable(MouseEvent event) {
    if (tableCompound.getSelectionModel().isEmpty())
        return;/*from   ww  w .j av a 2 s  .  c o m*/

    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.ui.BulkChangeEditorController.java

private void setupChangesTableView() {
    changesTableView.setEditable(true);/* w  w  w  .  j ava 2s  .c o  m*/
    changesTableView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    changesTableView.getColumns().clear();

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

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

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

    TableColumn<PotentialChange, String> colChangeDataset = new TableColumn<>("Dataset");
    colChangeDataset.setCellValueFactory(new PropertyValueFactory<>("dataset"));
    colChangeDataset.setPrefWidth(100.0);
    changesTableView.getColumns().add(colChangeDataset);

    ChangeFilter cf = project.getChangeFilter();
    TableColumn<PotentialChange, String> colFiltered = new TableColumn<>("Eliminated by filter?");
    colFiltered.setCellValueFactory(
            (TableColumn.CellDataFeatures<PotentialChange, String> features) -> new ReadOnlyStringWrapper(
                    cf.test(features.getValue()) ? "Allowed" : "Eliminated"));
    changesTableView.getColumns().add(colFiltered);

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

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

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

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

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

    // TODO: if we can get an ObservableList over tp.getAllChanges(), then this table
    // will update dynamically as changes are made. Won't that be something.
    // Yes, we want to getAllChanges() so we can see which ones are filtered out.
    changesTableView.setItems(foundChanges);
    changesTableView.getSortOrder().add(colChangeType);
}

From source file:dtv.controller.FXMLMainController.java

public void init(ObservableList<DVBChannel> serviceData, TableView<DVBChannel> table,
        TableColumn<DVBChannel, Integer> idx, TableColumn<DVBChannel, String> name,
        TableColumn<DVBChannel, String> type, TableColumn<DVBChannel, String> ppr) {

    table.setEditable(true);/*w ww .  j a  v a2 s.c o  m*/
    idx.setCellValueFactory(cellData -> cellData.getValue().idxProperty().asObject());
    name.setCellValueFactory(cellData -> cellData.getValue().nameProperty());
    name.setEditable(true);
    type.setCellValueFactory(cellData -> cellData.getValue().typeProperty());
    // nid.setCellValueFactory(cellData -> cellData.getValue().nidProperty().asObject());
    ppr.setCellValueFactory(cellData -> cellData.getValue().pprProperty());
    // newCol.setCellValueFactory(cellData -> cellData.getValue().neewProperty());

    // Context menu
    table.setRowFactory(tableView -> {
        final TableRow<DVBChannel> row = new TableRow<>();
        final ContextMenu rowMenu = new ContextMenu();

        final MenuItem removeItem = new MenuItem("Delete");
        removeItem.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent event) {
                final DVBChannel service = row.getItem();
                serviceData.removeAll(service);
            }
        });

        rowMenu.getItems().addAll(removeItem);
        row.contextMenuProperty().bind(Bindings.when(Bindings.isNotNull(row.itemProperty())).then(rowMenu)
                .otherwise((ContextMenu) null));

        return row;
    });

    ppr.setCellFactory(col -> {
        final TableCell<DVBChannel, String> cell = new TableCell<>();

        cell.textProperty().bind(cell.itemProperty());
        cell.itemProperty().addListener((obs, oldValue, newValue) -> {
            if (newValue != null) {
                final ContextMenu cellMenu = new ContextMenu();
                for (String pref : Utils.prefTab) {
                    final CheckMenuItem prefMenuItem = new CheckMenuItem(pref);

                    if (Utils.isPreferenceOn(cell.getText(), pref)) {
                        prefMenuItem.setSelected(true);
                    }

                    prefMenuItem.selectedProperty().addListener((obs1, old_val, new_val) -> {
                        final String new_ppr;
                        final DVBChannel service = (DVBChannel) cell.getTableRow().getItem();

                        if (new_val) {
                            new_ppr = Utils.add_ppr(cell.getText(), pref);
                        } else {
                            new_ppr = Utils.remove_ppr(cell.getText(), pref);
                        }

                        service.setPpr(new_ppr);
                        service.setModified(true);
                    });

                    cellMenu.getItems().add(prefMenuItem);
                    cell.setContextMenu(cellMenu);
                }
            } else {
                cell.setContextMenu(null);
            }
        });
        return cell;
    });

    // Editable service name
    name.setCellFactory(p -> new EditingCell());

    name.setOnEditCommit(t -> {

        final DVBChannel service = t.getTableView().getItems().get(t.getTablePosition().getRow());
        service.setName(t.getNewValue());
        service.setModified(true);
    });
}

From source file:com.ggvaidya.scinames.summary.NameStabilityView.java

private TableColumn<Dataset, String> createTableColumn(String colName, Function<Dataset, String> func) {
    TableColumn<Dataset, String> tableColumn = new TableColumn<>(colName);
    tableColumn.setCellValueFactory(features -> new ReadOnlyStringWrapper(func.apply(features.getValue())));

    tableColumn.setPrefWidth(100.0);//from w w  w .  ja v  a2s . co  m

    return tableColumn;
}

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());//from   w  w w . j a va 2  s. 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:fruitproject.FruitProject.java

public void second(final String pfname) {

    final Stage st = new Stage();
    Scene scene = null;/*from  ww  w  .j a v  a2  s  .  c om*/
    final GridPane grid = new GridPane();
    grid.setAlignment(Pos.CENTER);
    grid.setHgap(10);
    grid.setVgap(10);
    grid.setPadding(new Insets(25, 25, 25, 25));
    TableView tv = new TableView();

    final TableColumn<Map, String> firstDataColumn = new TableColumn<>("Name");
    final TableColumn<Map, String> secondDataColumn = new TableColumn<>("Amount");
    final TableColumn<Map, String> thirdDataColumn = new TableColumn<>("Remove");
    firstDataColumn.setMinWidth(130);
    secondDataColumn.setMinWidth(130);
    thirdDataColumn.setMinWidth(130);

    if (!pfname.equals("")) {

        firstDataColumn.setCellValueFactory(new MapValueFactory(Column1MapKey));
        secondDataColumn.setCellValueFactory(new MapValueFactory(Column2MapKey));
        thirdDataColumn.setCellValueFactory(new MapValueFactory(Column3MapKey));

        rows = 0;
        tv = new TableView<>(generateDataInMap(pfname, addPairs));

    }

    tv.getColumns().setAll(firstDataColumn, secondDataColumn, thirdDataColumn);

    // secondDataColumn.setCellFactory(TextFieldTableCell.forTableColumn());

    ScrollPane sp = new ScrollPane();
    sp.setMinWidth(400);
    sp.setHbarPolicy(ScrollBarPolicy.NEVER);
    sp.setContent(tv);
    grid.add(sp, 0, 3);

    final ComboBox comboBox = new ComboBox();
    HBox hb1 = new HBox();
    comboBox.setValue("FILE");
    comboBox.getItems().addAll("Save this file", "Load a new file");
    Button btnOk = new Button();
    btnOk.setText("OK");
    hb1.getChildren().addAll(comboBox, btnOk);
    hb1.setSpacing(10);
    grid.add(hb1, 0, 1);

    Label label1 = new Label("Title:");
    final TextField tfFilename = new TextField();
    tfFilename.setText(getTitle(pfname));
    HBox hb = new HBox();
    hb.getChildren().addAll(label1, tfFilename);
    hb.setSpacing(10);
    grid.add(hb, 0, 2);

    final Stage ps = new Stage();
    final TableView tv1 = tv;
    btnOk.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            //System.out.println("Hello World!");

            if (comboBox.getValue().equals("Load a new file")) {
                first(ps);
                st.close();
            } else {
                PrintWriter pw = null;
                try {
                    pw = new PrintWriter("abc.json");
                    BufferedWriter bw = new BufferedWriter(new FileWriter(pfname, false));
                    bw.write("{title:\"" + tfFilename.getText() + "\"");
                    bw.write(",fruits:[");
                    for (int i = 0; i < rows; i++) {
                        bw.write("{name:\"" + String.valueOf(firstDataColumn.getCellData(i)) + "\",amount:"
                                + String.valueOf(secondDataColumn.getCellData(i)) + "}");
                        if (i != rows - 1)
                            bw.write(",");
                    }
                    bw.write("]}");

                    bw.close();

                } catch (Exception e) {
                    System.out.println(e.toString());
                }

            }
        }
    });

    Button btn = new Button();
    btn.setText("New Fruit");
    grid.add(btn, 1, 2);

    // TableView tv=new TableView();
    // TableColumn Col1 = new TableColumn("Name");
    // TableColumn Col2 = new TableColumn("Amount");
    // TableColumn Col3 = new TableColumn("Remove");
    // tv.getColumns().addAll(Col1, Col2, Col3);

    //sp.setFitToWidth(true);

    Image img = new Image("file:music.jpg");
    ImageView iv2 = new ImageView();
    iv2.setImage(img);
    iv2.setFitWidth(200);
    iv2.setPreserveRatio(true);
    iv2.setSmooth(true);
    iv2.setCache(true);
    grid.add(iv2, 1, 3);

    btn.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            //System.out.println("Hello World!");

            System.out.println(comboBox.valueProperty());
            st.close();
            third(pfname);

        }
    });

    scene = new Scene(grid, 700, 450);
    st.setScene(scene);
    st.show();

}

From source file:jduagui.Controller.java

private TableColumn extCountColumn() {
    TableColumn<Map.Entry<String, Extension>, String> col = new TableColumn<>("Items");
    col.setCellValueFactory((TableColumn.CellDataFeatures<Map.Entry<String, Extension>, String> p) -> {
        return new ReadOnlyStringWrapper("" + p.getValue().getValue().getCount());
    });//w w w .  j  ava  2 s.com
    col.setComparator(new longComparator());
    return col;
}