Search in sources :

Example 1 with FieldImporterColumn

use of org.activityinfo.ui.client.component.importDialog.model.strategy.FieldImporterColumn in project activityinfo by bedatadriven.

the class AbstractImporterTest method dumpHeaders.

protected void dumpHeaders(List<FieldImporterColumn> importColumns) {
    System.out.print("  ");
    for (FieldImporterColumn col : importColumns) {
        System.out.print("  " + cell(col.getAccessor().getHeading()));
    }
    System.out.println();
    System.out.println(Strings.repeat("-", COLUMN_WIDTH * importColumns.size()));
}
Also used : FieldImporterColumn(org.activityinfo.ui.client.component.importDialog.model.strategy.FieldImporterColumn)

Example 2 with FieldImporterColumn

use of org.activityinfo.ui.client.component.importDialog.model.strategy.FieldImporterColumn in project activityinfo by bedatadriven.

the class AbstractImporterTest method dumpRows.

protected void dumpRows(ValidatedRowTable table) {
    int numRows = table.getRows().size();
    int numColumns = table.getColumns().size();
    for (int i = 0; i != numRows; ++i) {
        SourceRow sourceRow = importModel.getSource().getRows().get(i);
        ValidatedRow resultRow = table.getRows().get(i);
        for (int j = 0; j != numColumns; ++j) {
            FieldImporterColumn column = table.getColumns().get(j);
            String importedValue = Strings.nullToEmpty(column.getAccessor().getValue(sourceRow));
            ValidationResult result = resultRow.getResult(j);
            String cell = "";
            if (result.wasConverted()) {
                cell = importedValue + " [" + result.getTargetValue() + "]";
            } else {
                cell = importedValue;
            }
            System.out.print(" " + icon(result) + Strings.padEnd(cell, COLUMN_WIDTH - 2, ' '));
        }
        System.out.println();
    }
}
Also used : FieldImporterColumn(org.activityinfo.ui.client.component.importDialog.model.strategy.FieldImporterColumn) ValidatedRow(org.activityinfo.ui.client.component.importDialog.model.validation.ValidatedRow) SourceRow(org.activityinfo.ui.client.component.importDialog.model.source.SourceRow) ValidationResult(org.activityinfo.ui.client.component.importDialog.model.validation.ValidationResult)

Example 3 with FieldImporterColumn

use of org.activityinfo.ui.client.component.importDialog.model.strategy.FieldImporterColumn in project activityinfo by bedatadriven.

the class ValidationGrid method refresh.

public void refresh(ValidatedRowTable table) {
    while (dataGrid.getColumnCount() > 0) {
        dataGrid.removeColumn(0);
    }
    for (int i = 0; i < table.getColumns().size(); i++) {
        final FieldImporterColumn column = table.getColumns().get(i);
        String columnHeader = column.getAccessor().getHeading();
        dataGrid.addColumn(new ValidationRowGridColumn(column.getAccessor(), i), new TextHeader(columnHeader));
        dataGrid.setColumnWidth(i, GwtUtil.columnWidthInEm(columnHeader), Style.Unit.EM);
    }
    dataGrid.setRowData(table.getRows());
}
Also used : FieldImporterColumn(org.activityinfo.ui.client.component.importDialog.model.strategy.FieldImporterColumn) TextHeader(com.google.gwt.user.cellview.client.TextHeader)

Aggregations

FieldImporterColumn (org.activityinfo.ui.client.component.importDialog.model.strategy.FieldImporterColumn)3 TextHeader (com.google.gwt.user.cellview.client.TextHeader)1 SourceRow (org.activityinfo.ui.client.component.importDialog.model.source.SourceRow)1 ValidatedRow (org.activityinfo.ui.client.component.importDialog.model.validation.ValidatedRow)1 ValidationResult (org.activityinfo.ui.client.component.importDialog.model.validation.ValidationResult)1