Permalink
Browse files

Merge branch 'master' into LayoutSelection

  • Loading branch information...
2 parents 56e8e79 + ac1eccf commit 8636543e78960835b9a6fc1a3db64c149f1d40f7 @aeng aeng committed May 31, 2012
View
@@ -44,8 +44,8 @@ bin/
#gwt related
.gwt-log
*.gwt-tmp
-/server/zanata-war/src/main/webapp/WEB-INF/deploy/
-/server/zanata-war/src/main/webapp/webtrans/
+/zanata-war/src/main/webapp/WEB-INF/deploy/
+/zanata-war/src/main/webapp/webtrans/
# vim
*.swp
View
@@ -4,7 +4,7 @@
<parent>
<groupId>org.zanata</groupId>
<artifactId>server</artifactId>
- <version>1.6.0-beta-2-SNAPSHOT</version>
+ <version>1.6.1-SNAPSHOT</version>
</parent>
<groupId>org.zanata</groupId>
<artifactId>functional-test</artifactId>
View
10 pom.xml
@@ -2,13 +2,13 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>server</artifactId>
- <version>1.6.0-beta-2-SNAPSHOT</version>
+ <version>1.6.1-SNAPSHOT</version>
<name>Zanata server modules</name>
<packaging>pom</packaging>
<parent>
<groupId>org.zanata</groupId>
<artifactId>zanata-parent</artifactId>
- <version>5-SNAPSHOT</version>
+ <version>5</version>
<relativePath>../parent</relativePath>
</parent>
@@ -19,9 +19,9 @@
</scm>
<properties>
- <zanata.api.version>1.6.0-alpha-4-SNAPSHOT</zanata.api.version>
- <zanata.client.version>1.6.0-alpha-4-SNAPSHOT</zanata.client.version>
- <zanata.common.version>1.6.0-alpha-4-SNAPSHOT</zanata.common.version>
+ <zanata.api.version>1.6.0</zanata.api.version>
+ <zanata.client.version>1.6.0</zanata.client.version>
+ <zanata.common.version>1.6.0</zanata.common.version>
<!--delombok properties-->
<lombok.source.dir>${project.build.sourceDirectory}/org/zanata</lombok.source.dir>
View
@@ -4,7 +4,7 @@
<parent>
<groupId>org.zanata</groupId>
<artifactId>server</artifactId>
- <version>1.6.0-beta-2-SNAPSHOT</version>
+ <version>1.6.1-SNAPSHOT</version>
</parent>
<artifactId>zanata-model</artifactId>
<name>Zanata model</name>
@@ -21,7 +21,7 @@
<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
<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="-gen target/gwt-gen -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 -codeServerPort 9998 -war &quot;${project_loc:/zanata-war}/src/main/webapp&quot; org.zanata.webtrans.ApplicationDummy"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="zanata-war"/>
@@ -22,7 +22,7 @@
<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
<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="-gen target/gwt-gen -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 -codeServerPort 9997 -war &quot;${deploy.zanata}&quot; org.zanata.webtrans.Application"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="zanata-war"/>
View
@@ -25,7 +25,7 @@
<parent>
<groupId>org.zanata</groupId>
<artifactId>server</artifactId>
- <version>1.6.0-beta-2-SNAPSHOT</version>
+ <version>1.6.1-SNAPSHOT</version>
</parent>
<artifactId>zanata-war</artifactId>
<packaging>war</packaging>
@@ -313,8 +313,8 @@
</additionalClasspathElements>
<childDelegation>true</childDelegation>
<useSystemClassLoader>true</useSystemClassLoader>
- <argLine xml:space="preserve">-Xmx1024m -XX:MaxPermSize=512m -XX:+UseConcMarkSweepGC
- -XX:+CMSClassUnloadingEnabled -XX:+HeapDumpOnOutOfMemoryError
+ <argLine xml:space="preserve">-Xmx1024m -XX:MaxPermSize=512m -XX:+UseConcMarkSweepGC
+ -XX:+CMSClassUnloadingEnabled -XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath=${project.build.directory} -Dsun.lang.ClassLoader.allowArraySyntax=true</argLine>
<classpathDependencyExcludes>
<classpathDependencyExclude>
@@ -89,7 +89,7 @@ public void gotoPrevNew()
public void setRowValueOverride(int row, RowType rowValue)
{
// TODO ideally, we would just replace the affected row in the cache
-// clearCache();
+ clearCache();
quiet = true;
try
{
@@ -47,7 +47,6 @@
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.RequestValidationEvent;
import org.zanata.webtrans.client.events.TransUnitEditEvent;
import org.zanata.webtrans.client.events.TransUnitEditEventHandler;
import org.zanata.webtrans.client.events.TransUnitSelectionEvent;
@@ -348,43 +347,71 @@ public void onFindMessage(FindMessageEvent event)
@Override
public void onTransUnitUpdated(TransUnitUpdatedEvent event)
{
+ Log.debug("onTransUnitUpdated(TransUnitUpdatedEvent)");
+
+ Log.debug("event.getUpdateType: " + event.getUpdateType());
// assume update was successful
if (documentId != null && documentId.equals(event.getUpdateInfo().getDocumentId()))
{
- boolean editing = targetContentsPresenter.isEditing();
navigationService.updateMap(event.getUpdateInfo().getTransUnit().getId().getId(), event.getUpdateInfo().getTransUnit().getStatus());
- // if save-as-fuzzy on same tab
- if (event.getEditorClientId().equals(identity.getEditorClientId()) && event.getUpdateType() == UpdateType.WebEditorSaveFuzzy)
+
+ boolean editing = targetContentsPresenter.isEditing();
+ Integer rowIndex = navigationService.getRowIndex(event.getUpdateInfo().getTransUnit(), isFiltering(), display.getRowValues());
+ boolean updateRow = true;
+ boolean reopen = false;
+
+ boolean updatingSelectedTU = selectedTransUnit != null && selectedTransUnit.getId().equals(event.getUpdateInfo().getTransUnit().getId());
+ if (updatingSelectedTU)
{
- Integer rowIndex = navigationService.getRowIndex(event.getUpdateInfo().getTransUnit(), isFiltering(), display.getRowValues());
- if (rowIndex != null)
+ Log.info("selected TU updated");
+ boolean sameEditorClientId = event.getEditorClientId().equals(identity.getEditorClientId());
+ if (sameEditorClientId)
{
- TransUnit rowValue = display.getRowValue(rowIndex);
- if (rowValue != null)
+ // if save-as-fuzzy on same tab
+ if (event.getUpdateType() == UpdateType.WebEditorSaveFuzzy)
+ {
+ updateRow = false;
+ reopen = true;
+
+ // stay focused if same client id fuzzy edit
+ if (rowIndex != null)
+ {
+ TransUnit rowValue = display.getRowValue(rowIndex);
+ if (rowValue != null)
+ {
+ rowValue.OverrideWith(event.getUpdateInfo().getTransUnit());
+ display.getTableModel().setRowValueOverride(rowIndex, event.getUpdateInfo().getTransUnit());
+ }
+ }
+ }
+ else
{
- rowValue.OverrideWith(event.getUpdateInfo().getTransUnit());
- display.getTableModel().clearCache();
+ // current client updated current TU (probably Replace, possibly save as Approved)
+ // will kick out of editor (and clobber local changes)
}
}
+ else
+ {
+ // another client updated current TU
+ // will kick out of editor (and clobber local changes)
+ }
}
else
{
- if (selectedTransUnit != null && selectedTransUnit.getId().equals(event.getUpdateInfo().getTransUnit().getId()))
- {
- Log.info("selected TU updated; clear selection");
- eventBus.fireEvent(new RequestValidationEvent());
- }
-
- // - add TU index to model
- Integer rowIndex = navigationService.getRowIndex(event.getUpdateInfo().getTransUnit(), isFiltering(), display.getRowValues());
- if (rowIndex != null)
- {
- Log.info("onTransUnitUpdated - update row:" + rowIndex);
- display.getTableModel().setRowValueOverride(rowIndex, event.getUpdateInfo().getTransUnit());
- }
+ // updateRow = true, value updated below
+ // re-open editor to keep editor focused despite model update closing editor
+ reopen = true;
+ }
+ Log.debug("reopen: " + reopen);
+ Log.debug("updateRow: " + updateRow);
+ if (updateRow && rowIndex != null)
+ {
+ Log.info("onTransUnitUpdated - update row:" + rowIndex);
+ display.getTableModel().setRowValueOverride(rowIndex, event.getUpdateInfo().getTransUnit());
}
- if (editing)
+ if (editing && reopen)
{
+ Log.debug("going to current row");
gotoCurrentRow();
}
}
@@ -690,7 +717,7 @@ else if (caught instanceof AuthorizationError)
}
@Override
- public boolean onSetRowValue(int row, TransUnit rowValue)
+ public boolean onSetRowValue(final int row, TransUnit rowValue)
{
UpdateType updateType = rowValue.getStatus() == ContentState.Approved ? UpdateType.WebEditorSave : UpdateType.WebEditorSaveFuzzy;
Log.debug("row updated, calculated update type: " + updateType);
@@ -702,16 +729,33 @@ public boolean onSetRowValue(int row, TransUnit rowValue)
public void onFailure(Throwable e)
{
Log.error("UpdateTransUnit failure " + e, e);
- eventBus.fireEvent(new NotificationEvent(Severity.Error, messages.notifyUpdateFailed(e.getLocalizedMessage())));
+ String message = e.getLocalizedMessage();
+ failure(message);
+ }
+ /**
+ * @param message
+ */
+ private void failure(String message)
+ {
+ eventBus.fireEvent(new NotificationEvent(Severity.Error, messages.notifyUpdateFailed(message)));
display.getTableModel().clearCache();
display.reloadPage();
}
@Override
public void onSuccess(UpdateTransUnitResult result)
{
- eventBus.fireEvent(new NotificationEvent(Severity.Info, messages.notifyUpdateSaved()));
+ // FIXME check result.success
+ if (result.isSingleSuccess())
+ {
+ eventBus.fireEvent(new NotificationEvent(Severity.Info, messages.notifyUpdateSaved()));
+ }
+ else
+ {
+ // TODO localised message
+ failure("row " + row);
+ }
}
});
return true;

0 comments on commit 8636543

Please sign in to comment.