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() . 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
Source File: RetryLocalStorageServiceProxy.java    From shortyz with GNU General Public License v3.0 6 votes vote down vote up
@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 2
Source File: CourseCurriculaTable.java    From unitime with 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 3
Source File: TestDMRHandler.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@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 4
Source File: LocalStorageServiceProxy.java    From shortyz with GNU General Public License v3.0 5 votes vote down vote up
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
Source File: RequiredResourcesProcessor.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
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 6
Source File: ChartJsDisplayerView.java    From dashbuilder with Apache License 2.0 5 votes vote down vote up
protected AreaChartDataProvider createAreaDataProvider() {
    return new AreaChartDataProvider() {
        public JavaScriptObject getData() {
            return createChartData();
        }
        public void reload(AsyncCallback<AreaChartData> callback) {
            AreaChartData data = createChartData();
            callback.onSuccess(data);
        }
    };
}
 
Example 7
Source File: GwtRpcProxy.java    From unitime with 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 8
Source File: AcademicSessionSelectionBox.java    From unitime with Apache License 2.0 5 votes vote down vote up
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 9
Source File: SampleRepository.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@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 10
Source File: FilterBox.java    From unitime with 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 11
Source File: RoomFeaturesPage.java    From unitime with Apache License 2.0 4 votes vote down vote up
@Override
public void selectSession(Long sessionId, AsyncCallback<Boolean> callback) {
	callback.onSuccess(false);
}
 
Example 12
Source File: MsgConnectionsPresenter.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public void loadSocketBindings(AsyncCallback<List<String>> callback) {
    // TODO
    callback.onSuccess(Collections.emptyList());
}
 
Example 13
Source File: RequiredResourcesProcessor.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
private void finishWithContext(String token, SecurityContext securityContext, AsyncCallback<Void> callback) {
    nameTokenRegistry.revealed(token);
    securityFramework.assignContext(token, securityContext);
    callback.onSuccess(null);
}
 
Example 14
Source File: MsgConnectionsPresenter.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public void loadSocketBindings(AsyncCallback<List<String>> callback) {

        // TODO
        callback.onSuccess(Collections.EMPTY_LIST);
    }
 
Example 15
Source File: FilterBox.java    From unitime with 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 16
Source File: FilterBox.java    From unitime with 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 File: TravelTimes.java    From unitime with Apache License 2.0 4 votes vote down vote up
@Override
public void selectSession(Long sessionId, AsyncCallback<Boolean> callback) {
	callback.onSuccess(false);
}
 
Example 18
Source File: StudentSchedule.java    From unitime with 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 19
Source File: MsgClusteringPresenter.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public void loadExistingSocketBindings(AsyncCallback<List<String>> callback) {

        // TODO
        callback.onSuccess(Collections.EMPTY_LIST);
    }
 
Example 20
Source File: DragAndDropUploader.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Upload folder callback.
 */
private void callUploadedFolder(AsyncCallback<UploaderEvent> callback, String path, String error) {
	UploaderEvent event = new UploaderEvent(path, 100, error);
	callback.onSuccess(event);
}