Java Code Examples for com.google.gwt.user.client.rpc.AsyncCallback#onSuccess()

The following examples show how to use com.google.gwt.user.client.rpc.AsyncCallback#onSuccess() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@Override
public DispatchRequest execute(DMRAction action, AsyncCallback<DMRResponse> callback) {


    try {
        DispatchResult result = new SimpleDispatcher(DOMAIN_API_URL).execute(action.getOperation());
        callback.onSuccess(new DMRResponse(result.getResponseText(), APPLICATION_DMR_ENCODED) );

    } catch (Exception e) {
        callback.onFailure(e);
    }

    return new DispatchRequest()
    {
        @Override
        public void cancel() {

        }

        @Override
        public boolean isPending() {
            return false;
        }
    };
}
 
Example 2
@Override
public Request listPuzzles(final AsyncCallback<PuzzleDescriptor[]> callback) {
    return super.listPuzzles( new AsyncCallback<PuzzleDescriptor[]>(){

        @Override
        public void onFailure(Throwable caught) {
            if(caught instanceof InvocationException){
                RetryLocalStorageServiceProxy.super.listPuzzles(callback);
            } else {
                callback.onFailure(caught);
            }
        }

        @Override
        public void onSuccess(PuzzleDescriptor[] result) {
            callback.onSuccess(result);
        }

    });
}
 
Example 3
Source Project: unitime   File: CourseCurriculaTable.java    License: Apache License 2.0 6 votes vote down vote up
protected void ensureInitialized(final AsyncCallback<Boolean> callback) {
	if (iClassifications != null)
		callback.onSuccess(true);
	iCurriculaService.loadAcademicClassifications(new AsyncCallback<TreeSet<AcademicClassificationInterface>>() {
		@Override
		public void onSuccess(TreeSet<AcademicClassificationInterface> result) {
			iClassifications = result;
			if (callback != null) callback.onSuccess(true);
		}
		
		@Override
		public void onFailure(Throwable caught) {
			iHeader.setErrorMessage(MESSAGES.failedToLoadClassifications(caught.getMessage()));
			UniTimeNotifications.error(MESSAGES.failedToLoadClassifications(caught.getMessage()), caught);
			if (callback != null) callback.onFailure(caught);
		}
	});
}
 
Example 4
private void saveInternal(Long listingId, Puzzle puzzle, final AsyncCallback callback){
    try{
        WindowContext.INSTANCE.put(listingId.toString(), CODEC.serialize(puzzle));
        WindowContext.INSTANCE.flush();
    } catch(final Exception e){
        callback.onFailure(e);
    }
   
    callback.onSuccess(null);
}
 
Example 5
protected AreaChartDataProvider createAreaDataProvider() {
    return new AreaChartDataProvider() {
        public JavaScriptObject getData() {
            return createChartData();
        }
        public void reload(AsyncCallback<AreaChartData> callback) {
            AreaChartData data = createChartData();
            callback.onSuccess(data);
        }
    };
}
 
Example 6
Source Project: unitime   File: GwtRpcProxy.java    License: Apache License 2.0 5 votes vote down vote up
@Override
   protected <T> Request doInvoke(ResponseReader responseReader, final String methodName, RpcStatsContext statsContext, String requestData, final AsyncCallback<T> callback) {
	return super.doInvoke(responseReader, methodName, statsContext, requestData, new AsyncCallback<T>() {
		@Override
		public void onFailure(Throwable caught) {
			UniTimeNotifications.error("Request " + methodName.replace("_Proxy", "") + " failed: " + caught.getMessage(), caught);
			callback.onFailure(caught);
		}
		@Override
		public void onSuccess(T result) {
			callback.onSuccess(result);
		}
	});
}
 
