Java Code Examples for com.google.gwt.user.client.rpc.AsyncCallback

The following are top voted examples for showing how to use com.google.gwt.user.client.rpc.AsyncCallback. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: EasyML   File: HistoryPopupPanel.java   Source Code and License 6 votes vote down vote up
/**
 * Jump to a oozie instance( which need to synchronize current oozie job actions before jumping)
 * 
 * @param oozJobId   oozie job id
 * @param message page url
 */
public void goToOozInstance(final String oozJobId,final String message)
{
	jobSrv.updateJobActionStatus(oozJobId, new AsyncCallback<Void>(){

		@Override
		public void onFailure(Throwable caught) {
			// TODO Auto-generated method stub
			logger.warning("Synchronize current oozie instance actions status failed! Oozie job id ="+oozJobId);
		}

		@Override
		public void onSuccess(Void result) {
			// TODO Auto-generated method stub
			eventBus.fireEvent(new ToMonitorEvent(message));
		}
	});
}
 
Example 2
Project: unitimes   File: FilterBox.java   Source Code and License 6 votes vote down vote up
public void returnSuggestions(final List<Chip> chips, final String text, final List<Suggestion> suggestions, final AsyncCallback<Collection<Suggestion>> callback) {
	if (iNext == null)
		callback.onSuccess(suggestions);
	else
		iNext.getSuggestions(chips, text, new AsyncCallback<Collection<Suggestion>>() {

			@Override
			public void onFailure(Throwable caught) {
				callback.onSuccess(suggestions);
			}

			@Override
			public void onSuccess(Collection<Suggestion> result) {
				if (result != null) suggestions.addAll(result);
				callback.onSuccess(suggestions);
			}
		});
}
 
Example 3
Project: unitimes   File: UniTimeMobileMenu.java   Source Code and License 6 votes vote down vote up
public void showMenu() {
	if (iLoaded) showMenuPopup();
	else {
		RPC.execute(new MenuInterface.MenuRpcRequest(), new AsyncCallback<GwtRpcResponseList<MenuInterface>>() {
			@Override
			public void onSuccess(GwtRpcResponseList<MenuInterface> result) {
				initMenu(result);
				showMenuPopup();
			}
			@Override
			public void onFailure(Throwable caught) {
				UniTimeNotifications.error(caught.getMessage(), caught);
			}
		});
	}
}
 
Example 4
Project: DocIT   File: CompanyPanel.java   Source Code and License 6 votes vote down vote up
public void setCompany(Integer company) {
	this.company = company;
	
	companyService.getCompany(company, new AsyncCallback<CompanyInfo>() {

		@Override
		public void onFailure(Throwable caught) {
			Window.alert(caught.getMessage());
		}

		@Override
		public void onSuccess(CompanyInfo result) {
			resetFaultMessages();
			name.setText(result.getName());
			total.setText(Double.toString(result.getTotal()));
		}
	});
}
 
Example 5
Project: unitimes   File: CourseCurriculaTable.java   Source Code and License 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 6
Project: unitimes   File: TeachingRequestsFilterBox.java   Source Code and License 6 votes vote down vote up
@Override
public void requestSuggestions(final Request request, final Callback callback) {
	if (!request.getQuery().isEmpty()) {
		iFilter.getWidget().getSuggestionsProvider().getSuggestions(iFilter.getWidget().getChips(null), request.getQuery(), new AsyncCallback<Collection<FilterBox.Suggestion>>() {

			@Override
			public void onFailure(Throwable caught) {
			}

			@Override
			public void onSuccess(Collection<FilterBox.Suggestion> result) {
				if (result == null) return;
				List<CourseSuggestion> suggestions = new ArrayList<CourseSuggestion>();
				for (FilterBox.Suggestion suggestion: result) {
					if (suggestion.getChipToAdd() != null && "course".equals(suggestion.getChipToAdd().getCommand())) {
						suggestions.add(new CourseSuggestion(suggestion));
					}
				}
				callback.onSuggestionsReady(request, new Response(suggestions));
			}
		});
	}
}
 
Example 7
Project: unitimes   File: SolverPage.java   Source Code and License 6 votes vote down vote up
public SolverStatus() {
	super("unitime-SolverStatus");
	iStatus = new P("status-label");
	iIcon = new Image(RESOURCES.helpIcon()); iIcon.addStyleName("status-icon");
	iIcon.setVisible(false);
	add(iStatus); add(iIcon);
	RPC.execute(new PageNameRpcRequest("Solver Status"), new AsyncCallback<PageNameInterface>() {
		@Override
		public void onFailure(Throwable caught) {}
		@Override
		public void onSuccess(final PageNameInterface result) {
			iIcon.setTitle(MESSAGES.pageHelp(result.getName()));
			iIcon.setVisible(true);
			iIcon.addClickHandler(new ClickHandler() {
				@Override
				public void onClick(ClickEvent event) {
					if (result.getHelpUrl() == null || result.getHelpUrl().isEmpty()) return;
					UniTimeFrameDialog.openDialog(MESSAGES.pageHelp(result.getName()), result.getHelpUrl());
				}
			});
		}
	});
}
 
Example 8
Project: unitimes   File: PeriodPreferencesWidget.java   Source Code and License 6 votes vote down vote up
public void insert(final RootPanel panel, Long eventAvailability) {
	String[] ids = panel.getElement().getInnerHTML().trim().split(":");
	Long locationId = Long.valueOf(ids[0]);
	Long examTypeId = Long.valueOf(ids[1]);
	RPC.execute(RoomInterface.PeriodPreferenceRequest.load(locationId, examTypeId), new AsyncCallback<PeriodPreferenceModel>() {
		@Override
		public void onFailure(Throwable caught) {
			UniTimeNotifications.error(MESSAGES.failedToLoadPeriodPreferences(caught.getMessage()));
		}

		@Override
		public void onSuccess(PeriodPreferenceModel result) {
			panel.getElement().setInnerText(null);
			setModel(result);
			panel.add(PeriodPreferencesWidget.this);
			panel.setVisible(true);
		}
	});
}
 
Example 9
Project: sig-seguimiento-vehiculos   File: EnvelopeTool.java   Source Code and License 6 votes vote down vote up
private void drawEnvelope(final VectorFeature... vectorFeatures) {
	final WKT wktFormat = new WKT();
	final List<String> wktElements = new ArrayList<String>();
	for (final VectorFeature feature : vectorFeatures) {
		wktElements.add(wktFormat.write(feature));
	}

	JTS_SERVICE_ASYNC.getEnvelope(wktElements, new AsyncCallback<List<String>>() {
		public void onFailure(final Throwable caught) {
			progressBar.hide();
			messageDialogBuilder.createError(UIMessages.INSTANCE.fail(), "Error: " + caught.getMessage()).show();
		}

		public void onSuccess(final List<String> wktEnvelopes) {
			final VectorLayer vector = getEnvelopeLayer();
			for (final String wktEnvelope : wktEnvelopes) {
				final VectorFeature newVectorFeature = new VectorFeature(Geometry.fromWKT(wktEnvelope));
				vector.addFeature(newVectorFeature);
			}
			progressBar.hide();
		}
	});
}
 
