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

Commit

Permalink
rhbz844820 - making save and move to next working
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Huang committed Aug 23, 2012
1 parent e20ffe1 commit 553edb8
Show file tree
Hide file tree
Showing 13 changed files with 210 additions and 189 deletions.
Expand Up @@ -45,8 +45,6 @@
import org.zanata.webtrans.client.events.NavTransUnitHandler;
import org.zanata.webtrans.client.events.NotificationEvent;
import org.zanata.webtrans.client.events.NotificationEvent.Severity;
import org.zanata.webtrans.client.events.OpenEditorEvent;
import org.zanata.webtrans.client.events.OpenEditorEventHandler;
import org.zanata.webtrans.client.events.TransUnitEditEvent;
import org.zanata.webtrans.client.events.TransUnitEditEventHandler;
import org.zanata.webtrans.client.events.TransUnitSelectionEvent;
Expand Down Expand Up @@ -480,15 +478,6 @@ public void onNavTransUnit(NavTransUnitEvent event)
}
}));

registerHandler(eventBus.addHandler(OpenEditorEvent.getType(), new OpenEditorEventHandler()
{
@Override
public void onOpenEditor(OpenEditorEvent event)
{
tableModelHandler.gotoRowInCurrentPage(event.getRowNum(), true);
}
}));

registerHandler(eventBus.addHandler(TransUnitEditEvent.getType(), new TransUnitEditEventHandler()
{
@Override
Expand Down
Expand Up @@ -46,6 +46,7 @@
import org.zanata.webtrans.client.events.TransMemoryShortcutCopyEvent;
import org.zanata.webtrans.client.events.TransUnitEditEvent;
import org.zanata.webtrans.client.events.TransUnitEditEventHandler;
import org.zanata.webtrans.client.events.TransUnitSaveEvent;
import org.zanata.webtrans.client.events.UserConfigChangeEvent;
import org.zanata.webtrans.client.events.UserConfigChangeHandler;
import org.zanata.webtrans.client.keys.KeyShortcut;
Expand Down Expand Up @@ -346,7 +347,6 @@ public void setToViewMode()
currentDisplay.setToView();
currentDisplay.showButtons(false);
}
concealDisplay();
}

private void fireTransUnitEditAction()
Expand Down Expand Up @@ -379,11 +379,7 @@ public void showEditors(int editorIndex)

fireTransUnitEditAction();

if (editorIndex != NO_OPEN_EDITOR)
{
currentEditorIndex = editorIndex;
}
else if (currentEditorIndex == LAST_INDEX)
if (currentEditorIndex == LAST_INDEX)
{
currentEditorIndex = currentEditors.size() - 1;
}
Expand All @@ -392,6 +388,7 @@ else if (currentEditorIndex == LAST_INDEX)
currentEditorIndex = 0;
}

//TODO remove this if
if (currentEditorIndex != NO_OPEN_EDITOR && currentEditorIndex < currentEditors.size())
{
validationMessagePanel.clear();
Expand Down Expand Up @@ -495,17 +492,18 @@ protected void moveNext(boolean forceSave)
currentEditorIndex = 0;
if (forceSave)
{
cellEditor.acceptEdit();
cellEditor.setRowValueOverride(cellEditor.getCurrentRow(), cellEditor.getTargetCell());
eventBus.fireEvent(new TransUnitSaveEvent(getNewTargets(), ContentState.Approved));
// cellEditor.acceptEdit();
// cellEditor.setRowValueOverride(cellEditor.getCurrentRow(), cellEditor.getTargetCell());
}
scheduler.scheduleDeferred(new Scheduler.ScheduledCommand()
{
@Override
public void execute()
{
cellEditor.saveAndMoveRow(NavTransUnitEvent.NavigationType.NextEntry);
}
});
// scheduler.scheduleDeferred(new Scheduler.ScheduledCommand()
// {
// @Override
// public void execute()
// {
// cellEditor.saveAndMoveRow(NavTransUnitEvent.NavigationType.NextEntry);
// }
// });
}
}

Expand Down
Expand Up @@ -39,7 +39,7 @@
</g:FlowPanel>
</g:cell>
<g:cell verticalAlignment="ALIGN_TOP" horizontalAlignment="ALIGN_RIGHT" width="100px">
<g:HorizontalPanel ui:field="buttons" styleName="gwt-Button" visible="false">
<g:HorizontalPanel ui:field="buttons" styleName="gwt-Button">
<g:SimplePanel ui:field="undoContainer" styleName="{style.undoContainer}" />
<g:PushButton ui:field="saveButton" styleName="gwt-Button" title="{messages.editSaveShortcut}">
<g:upFace image="{images.cellEditorAccept}" />
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

@@ -0,0 +1,64 @@
/*
* Copyright 2012, Red Hat, Inc. and individual contributors as indicated by the
* @author tags. See the copyright.txt file in the distribution for a full
* listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this software; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
* site: http://www.fsf.org.
*/

package org.zanata.webtrans.client.events;

import java.util.List;

import org.zanata.common.ContentState;
import com.google.common.collect.Lists;
import com.google.gwt.event.shared.GwtEvent;

/**
* @author Patrick Huang <a href="mailto:pahuang@redhat.com">pahuang@redhat.com</a>
*/
public class TransUnitSaveEvent extends GwtEvent<TransUnitSaveEventHandler>
{
public static Type<TransUnitSaveEventHandler> TYPE = new Type<TransUnitSaveEventHandler>();
private List<String> targets = Lists.newArrayList();
private ContentState status;

public TransUnitSaveEvent(List<String> targets, ContentState status)
{
this.targets = targets;
this.status = status;
}

public Type<TransUnitSaveEventHandler> getAssociatedType()
{
return TYPE;
}

protected void dispatch(TransUnitSaveEventHandler handler)
{
handler.onTransUnitSave(this);
}

public List<String> getTargets()
{
return targets;
}

public ContentState getStatus()
{
return status;
}
}
@@ -0,0 +1,29 @@
/*
* Copyright 2012, Red Hat, Inc. and individual contributors as indicated by the
* @author tags. See the copyright.txt file in the distribution for a full
* listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this software; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
* site: http://www.fsf.org.
*/

package org.zanata.webtrans.client.events;

import com.google.gwt.event.shared.EventHandler;

public interface TransUnitSaveEventHandler extends EventHandler
{
void onTransUnitSave(TransUnitSaveEvent event);
}

0 comments on commit 553edb8

Please sign in to comment.