use of javafx.event.EventDispatcher in project Gargoyle by callakrsos.
the class CrudBaseColumnMapper method textField.
private TextFieldTableCell<T, Object> textField(Class<?> classType, String columnName, IOptions naming) {
TextFieldTableCell<T, Object> textFieldTableCell = new TextFieldTableCell<T, Object>() {
/*
* (non-Javadoc)
*
* @see javafx.scene.control.cell.TextFieldTableCell#startEdit()
*/
@Override
public void startEdit() {
Object vo = tableViewProperty().get().getItems().get(getIndex());
if (vo instanceof AbstractDVO) {
AbstractDVO _abstractvo = (AbstractDVO) vo;
if (Objects.equals(CommonConst._STATUS_CREATE, _abstractvo.get_status())) {
// 아래와 같은형태가 되어선안됨.
// if (annotationClass != null &&
// naming.editable(columnName)) {
// 새로 추가된 항목은 NotEditable항목 편집가능하게 함.
boolean editable = naming.editable(columnName);
if (!editable)
return;
super.startEdit();
LOGGER.debug("start Edit");
} 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");
}
}
} else {
LOGGER.debug("start Edit");
super.startEdit();
}
}
};
StringConverter<Object> converter = naming.stringConverter(columnName);
if (converter == null) {
textFieldTableCell.setConverter(converter(textFieldTableCell, classType));
} else {
textFieldTableCell.setConverter(converter);
}
EventDispatcher originalDispatcher = textFieldTableCell.getEventDispatcher();
textFieldTableCell.setEventDispatcher((event, tail) -> {
return textFieldCellEventDispatcher(textFieldTableCell, originalDispatcher, event, tail);
});
return textFieldTableCell;
}
use of javafx.event.EventDispatcher 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