Example 10
Project: unitimes   File: ReservationEdit.java   Source Code and License 6 votes vote down vote up
private void execute(final int index, final AsyncCallback<Boolean> callback) {
	if (index >= iInitializations.length) {
		callback.onSuccess(true);
	} else {
		iInitializations[index].execute(new AsyncCallback<Boolean>() {
			@Override
			public void onFailure(Throwable caught) {
				callback.onFailure(caught);
			}
			@Override
			public void onSuccess(Boolean result) {
				if (result) {
					execute(1 + index, callback);
				} else {
					callback.onSuccess(false);
				}
			}
		});
	}
}
 
Example 11
Project: appinventor-extensions   File: TopToolbar.java   Source Code and License 6 votes vote down vote up
/**
 * Enables or disables buttons based on whether the user has an android.keystore file.
 */
public void updateKeystoreFileMenuButtons() {
  Ode.getInstance().getUserInfoService().hasUserFile(StorageUtil.ANDROID_KEYSTORE_FILENAME,
      new AsyncCallback<Boolean>() {
        @Override
        public void onSuccess(Boolean keystoreFileExists) {
          isKeystoreCached = true;
          isKeystorePresent = keystoreFileExists;
          fileDropDown.setItemEnabled(MESSAGES.deleteKeystoreMenuItem(), keystoreFileExists);
          fileDropDown.setItemEnabled(MESSAGES.downloadKeystoreMenuItem(), keystoreFileExists);
        }

        @Override
        public void onFailure(Throwable caught) {
          // Enable the MenuItems. If they are clicked, we'll check again if the keystore exists.
          fileDropDown.setItemEnabled(MESSAGES.deleteKeystoreMenuItem(), true);
          fileDropDown.setItemEnabled(MESSAGES.downloadKeystoreMenuItem(), true);
        }
      });
}
 
Example 12
Project: unitimes   File: TeachingRequestDetailPage.java   Source Code and License 6 votes vote down vote up
public void showInstructorDetail(Long id) {
	iAssignmentTable.clearTable(1);
	LoadingWidget.getInstance().show(MESSAGES.waitLoadTeachingRequestDetail());
	ToolBox.setMaxHeight(iScroll.getElement().getStyle(), Math.round(0.9 * Window.getClientHeight()) + "px");
	RPC.execute(new TeachingAssignmentsDetailRequest(id), new AsyncCallback<InstructorInfo>() {
		@Override
		public void onFailure(Throwable caught) {
			LoadingWidget.getInstance().hide();
			UniTimeNotifications.error(MESSAGES.failedToLoadTeachingRequestDetail(caught.getMessage()), caught);
			ToolBox.checkAccess(caught);
		}

		@Override
		public void onSuccess(InstructorInfo result) {
			LoadingWidget.getInstance().hide();
			populate(null, null, result);
			GwtHint.hideHint();
			center();
			RootPanel.getBodyElement().getStyle().setOverflow(Overflow.HIDDEN);
		}
	});
}
 
Example 13
Project: sig-seguimiento-vehiculos   File: Geoprocess.java   Source Code and License 6 votes vote down vote up
protected AsyncCallback<List<String>> getDefaultAsyncCallback() {
	
	return new AsyncCallback<List<String>>() {

		@Override
		public void onFailure(final Throwable caught) {
			finishProgressbar();		
			onError(caught.getMessage());				
		}

		public void onSuccess(final List<String> wktElements) {
			finishProgressbar();
			onSucess(getResultLayer(wktElements));				
		}
	};
}
 
Example 14
Project: unitimes   File: NotAssignedClassesPage.java   Source Code and License 6 votes vote down vote up
protected void init() {
	RPC.execute(new NotAssignedClassesFilterRequest(), new AsyncCallback<NotAssignedClassesFilterResponse>() {
		@Override
		public void onFailure(Throwable caught) {
			iFilter.getFooter().setErrorMessage(MESSAGES.failedToInitialize(caught.getMessage()));
			UniTimeNotifications.error(MESSAGES.failedToInitialize(caught.getMessage()), caught);
			ToolBox.checkAccess(caught);
		}

		@Override
		public void onSuccess(NotAssignedClassesFilterResponse result) {
			iLegend = new PreferenceLegend(result.getPreferences());
			iFilter.getFooter().clearMessage();
			iFilter.setValue(result);
			iFilter.getFooter().setEnabled("search", true);
			createTriggers();
			if (iFilter.getHeader().isCollapsible() != null && !iFilter.getHeader().isCollapsible())
				search(null);
		}
	});
}
 
Example 15
Project: unitimes   File: EventFilterBox.java   Source Code and License 6 votes vote down vote up
@Override
public void requestSuggestions(final Request request, final Callback callback) {
	if (!request.getQuery().isEmpty()) {
		iFilter.getWidget().getSuggestionsProvider().getSuggestions(iFilter.getWidget().getChips(null), request.getQuery(), new AsyncCallback<Collection<FilterBox.Suggestion>>() {

			@Override
			public void onFailure(Throwable caught) {
			}

			@Override
			public void onSuccess(Collection<FilterBox.Suggestion> result) {
				if (result == null) return;
				List<RequestedBySuggestion> suggestions = new ArrayList<RequestedBySuggestion>();
				for (FilterBox.Suggestion suggestion: result) {
					if (suggestion.getChipToAdd() != null && "requested".equals(suggestion.getChipToAdd().getCommand())) {
						suggestions.add(new RequestedBySuggestion(suggestion));
					}
				}
				callback.onSuggestionsReady(request, new Response(suggestions));
			}
		});
	}
}
 
Example 16
Project: unitimes   File: PeriodPreferencesHint.java   Source Code and License 5 votes vote down vote up
public static void showHint(final Element relativeObject, final Long locationId, final Long examTypeId) {
	sLastLocationId = locationId;
	sShowHint = true;
	RPC.execute(RoomInterface.PeriodPreferenceRequest.load(locationId, examTypeId), new AsyncCallback<RoomInterface.PeriodPreferenceModel>() {
		@Override
		public void onFailure(Throwable caught) {
		}
		
		@Override
		public void onSuccess(RoomInterface.PeriodPreferenceModel result) {
			if (locationId.equals(sLastLocationId) && sShowHint && result != null && !result.getPeriods().isEmpty())
				GwtHint.showHint(relativeObject, content(result));
		}
	});
}
 
Example 17
Project: unitimes   File: ReservationEdit.java   Source Code and License 5 votes vote down vote up
@Override
public void execute(final AsyncCallback<Boolean> callback) {
	RPC.execute(new ReservationDefaultExpirationDatesRpcRequest(), new AsyncCallback<DefaultExpirationDates>() {
		@Override
		public void onFailure(Throwable caught) {
			callback.onFailure(caught);
		}

		@Override
		public void onSuccess(DefaultExpirationDates result) {
			iExpirations = result;
			callback.onSuccess(true);
		}
	});
}
 
