use of org.activityinfo.model.type.time.PeriodType in project activityinfo by bedatadriven.
the class SubFormViewModelBuilder method find.
private FormInputViewModel find(RecordRef activeRecord, List<FormInputViewModel> subRecordViews) {
for (FormInputViewModel subRecordView : subRecordViews) {
if (subRecordView.getRecordRef().equals(activeRecord)) {
return subRecordView;
}
}
if (keyField.isPresent()) {
PeriodType periodType = (PeriodType) keyField.get().getType();
PeriodValue periodValue = periodType.fromSubFormKey(activeRecord);
return formBuilder.placeholder(activeRecord, keyField.get(), periodValue);
} else {
return formBuilder.placeholder(activeRecord);
}
}
use of org.activityinfo.model.type.time.PeriodType in project activityinfo by bedatadriven.
the class SubFormPatch method fromRecordId.
public static CursorObserver<ResourceId> fromRecordId(FormClass formClass, final CursorObserver<FieldValue> observer) {
final ResourceId formId = formClass.getId();
final PeriodType periodType = formClass.getSubFormKind().getPeriodType();
return new CursorObserver<ResourceId>() {
@Override
public void onNext(ResourceId value) {
observer.onNext(periodType.fromSubFormKey(new RecordRef(formId, value)));
}
@Override
public void done() {
observer.done();
}
};
}
use of org.activityinfo.model.type.time.PeriodType in project activityinfo by bedatadriven.
the class SubFormViewModel method getActivePeriod.
public PeriodValue getActivePeriod() {
RecordRef ref = getActiveRecordRef();
PeriodType periodType = subFormKind.getPeriodType();
return periodType.fromSubFormKey(ref);
}
Aggregations