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

Commit

Permalink
Fix TransUnit Edit event, updating translator info when moved to diff…
Browse files Browse the repository at this point in the history
…erent row
  • Loading branch information
Alex Eng committed May 15, 2012
1 parent ec738f0 commit b75f1b1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Expand Up @@ -49,6 +49,7 @@
import org.zanata.webtrans.client.presenter.UserConfigHolder;
import org.zanata.webtrans.client.presenter.WorkspaceUsersPresenter;
import org.zanata.webtrans.client.resources.TableEditorMessages;
import org.zanata.webtrans.client.rpc.CachingDispatchAsync;
import org.zanata.webtrans.client.ui.ToggleEditor;
import org.zanata.webtrans.client.ui.ToggleEditor.ViewMode;
import org.zanata.webtrans.client.ui.ValidationMessagePanelDisplay;
Expand All @@ -58,12 +59,15 @@
import org.zanata.webtrans.shared.model.TransUnitId;
import org.zanata.webtrans.shared.model.UserPanelSessionItem;
import org.zanata.webtrans.shared.model.WorkspaceContext;
import org.zanata.webtrans.shared.rpc.TransUnitEditAction;
import org.zanata.webtrans.shared.rpc.TransUnitEditResult;

import com.allen_sauer.gwt.log.client.Log;
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.event.dom.client.KeyDownEvent;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.inject.Inject;
import com.google.inject.Singleton;

Expand All @@ -90,6 +94,7 @@ public class TargetContentsPresenter implements TargetContentsDisplay.Listener,
private ArrayList<ToggleEditor> currentEditors;
private TransUnitsEditModel cellEditor;


private final Identity identity;

@Inject
Expand Down Expand Up @@ -145,7 +150,6 @@ public void showEditors(int rowIndex, int editorIndex)
editor.clearTranslatorList();
validate(editor);
}

if (configHolder.isDisplayButtons())
{
currentDisplay.showButtons(true);
Expand Down Expand Up @@ -184,9 +188,9 @@ public void onTransUnitEdit(final TransUnitEditEvent event)

private void updateEditorTranslatorList(TransUnitId selectedTransUnitId, Person person, String sessionId)
{
if (cellEditor.getTargetCell() != null && cellEditor.getTargetCell().getId().equals(selectedTransUnitId))
if (cellEditor.getTargetCell() != null)
{
if (!sessionId.equals(identity.getSessionId().toString()))
if (!sessionId.equals(identity.getSessionId().toString()) && cellEditor.getTargetCell().getId().equals(selectedTransUnitId))
{
for (ToggleEditor editor : currentEditors)
{
Expand Down
Expand Up @@ -59,6 +59,7 @@
import org.zanata.webtrans.client.presenter.WorkspaceUsersPresenter;
import org.zanata.webtrans.client.resources.NavigationMessages;
import org.zanata.webtrans.client.resources.TableEditorMessages;
import org.zanata.webtrans.client.rpc.CachingDispatchAsync;
import org.zanata.webtrans.client.ui.ToggleEditor;
import org.zanata.webtrans.client.ui.ValidationMessagePanelDisplay;
import org.zanata.webtrans.shared.auth.Identity;
Expand Down Expand Up @@ -94,10 +95,12 @@ public class TargetContentsPresenterTest
@Mock private TransUnit transUnit;
@Mock private UserConfigHolder configHolder;
@Mock private TransUnitsEditModel cellEditor;

private final ArrayList<String> targetContents = Lists.newArrayList("", "");
@Captor private ArgumentCaptor<RunValidationEvent> runValidationEventCaptor;
@Captor private ArgumentCaptor<NotificationEvent> notificationEventCaptor;


@BeforeMethod
public void beforeMethod()
{
Expand Down

0 comments on commit b75f1b1

Please sign in to comment.