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

Commit

Permalink
More updates from code review.
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlos A. Munoz committed Jul 29, 2013
1 parent 2d425b0 commit d3f7714
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 21 deletions.
Expand Up @@ -58,7 +58,7 @@ public class TransMemoryAdapter
private TransMemoryDAO transMemoryDAO;

/**
* Returns an effect function that persists the header elements when
* Persists the header elements when
* encountered while parsing. This modifies the translation memory fields and
* metadata.
*/
Expand All @@ -69,7 +69,7 @@ public void persistHeader(TransMemory tm, Element headerElem)
}

/**
* Returns an effect function that persists a translation unit when a <tu>
* Persists a translation unit when a <tu>
* element is encountered while parsing.
*/
public void persistTransUnit(TransMemory tm, Element tuElem)
Expand Down Expand Up @@ -125,13 +125,13 @@ private String determineUniqueId(TransMemoryUnit tu)
String srcLang = tu.getSourceLanguage() != null ? tu.getSourceLanguage() : tu.getTranslationMemory().getSourceLanguage();
if (srcLang != null)
{
// source lang is *all*
if (srcLang.equalsIgnoreCase("*all*"))
{
srcLang = tu.getSourceLanguage();
if (srcLang == null || srcLang.equalsIgnoreCase("*all*"))
{
throw new RuntimeException("Source language cannot be determined for Translation unit. " + "It must be defined either in the <tu> or the <header> element.");
throw new RuntimeException("Source language cannot be determined for Translation unit. "
+ "It must be defined either in the <tu> or the <header> element.");
}
}

Expand Down
Expand Up @@ -152,24 +152,26 @@ public void onSelectionChange(String groupName, MergeOption option)
switch (optionType)
{
case PROJECT_MISMATCH:
differentProjectStatus.setText(mergeStatusRenderer.render(option));
differentProjectStatus.setStyleName(resolveStyle(option));
setTextAndStyle(differentProjectStatus, option);
break;
case DOC_ID_MISMATCH:
differentDocIdStatus.setText(mergeStatusRenderer.render(option));
differentDocIdStatus.setStyleName(resolveStyle(option));
setTextAndStyle(differentDocIdStatus, option);
break;
case CTX_MISMATCH:
differentContextStatus.setText(mergeStatusRenderer.render(option));
differentContextStatus.setStyleName(resolveStyle(option));
setTextAndStyle(differentContextStatus, option);
break;
case IMPORTED_MATCH:
importedMatchStatus.setText(mergeStatusRenderer.render(option));
importedMatchStatus.setStyleName(resolveStyle(option));
setTextAndStyle(importedMatchStatus, option);
break;
}
}

private void setTextAndStyle(InlineLabel label, MergeOption option)
{
label.setText(mergeStatusRenderer.render(option));
label.setStyleName(resolveStyle(option));
}

private String resolveStyle(MergeOption option)
{
switch (option)
Expand Down
Expand Up @@ -27,10 +27,6 @@
import java.util.List;
import java.util.Map;

import lombok.extern.slf4j.Slf4j;
import net.customware.gwt.dispatch.server.ExecutionContext;
import net.customware.gwt.dispatch.shared.ActionException;

import org.apache.lucene.queryParser.ParseException;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.In;
Expand All @@ -51,14 +47,16 @@
import org.zanata.webtrans.server.ActionHandlerFor;
import org.zanata.webtrans.shared.model.TransMemoryQuery;
import org.zanata.webtrans.shared.model.TransMemoryResultItem;
import org.zanata.webtrans.shared.model.TransMemoryResultItem.MatchType;
import org.zanata.webtrans.shared.rpc.GetTranslationMemory;
import org.zanata.webtrans.shared.rpc.GetTranslationMemoryResult;
import org.zanata.webtrans.shared.rpc.HasSearchType.SearchType;

import com.google.common.base.Objects;
import com.google.common.collect.Lists;

import org.zanata.webtrans.shared.model.TransMemoryResultItem.MatchType;
import lombok.extern.slf4j.Slf4j;
import net.customware.gwt.dispatch.server.ExecutionContext;
import net.customware.gwt.dispatch.shared.ActionException;

@Name("webtrans.gwt.GetTransMemoryHandler")
@Scope(ScopeType.STATELESS)
Expand Down
Expand Up @@ -185,7 +185,6 @@ private TransUnitUpdateRequest createRequest(TransMemoryMerge action, HLocale hL
TransMemoryDetails tmDetail = getTransMemoryDetailsHandler.getTransMemoryDetail(hLocale, tmSource);
statusToSet = TransMemoryMergeStatusResolver.newInstance().workOutStatus(action, hTextFlowToBeFilled,
tmDetail, tmResult, oldTarget);
//statusToSet is null means we need to skip/reject the auto translation
comment = buildTargetComment(tmDetail);
}

Expand Down
2 changes: 1 addition & 1 deletion zanata-war/src/main/webapp/tm/home.xhtml
Expand Up @@ -97,7 +97,7 @@
</ui:define>

<ui:define name="center_content" >
<!-- Simply needed to load jQuery -->
<ui:remove><!-- Simply needed to load jQuery --></ui:remove>
<rich:jQuery query="jquery" />

<s:decorate id="main_content">
Expand Down
2 changes: 1 addition & 1 deletion zanata-war/src/test/java/org/zanata/tmx/TMXParserTest.java
Expand Up @@ -142,7 +142,7 @@ public void mergeSameTM() throws Exception
}

@Test
public void mergeComplimentaryTM() throws Exception
public void mergeComplementaryTM() throws Exception
{
// Initial load
TransMemory tm = parseAndSaveTMFromFile("/tmx/default-valid-tm.tmx");
Expand Down

0 comments on commit d3f7714

Please sign in to comment.