use of org.talend.designer.core.generic.ui.JsonTableVO in project tdi-studio-se by Talend.
the class JsonTableController method generateTableEditorView.
private JsonTableView generateTableEditorView(Composite parent, IElementParameter param) {
JsonTableVO vo = null;
Object value = param.getValue();
if (value != null) {
String valueStr = TalendQuoteUtils.removeQuotesIfExist(String.valueOf(value));
if (StringUtils.isNotBlank(valueStr)) {
vo = JsonTableHandler.getInstance().parse(valueStr);
}
}
if (vo != null) {
rows = vo.getData();
if (rows != null) {
rowsNum = rows.size();
}
titles = vo.getTitles();
}
JsonFieldModel tableEditorModel = new JsonFieldModel(rows);
JsonTableView tableEditorView = new JsonTableView(parent, tableEditorModel, readonly, !hideToolbar) {
@Override
protected List<String> getColumnTitles() {
return titles;
}
};
tableEditorView.getExtendedTableViewer().setCommandStack(getCommandStack());
tableEditorView.setReadOnly(param.isReadOnly() || param.isRepositoryValueUsed());
tableEditorModel.setModifiedBeanListenable(tableEditorView.getTableViewerCreator());
final Table table = tableEditorView.getTable();
table.setToolTipText(VARIABLE_TOOLTIP + param.getVariableName());
// add listener to tableMetadata (listen the event of the toolbars)
tableEditorView.getExtendedTableModel().addAfterOperationListListener(new IListenableListListener() {
@Override
public void handleEvent(ListenableListEvent event) {
if (elem instanceof Node) {
Node node = (Node) elem;
node.checkAndRefreshNode();
}
}
});
return tableEditorView;
}
Aggregations