use of org.activityinfo.ui.client.store.FormStoreImpl in project activityinfo by bedatadriven.
the class AppEntryPoint method onModuleLoad.
@Override
public void onModuleLoad() {
LOGGER.info("user.agent = " + System.getProperty("user.agent"));
LOGGER.info("gxt.user.agent = " + System.getProperty("gxt.user.agent"));
LOGGER.info("gxt.device = " + System.getProperty("gxt.device"));
Icons.INSTANCE.ensureInjected();
AppCache appCache = new AppCache();
AppCacheMonitor3 monitor = new AppCacheMonitor3(appCache);
monitor.start();
EventBus eventBus = new SimpleEventBus();
PlaceController placeController = new PlaceController(eventBus);
ConnectionListener connectionListener = new ConnectionListener();
connectionListener.start();
ActivityInfoClientAsync client = new ActivityInfoClientAsyncImpl(findServerUrl());
HttpStore httpStore = new HttpStore(connectionListener.getOnline(), client, Scheduler.get());
OfflineStore offlineStore = new OfflineStore(httpStore, IDBFactoryImpl.create());
FormStore formStore = new FormStoreImpl(httpStore, offlineStore, Scheduler.get());
LocalStorage storage = LocalStorage.create();
Viewport viewport = new Viewport();
AppFrame appFrame = new AppFrame(appCache, httpStore, offlineStore);
ActivityMapper activityMapper = new AppActivityMapper(formStore, storage);
ActivityManager activityManager = new ActivityManager(activityMapper, eventBus);
activityManager.setDisplay(appFrame.getDisplayWidget());
AppPlaceHistoryMapper historyMapper = new AppPlaceHistoryMapper();
PlaceHistoryHandler historyHandler = new PlaceHistoryHandler(historyMapper);
historyHandler.register(placeController, eventBus, DEFAULT_PLACE);
// Start synchronizer...
RecordSynchronizer synchronizer = new RecordSynchronizer(httpStore, offlineStore);
viewport.add(appFrame);
RootLayoutPanel.get().add(viewport);
historyHandler.handleCurrentHistory();
}
use of org.activityinfo.ui.client.store.FormStoreImpl in project activityinfo by bedatadriven.
the class OfflineStoreGwtTest method testStoreForm.
public void testStoreForm() {
survey = new Survey();
FormMetadata surveyMetadata = FormMetadata.of(1L, survey.getFormClass(), FormPermissions.readWrite());
// First put the schema to the store
Snapshot snapshot = new Snapshot(Collections.singletonList(surveyMetadata), Collections.singletonList(toFormRecordSet(survey)));
offlineStore = new OfflineStore(httpStore, IDBFactoryImpl.create());
httpStore = new HttpStore(new OfflineClientStub());
formStore = new FormStoreImpl(httpStore, offlineStore, Scheduler.get());
offlineStore.store(snapshot).then(new AsyncCallback<Void>() {
@Override
public void onFailure(Throwable caught) {
fail();
}
@Override
public void onSuccess(Void result) {
// Once the store is complete,
// verify that the Form Schema can be read...
verifyWeCanReadFormSchemas().join(OfflineStoreGwtTest.this::verifyWeCanQueryRecords).join(OfflineStoreGwtTest.this::verifyWeCanMakeChangesOffline).join(OfflineStoreGwtTest.this::verifyWeCanLoadCurrentSnapshot).join(OfflineStoreGwtTest.this::verifyWeCanQuery).then(new AsyncCallback<Void>() {
@Override
public void onFailure(Throwable caught) {
LOGGER.log(Level.SEVERE, "Operation failed", caught);
fail();
}
@Override
public void onSuccess(Void result) {
finishTest();
}
});
}
});
delayTestFinish(5000);
}
Aggregations