Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

  • Loading branch information...
commit e32cdca38a40e6f29773495b170b52862e843a7f 1 parent 5a6dcfd
Patrick Huang authored April 24, 2012
51  zanata-war/src/main/java/org/zanata/webtrans/client/editor/table/InlineTargetCellEditor.java
@@ -215,30 +215,6 @@ else if (cancelIfUnchanged)
215 215
       targetContentsPresenter.setToViewMode();
216 216
    }
217 217
 
218  
-   private void determineStatus(ArrayList<String> newTargets, ContentState stateToSet)
219  
-   {
220  
-      Collection<String> emptyTargets = Collections2.filter(newTargets, new Predicate<String>()
221  
-      {
222  
-         @Override
223  
-         public boolean apply(@Nullable String input)
224  
-         {
225  
-            return Strings.isNullOrEmpty(input);
226  
-         }
227  
-      });
228  
-      if (emptyTargets.isEmpty() && stateToSet == ContentState.Approved)
229  
-      {
230  
-         cellValue.setStatus(ContentState.Approved);
231  
-      }
232  
-      else if (emptyTargets.size() > 0 && stateToSet == ContentState.NeedReview)
233  
-      {
234  
-         cellValue.setStatus(ContentState.NeedReview);
235  
-      }
236  
-      else
237  
-      {
238  
-         cellValue.setStatus(ContentState.New);
239  
-      }
240  
-   }
241  
-
242 218
    @Override
243 219
    public void saveAndMoveRow(NavigationType nav)
244 220
    {
@@ -249,7 +225,8 @@ public void saveAndMoveRow(NavigationType nav)
249 225
    /**
250 226
     * Accept the contents of the cell editor as the new cell value.
251 227
     */
252  
-   private void acceptEdit()
  228
+   @Override
  229
+   public void acceptEdit()
253 230
    {
254 231
       // Check if we are ready to accept
255 232
       if (!onAccept())
@@ -281,6 +258,30 @@ public void acceptFuzzyEdit()
281 258
       curCallback.onComplete(curCellEditInfo, cellValue);
282 259
    }
283 260
 
  261
+   private void determineStatus(ArrayList<String> newTargets, ContentState stateToSet)
  262
+   {
  263
+      Collection<String> emptyTargets = Collections2.filter(newTargets, new Predicate<String>()
  264
+      {
  265
+         @Override
  266
+         public boolean apply(@Nullable String input)
  267
+         {
  268
+            return Strings.isNullOrEmpty(input);
  269
+         }
  270
+      });
  271
+      if (emptyTargets.isEmpty() && stateToSet == ContentState.Approved)
  272
+      {
  273
+         cellValue.setStatus(ContentState.Approved);
  274
+      }
  275
+      else if (emptyTargets.size() > 0 && stateToSet == ContentState.NeedReview)
  276
+      {
  277
+         cellValue.setStatus(ContentState.NeedReview);
  278
+      }
  279
+      else
  280
+      {
  281
+         cellValue.setStatus(ContentState.New);
  282
+      }
  283
+   }
  284
+
284 285
    /**
285 286
     * Cancel the cell edit.
286 287
     */
11  zanata-war/src/main/java/org/zanata/webtrans/client/editor/table/TargetContentsPresenter.java
@@ -190,6 +190,11 @@ public void validate(ToggleEditor editor)
190 190
    @Override
191 191
    public void saveAsApprovedAndMoveNext()
192 192
    {
  193
+      moveNext(true);
  194
+   }
  195
+
  196
+   private void moveNext(boolean forceSave)
  197
+   {
193 198
       if (currentEditorIndex + 1 < currentEditors.size())
194 199
       {
195 200
          currentDisplay.focusEditor(currentEditorIndex + 1);
@@ -198,6 +203,10 @@ public void saveAsApprovedAndMoveNext()
198 203
       else
199 204
       {
200 205
          currentEditorIndex = 0;
  206
+         if (forceSave)
  207
+         {
  208
+            cellEditor.acceptEdit();
  209
+         }
201 210
          cellEditor.saveAndMoveRow(NavTransUnitEvent.NavigationType.NextEntry);
202 211
       }
203 212
    }
@@ -374,7 +383,7 @@ public void onEditorKeyDown(KeyDownEvent event, ToggleEditor editor)
374 383
       }
375 384
       else if (checkKey.isNextEntryKey())
376 385
       {
377  
-         saveAsApprovedAndMoveNext();
  386
+         moveNext(false);
378 387
       }
379 388
       else if (checkKey.isPreviousEntryKey())
380 389
       {
2  zanata-war/src/main/java/org/zanata/webtrans/client/editor/table/TransUnitsEditModel.java
@@ -23,4 +23,6 @@
23 23
    void savePendingChange(boolean cancelIfUnchanged);
24 24
 
25 25
    void saveAndMoveRow(NavTransUnitEvent.NavigationType nav);
  26
+
  27
+   void acceptEdit();
26 28
 }

0 notes on commit e32cdca

Please sign in to comment.
Something went wrong with that request. Please try again.