Example 18
Project: unitimes   File: RoomSharingHint.java   Source Code and License 5 votes vote down vote up
public static void showHint(final Element relativeObject, final long locationId, boolean eventAvailability) {
	sLastLocationId = locationId;
	sShowHint = true;
	RPC.execute(RoomInterface.RoomSharingRequest.load(locationId, eventAvailability), new AsyncCallback<RoomInterface.RoomSharingModel>() {
		@Override
		public void onFailure(Throwable caught) {
		}
		
		@Override
		public void onSuccess(RoomInterface.RoomSharingModel result) {
			if (locationId == sLastLocationId && sShowHint && result != null)
				GwtHint.showHint(relativeObject, content(result));
		}
	});
}
 
Example 19
Project: unitimes   File: SolverLogPage.java   Source Code and License 5 votes vote down vote up
public void refresh() {
	int level = iLevel.getSelectedIndex();
	SolverCookie.getInstance().setLogLevel(level);
	iHeader.showLoading();
	iTimer.cancel();
	RPC.execute(new SolverLogPageRequest(iType, ProgressLogLevel.values()[level], null), new AsyncCallback<SolverLogPageResponse>() {
		@Override
		public void onFailure(Throwable caught) {
			iHeader.setErrorMessage(caught.getMessage());
		}

		@Override
		public void onSuccess(SolverLogPageResponse result) {
			iHeader.clearMessage();
			for (int row = getRowCount() - 1; row > iLevelRow; row--)
				removeRow(row);
			if (result.hasLog()) {
				iLog = new ProgressLog(result.getLog());
				addRow(iLog);
				addBottomRow(iFooter);
				iTimer.scheduleRepeating(1000);
			} else if (result.hasSolutionLogs()) {
				for (SolutionLog log: result.getSolutionLogs()) {
					if (log.hasLog()) {
						addHeaderRow(log.getOwner());
						addRow(new ProgressLog(log.getLog()));
					}
				}
				addBottomRow(iFooter);
			}
		}
	});
}
 
Example 20
Project: unitimes   File: UniTimeFileUpload.java   Source Code and License 5 votes vote down vote up
@Override
public void reset() {
	super.reset();
	RPC.execute(new FileUploadRpcRequest(true), new AsyncCallback<FileUploadRpcResponse>() {
		@Override
		public void onFailure(Throwable caught) {
			UniTimeNotifications.error(caught);
		}

		@Override
		public void onSuccess(FileUploadRpcResponse result) {
		}
	});
}
 
Example 21
Project: sig-seguimiento-vehiculos   File: CentroidTool.java   Source Code and License 5 votes vote down vote up
private void drawCentroid(final VectorFeature... vectorFeatures) {
	final WKT wktFormat = new WKT();
	final List<String> wktElements = new ArrayList<String>();
	for (final VectorFeature feature : vectorFeatures) {
		wktElements.add(wktFormat.write(feature));
	}

	JTS_SERVICE_ASYNC.getCentroid(wktElements,
			new AsyncCallback<List<String>>() {
				public void onFailure(final Throwable caught) {
					progressBar.hide();
					messageDialogBuilder.createError(UIMessages.INSTANCE.fail(),
							"Error: " + caught.getMessage()).show();
				}

				public void onSuccess(final List<String> wktEnvelopes) {

					VectorLayer layer = getCentroidLayer();
					for (String wktEnvelope : wktEnvelopes) {
						VectorFeature newVectorFeature = new VectorFeature(
								Geometry.fromWKT(wktEnvelope));
						layer.addFeature(newVectorFeature);
					}
					progressBar.hide();
				}
			});
}
 
Example 22
Project: unitimes   File: FilterBox.java   Source Code and License 5 votes vote down vote up
public void refreshSuggestions() {
	if (getSuggestionsProvider() == null) return;
	if (isFilterPopupShowing()) return;
	if (!isEnabled()) return;
	String value = getValue();
	if (value.equals(iLastValue)) return;
	iLastValue = value;
	final String query = iFilter.getText();
	getSuggestionsProvider().getSuggestions(getChips(null), query, new AsyncCallback<Collection<Suggestion>>() {
		@Override
		public void onFailure(Throwable caught) {
			if (iSuggestionsPopup.isShowing()) iSuggestionsPopup.hide();
		}

		@Override
		public void onSuccess(Collection<Suggestion> result) {
			if (!query.equals(iFilter.getText())) return; // old request
			if (result != null && !result.isEmpty()) {
				updateSuggestions(result);
				iSuggestionsPopup.setWidth(getElement().getClientWidth() + "px");
				iSuggestionsPopup.showRelativeTo(FilterBox.this);
			} else {
				if (iSuggestionsPopup.isShowing()) iSuggestionsPopup.hide();
			}
		}
	});
}
 
Example 23
Project: EasyML   File: AccountPresenter.java   Source Code and License 5 votes vote down vote up
/**
 * User information is initialized
 */
public void init(){
	if(AppController.power.startsWith("0")){ 			//Authority code starts with 0, general user have no authority to visit background management.
		accountView.getAdminAnchor().setVisible(false);
		accountView.getAdminAnchor().setEnabled(false);
	}
	accountView.setAccount(AppController.username, AppController.email);
	Account account = new Account();
	account.setUsername(AppController.username);
	account.setEmail(AppController.email);
	accountService.getAccountInfo(account, new AsyncCallback<Account>(){

		@Override
		public void onFailure(Throwable caught) {
			// TODO Auto-generated method stub
			accountView.getVererrorLabel().setText(caught.getMessage());
		}

		@Override
		public void onSuccess(Account result) {
			// TODO Auto-generated method stub
			accountView.getUsrBox().setValue(result.getUsername());
			accountView.getCmpBox().setValue(result.getCompany());
			accountView.getPstBox().setValue(result.getPosition());
		}

	});
}
 
Example 24
Project: EasyML   File: DatasetLoader.java   Source Code and License 5 votes vote down vote up
/**
 * Load search result and reset paging control 
 */	
private void searchResult(){
	adminView.getDataPage().clear();							
	adminView.getDataPage().add(page);
	datasetService.search(searchDataset, searchStart, searchEnd, 0, 0, new AsyncCallback<List<Dataset>>(){

		@Override
		public void onFailure(Throwable caught) {
			// TODO Auto-generated method stub
			searchAlert.setContent(caught.getMessage());
			searchAlert.show();
		}

		@Override
		public void onSuccess(List<Dataset> result) {
			// TODO Auto-generated method stub
			if(result.size() == 0){
				searchAlert.setContent( Constants.adminUIMsg.searchNoResult());
				searchAlert.show();
			}else{
				resultSize = result.size();						
				pageSize = (int)Math.ceil((double)result.size()/13);
				lastPage = pageSize;
				currentPage = 1;
				pagination = new Pagination(page, pageSize, Pagination.PageType.LARGE);
				pagination.load();
				reload();									
			}
		}

	});
}
 
