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

Commit

Permalink
Merge branch 'rhbz743134' into 1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Eng committed Oct 6, 2011
2 parents c0c3db8 + 82a9ca1 commit 75848f4
Show file tree
Hide file tree
Showing 22 changed files with 666 additions and 98 deletions.
2 changes: 1 addition & 1 deletion server/zanata-war/eclipse/launch/webtrans-dummy.launch
Expand Up @@ -20,7 +20,7 @@
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="com.google.gwt.eclipse.core.moduleClasspathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="com.google.gdt.eclipse.maven.mavenClasspathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.google.gwt.dev.DevMode"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-codeServerPort 9998 -war &quot;${project_loc:/zanata-war}/src/main/webapp&quot; -remoteUI &quot;${gwt_remote_ui_server_port}:${unique_id}&quot; -startupUrl webtrans/Application.html?project=sample-project&amp;iteration=1.0&amp;localeId=de -logLevel INFO -port 48881 org.zanata.webtrans.ApplicationDummy"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="zanata-war"/>
Expand Down
2 changes: 1 addition & 1 deletion server/zanata-war/eclipse/launch/webtrans-jboss.launch
Expand Up @@ -21,7 +21,7 @@
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="com.google.gwt.eclipse.core.moduleClasspathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="com.google.gdt.eclipse.maven.mavenClasspathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.google.gwt.dev.DevMode"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-codeServerPort 9997 -war &quot;${deploy.zanata}&quot; -remoteUI &quot;${gwt_remote_ui_server_port}:${unique_id}&quot; -startupUrl http://localhost:8080/zanata/webtrans/Application.html?project=sample-project&amp;iteration=1.0&amp;localeId=de -logLevel INFO -noserver org.zanata.webtrans.Application"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="zanata-war"/>
Expand Down
Expand Up @@ -45,6 +45,9 @@ public interface Resources extends ClientBundle
@Source("org/zanata/webtrans/images/crystal_project/_16x16/actions/rightArrow.png")
ImageResource rightArrowButton();

@Source("org/zanata/webtrans/images/crystal_project/_16x16/actions/configure.png")
ImageResource configureButton();

@Source("org/zanata/webtrans/images/banner_bg.png")
DataResource bannerBackground();

Expand Down
Expand Up @@ -20,19 +20,25 @@
*/
package org.zanata.webtrans.client;

import java.util.Map;

import net.customware.gwt.presenter.client.EventBus;
import net.customware.gwt.presenter.client.widget.WidgetDisplay;
import net.customware.gwt.presenter.client.widget.WidgetPresenter;

import org.zanata.common.ContentState;
import org.zanata.webtrans.client.editor.table.TableConstants;
import org.zanata.webtrans.client.events.NavTransUnitEvent;
import org.zanata.webtrans.client.events.NavTransUnitEvent.NavigationType;
import org.zanata.webtrans.client.events.NavTransUnitHandler;
import org.zanata.webtrans.client.ui.ShortcutConfigPanel;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.ui.Widget;
import com.google.inject.Inject;

public class TransUnitNavigationPresenter extends WidgetPresenter<TransUnitNavigationPresenter.Display> implements HasNavTransUnitHandlers
Expand All @@ -47,6 +53,12 @@ public interface Display extends WidgetDisplay
HasClickHandlers getPrevFuzzyOrUntranslatedButton();

HasClickHandlers getNextFuzzyOrUntranslatedButton();

HasClickHandlers getConfigureButton();

Widget getConfigureButtonObject();

void setNavModeTooltip(Map<ContentState, Boolean> configMap);
}

@Inject
Expand All @@ -55,6 +67,8 @@ public TransUnitNavigationPresenter(Display display, EventBus eventBus)
super(display, eventBus);
}

final ShortcutConfigPanel shortcutConfigPanel = new ShortcutConfigPanel(true, eventBus);

@Override
protected void onBind()
{
Expand Down Expand Up @@ -94,6 +108,15 @@ public void onClick(ClickEvent event)
}
});

display.getConfigureButton().addClickHandler(new ClickHandler()
{
@Override
public void onClick(ClickEvent event)
{
shortcutConfigPanel.toggleDisplay(display.getConfigureButtonObject());
}
});

}

@Override
Expand Down
Expand Up @@ -20,6 +20,9 @@
*/
package org.zanata.webtrans.client;

import java.util.Map;

import org.zanata.common.ContentState;
import org.zanata.webtrans.client.editor.table.NavigationMessages;

import com.google.gwt.core.client.GWT;
Expand All @@ -41,7 +44,7 @@ interface TransUnitNavigationViewUiBinder extends UiBinder<Widget, TransUnitNavi
}

@UiField
Image nextEntry, prevEntry, prevFuzzyOrUntranslated, nextFuzzyOrUntranslated;
Image nextEntry, prevEntry, prevFuzzyOrUntranslated, nextFuzzyOrUntranslated, configure;

private final NavigationMessages messages;

