Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Merge pull request #375 from zanata/rhbz1064628
Browse files Browse the repository at this point in the history
Fix on project stats in editor not updated during translation
  • Loading branch information
carlosmunoz committed Feb 13, 2014
2 parents d483df9 + 5a12034 commit 9c46eb0
Showing 1 changed file with 17 additions and 10 deletions.
Expand Up @@ -20,11 +20,6 @@
*/
package org.zanata.webtrans.client.presenter;

import net.customware.gwt.presenter.client.EventBus;
import net.customware.gwt.presenter.client.PresenterRevealedEvent;
import net.customware.gwt.presenter.client.PresenterRevealedHandler;
import net.customware.gwt.presenter.client.widget.WidgetPresenter;

import org.zanata.common.LocaleId;
import org.zanata.common.TransUnitCount;
import org.zanata.common.TransUnitWords;
Expand Down Expand Up @@ -59,12 +54,17 @@
import org.zanata.webtrans.shared.model.DocumentId;
import org.zanata.webtrans.shared.model.DocumentInfo;
import org.zanata.webtrans.shared.model.UserWorkspaceContext;

import com.allen_sauer.gwt.log.client.Log;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.google.gwt.core.client.GWT;
import com.google.inject.Inject;

import net.customware.gwt.presenter.client.EventBus;
import net.customware.gwt.presenter.client.PresenterRevealedEvent;
import net.customware.gwt.presenter.client.PresenterRevealedHandler;
import net.customware.gwt.presenter.client.widget.WidgetPresenter;

public class AppPresenter extends WidgetPresenter<AppDisplay> implements
ShowSideMenuEventHandler, WorkspaceContextUpdateEventHandler,
DocumentStatsUpdatedEventHandler, PresenterRevealedHandler,
Expand Down Expand Up @@ -128,14 +128,19 @@ public AppPresenter(AppDisplay display, EventBus eventBus,
.getLocaleId();

projectStats = new ContainerTranslationStatistics();
projectStats.addStats(new TranslationStatistics(new TransUnitCount(0,
0, 0), localeId.getId()));
projectStats.addStats(new TranslationStatistics(new TransUnitWords(0,
0, 0), localeId.getId()));
resetProjectStats();

display.setListener(this);
}

private void resetProjectStats() {
projectStats.setStats(Lists.newArrayList(
new TranslationStatistics(new TransUnitCount(0, 0, 0), localeId
.getId()),
new TranslationStatistics(new TransUnitWords(0, 0, 0), localeId
.getId())));
}

@Override
protected void onBind() {
keyShortcutPresenter.bind();
Expand Down Expand Up @@ -446,6 +451,8 @@ public void onAttentionModeActivationChanged(

@Override
public void onProjectStatsUpdated(RefreshProjectStatsEvent event) {
resetProjectStats();

for (DocumentNode documentNode : event.getDocumentNodes()) {
ContainerTranslationStatistics statsContainer =
documentNode.getDocInfo().getStats();
Expand Down

0 comments on commit 9c46eb0

Please sign in to comment.