Search in sources :

Example 6 with ImportTarget

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

the class ColumnActionSelector method updateStyles.

public void updateStyles() {
    for (Map.Entry<ColumnAction, RadioButton> entry : buttons.entrySet()) {
        final ColumnAction columnAction = entry.getKey();
        if (columnAction instanceof MapExistingAction) {
            final ImportTarget target = ((MapExistingAction) columnAction).getTarget();
            final RadioButton button = entry.getValue();
            button.removeStyleName(ColumnMappingStyles.INSTANCE.stateBound());
            button.removeStyleName(ColumnMappingStyles.INSTANCE.stateUnset());
            if (!importModel.getMappedColumns(target.getFormField().getId()).isEmpty()) {
                button.addStyleName(ColumnMappingStyles.INSTANCE.stateBound());
            } else if (target.getFormField().isRequired()) {
                button.addStyleName(ColumnMappingStyles.INSTANCE.stateUnset());
            }
        }
    }
}
Also used : ColumnAction(org.activityinfo.ui.client.component.importDialog.model.ColumnAction) ImportTarget(org.activityinfo.ui.client.component.importDialog.model.strategy.ImportTarget) MapExistingAction(org.activityinfo.ui.client.component.importDialog.model.MapExistingAction) RadioButton(org.activityinfo.ui.client.widget.RadioButton) Map(java.util.Map)

Example 7 with ImportTarget

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

the class ImportPresenter method createMatchingColumnActions.

private List<MapExistingAction> createMatchingColumnActions() {
    final List<MapExistingAction> columnActions = Lists.newArrayList();
    final List<ImportTarget> importTargets = importer.getImportTargets();
    for (ImportTarget target : importTargets) {
        columnActions.add(new MapExistingAction(target));
    }
    return columnActions;
}
Also used : ImportTarget(org.activityinfo.ui.client.component.importDialog.model.strategy.ImportTarget) MapExistingAction(org.activityinfo.ui.client.component.importDialog.model.MapExistingAction)

Aggregations

ImportTarget (org.activityinfo.ui.client.component.importDialog.model.strategy.ImportTarget)7 MapExistingAction (org.activityinfo.ui.client.component.importDialog.model.MapExistingAction)4 Map (java.util.Map)3 ColumnAction (org.activityinfo.ui.client.component.importDialog.model.ColumnAction)2 RadioButton (org.activityinfo.ui.client.widget.RadioButton)2 TreeMap (java.util.TreeMap)1 FormField (org.activityinfo.model.form.FormField)1 FormTree (org.activityinfo.model.formTree.FormTree)1 ColumnSet (org.activityinfo.model.query.ColumnSet)1 QueryModel (org.activityinfo.model.query.QueryModel)1 FieldTypeClass (org.activityinfo.model.type.FieldTypeClass)1 EnumType (org.activityinfo.model.type.enumerated.EnumType)1 ImportModel (org.activityinfo.ui.client.component.importDialog.model.ImportModel)1 PastedTable (org.activityinfo.ui.client.component.importDialog.model.source.PastedTable)1 SourceColumn (org.activityinfo.ui.client.component.importDialog.model.source.SourceColumn)1 ColumnAccessor (org.activityinfo.ui.client.component.importDialog.model.strategy.ColumnAccessor)1 TargetSiteId (org.activityinfo.ui.client.component.importDialog.model.strategy.TargetSiteId)1 ValidatedRowTable (org.activityinfo.ui.client.component.importDialog.model.validation.ValidatedRowTable)1 Test (org.junit.Test)1