cdc.perfs.ui.fx.SourcesPane Maven / Gradle / Ivy
package cdc.perfs.ui.fx;
import cdc.perfs.EnvironmentKind;
import cdc.perfs.api.MeasureLevel;
import cdc.perfs.api.Source;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.layout.BorderPane;
public class SourcesPane extends BorderPane {
private final TableView wTable = new TableView<>();
public SourcesPane(SourcesTableModel model) {
wTable.setEditable(true);
wTable.setItems(model);
final TableColumn wSourceCol = new TableColumn<>("Source");
final TableColumn wMaxLevelCol = new TableColumn<>("Max Level");
wTable.getColumns().add(wSourceCol);
wTable.getColumns().add(wMaxLevelCol);
wSourceCol.setCellValueFactory(new PropertyValueFactory<>("source"));
wMaxLevelCol.setCellValueFactory(new PropertyValueFactory("maxLevel"));
// wMaxLevelCol.setCellFactory(ComboBoxTableCell.forTableColumn(MeasureLevel.values()));
wMaxLevelCol.setCellFactory(column -> new MeasureLevelTableCell());
wMaxLevelCol.setEditable(model.getEnvironment().getKind() == EnvironmentKind.RUNTIME);
wMaxLevelCol.setOnEditCommit(e -> e.getTableView().getItems().get(e.getTablePosition().getRow()).setMaxLevel(e.getNewValue()));
setCenter(wTable);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy