use of org.knime.core.node.util.dialog.field.FieldList.OutColumnList in project knime-core by knime.
the class OutFieldsTable method getOutColFields.
/**
* Get the field definitions representing output columns.
*
* @return fields representing output columns.
*/
public OutColumnList getOutColFields() {
OutColumnList outCols = new OutColumnList();
for (int r = 0; r < m_model.getRowCount(); r++) {
if (!m_model.validateValues(r)) {
// there are errors in this row
continue;
}
Object fieldTypeValue = getFieldType(r);
if (null == fieldTypeValue) {
continue;
}
boolean isColumn = fieldTypeValue.equals(FieldType.Column);
if (isColumn) {
OutColumnField outCol = new OutColumnField();
outCol.setReplaceExisting((Boolean) m_model.getValueAt(r, Column.REPLACE_EXISTING));
Object colColValue = m_model.getValueAt(r, Column.COLUMN);
if (colColValue instanceof DataColumnSpec) {
DataColumnSpec colSpec = (DataColumnSpec) colColValue;
outCol.setKnimeName(colSpec.getName());
} else if (colColValue instanceof String) {
outCol.setKnimeName(colColValue.toString());
} else {
continue;
}
Object dataTypeValue = m_model.getValueAt(r, Column.DATA_TYPE);
boolean isArray = (Boolean) m_model.getValueAt(r, Column.IS_COLLECTION);
if (dataTypeValue instanceof DataType) {
DataType type = (DataType) dataTypeValue;
if (isArray) {
type = ListCell.getCollectionType(type);
}
outCol.setKnimeType(type);
} else {
continue;
}
outCols.add(outCol);
}
}
return outCols;
}
Aggregations