@Override public void cancelEdit() { //Once the edit has been cancelled we no longer need the editor //so we mark it for cleanup here. Note though that you have to handle //this situation in the focus listener which gets fired at the end //of the editing. editorNode = null; super.cancelEdit(); builder.cancelEdit(); builder.setValue(getValue()); setContentDisplay(ContentDisplay.TEXT_ONLY); }
@Override public void updateItem(T item, boolean empty) { super.updateItem(item, empty); if (empty) { setText(null); setGraphic(null); } else { if (isEditing() && checkGroupedColumn()) { if (editorNode != null) { builder.setValue(getValue()); } setGraphic(editorNode); setContentDisplay(ContentDisplay.GRAPHIC_ONLY); builder.updateItem(item, empty); } else { Object value = getValue(); if (value instanceof Node) { setGraphic((Node) value); setContentDisplay(ContentDisplay.GRAPHIC_ONLY); } else { setText(value.toString()); setContentDisplay(ContentDisplay.TEXT_ONLY); } } } }
@Override public void startEdit() { if (isEditable() && checkGroupedColumn()) { super.startEdit(); if (editorNode == null) { createEditorNode(); } else { // set current value if the editor is already created builder.setValue(getValue()); } builder.startEdit(); setGraphic(editorNode); setContentDisplay(ContentDisplay.GRAPHIC_ONLY); } }
@Override public void cancelEdit() { //Once the edit has been cancelled we no longer need the editor //so we mark it for cleanup here. Note though that you have to handle //this situation in the focus listener which gets fired at the end //of the editing. editorNode = null; super.cancelEdit(); builder.cancelEdit(); builder.setValue(getValue()); setContentDisplay(ContentDisplay.TEXT_ONLY); }
@Override public void updateItem(T item, boolean empty) { super.updateItem(item, empty); if (empty) { setText(null); setGraphic(null); } else { if (isEditing() && checkGroupedColumn()) { if (editorNode != null) { builder.setValue(getValue()); } setGraphic(editorNode); setContentDisplay(ContentDisplay.GRAPHIC_ONLY); builder.updateItem(item, empty); } else { Object value = getValue(); if (value instanceof Node) { setGraphic((Node) value); setContentDisplay(ContentDisplay.GRAPHIC_ONLY); } else { setText(value.toString()); setContentDisplay(ContentDisplay.TEXT_ONLY); } } } }
@Override public void startEdit() { if (isEditable() && checkGroupedColumn()) { super.startEdit(); if (editorNode == null) { createEditorNode(); } else { // set current value if the editor is already created builder.setValue(getValue()); } builder.startEdit(); setGraphic(editorNode); setContentDisplay(ContentDisplay.GRAPHIC_ONLY); } }