use of org.talend.designer.scd.util.IPropertySetter in project tdi-studio-se by Talend.
the class MultipleSurrogateSection method creationComplement.
/**
* DOC hcw Comment method "onCreationChange".
*
* @param value
* @param key
* @param item
*/
protected void creationComplement(Integer value, final SurrogateKey key, final TableItem item) {
// dispose editor
TableEditor editor = editorManager.getEditor(item, COMPLEMENT_INDEX);
editorManager.disposeEditor(editor);
if (value == SurrogateCreationType.ROUTINE.getIndex()) {
// create routine editor
editor = editorManager.createTextEditor(editor, table, key.getComplement(), item, COMPLEMENT_INDEX, new IPropertySetter<String>() {
public void set(String value) {
key.setComplement(value);
}
});
// add content proposal
TalendProposalUtils.installOn(editor.getEditor(), null);
} else if (value == SurrogateCreationType.DB_SEQUENCE.getIndex()) {
editor = editorManager.createTextEditor(editor, table, key.getComplement(), item, COMPLEMENT_INDEX, new IPropertySetter<String>() {
public void set(String value) {
key.setComplement(value);
}
});
// add content proposal
TalendProposalUtils.installOn(editor.getEditor(), null);
} else if (value == SurrogateCreationType.INPUT_FIELD.getIndex()) {
// combo editor
// final List<String> inputColumns = scdManager.getInputColumnNames();
// inputColumns.add(0, "");
// int index = editorManager.getComboIndex(inputColumns, key.getComplement());
// editor = editorManager.createComboEditor(table, inputColumns.toArray(new String[inputColumns.size()]),
// item,
// COMPLEMENT_INDEX, index, new IPropertySetter<Integer>() {
//
// public void set(Integer value) {
// key.setComplement(inputColumns.get(value));
// Color color = value == 0 ? ERROR_COLOR : null;
// editorManager.setComboColor(item, COMPLEMENT_INDEX, color);
// scdManager.fireFieldChange();
// }
// });
//
// if (StringUtils.isEmpty(key.getComplement())) {
// // display as error status, this field must not be null
// editorManager.setComboColor(item, COMPLEMENT_INDEX, ERROR_COLOR);
// }
// label editor
editor = editorManager.createLabelEditor(editor, table, key.getComplement(), item, COMPLEMENT_INDEX);
final Label text = (Label) editor.getEditor();
if (StringUtils.isEmpty(key.getComplement())) {
// display as error status, this field must not be null
text.setBackground(ERROR_COLOR);
}
// add drag and drop support
// IDragDropDelegate delegate = createDragDropDelegate(key, text);
// dragDropManager.addDragSupport(text, delegate);
// dragDropManager.addDropSupport(text, delegate);
}
}
Aggregations