use of javafx.scene.control.cell.ChoiceBoxTableCell in project Gargoyle by callakrsos.
the class CrudBaseColumnMapper method commboBox.
private CommboBoxTableColumn<T, Object> commboBox(Class<?> classType, String columnName, IOptions naming) {
CommboInfo<?> comboBox = naming.comboBox(columnName);
ObservableList codeList = (ObservableList) comboBox.getCodeList();
String code = comboBox.getCode();
String codeNm = comboBox.getCodeNm();
Supplier<ChoiceBoxTableCell<T, Object>> supplier = () -> {
ChoiceBoxTableCell<T, Object> choiceBoxTableCell = new ChoiceBoxTableCell<T, Object>(codeList) {
@Override
public void startEdit() {
Object vo = tableViewProperty().get().getItems().get(super.getIndex());
if (vo instanceof AbstractDVO) {
AbstractDVO _abstractvo = (AbstractDVO) vo;
if (Objects.equals(CommonConst._STATUS_CREATE, _abstractvo.get_status())) {
boolean editable = naming.editable(columnName);
if (!editable)
return;
super.startEdit();
} else if (Objects.equals(CommonConst._STATUS_UPDATE, _abstractvo.get_status())) {
boolean editable = naming.editable(columnName);
if (!editable)
return;
NonEditable annotationClass = getAnnotationClass(_abstractvo.getClass(), NonEditable.class, columnName);
if (annotationClass != null) {
LOGGER.debug("non start Edit");
} else {
super.startEdit();
LOGGER.debug("start Edit");
}
}
}
}
};
EventDispatcher originalDispatcher = choiceBoxTableCell.getEventDispatcher();
choiceBoxTableCell.setEventDispatcher((event, tail) -> {
return choiceBoxTableCellCellEventDispatcher(choiceBoxTableCell, originalDispatcher, event, tail);
});
// 아직까지는 codeList가 쓰일일이 없어서 주석처리함.. 과연 필요한 케이스가 생길지...?
choiceBoxTableCell.setConverter(new CommboBoxStringConverter<Object>(/* codeList, */
code, codeNm));
return choiceBoxTableCell;
};
CommboBoxTableColumn<T, Object> combobox = new CommboBoxTableColumn<T, Object>(supplier, columnName, codeList, code, codeNm);
return combobox;
}
Aggregations