Expand All @@ -57,6 +60,43 @@ public TransUnitNavigationView(final NavigationMessages messages, final Resource

prevEntry.setTitle(messages.actionToolTip(messages.prevEntry(), messages.prevEntryShortcut()));
nextEntry.setTitle(messages.actionToolTip(messages.nextEntry(), messages.nextEntryShortcut()));
setFuzzyAndUntranslatedModeTooltip();
configure.setTitle(messages.configurationButton());
}

public void setNavModeTooltip(Map<ContentState, Boolean> configMap)
{
boolean isFuzzy = configMap.get(ContentState.NeedReview);
boolean isUntranslated = configMap.get(ContentState.New);

if (isFuzzy && !isUntranslated)
{
setFuzzyModeTooltip();
}
else if (isUntranslated && !isFuzzy)
{
setUntranslatedModeTooltip();
}
else
{
setFuzzyAndUntranslatedModeTooltip();
}
}

private void setFuzzyModeTooltip()
{
prevFuzzyOrUntranslated.setTitle(messages.actionToolTip(messages.prevFuzzy(), messages.prevFuzzyOrUntranslatedShortcut()));
nextFuzzyOrUntranslated.setTitle(messages.actionToolTip(messages.nextFuzzy(), messages.nextFuzzyOrUntranslatedShortcut()));
}

private void setUntranslatedModeTooltip()
{
prevFuzzyOrUntranslated.setTitle(messages.actionToolTip(messages.prevUntranslated(), messages.prevFuzzyOrUntranslatedShortcut()));
nextFuzzyOrUntranslated.setTitle(messages.actionToolTip(messages.nextUntranslated(), messages.nextFuzzyOrUntranslatedShortcut()));
}

private void setFuzzyAndUntranslatedModeTooltip()
{
prevFuzzyOrUntranslated.setTitle(messages.actionToolTip(messages.prevFuzzyOrUntranslated(), messages.prevFuzzyOrUntranslatedShortcut()));
nextFuzzyOrUntranslated.setTitle(messages.actionToolTip(messages.nextFuzzyOrUntranslated(), messages.nextFuzzyOrUntranslatedShortcut()));
}
Expand Down Expand Up @@ -92,4 +132,16 @@ public Widget asWidget()
return this;
}

@Override
public HasClickHandlers getConfigureButton()
{
return configure;
}

@Override
public Widget getConfigureButtonObject()
{
return configure;
}

}
Expand Up @@ -11,6 +11,7 @@
<nobr>
<g:Image resource="{resources.prevUntranslated}" ui:field="prevFuzzyOrUntranslated" styleName="{style.imageAnchor}"/>
<g:Image resource="{resources.prevEntry}" ui:field="prevEntry" styleName="{style.imageAnchor}"/>
<g:Image resource="{resources.configureButton}" ui:field="configure" styleName="{style.imageAnchor}"/>
<g:Image resource="{resources.nextEntry}" ui:field="nextEntry" styleName="{style.imageAnchor}"/>
<g:Image resource="{resources.nextUntranslated}" ui:field="nextFuzzyOrUntranslated" styleName="{style.imageAnchor}"/>
</nobr>
Expand Down
Expand Up @@ -32,10 +32,13 @@
import org.zanata.webtrans.client.editor.table.TableEditorPresenter;
import org.zanata.webtrans.client.events.DocumentSelectionEvent;
import org.zanata.webtrans.client.events.DocumentSelectionHandler;
import org.zanata.webtrans.client.events.NavConfigChangeEvent;
import org.zanata.webtrans.client.events.NavConfigChangeHandler;
import org.zanata.webtrans.client.events.TransUnitUpdatedEvent;
import org.zanata.webtrans.client.events.TransUnitUpdatedEventHandler;
import org.zanata.webtrans.client.rpc.CachingDispatchAsync;
import org.zanata.webtrans.client.ui.HasPager;
import org.zanata.webtrans.client.ui.ShortcutConfigPanel;
import org.zanata.webtrans.shared.model.DocumentId;
import org.zanata.webtrans.shared.model.DocumentInfo;
import org.zanata.webtrans.shared.model.TransUnit;
Expand Down Expand Up @@ -150,6 +153,16 @@ public void onDocumentSelected(DocumentSelectionEvent event)
}
}));
registerHandler(eventBus.addHandler(TransUnitUpdatedEvent.getType(), updateHandler));

registerHandler(eventBus.addHandler(NavConfigChangeEvent.getType(), new NavConfigChangeHandler()
{
@Override
public void onValueChanged(NavConfigChangeEvent event)
{
transUnitNavigationPresenter.getDisplay().setNavModeTooltip(event.getConfigMap());
tableEditorPresenter.getDisplay().getTargetCellEditor().setNavMode(event.getConfigMap());
}
}));
}

private void requestStatusCount(final DocumentId newDocumentId)
Expand Down
Expand Up @@ -7,7 +7,15 @@ public interface EditRowCallback

void gotoPrevRow(int row);

void gotoNextFuzzy(int row);
void gotoNextFuzzyNewRow(int row);

void gotoPrevFuzzy(int row);
void gotoPrevFuzzyNewRow(int row);

void gotoNextFuzzyRow(int row);

void gotoPrevFuzzyRow(int row);

void gotoNextNewRow(int row);