Example 25
Project: unitimes   File: PinDialog.java   Source Code and License 5 votes vote down vote up
protected void sendPin() {
	final String pin = iPin.getText();
	hide();
	LoadingWidget.getInstance().show(MESSAGES.waitEligibilityCheck());
	sSectioningService.checkEligibility(iOnline, iSectioning, iSessionId, iStudentId, pin, new AsyncCallback<EligibilityCheck>() {
		
		@Override
		public void onSuccess(EligibilityCheck result) {
			LoadingWidget.getInstance().hide();
			iCallback.onMessage(result);
			if (result.hasFlag(OnlineSectioningInterface.EligibilityCheck.EligibilityFlag.PIN_REQUIRED)) {
				center();
				Scheduler.get().scheduleDeferred(new ScheduledCommand() {
					@Override
					public void execute() {
						iPin.selectAll();
						iPin.setFocus(true);
					}
				});
			} else {
				iCallback.onSuccess(result);
			}
		}
		
		@Override
		public void onFailure(Throwable caught) {
			LoadingWidget.getInstance().hide();
			iCallback.onFailure(caught);
		}
	});
}
 
Example 26
Project: unitimes   File: ScriptPage.java   Source Code and License 5 votes vote down vote up
private void refreshQueue(Long deleteId, final Long selectId) {
	RPC.execute(new ScriptInterface.GetQueueTableRpcRequest(deleteId), new AsyncCallback<GwtRpcResponseList<QueueItemInterface>>() {
		@Override
		public void onFailure(Throwable caught) {
			UniTimeNotifications.error(MESSAGES.failedLoadData(caught.getMessage()), caught);
		}

		@Override
		public void onSuccess(GwtRpcResponseList<QueueItemInterface> result) {
			populate(result, selectId);
		}
	});
}
 
Example 27
Project: unitimes   File: OnlineSectioningTest.java   Source Code and License 5 votes vote down vote up
private void checkEligibility(final Callback<EligibilityCheck> callback) {
	debug("checkEligibility()");	
	iSectioningService.checkEligibility(true, true, iSessionId, iStudentId, iPin.getWidget().getText(),  new AsyncCallback<EligibilityCheck>() {
		@Override
		public void onSuccess(EligibilityCheck result) {
			callback.execute(result, null);
		}
		@Override
		public void onFailure(Throwable caught) {
			warn("&nbsp;&nbsp;checkEligibility() failed: " + caught.getMessage());
			callback.execute(null, caught);
		}
	});
	
}
 
Example 28
Project: unitimes   File: AssignedClassesPage.java   Source Code and License 5 votes vote down vote up
private void exportData(String format) {
	String query = "output=assigned-classes." + format + iFilter.getQuery() + "&sort=" + SolverCookie.getInstance().getAssignedClassesSort();
	RPC.execute(EncodeQueryRpcRequest.encode(query), new AsyncCallback<EncodeQueryRpcResponse>() {
		@Override
		public void onFailure(Throwable caught) {
		}
		@Override
		public void onSuccess(EncodeQueryRpcResponse result) {
			ToolBox.open(GWT.getHostPageBaseURL() + "export?q=" + result.getQuery());
		}
	});
}
 
Example 29
Project: unitimes   File: RoomsPage.java   Source Code and License 5 votes vote down vote up
protected void export(String format) {
	RPC.execute(EncodeQueryRpcRequest.encode(query(format)), new AsyncCallback<EncodeQueryRpcResponse>() {
		@Override
		public void onFailure(Throwable caught) {
		}
		@Override
		public void onSuccess(EncodeQueryRpcResponse result) {
			ToolBox.open(GWT.getHostPageBaseURL() + "export?q=" + result.getQuery());
		}
	});
}
 
Example 30
Project: unitimes   File: PointInTimeDataReportsPage.java   Source Code and License 5 votes vote down vote up
public void loadQueries(final Long select, final boolean reload) {
	if (!LoadingWidget.getInstance().isShowing())
		LoadingWidget.getInstance().show(MESSAGES.waitLoadingReports());
	RPC.execute(new PITDQueriesRpcRequest(), new AsyncCallback<GwtRpcResponseList<Report>>() {
		@Override
		public void onFailure(Throwable caught) {
			iHeader.setErrorMessage(caught.getMessage());
			LoadingWidget.getInstance().hide();
		}
		@Override
		public void onSuccess(GwtRpcResponseList<Report> result) {
			String selected = (select == null ? null : select.toString());
			if (selected == null && iReportSelector.getWidget().getSelectedIndex() >= 0) {
				selected = iReportSelector.getWidget().getValue(iReportSelector.getWidget().getSelectedIndex());
			}
			iReportSelector.getWidget().clear();
			if (result.isEmpty()) {
				iHeader.setErrorMessage(MESSAGES.errorNoReportsAvailable());
			} else {
				iReportSelector.getWidget().addItem(MESSAGES.itemSelect(), "-1");
				iReports = result;
				for (int i = 0; i < result.size(); i++) {
					iReportSelector.getWidget().addItem(result.get(i).getName(), result.get(i).getId().toString());
					if (selected != null && selected.equals(result.get(i).getId().toString()))
						iReportSelector.getWidget().setSelectedIndex(1 + i);
				}
				queryChanged();
			}
			LoadingWidget.getInstance().hide();
			if (reload) reload(History.getToken());
		}
	});
}
 
Example 31
Project: unitimes   File: SavedHQLPage.java   Source Code and License 5 votes vote down vote up
public void loadQueries(final Long select, final boolean reload) {
	if (!LoadingWidget.getInstance().isShowing())
		LoadingWidget.getInstance().show(MESSAGES.waitLoadingReports());
	RPC.execute(new HQLQueriesRpcRequest(iAppearance), new AsyncCallback<GwtRpcResponseList<Query>>() {
		@Override
		public void onFailure(Throwable caught) {
			iHeader.setErrorMessage(caught.getMessage());
			LoadingWidget.getInstance().hide();
		}
		@Override
		public void onSuccess(GwtRpcResponseList<Query> result) {
			String selected = (select == null ? null : select.toString());
			if (selected == null && iQuerySelector.getWidget().getSelectedIndex() >= 0) {
				selected = iQuerySelector.getWidget().getValue(iQuerySelector.getWidget().getSelectedIndex());
			}
			iQuerySelector.getWidget().clear();
			if (result.isEmpty()) {
				iHeader.setErrorMessage(MESSAGES.errorNoReportsAvailable());
			} else {
				iQuerySelector.getWidget().addItem(MESSAGES.itemSelect(), "-1");
				iQueries = result;
				for (int i = 0; i < result.size(); i++) {
					iQuerySelector.getWidget().addItem(result.get(i).getName(), result.get(i).getId().toString());
					if (selected != null && selected.equals(result.get(i).getId().toString()))
						iQuerySelector.getWidget().setSelectedIndex(1 + i);
				}
				queryChanged();
			}
			LoadingWidget.getInstance().hide();
			if (reload) reload(History.getToken());
		}
	});
}
 
