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

Commit

Permalink
Merge branch 'integration/master' of github.com:zanata/zanata into in…
Browse files Browse the repository at this point in the history
…tegration/master
  • Loading branch information
alex-sl-eng committed May 10, 2012
2 parents c71123d + a9e0340 commit f89fd33
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public boolean validateSlug(String slug, String componentId)

public boolean isSlugAvailable(String slug)
{
return slugEntityServiceImpl.isSlugAvailable(slug, HProjectIteration.class);
return slugEntityServiceImpl.isProjectIterationSlugAvailable(slug, projectSlug);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,13 @@ public interface SlugEntityService
*/
boolean isSlugAvailable(String slug, Class<? extends SlugEntityBase> cls);


/**
* Determines if a given slug is available for a project iteration.
*
* @param slug The slug to check
* @param projectSlug The project slug.
* @return True if the slug is not in use by any other project iteration in the given project. False, otherwise.
*/
boolean isProjectIterationSlugAvailable(String slug, String projectSlug);
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.zanata.model.HProjectIteration;
import org.zanata.model.SlugEntityBase;
import org.zanata.service.SlugEntityService;

Expand All @@ -48,4 +49,12 @@ public boolean isSlugAvailable(String slug, Class<? extends SlugEntityBase> cls)
{
return session.createCriteria(cls).add(Restrictions.eq("slug", slug)).list().size() == 0;
}

@Override
public boolean isProjectIterationSlugAvailable(String slug, String projectSlug)
{
return session.createCriteria(HProjectIteration.class).add(Restrictions.eq("slug", slug))
.createCriteria("project")
.add(Restrictions.eq("slug", projectSlug)).list().size() == 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.zanata.webtrans.shared.rpc.ExitWorkspaceResult;

import com.allen_sauer.gwt.log.client.Log;
import com.google.common.base.Strings;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.http.client.URL;
Expand All @@ -35,14 +36,13 @@
public class Application implements EntryPoint
{

private static boolean IS_DEBUG = false;
private static final String APP_LOAD_ERROR_CSS_CLASS = "AppLoadError";

private static String zanataUrl = null;
private static boolean IS_DEBUG = false;
private static WorkspaceId workspaceId;
private static WorkspaceContext workspaceContext;
private static Identity identity;

private static String APP_LOAD_ERROR_CSS_CLASS = "AppLoadError";
private static Identity identity;

private final static WebTransGinjector injector = GWT.create(WebTransGinjector.class);

Expand Down Expand Up @@ -234,7 +234,7 @@ private static void showErrorWithLink(String message, Throwable e, String linkTe
FlowPanel layoutPanel = new FlowPanel();
layoutPanel.add(messageLabel);

if (linkText != null && linkText != "" && linkUrl != null && linkUrl != "")
if (Strings.isNullOrEmpty(linkText) && Strings.isNullOrEmpty(linkUrl))
{
Anchor a = new Anchor(linkText, linkUrl);
a.getElement().addClassName(APP_LOAD_ERROR_CSS_CLASS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,9 @@ public InlineTargetCellEditor getTargetCellEditor()

public void setTransUnitDetails(TransUnit selectedTransUnit)
{
VerticalPanel sourcePanel = sourcePanelMap.get(selectedTransUnit.getId());
if (sourcePanel != null)
if (selectedTransUnit != null && sourcePanelMap.get(selectedTransUnit.getId()) != null)
{
VerticalPanel sourcePanel = sourcePanelMap.get(selectedTransUnit.getId());
FlowPanel wrapper = new FlowPanel();
wrapper.addStyleName("TransUnitDetail-Wrapper");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -493,11 +493,11 @@ else if (checkKey.isPreviousEntryKey())
}
else if (checkKey.isNextStateEntryKey())
{
moveNext(false);
moveToNextState(NavTransUnitEvent.NavigationType.NextEntry);
}
else if (checkKey.isPreviousStateEntryKey())
{
movePrevious(false);
moveToNextState(NavTransUnitEvent.NavigationType.PrevEntry);
}
else if (checkKey.isSaveAsFuzzyKey())
{
Expand Down Expand Up @@ -525,9 +525,21 @@ else if (checkKey.isUserTyping() && checkKey.isBackspace())
}
}

public void moveToNextState(NavTransUnitEvent.NavigationType nav)
public void moveToNextState(final NavTransUnitEvent.NavigationType nav)
{
cellEditor.savePendingChange(true);
scheduler.scheduleDeferred(new Scheduler.ScheduledCommand()
{
@Override
public void execute()
{
goToRowWithState(nav);
}
});
}

private void goToRowWithState(NavTransUnitEvent.NavigationType nav)
{
if (configHolder.isFuzzyAndUntranslated())
{
cellEditor.gotoFuzzyAndNewRow(nav);
Expand Down

0 comments on commit f89fd33

Please sign in to comment.