Package org.zanata.webtrans.client.presenter

Examples of org.zanata.webtrans.client.presenter.DocumentListPresenter


        Window.enableScrolling(true);
    }

    private void delayedStartApp() {
        final AppPresenter appPresenter = injector.getAppPresenter();
        final DocumentListPresenter documentListPresenter =
                injector.getDocumentListPresenter();
        RootPanel.get(CONTENT_DIV_ID).add(appPresenter.getDisplay().asWidget());
        appPresenter.bind();
        Window.enableScrolling(true);
        // eager load document list
        final EventBus eventBus = injector.getEventBus();

        GetDocumentList action =
                new GetDocumentList(injector.getLocation().getQueryDocuments());

        documentListPresenter.showLoading(true);
        final Stopwatch stopwatch = new Stopwatch().start();
        injector.getDispatcher().execute(action,
                new AsyncCallback<GetDocumentListResult>() {
                    @Override
                    public void onFailure(Throwable caught) {
                        eventBus.fireEvent(new NotificationEvent(
                                NotificationEvent.Severity.Error,
                                "Failed to load documents"));
                        documentListPresenter.showLoading(false);
                        stopwatch.stop();
                    }

                    @Override
                    public void onSuccess(GetDocumentListResult result) {
                        final List<DocumentInfo> documents =
                                result.getDocuments();
                        Log.info("Received doc list for "
                                + result.getProjectIterationId() + ": "
                                + documents.size()
                                + " elements, loading time: "
                                + stopwatch.elapsedMillis() + "ms");
                        documentListPresenter.setDocuments(documents);

                        History history = injector.getHistory();
                        history.addValueChangeHandler(injector
                                .getHistoryEventHandlerService());
                        Log.info("=========== now firing current history state =========== ");
                        history.fireCurrentHistoryState();

                        exceptionHandler.setAppPresenter(appPresenter);
                        exceptionHandler.setTargetContentsPresenter(injector
                                .getTargetContentsPresenter());

                        documentListPresenter.queryStats();
                        documentListPresenter.showLoading(false);
                        injector.getTransUnitSaveService().init();

                        stopwatch.stop();
                    }
                });
View Full Code Here

TOP

Related Classes of org.zanata.webtrans.client.presenter.DocumentListPresenter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.