Example 32
Project: unitimes   File: SectioningStatusPage.java   Source Code and License 5 votes vote down vote up
private void exportData() {
	int tab = iTabIndex;
	if (tab < 0)
		tab = SectioningStatusCookie.getInstance().getTab(iOnline);
	
	String query = "output=student-dashboard.csv&online=" + (iOnline ? 1 : 0) + "&tab=" + tab + "&sort=" + SectioningStatusCookie.getInstance().getSortBy(iOnline, tab);
	if (tab == 0)
		for (Long courseId: iSelectedCourseIds)
			query += "&c=" + courseId;
	query += "&query=" + URL.encodeQueryString(iFilter.getValue());
	FilterRpcRequest req = iFilter.getElementsRequest();
	if (req.hasOptions()) {
		for (Map.Entry<String, Set<String>> option: req.getOptions().entrySet()) {
			for (String value: option.getValue()) {
				query += "&f:" + option.getKey() + "=" + URL.encodeQueryString(value);
			}
		}
	}
	if (req.getText() != null && !req.getText().isEmpty()) {
		query += "&f:text=" + URL.encodeQueryString(req.getText());
	}
	
	RPC.execute(EncodeQueryRpcRequest.encode(query), new AsyncCallback<EncodeQueryRpcResponse>() {
		@Override
		public void onFailure(Throwable caught) {
		}
		@Override
		public void onSuccess(EncodeQueryRpcResponse result) {
			ToolBox.open(GWT.getHostPageBaseURL() + "export?q=" + result.getQuery());
		}
	});
}
 
Example 33
Project: EasyML   File: ProgramDeprecateMenu.java   Source Code and License 5 votes vote down vote up
public static MenuItem create(final ProgramLeaf node) {
	Command command = new MenuItemCommand(node) {
		@Override
		public void execute() {
			String id = node.getModule().getId();
			boolean y = Window.confirm("Are you ready to deprecate " + node.getModule().getName() + "?");
			if (y) {
				ProgramServiceAsync svc = GWT.create(ProgramService.class);
				svc.deprecate(id, new AsyncCallback<Void>() {

					@Override
					public void onFailure(Throwable caught) {
						Window.alert(caught.getMessage());
					}

					@Override
					public void onSuccess(Void result) {
						node.delete();
					}

				});
			}
			this.component.getContextMenu().hide();
		}

	};

	MenuItem item = new MenuItem("deprecate", command);
	return item;
}
 
Example 34
Project: unitimes   File: FreeTimeParser.java   Source Code and License 5 votes vote down vote up
@Override
public void getData(String source, AsyncCallback<List<FreeTime>> callback) {
	try {
		callback.onSuccess(parseFreeTime(source));
	} catch (IllegalArgumentException e) {
		callback.onFailure(e);
	}
}
 
Example 35
Project: unitimes   File: FilterBox.java   Source Code and License 4 votes vote down vote up
@Override
public void getValues(List<Chip> chips, String text, AsyncCallback<Collection<Chip>> callback) {
	callback.onSuccess(iValues);
}
 
Example 36
Project: DocIT   File: ServiceAsync.java   Source Code and License 4 votes vote down vote up
void cutEmployee(String employeeName, Double salary,
AsyncCallback<Double> callback);
 
Example 37
Project: appinventor-extensions   File: ComponentRenameWizard.java   Source Code and License 4 votes vote down vote up
protected ComponentRenameWizard(final String defaultTypeName, long projectId, final List<ProjectNode> compNodes) {
    super(MESSAGES.componentRenameWizardCaption(), true, false);

    this.defaultTypeName = defaultTypeName;
    this.defaultName = getDefaultName(defaultTypeName);
    this.destinationProjectId = projectId;
    this.nodes = compNodes;

    setStylePrimaryName("ode-DialogBox");

    renameTextBox = new LabeledTextBox(MESSAGES.componentNameLabel());
    renameTextBox.getTextBox().addKeyDownHandler(new KeyDownHandler() {
        @Override
        public void onKeyDown(KeyDownEvent event) {
            int keyCode = event.getNativeKeyCode();
            if (keyCode == KeyCodes.KEY_ENTER) {
                handleOkClick();
            } else if (keyCode == KeyCodes.KEY_ESCAPE) {
                handleCancelClick();
            }
        }
    });

    renameTextBox.setText(defaultName);

    VerticalPanel page = new VerticalPanel();

    page.add(renameTextBox);
    addPage(page);

    // Create finish command (rename Extension)
    initFinishCommand(new Command() {
        @Override
        public void execute() {
            String newName = renameTextBox.getText();

            if (TextValidators.checkNewComponentName(newName)) {
                ode.getComponentService().renameImportedComponent(defaultTypeName, newName, destinationProjectId, new RenameComponentCallback());

            } else {
                show();
                center();
                renameTextBox.setFocus(true);
                renameTextBox.selectAll();
                return;
            }
        }
    });
    // Create cancel command (delete component files)
    initCancelCommand(new Command() {
        @Override
        public void execute() {
            ode.getComponentService().deleteImportedComponent(defaultTypeName, destinationProjectId, new AsyncCallback<Void>() {
                @Override
                public void onFailure(Throwable throwable) {

                }

                @Override
                public void onSuccess(Void aVoid) {

                }
            });
        }
    });
}
 
Example 38
Project: unitimes   File: SuggestionsBox.java   Source Code and License 4 votes vote down vote up
public void open(CourseRequestInterface request, ArrayList<ClassAssignmentInterface.ClassAssignment> rows, RequestedCourse course, boolean useGwtConfirmations, AsyncCallback<ClassAssignmentInterface> callback) {
	LoadingWidget.getInstance().show(MESSAGES.suggestionsLoadingChoices());
	iAssignment = null;
	iCurrent = rows;
	iRequest = request;
	iIndex = -1;
	iHintId = null;
	iUseGwtConfirmations = useGwtConfirmations;
	iSource = course.getCourseName();
	setText(MESSAGES.suggestionsChoices(iSource));
	iSuggestions.setSelectedRow(-1);
	iSuggestions.clearData(true);
	iSuggestions.setEmptyMessage(MESSAGES.suggestionsLoadingChoices());
	iLegend.setHTML(MESSAGES.suggestionsLegendOnNewCourse(course.getCourseName()));
	iMessages.setHTML("");
	iFilter.setText("");
	iQuickDrop.setVisible(false); iQuickDrop.setEnabled(false);
	request.addCourse(course);
	iCustomCallback = callback;
	iSectioningService.computeSuggestions(iOnline, request, rows, -1, iFilter.getText(), new AsyncCallback<Collection<ClassAssignmentInterface>>() {
		@Override
		public void onSuccess(Collection<ClassAssignmentInterface> result) {
			if (result == null || result.isEmpty()) {
				LoadingWidget.getInstance().hide();
				iCustomCallback.onFailure(new SectioningException(MESSAGES.suggestionsNoChoices(iSource)));
			} else if (result.size() == 1) {
				ClassAssignmentInterface a = result.iterator().next();
				if (a.getCourseAssignments().isEmpty()) {
					LoadingWidget.getInstance().hide();	
					if (a.hasMessages())
						iCustomCallback.onFailure(new SectioningException(a.getMessages(", ")));
					else
						iCustomCallback.onFailure(new SectioningException(MESSAGES.suggestionsNoChoices(iSource)));
				} else {
					iCallback.onSuccess(result);
				}
			} else {
				iCallback.onSuccess(result);
			}
		}
		@Override
		public void onFailure(Throwable caught) {
			LoadingWidget.getInstance().hide();
			iCustomCallback.onFailure(caught);
		}
	});
}
 
