public void formEntrySaved(FormDef form, FormInstance instanceData, boolean formWasCompleted) {
		System.out.println("form is complete: " + formWasCompleted);
 
		//Warning, this might be null
		final SubmissionProfile profile = form.getSubmissionProfile();
		
		if (formWasCompleted) {
			
			// We want to cache this send before we actually ask, otherwise the user could quit before it is
			// either sent _or_ saved.
			
			IStorageUtility storage = StorageManager.getStorage(FormInstance.STORAGE_KEY);
			try {
				Logger.log("formentry","writing data: " + instanceData.getName());
				storage.write(instanceData);
				final int record = instanceData.getID();

				TransportMessage message = JRDemoContext._().buildMessage(instanceData, profile);
				
				CompletedFormOptionsState completed = new CompletedFormOptionsState(message) {
	
					public void sendData(TransportMessage message) {
						
						JRDemoFormTransportState send = new JRDemoFormTransportState(message, record) {
							public void done() {
								JRDemoUtil.goToList(cameFromFormList);
							}
		
							public void sendToBackground() {
								JRDemoUtil.goToList(cameFromFormList);
							}
						};
							
						send.start();
					}
	
					public void skipSend(TransportMessage message) {
						// Message should already be cached.
						abort();
					}
				};
				completed.start();
			} catch (StorageFullException e) {
				new RuntimeException("Storage full, unable to save data.");
			}
		} else {
			abort();
		}
	}
Beispiel #2
0
 /**
  * Constructor for this PropertyManager
  */
 public PropertyManager() {
     this.properties = (IStorageUtilityIndexed)StorageManager.getStorage(STORAGE_KEY);
     rulesList = new Vector();
 }
Beispiel #3
0
 public static void initDefaultPropertyManager() {
     StorageManager.registerStorage(PropertyManager.STORAGE_KEY, Property.class);
     setPropertyManager(new PropertyManager());
 }