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

Commit

Permalink
Work in progress: fixing on bug: https://bugzilla.redhat.com/show_bug…
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Eng committed May 10, 2012
1 parent c5e540b commit ea2e877
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 8 deletions.
Expand Up @@ -146,6 +146,8 @@ public interface Display extends WidgetDisplay, HasPageNavigation
void setTransUnitDetails(TransUnit selectedTransUnit);

boolean isProcessing();

void ignoreStopProcessing();
}

private DocumentId documentId;
Expand Down Expand Up @@ -317,7 +319,6 @@ public void onFindMessage(FindMessageEvent event)
Log.info("cancelling selection");
display.getTargetCellEditor().clearSelection();
}
display.startProcessing();
findMessage = event.getMessage();
display.setFindMessage(findMessage);
if (selectedTransUnit != null)
Expand Down Expand Up @@ -563,19 +564,25 @@ public void requestRows(final Request request, final Callback<TransUnit> callbac
{
int numRows = request.getNumRows();
int startRow = request.getStartRow();
Log.info("Table requesting " + numRows + " starting from " + startRow);

if (documentId == null)
{
callback.onFailure(new RuntimeException("No DocumentId"));
return;
}
Log.info("Table requesting " + numRows + " starting from " + startRow);

display.startProcessing();
if (display.isProcessing())
{
display.ignoreStopProcessing();
}
else
{
display.startProcessing();
}

dispatcher.execute(new GetTransUnitList(documentId, startRow, numRows, findMessage, filterViewConfirmationPanel.isFilterTranslated(), filterViewConfirmationPanel.isFilterNeedReview(), filterViewConfirmationPanel.isFilterUntranslated(), targetTransUnitId), new AsyncCallback<GetTransUnitListResult>()
{

@Override
public void onSuccess(GetTransUnitListResult result)
{
Expand All @@ -585,7 +592,6 @@ public void onSuccess(GetTransUnitListResult result)
Log.info("Got " + result.getUnits().size() + " rows back of " + result.getTotalCount() + " available");
callback.onRowsReady(request, response);
display.getTableModel().setRowCount(result.getTotalCount());
display.stopProcessing();

int gotoRow = curRowIndex;

Expand All @@ -597,6 +603,7 @@ public void onSuccess(GetTransUnitListResult result)
}
tableModelHandler.gotoRow(gotoRow, false);
}
display.stopProcessing();
}

@Override
Expand Down Expand Up @@ -1119,7 +1126,7 @@ private void loadDocument(DocumentId selectDocId)
{
if (!selectDocId.equals(documentId))
{
display.startProcessing();
// display.startProcessing();
documentId = selectDocId;
initialiseTransUnitList();
}
Expand Down
Expand Up @@ -33,6 +33,7 @@
import org.zanata.webtrans.shared.model.TransUnit;
import org.zanata.webtrans.shared.model.WorkspaceContext;

import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.dom.client.Element;
import com.google.gwt.event.logical.shared.HasSelectionHandlers;
import com.google.gwt.event.logical.shared.SelectionEvent;
Expand Down Expand Up @@ -69,6 +70,7 @@ public TableEditorView(NavigationMessages messages, EventBus eventBus, Workspace
{
this(messages, new RedirectingTableModel<TransUnit>(), eventBus, workspaceContext, sourceContentsPresenter, targetContentsPresenter);
loadingPanel = new LoadingPanel(resources);
loadingPanel.hide();
}

private TableEditorView(NavigationMessages messages, RedirectingTableModel<TransUnit> tableModel, EventBus eventBus, WorkspaceContext workspaceContext, final SourceContentsPresenter sourceContentsPresenter, TargetContentsPresenter targetContentsPresenter)
Expand Down Expand Up @@ -140,6 +142,14 @@ public Widget asWidget()
return this;
}

private int ignoreStopProcessingCount = 0;

@Override
public void ignoreStopProcessing()
{
ignoreStopProcessingCount++;
}

@Override
public void startProcessing()
{
Expand All @@ -150,8 +160,15 @@ public void startProcessing()
@Override
public void stopProcessing()
{
setVisible(true);
loadingPanel.hide();
if (ignoreStopProcessingCount == 0)
{
setVisible(true);
loadingPanel.hide();
}
else
{
ignoreStopProcessingCount--;
}
}

@Override
Expand Down

0 comments on commit ea2e877

Please sign in to comment.