Example 39
Project: unitimes   File: SectioningReports.java   Source Code and License 4 votes vote down vote up
private void execute() {
	iHeader.setEnabled("print", false);
	
	if (iReportSelector.getWidget().getSelectedIndex() <= 0) {
		iHeader.setErrorMessage(MESSAGES.errorNoReportSelected());
		return;
	}
	
	ReportType type = ReportType.valueOf(iReportSelector.getWidget().getValue(iReportSelector.getWidget().getSelectedIndex()));
	iLastHistory = type.name();
	iTable.clearTable();
	iTableHeader.clearMessage();
	iHeader.clearMessage();
	LoadingWidget.getInstance().show(MESSAGES.waitExecuting(type.getName()));
	History.newItem(iLastHistory + ":" + iFirstLine + ":" + iLastSort, false);
	
	SectioningReportRpcRequest request = new SectioningReportRpcRequest();
	request.setParameter("report", type.getImplementation());
	request.setParameter("online", iOnline ? "true" : "false");
	for (int i = 0; i + 1 < type.getParameters().length; i += 2)
		request.setParameter(type.getParameters()[i], type.getParameters()[i + 1]);
	
	RPC.execute(request, new AsyncCallback<SectioningReportRpcResponse>() {
		@Override
		public void onFailure(Throwable caught) {
			iTableHeader.setErrorMessage(caught.getMessage());
			LoadingWidget.getInstance().hide();
		}
		@Override
		public void onSuccess(SectioningReportRpcResponse result) {
			iData.clear();
			RowData prev = null;
			for (int i = 0; i < result.getReport().size(); i ++) {
				String[] row = result.getReport().get(i);
				if (row.length == 0) continue;
				RowData data = new RowData(row);
				while (prev != null) {
					if (data.getNrBlanks() > prev.getNrBlanks()) break;
					prev = prev.getParent();
				}
				if (prev != null)
					data.setParent(prev);
				if (i == 0) {
					iHead = data;
				} else {
					iData.add(data);
					prev = data;
				}
			}
			populate(true);
			LoadingWidget.getInstance().hide();
		}
	});
}
 
Example 40
Project: unitimes   File: UniTimeFilterBox.java   Source Code and License 4 votes vote down vote up
public UniTimeFilterBox(AcademicSessionProvider session) {
	iFilter = new UniTimeWidget<FilterBox>(new FilterBox());
	iFilter.addStyleName("unitime-FilterBoxContainer");
	
	iFilter.getWidget().setSuggestionsProvider(new SuggestionsProvider() {
		@Override
		public void getSuggestions(List<Chip> chips, String text, final AsyncCallback<Collection<Suggestion>> callback) {
			Long sessionId = (iAcademicSession == null ? null : iAcademicSession.getAcademicSessionId());
			if (sessionId == null && iAcademicSession != null) {
				callback.onSuccess(null);
				return;
			}
			RPC.execute(createRpcRequest(FilterRpcRequest.Command.SUGGESTIONS, iAcademicSession == null ? null : iAcademicSession.getAcademicSessionId(), chips, text), new AsyncCallback<FilterRpcResponse>() {

				@Override
				public void onFailure(Throwable caught) {
					callback.onFailure(caught);
				}

				@Override
				public void onSuccess(FilterRpcResponse result) {
					List<FilterBox.Suggestion> suggestions = new ArrayList<FilterBox.Suggestion>();
					if (result.hasSuggestions()) {
						for (FilterRpcResponse.Entity s: result.getSuggestions())
							addSuggestion(suggestions, s);
					}
					callback.onSuccess(suggestions);
				}
				
			});
		}
	});
	
	initWidget(iFilter);
	
	iAcademicSession = session;
	
	if (iAcademicSession != null)
		iAcademicSession.addAcademicSessionChangeHandler(new AcademicSessionChangeHandler() {
			@Override
			public void onAcademicSessionChange(AcademicSessionChangeEvent event) {
				if (event.isChanged()) init(true, event.getNewAcademicSessionId(), null);
			}
		});
	
	Scheduler.get().scheduleDeferred(new ScheduledCommand() {
		@Override
		public void execute() {
			init(true, iAcademicSession == null ? null : iAcademicSession.getAcademicSessionId(), null);
		}
	});
}
 
Example 41
Project: unitimes   File: EventRoomAvailability.java   Source Code and License 4 votes vote down vote up
private void setup(boolean init) {
	if (init)
		iInitialized = true;
	boolean reload = init;
	boolean isDefault = true;
	if (iHistoryToken.isChanged("rooms", "flag:Event", iRooms.getValue())) {
		iRooms.setValue(iHistoryToken.getParameter("rooms", "flag:Event"), true);
		reload = true;
		if (!iRooms.getValue().equals("flag:Event")) {
			isDefault = false;
		}
	}
	if (iHistoryToken.isChanged("after", iTimes.getValue().getStart() == null ? "" : iTimes.getValue().getStart().toString()) || iHistoryToken.isChanged("before", iTimes.getValue().getEnd() == null ? "" : iTimes.getValue().getEnd().toString())) {
		String after = iHistoryToken.getParameter("after");
		String before = iHistoryToken.getParameter("before");
		iTimes.setValue(new StartEndTime(after == null || after.isEmpty() ? null : Integer.valueOf(after), before == null || before.isEmpty() ? null : Integer.valueOf(before)));
		reload = true;
		if (iTimes.getValue().getStart() != null)
			isDefault = false;
	}
	String dates = "";
	for (Integer date: iDates.getSelectedDays()) {
		dates += (dates.isEmpty() ? "" : ",") + date;
	}
	if (iHistoryToken.isChanged("dates", dates)) {
		dates = iHistoryToken.getParameter("dates");
		List<Date> val = new ArrayList<Date>();
		if (dates != null && !dates.isEmpty()) {
			for (String d: dates.split(","))
				val.add(iDates.getDate(Integer.valueOf(d)));
		}
		iDates.setValue(val);
		reload = true;
		if (iDates.getSelectedDaysCount() > 0)
			isDefault = false;
	}
	if (iHistoryToken.isChanged("term", iSession.getAcademicSessionAbbreviation()) && iHistoryToken.getParameter("term") != null)
		iSession.selectSession(iHistoryToken.getParameter("term"), null);
	if (iHistoryToken.hasParameter("event")) {
		if ("add".equals(iHistoryToken.getParameter("event"))) {
			iEventAdd.setEvent(null);
			iEventAdd.show();
		} else {
			Long eventId = Long.valueOf(iHistoryToken.getParameter("event"));
			LoadingWidget.execute(EventDetailRpcRequest.requestEventDetails(iSession.getAcademicSessionId(), eventId), new AsyncCallback<EventInterface>() {
				@Override
				public void onFailure(Throwable caught) {
					UniTimeNotifications.error(MESSAGES.failedLoad(MESSAGES.anEvent(), caught.getMessage()), caught);
				}
				@Override
				public void onSuccess(EventInterface result) {
					LoadingWidget.getInstance().hide();
					iEventDetail.setEvent(result);
					iEventDetail.show();
				}
			}, MESSAGES.waitLoading(MESSAGES.anEvent()));
		}
	} else {
		iRootPanel.setWidget(iPanel);
		if (iHistoryToken.hasParameter("term") && iHistoryToken.isChanged("term", iSession.getAcademicSessionAbbreviation())) {
			iSession.selectSession(iHistoryToken.getParameter("term"), null);
		} else if (reload && iProperties != null) {
			reload(isShowingResults() || (!isDefault && CONSTANTS.searchWhenPageIsLoaded()));
		}
	}
}
 