Example 7
public void selectSession(String sessionAbbreviation, AsyncCallback<Boolean> callback) {
	if (sessionAbbreviation != null && sessionAbbreviation.equals(getAcademicSessionAbbreviation())) {
		if (callback != null) callback.onSuccess(true);
		return;
	}
	if (sessionAbbreviation == null && getAcademicSessionAbbreviation() == null) {
		if (callback != null) callback.onSuccess(true);
		return;
	}
	if (sessionAbbreviation == null) {
		setValue(null);
		if (callback != null) callback.onSuccess(true);
	} else {
		boolean found = false;
		if (getValues() != null) {
			for (AcademicSession session: getValues()) {
				if (sessionAbbreviation.equals(session.getAbbv())) {
					setValue(new Interval(session));
					if (callback != null) callback.onSuccess(true);
					found = true;
					break;
				}
			}
		}
		if (!found) {
			setValue(null);
			if (callback != null) callback.onSuccess(false);
		}
	}
	fireAcademicSessionChanged();
}
 
Example 8
@Override
public void getDialog(String name, AsyncCallback<Dialog> callback) {
    Dialog dialog = null;

    for(Sample sample : samples)
    {
        if(sample.getName().equals(name))
        {
            dialog = sample.getDialog();
            break;
        }
    }
    callback.onSuccess(dialog);
}
 
Example 9
Source Project: unitime   File: FilterBox.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void validate(String text, AsyncCallback<Chip> callback) {
	if (iValidate) {
		for (Chip chip: iValues)
			if (chip.getValue().equals(text)) {
				callback.onSuccess(chip);
				return;
			}
		callback.onFailure(new Exception("Unknown value " + text + "."));
	} else {
		callback.onSuccess(new Chip(getCommand(), text).withTranslatedCommand(getLabel()));
	}
}
 
Example 10
private void finishWithContext(String token, RequiredResourcesContext context, AsyncCallback<Void> callback) {
    nameTokenRegistry.revealed(token);
    SecurityContextImpl securityContext = new SecurityContextImpl(token, context.getDescriptions().keySet());
    context.mergeWith(securityContext);
    securityFramework.assignContext(token, securityContext);
    callback.onSuccess(null);
}
 
Example 11
/**
 * Upload folder callback.
 */
private void callUploadedFolder(AsyncCallback<UploaderEvent> callback, String path, String error) {
	UploaderEvent event = new UploaderEvent(path, 100, error);
	callback.onSuccess(event);
}
 
Example 12
public void loadExistingSocketBindings(AsyncCallback<List<String>> callback) {

        // TODO
        callback.onSuccess(Collections.EMPTY_LIST);
    }
 
Example 13
Source Project: unitime   File: StudentSchedule.java    License: Apache License 2.0 4 votes vote down vote up
protected void setCritical(Long studentId, Request request, Integer critical, AsyncCallback<Integer> callback) {
	callback.onSuccess(request.getCritical());
}
 
Example 14
Source Project: unitime   File: TravelTimes.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void selectSession(Long sessionId, AsyncCallback<Boolean> callback) {
	callback.onSuccess(false);
}
 
Example 15
Source Project: unitime   File: RoomFeaturesPage.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void selectSession(Long sessionId, AsyncCallback<Boolean> callback) {
	callback.onSuccess(false);
}
 
Example 16
Source Project: unitime   File: FilterBox.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void getValues(List<Chip> chips, String text, AsyncCallback<Collection<Chip>> callback) {
	callback.onSuccess(iValues);
}
 
Example 17
Source Project: unitime   File: FilterBox.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void validate(String value, AsyncCallback<Chip> callback) {
	callback.onSuccess(new Chip(getCommand(), value).withTranslatedCommand(getLabel()));
}
 
Example 18
public void loadSocketBindings(AsyncCallback<List<String>> callback) {

        // TODO
        callback.onSuccess(Collections.EMPTY_LIST);
    }
 
Example 19
private void finishWithContext(String token, SecurityContext securityContext, AsyncCallback<Void> callback) {
    nameTokenRegistry.revealed(token);
    securityFramework.assignContext(token, securityContext);
    callback.onSuccess(null);
}
 
Example 20
public void loadSocketBindings(AsyncCallback<List<String>> callback) {
    // TODO
    callback.onSuccess(Collections.emptyList());
}