use of org.activityinfo.ui.client.component.importDialog.model.source.SourceColumn in project activityinfo by bedatadriven.
the class ImportSimpleTest method assertMapping.
private void assertMapping(String sourceColumnLabel, String targetColumnLabel) {
final SourceColumn sourceColumn = importModel.getSourceColumn(columnIndex(sourceColumnLabel));
assertNotNull(sourceColumn);
final MapExistingAction columnAction = (MapExistingAction) importModel.getColumnAction(sourceColumn);
assertTrue(columnAction.getTarget().getLabel().equals(targetColumnLabel));
}
use of org.activityinfo.ui.client.component.importDialog.model.source.SourceColumn in project activityinfo by bedatadriven.
the class PastedTableTest method nfiParsingPerformance.
@Test
public void nfiParsingPerformance() throws IOException {
long start = System.currentTimeMillis();
PastedTable pastedTable = new PastedTable(Resources.toString(getResource(getClass(), "nfi-import-test.csv"), Charsets.UTF_8));
pastedTable.parseAllRows();
final List<SourceColumn> columns = pastedTable.getColumns();
final List<? extends SourceRow> rows = pastedTable.getRows();
long end = System.currentTimeMillis();
System.out.println("Done in " + (end - start) + "ms , rows count=" + rows.size() + ", columns count=" + columns.size());
}
use of org.activityinfo.ui.client.component.importDialog.model.source.SourceColumn in project activityinfo by bedatadriven.
the class RowParserTest method qisCsvColumns.
@Test
public void qisCsvColumns() throws IOException {
PastedTable source = new PastedTable(Resources.toString(getResource(getClass(), "qis.csv"), Charsets.UTF_8));
final List<SourceColumn> columns = source.getColumns();
System.out.println(Joiner.on('\n').join(columns));
assertThat(columns.size(), equalTo(47));
}
use of org.activityinfo.ui.client.component.importDialog.model.source.SourceColumn in project activityinfo by bedatadriven.
the class ColumnMappingGrid method refresh.
public void refresh() {
while (this.getColumnCount() > 0) {
this.removeColumn(0);
}
sourceColumns = model.getSource().getColumns();
for (SourceColumn sourceColumn : sourceColumns) {
GridColumn gridColumn = new GridColumn(sourceColumn);
GridHeader gridHeader = new GridHeader(sourceColumn, headerCell, columnSelectionModel);
addColumn(gridColumn, gridHeader);
setColumnWidth(gridColumn, columnWidthInEm(sourceColumn.getHeader()), com.google.gwt.dom.client.Style.Unit.EM);
}
this.redrawHeaders();
// show already parsed data (it can be only part of it, not all)
this.setRowData(model.getSource().getRows());
// update table if not all rows are parsed
if (!model.getSource().parsedAllRows()) {
// give some time to switch the page
Scheduler.get().scheduleFixedDelay(new Scheduler.RepeatingCommand() {
@Override
public boolean execute() {
refreshWithNewlyParsedRows();
return false;
}
}, // wait 2 seconds
2000);
}
}
use of org.activityinfo.ui.client.component.importDialog.model.source.SourceColumn in project activityinfo by bedatadriven.
the class ColumnMappingPage method updateColumnMapping.
private void updateColumnMapping(ColumnAction action) {
final SourceColumn removedColumn = importModel.setColumnBinding(action, getSelectedColumn());
dataGrid.refreshColumnStyles(getSelectedColumn().getIndex());
if (removedColumn != null) {
dataGrid.refreshColumnStyles(removedColumn.getIndex());
}
fireStateChanged();
}
Aggregations