Example 42
Project: sig-seguimiento-vehiculos   File: GeocodingPanelWidget.java   Source Code and License 4 votes vote down vote up
private void getW3WPosition(final String words) {
	startProgressBar();

	w3wServiceAsync.getPosition(words, w3wTool.getLocale(), new AsyncCallback<String>() {
		public void onFailure(final Throwable caught) {
			finishProgressBar();

			final AlertMessageBox messageBox = new AlertMessageBox(UIMessages.INSTANCE.warning(),
					UIMessages.INSTANCE.w3wErrorText());
			messageBox.show();
		}

		public void onSuccess(final String response) {
			finishProgressBar();
			if (response.isEmpty()) {
				showException(UIMessages.INSTANCE.w3wErrorText());
				return;
			}

			final JSONValue jsonValue = JSONParser.parseLenient(response);
			final JSONObject jsonObject = jsonValue.isObject();

			if (jsonObject.containsKey("geometry")) {
				final JSONObject jsonCoords = jsonObject.get("geometry").isObject();

				final double latitud = jsonCoords.get("lat").isNumber().doubleValue();
				final double longitud = jsonCoords.get("lng").isNumber().doubleValue();

				updateMap(latitud, longitud, 20, "EPSG:4326");
				final LonLat lonLat = new LonLat(longitud, latitud);
				transformToInternalProjection(lonLat, "EPSG:4326");
				w3wTool.addElementToW3wLayer(lonLat, words);

			} else if (jsonObject.containsKey("error")) {
				showException(UIMessages.INSTANCE.fail() + jsonObject.get("message").toString());
			} else {
				showException(UIMessages.INSTANCE.w3wErrorText());
			}
		}
	});
}
 
Example 43
Project: unitimes   File: ReservationEdit.java   Source Code and License 4 votes vote down vote up
public void setReservation(ReservationInterface r) {
	iReservation = r;
	UniTimePageLabel.getInstance().setPageName(iReservation == null ? MESSAGES.pageAddReservation() : MESSAGES.pageEditReservation());
	iTitleAndButtons.setEnabled("delete", iReservation != null);
	iTitleAndButtons.clearMessage();
	iLimit.clearHint();
	iType.clearHint();
	
	Long offeringId = (iReservation == null ? null : iReservation.getOffering().getId());
	if (offeringId == null) {
		if (Window.Location.getParameter("offering") != null)
			offeringId =  Long.valueOf(Window.Location.getParameter("offering"));
	}

	if (offeringId == null) {
		iOffering = null;
		iCourseBox.setEnabled(true);
		iCourseBox.setValue((RequestedCourse)null, false);
		iCourseBox.setError(null);
		iLimit.getWidget().setValue("", true);
		iExpirationDate.getWidget().setValue(null);
		iRestrictions.clear();
		iType.getWidget().setSelectedIndex(0);
		iGroup.getWidget().setSelectedIndex(0);
		iArea.getWidget().setSelectedIndex(0);
		iClassifications.clear();
		iStudents.getWidget().setText("");
		iCourse.getWidget().clear();
		iMajors.clear();
		iType.setReadOnly(false);
		iCurricula.clear();
		iCurriculum.getWidget().clear();
		iCurriculum.getWidget().addItem(MESSAGES.itemNone(), "");
		iCurriculum.getWidget().setSelectedIndex(0);
		areaChanged();
		typeChanged(true);
	} else {
		iCourseBox.setEnabled(false);
		LoadingWidget.getInstance().show(MESSAGES.waitLoadingReservation());
		iReservationService.getOffering(offeringId, new AsyncCallback<Offering>() {
			@Override
			public void onFailure(Throwable caught) {
				loadingFailed(caught);
			}

			@Override
			public void onSuccess(Offering result) {
				setOffering(result);
				LoadingWidget.getInstance().hide();
			}
		});
	}
	
	if (iReservation == null) {
		iTitleAndButtons.setEnabled("previous", false);
		iTitleAndButtons.setEnabled("next", false);
	} else {
		EditFinishedEvent e = new EditFinishedEvent(iReservation.getId());
		for (EditFinishedHandler h: iEditFinishedHandlers) {
			iTitleAndButtons.setEnabled("previous", h.hasPrevious(e));
			iTitleAndButtons.setEnabled("next", h.hasNext(e));
		}
	}
}
 
Example 44
Project: EasyML   File: ETLServiceAsync.java   Source Code and License 4 votes vote down vote up
void SqlETLGetTables(String url, String user, String passwd,
AsyncCallback<ArrayList<String>> callback) throws IllegalArgumentException;
 
Example 45
Project: unitimes   File: RoomFeaturesPage.java   Source Code and License 4 votes vote down vote up
protected void search(final Long featureId) {
	hideResults();
	SearchRoomFeaturesRequest request = new SearchRoomFeaturesRequest(iProperties.getAcademicSessionId());
	request.setFilter(iFilter.getElementsRequest());
	LoadingWidget.execute(request, new AsyncCallback<GwtRpcResponseList<FeatureInterface>>() {
		@Override
		public void onFailure(Throwable caught) {
			iFilter.setErrorHint(MESSAGES.failedToLoadRoomFeatures(caught.getMessage()));
			UniTimeNotifications.error(MESSAGES.failedToLoadRoomFeatures(caught.getMessage()), caught);
		}
		@Override
		public void onSuccess(GwtRpcResponseList<FeatureInterface> result) {
			iFilter.clearHint();
			if (result == null || result.isEmpty()) {
				iFilter.setErrorHint(MESSAGES.errorNoRoomFeatures());
			} else {
				Chip dept = iFilter.getChip("department");
				boolean skipDepartmental = false;
				DepartmentInterface department = null;
				if (dept != null) {
					for (ExamTypeInterface type: iProperties.getExamTypes())
						if (type.getReference().equals(dept.getValue())) {
							skipDepartmental = true;
							break;
						}
					for (DepartmentInterface d: iProperties.getDepartments())
						if (dept.getValue().equals(d.getDeptCode())) {
							department = d; break;
						}
				}
				for (FeatureInterface Feature: result) {
					if (Feature.isDepartmental()) {
						if (skipDepartmental) continue;
						if (department != null && !department.equals(Feature.getDepartment())) continue;
						if (dept == null && !Feature.hasRooms()) continue;
						iDepartmentalFeaturesTable.addFeature(Feature);
					} else {
						iGlobalFeaturesTable.addFeature(Feature);
					}
				}
				iDepartmentalFeaturesTable.sort();
				iGlobalFeaturesTable.sort();
			}
			if (iMore != null) iMore.setEnabled(iDepartmentalFeaturesTable.getRowCount() > 1 || iGlobalFeaturesTable.getRowCount() > 1);
			if (iHeaderPanel != null) iHeaderPanel.setEnabled("more", iDepartmentalFeaturesTable.getRowCount() > 1 || iGlobalFeaturesTable.getRowCount() > 1);
			iFeaturesPanel.getRowFormatter().setVisible(iGlobalFeaturesRow, iGlobalFeaturesTable.getRowCount() > 1);
			iFeaturesPanel.getRowFormatter().setVisible(iGlobalFeaturesRow + 1, iGlobalFeaturesTable.getRowCount() > 1);
			iFeaturesPanel.getRowFormatter().setVisible(iDepartmentalFeaturesRow, iDepartmentalFeaturesTable.getRowCount() > 1);
			iFeaturesPanel.getRowFormatter().setVisible(iDepartmentalFeaturesRow + 1, iDepartmentalFeaturesTable.getRowCount() > 1);
			iDepartmentalFeaturesTable.scrollTo(featureId);
			iGlobalFeaturesTable.scrollTo(featureId);
		}
	}, MESSAGES.waitLoadingRoomFeatures());
}
 
