use of org.kie.workbench.common.widgets.decoratedgrid.client.widget.DynamicColumn in project drools-wb by kiegroup.
the class AbstractDecoratedTemplateDataGridWidget method onSetModel.
public void onSetModel(SetModelEvent<TemplateModel> event) {
DynamicData data = new DynamicData();
TemplateModel model = event.getModel();
List<DynamicColumn<TemplateDataColumn>> columns = new ArrayList<DynamicColumn<TemplateDataColumn>>();
setupInternalModel(model, columns, data);
// Raise event setting data and columns for UI components
SetInternalTemplateDataModelEvent sime = new SetInternalTemplateDataModelEvent(model, data, columns);
eventBus.fireEvent(sime);
}
use of org.kie.workbench.common.widgets.decoratedgrid.client.widget.DynamicColumn in project drools-wb by kiegroup.
the class AbstractDecoratedTemplateDataGridWidget method setupInternalModel.
private void setupInternalModel(TemplateModel model, List<DynamicColumn<TemplateDataColumn>> columns, DynamicData data) {
// Get interpolation variables
InterpolationVariable[] vars = model.getInterpolationVariablesList();
if (vars.length == 0) {
return;
}
int colIndex = 0;
String[][] modelData = model.getTableAsArray();
// to be enough rows to receive the columns data
for (int iRow = 0; iRow < modelData.length; iRow++) {
data.addRow();
}
// Add corresponding columns to table
for (InterpolationVariable var : vars) {
TemplateDataColumn col = new TemplateDataColumn(var.getVarName(), var.getDataType(), var.getFactType(), var.getFactField());
DynamicColumn<TemplateDataColumn> column = new DynamicColumn<TemplateDataColumn>(col, cellFactory.getCell(col), colIndex, eventBus);
columns.add(column);
data.addColumn(colIndex, makeColumnData(modelData, col, colIndex++), true);
}
}
Aggregations