use of javafx.scene.control.cell.CheckBoxTableCell in project Gargoyle by callakrsos.
the class CrudBaseColumnMapper method checkBox.
private CheckBoxTableCell<T, Object> checkBox(TableColumn<T, ?> column) {
CheckBox columnheaderCheckbox = new CheckBox();
// columnheaderCheckbox.setStyle("-fx-background-color:white;
// -fx-border-color :black; -fx-border-width:1;");
column.setGraphic(columnheaderCheckbox);
column.setSortable(false);
columnheaderCheckbox.addEventHandler(ActionEvent.ACTION, event -> {
if (columnheaderCheckbox.isSelected()) {
setSelectAll(column, true);
} else {
setSelectAll(column, false);
}
});
return new CheckBoxTableCell<T, Object>() {
@Override
public void updateItem(Object item, boolean empty) {
super.updateItem(item, empty);
}
@Override
public void startEdit() {
//TODO 추가 작업 예상됨. 현재는 기본컬럼으로 CheckBox형태가 나올것같지않음.
super.startEdit();
}
};
}
use of javafx.scene.control.cell.CheckBoxTableCell in project Gargoyle by callakrsos.
the class CheckBoxTableCellExam method start.
/*
* (non-Javadoc)
*
* @see javafx.application.Application#start(javafx.stage.Stage)
*/
@Override
public void start(Stage primaryStage) throws Exception {
TableView<SampleVO> center = new TableView<>();
center.setEditable(true);
TableColumn<SampleVO, Boolean> e = new TableColumn<SampleVO, Boolean>();
e.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<SampleVO, Boolean>, ObservableValue<Boolean>>() {
@Override
public ObservableValue<Boolean> call(CellDataFeatures<SampleVO, Boolean> param) {
return param.getValue().checked;
}
});
e.setCellFactory(new Callback<TableColumn<SampleVO, Boolean>, TableCell<SampleVO, Boolean>>() {
@Override
public TableCell<SampleVO, Boolean> call(TableColumn<SampleVO, Boolean> param) {
return new CheckBoxTableCell<SampleVO, Boolean>() {
/*
* (non-Javadoc)
*
* @see
* javafx.scene.control.cell.CheckBoxTableCell#updateItem(
* java.lang.Object, boolean)
*/
@Override
public void updateItem(Boolean item, boolean empty) {
super.updateItem(item, empty);
}
/*
* (non-Javadoc)
*
* @see
* javafx.scene.control.Cell#isItemChanged(java.lang.Object,
* java.lang.Object)
*/
@Override
protected boolean isItemChanged(Boolean oldItem, Boolean newItem) {
System.out.println(oldItem + " : " + newItem);
return super.isItemChanged(oldItem, newItem);
}
};
}
});
e.setEditable(true);
TableColumn<SampleVO, String> e2 = new TableColumn<SampleVO, String>();
e2.setCellValueFactory(new PropertyValueFactory<SampleVO, String>("name"));
center.getColumns().add(e);
center.getColumns().add(e2);
center.getItems().add(new SampleVO(true, "kim"));
center.getItems().add(new SampleVO(true, "young"));
BorderPane borderPane = new BorderPane(center);
primaryStage.setScene(new Scene(borderPane));
primaryStage.show();
}
Aggregations