Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix bug - click save button on fuzzy item won't save if no changes

  • Loading branch information...
commit e32cdca38a40e6f29773495b170b52862e843a7f 1 parent 5a6dcfd
@huangp huangp authored
View
51 zanata-war/src/main/java/org/zanata/webtrans/client/editor/table/InlineTargetCellEditor.java
@@ -215,30 +215,6 @@ else if (cancelIfUnchanged)
targetContentsPresenter.setToViewMode();
}
- private void determineStatus(ArrayList<String> newTargets, ContentState stateToSet)
- {
- Collection<String> emptyTargets = Collections2.filter(newTargets, new Predicate<String>()
- {
- @Override
- public boolean apply(@Nullable String input)
- {
- return Strings.isNullOrEmpty(input);
- }
- });
- if (emptyTargets.isEmpty() && stateToSet == ContentState.Approved)
- {
- cellValue.setStatus(ContentState.Approved);
- }
- else if (emptyTargets.size() > 0 && stateToSet == ContentState.NeedReview)
- {
- cellValue.setStatus(ContentState.NeedReview);
- }
- else
- {
- cellValue.setStatus(ContentState.New);
- }
- }
-
@Override
public void saveAndMoveRow(NavigationType nav)
{
@@ -249,7 +225,8 @@ public void saveAndMoveRow(NavigationType nav)
/**
* Accept the contents of the cell editor as the new cell value.
*/
- private void acceptEdit()
+ @Override
+ public void acceptEdit()
{
// Check if we are ready to accept
if (!onAccept())
@@ -281,6 +258,30 @@ public void acceptFuzzyEdit()
curCallback.onComplete(curCellEditInfo, cellValue);
}
+ private void determineStatus(ArrayList<String> newTargets, ContentState stateToSet)
+ {
+ Collection<String> emptyTargets = Collections2.filter(newTargets, new Predicate<String>()
+ {
+ @Override
+ public boolean apply(@Nullable String input)
+ {
+ return Strings.isNullOrEmpty(input);
+ }
+ });
+ if (emptyTargets.isEmpty() && stateToSet == ContentState.Approved)
+ {
+ cellValue.setStatus(ContentState.Approved);
+ }
+ else if (emptyTargets.size() > 0 && stateToSet == ContentState.NeedReview)
+ {
+ cellValue.setStatus(ContentState.NeedReview);
+ }
+ else
+ {
+ cellValue.setStatus(ContentState.New);
+ }
+ }
+
/**
* Cancel the cell edit.
*/
View
11 zanata-war/src/main/java/org/zanata/webtrans/client/editor/table/TargetContentsPresenter.java
@@ -190,6 +190,11 @@ public void validate(ToggleEditor editor)
@Override
public void saveAsApprovedAndMoveNext()
{
+ moveNext(true);
+ }
+
+ private void moveNext(boolean forceSave)
+ {
if (currentEditorIndex + 1 < currentEditors.size())
{
currentDisplay.focusEditor(currentEditorIndex + 1);
@@ -198,6 +203,10 @@ public void saveAsApprovedAndMoveNext()
else
{
currentEditorIndex = 0;
+ if (forceSave)
+ {
+ cellEditor.acceptEdit();
+ }
cellEditor.saveAndMoveRow(NavTransUnitEvent.NavigationType.NextEntry);
}
}
@@ -374,7 +383,7 @@ public void onEditorKeyDown(KeyDownEvent event, ToggleEditor editor)
}
else if (checkKey.isNextEntryKey())
{
- saveAsApprovedAndMoveNext();
+ moveNext(false);
}
else if (checkKey.isPreviousEntryKey())
{
View
2  zanata-war/src/main/java/org/zanata/webtrans/client/editor/table/TransUnitsEditModel.java
@@ -23,4 +23,6 @@
void savePendingChange(boolean cancelIfUnchanged);
void saveAndMoveRow(NavTransUnitEvent.NavigationType nav);
+
+ void acceptEdit();
}
Please sign in to comment.
Something went wrong with that request. Please try again.