use of org.opendatakit.briefcase.model.EndPointType in project briefcase by opendatakit.
the class PullTransferPanel method updateFormStatuses.
public void updateFormStatuses() {
List<FormStatus> statuses = new ArrayList<>();
// determine what our origin is...
String strSelection = (String) listOriginDataSource.getSelectedItem();
EndPointType selection = (strSelection != null) ? EndPointType.fromString(strSelection) : null;
if (selection != null) {
if (EndPointType.AGGREGATE_1_0_CHOICE.equals(selection)) {
// clear the list of forms first...
formTransferTable.setFormStatusList(statuses);
terminationFuture.reset();
TransferAction.retrieveAvailableFormsFromServer((Window) getTopLevelAncestor(), originServerInfo, terminationFuture);
// list will be communicated back via the
// RetrieveAvailableFormsSucceededEvent
} else if (EndPointType.CUSTOM_ODK_COLLECT_DIRECTORY.equals(selection)) {
File odk = new File(txtOriginName.getText());
List<OdkCollectFormDefinition> forms = FileSystemUtils.getODKFormList(odk);
for (OdkCollectFormDefinition f : forms) {
statuses.add(new FormStatus(FormStatus.TransferType.GATHER, f));
}
formTransferTable.setFormStatusList(statuses);
} else if (EndPointType.MOUNTED_ODK_COLLECT_DEVICE_CHOICE.equals(selection)) {
File sdcard = new File(txtOriginName.getText());
File odk = new File(sdcard, "odk");
List<OdkCollectFormDefinition> forms = FileSystemUtils.getODKFormList(odk);
for (OdkCollectFormDefinition f : forms) {
statuses.add(new FormStatus(FormStatus.TransferType.GATHER, f));
}
formTransferTable.setFormStatusList(statuses);
} else {
throw new IllegalStateException("unexpected case");
}
}
}
Aggregations