void gotoPrevNewRow(int row);
}
Expand Up @@ -20,6 +20,8 @@
*/
package org.zanata.webtrans.client.editor.table;

import java.util.Map;

import net.customware.gwt.presenter.client.EventBus;

import org.zanata.common.ContentState;
Expand Down Expand Up @@ -255,12 +257,12 @@ else if (event.isAltKeyDown() && (event.isUpArrow() || keyCode == TableConstants
else if (event.isAltKeyDown() && keyCode == KeyCodes.KEY_PAGEDOWN)
{
// alt-pagedown
saveAndMoveNextFuzzy(NavigationType.NextEntry);
saveAndMoveNextState(NavigationType.NextEntry);
}
else if (event.isAltKeyDown() && keyCode == KeyCodes.KEY_PAGEUP)
{
// alt-pageup
saveAndMoveNextFuzzy(NavigationType.PrevEntry);
saveAndMoveNextState(NavigationType.PrevEntry);
}
else if (!event.isAltKeyDown() && !event.isControlKeyDown())
{
Expand Down Expand Up @@ -311,7 +313,7 @@ else if (!event.isAltKeyDown() && !event.isControlKeyDown())

Image fuzzyButton = new Image(images.cellEditorFuzzy());
fuzzyButton.setStyleName("gwt-Button");
fuzzyButton.setTitle(messages.fuzzy());
fuzzyButton.setTitle(messages.saveAsFuzzy());
fuzzyButton.addClickHandler(fuzzyHandler);

operationsPanel.add(saveButton);
Expand All @@ -332,15 +334,39 @@ else if (nav == NavigationType.PrevEntry)
}
}

private void gotoNewRow(NavigationType nav)
{
if (nav == NavigationType.NextEntry)
{
editRowCallback.gotoNextNewRow(curRow);
}
else if (nav == NavigationType.PrevEntry)
{
editRowCallback.gotoPrevNewRow(curRow);
}
}

private void gotoFuzzyAndNewRow(NavigationType nav)
{
if (nav == NavigationType.NextEntry)
{
editRowCallback.gotoNextFuzzyNewRow(curRow);
}
else if (nav == NavigationType.PrevEntry)
{
editRowCallback.gotoPrevFuzzyNewRow(curRow);
}
}

private void gotoFuzzyRow(NavigationType nav)
{
if (nav == NavigationType.NextEntry)
{
editRowCallback.gotoNextFuzzy(curRow);
editRowCallback.gotoNextFuzzyRow(curRow);
}
else if (nav == NavigationType.PrevEntry)
{
editRowCallback.gotoPrevFuzzy(curRow);
editRowCallback.gotoPrevFuzzyRow(curRow);
}
}

Expand Down Expand Up @@ -440,10 +466,24 @@ public void savePendingChange(boolean cancelIfUnchanged)
}
}

public void saveAndMoveNextFuzzy(NavigationType nav)
private boolean newMode = true, fuzzyMode = true;

public void saveAndMoveNextState(NavigationType nav)
{
savePendingChange(true);
gotoFuzzyRow(nav);

if (newMode && fuzzyMode)
{
gotoFuzzyAndNewRow(nav);
}
else if (newMode)
{
gotoNewRow(nav);
}
else if (fuzzyMode)
{
gotoFuzzyRow(nav);
}
}

/**
Expand Down Expand Up @@ -569,4 +609,10 @@ public void autoSize()
textArea.setVisibleLines(textArea.getVisibleLines() + growByLines);
}
}

public void setNavMode(Map<ContentState, Boolean> configMap)
{
newMode = configMap.get(ContentState.New);
fuzzyMode = configMap.get(ContentState.NeedReview);
}
}
Expand Up @@ -23,7 +23,7 @@

public interface NavigationCacheCallback
{
void nextFuzzy();
void next(boolean isNewState, boolean isFuzzyState);

void prevFuzzy();
void prev(boolean isNewState, boolean isFuzzyState);
}
Expand Up @@ -44,6 +44,15 @@ public interface NavigationMessages extends Messages
@DefaultMessage("Next Fuzzy")
String nextFuzzy();

@DefaultMessage("Prev Fuzzy")
String prevFuzzy();

@DefaultMessage("Next Untranslated")
String nextUntranslated();

@DefaultMessage("Prev Untranslated")
String prevUntranslated();

@DefaultMessage("Next Fuzzy or Untranslated")
String nextFuzzyOrUntranslated();

Expand All @@ -62,6 +71,9 @@ public interface NavigationMessages extends Messages
@DefaultMessage("Cancel")
String editCancelShortcut();

@DefaultMessage("Configure navigation shortcut key")
String configurationButton();

// @DefaultMessage("Copy")
// String editClone();

Expand All @@ -83,7 +95,7 @@ public interface NavigationMessages extends Messages
String actionToolTip(String actionName, String shortcut);

@DefaultMessage("Save as Fuzzy (Ctrl+S)")
String fuzzy();
String saveAsFuzzy();

@DefaultMessage("Source comment: ")
String sourceCommentLabel();
Expand Down

0 comments on commit 75848f4

Please sign in to comment.