Java 类com.google.gwt.user.client.rpc.AsyncCallback 实例源码

项目:EasyML    文件:HistoryPopupPanel.java   
/**
 * 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));
        }
    });
}
项目:unitimes    文件:FilterBox.java   
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);
            }
        });
}
项目:unitimes    文件:UniTimeMobileMenu.java   
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);
            }
        });
    }
}
项目:DocIT    文件:CompanyPanel.java   
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()));
        }
    });
}
项目:unitimes    文件:CourseCurriculaTable.java   
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);
        }
    });
}
项目:unitimes    文件:TeachingRequestsFilterBox.java   
@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));
            }
        });
    }
}
项目:unitimes    文件:SolverPage.java   
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());
                }
            });
        }
    });
}
项目:unitimes    文件:PeriodPreferencesWidget.java   
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);
        }
    });
}
项目:sig-seguimiento-vehiculos    文件:EnvelopeTool.java   
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();
        }
    });
}
项目:unitimes    文件:ReservationEdit.java   
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);
                }
            }
        });
    }
}
项目:appinventor-extensions    文件:TopToolbar.java   
/**
 * 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);
        }
      });
}
项目:unitimes    文件:TeachingRequestDetailPage.java   
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);
        }
    });
}
项目:sig-seguimiento-vehiculos    文件:Geoprocess.java   
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));              
        }
    };
}
项目:unitimes    文件:NotAssignedClassesPage.java   
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);
        }
    });
}
项目:unitimes    文件:EventFilterBox.java   
@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));
            }
        });
    }
}
项目:unitimes    文件:PeriodPreferencesHint.java   
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));
        }
    });
}
项目:unitimes    文件:ReservationEdit.java   
@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);
        }
    });
}
项目:unitimes    文件:RoomSharingHint.java   
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));
        }
    });
}
项目:unitimes    文件:SolverLogPage.java   
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);
            }
        }
    });
}
项目:unitimes    文件:UniTimeFileUpload.java   
@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) {
        }
    });
}
项目:sig-seguimiento-vehiculos    文件:CentroidTool.java   
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();
                }
            });
}
项目:unitimes    文件:FilterBox.java   
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();
            }
        }
    });
}
项目:EasyML    文件:AccountPresenter.java   
/**
 * 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());
        }

    });
}
项目:EasyML    文件:DatasetLoader.java   
/**
 * 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();                                   
            }
        }

    });
}
项目:unitimes    文件:PinDialog.java   
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);
        }
    });
}
项目:unitimes    文件:ScriptPage.java   
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);
        }
    });
}
项目:unitimes    文件:OnlineSectioningTest.java   
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);
        }
    });

}
项目:unitimes    文件:AssignedClassesPage.java   
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());
        }
    });
}
项目:unitimes    文件:RoomsPage.java   
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());
        }
    });
}
项目:unitimes    文件:PointInTimeDataReportsPage.java   
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());
        }
    });
}
项目:unitimes    文件:SavedHQLPage.java   
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());
        }
    });
}
项目:unitimes    文件:SectioningStatusPage.java   
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());
        }
    });
}
项目:EasyML    文件:ProgramDeprecateMenu.java   
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;
}
项目:unitimes    文件:FreeTimeParser.java   
@Override
public void getData(String source, AsyncCallback<List<FreeTime>> callback) {
    try {
        callback.onSuccess(parseFreeTime(source));
    } catch (IllegalArgumentException e) {
        callback.onFailure(e);
    }
}
项目:unitimes    文件:FilterBox.java   
@Override
public void getValues(List<Chip> chips, String text, AsyncCallback<Collection<Chip>> callback) {
    callback.onSuccess(iValues);
}
项目:DocIT    文件:ServiceAsync.java   
void cutEmployee(String employeeName, Double salary,
AsyncCallback<Double> callback);
项目:appinventor-extensions    文件:ComponentRenameWizard.java   
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) {

                }
            });
        }
    });
}
项目:unitimes    文件:SuggestionsBox.java   
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);
        }
    });
}
项目:unitimes    文件:SectioningReports.java   
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();
        }
    });
}
项目:unitimes    文件:UniTimeFilterBox.java   
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);
        }
    });
}