Example 46
Project: EasyML   File: JobServiceAsync.java   Source Code and License 4 votes vote down vote up
void submit(String jobName, String bdaJobId, OozieGraph graph, String account,
String desc, AsyncCallback<BdaJob> callback);
 
Example 47
Project: appinventor-extensions   File: ExtendedServiceProxyGenerator.java   Source Code and License 4 votes vote down vote up
/**
 * Generate the implementation of a single method.
 *
 * @param out where to print the method to
 * @param method the method
 * @param typeName type name of the containing proxy class
 */
private void printMethod(PrintWriter out, JMethod method, String typeName) {
  // Build parameter lists
  int i = 0;
  StringBuilder actualParamsBuilder = new StringBuilder();
  StringBuilder formalParamsBuilder = new StringBuilder();
  for (JParameter param : method.getParameters()) {
    if (i != 0) {
      actualParamsBuilder.append(", ");
      formalParamsBuilder.append(", ");
    }

    String paramType = param.getType().getParameterizedQualifiedSourceName();
    String paramName = "p" + i++;
    actualParamsBuilder.append(paramName);
    formalParamsBuilder.append(paramType + " " + paramName);
  }
  String actualParams = actualParamsBuilder.toString();
  String formalParams = formalParamsBuilder.toString();

  // Information about the return type
  JType returnType = method.getReturnType();
  boolean hasReturnValue = !returnType.getSimpleSourceName().equals("void");

  JPrimitiveType primitiveReturnType = returnType.isPrimitive();
  String resultType =
      primitiveReturnType != null ? primitiveReturnType.getQualifiedBoxedSourceName()
          : returnType.getParameterizedQualifiedSourceName();

  String callbackType = AsyncCallback.class.getName() + "<" + resultType + ">";

  // Print method
  out.println("  public void " + method.getName() + "(" + formalParams
      + (formalParams.isEmpty() ? "" : ", ") + "final " + callbackType + " callback" + ") {");
  out.println("    fireStart(\"" + method.getName() + "\"" + (actualParams.isEmpty() ? "" : ", ")
      + actualParams + ");");
  out.println("    proxy." + method.getName() + "(" + actualParams
      + (actualParams.isEmpty() ? "" : ", ") + "new " + callbackType + "() {");
  out.println("      public void onSuccess(" + resultType + " result) {");
  out.println("        " + outcome(method, "Success", "result"));
  out.println("      }");
  out.println("      public void onFailure(Throwable caught) {");
  out.println("        " + outcome(method, "Failure", "caught"));
  out.println("      }");
  out.println("    });");
  out.println("  }");
}
 
Example 48
Project: appinventor-extensions   File: GalleryServiceAsync.java   Source Code and License 2 votes vote down vote up
/**
 * @see @link{@link GalleryService#getComments(long)
 */
void getComments(long galleryId, AsyncCallback<List<GalleryComment>> callback);
 
Example 49
Project: appinventor-extensions   File: GalleryServiceAsync.java   Source Code and License 2 votes vote down vote up
/**
 * @see @link{@link GalleryService#publishApp(long, String, String, String, String, String)
 */
void publishApp(long projectId, String title, String projectName, String description,
    String moreInfo, String credit, AsyncCallback<GalleryApp> callback);
 
Example 50
Project: appinventor-extensions   File: ComponentServiceAsync.java   Source Code and License 2 votes vote down vote up
/**
 * @see ComponentService#importComponentToProject(String, long, String)
 */
void importComponentToProject(String forOrUrl, long projectId, String folderPath,
    AsyncCallback<ComponentImportResponse> callback);
 
Example 51
Project: appinventor-extensions   File: ProjectServiceAsync.java   Source Code and License 2 votes vote down vote up
/**
 * @see ProjectService#loadraw(long, String)
 */
void loadraw(long projectId, String fileId, AsyncCallback<byte []> callback);
 
Example 52
Project: appinventor-extensions   File: ProjectServiceAsync.java   Source Code and License 2 votes vote down vote up
/**
 * @see ProjectService#loadProjectSettings(long)
 */
void loadProjectSettings(long projectId, AsyncCallback<String> callback);
 
Example 53
Project: appinventor-extensions   File: GalleryServiceAsync.java   Source Code and License 2 votes vote down vote up
/**
 * @see @link{@link GalleryService#isFeatured(long)
 */
void isFeatured(long galleryId, AsyncCallback<Boolean> callback);
 
Example 54
Project: appinventor-extensions   File: ProjectServiceAsync.java   Source Code and License 2 votes vote down vote up
/**
 * @see ProjectService#storeProjectSettings(String, long, String)
 */
void storeProjectSettings(String sessionId, long projectId, String settings, AsyncCallback<Void> callback);
 
Example 55
Project: appinventor-extensions   File: GalleryServiceAsync.java   Source Code and License 2 votes vote down vote up
/**
 * @see @link{@link GalleryService#increaseLikes(long)
 */
void increaseLikes(long galleryId, AsyncCallback<java.lang.Integer> num);
 
Example 56
Project: appinventor-extensions   File: UserInfoServiceAsync.java   Source Code and License 2 votes vote down vote up
/**
 * @see UserInfoService#loadUserSettings()
 */
void loadUserSettings(AsyncCallback<String> callback);
 
Example 57
Project: appinventor-extensions   File: GalleryServiceAsync.java   Source Code and License 2 votes vote down vote up
/**
 * @see @link{@link GalleryService#publishApp(long, String, String, String, String, String)
 */
void publishComment(long galleryId, String comment, AsyncCallback<java.lang.Long> date);
 
Example 58
Project: appinventor-extensions   File: ProjectServiceAsync.java   Source Code and License 2 votes vote down vote up
/**
 * @see ProjectService#screnshot(String, long, String, String)
 */

void screenshot(String sessionId, long projectId, String fileId, String content,
  AsyncCallback<RpcResult> callback);
 
Example 59
Project: appinventor-extensions   File: GalleryServiceAsync.java   Source Code and License 2 votes vote down vote up
/**
 * @see @link{@link GalleryService#getRecentReports(int, int)
 */
void getRecentReports(int start, int count, AsyncCallback<GalleryReportListResult> callback);
 
Example 60
Project: appinventor-extensions   File: ProjectServiceAsync.java   Source Code and License 2 votes vote down vote up
/**
 * @see ProjectService#save(String, long, String, String)
 */
void save(String sessionId, long projectId, String fileId, String source, AsyncCallback<Long> callback);