Coverage Report - org.jtheque.films.controllers.impl.undo.DeletedLanguageEdit
 
Classes in this File Line Coverage Branch Coverage Complexity
DeletedLanguageEdit
0 %
0/11
N/A
1
 
 1  
 package org.jtheque.films.controllers.impl.undo;
 2  
 
 3  
 /*
 4  
  * This file is part of JTheque.
 5  
  *
 6  
  * JTheque is free software: you can redistribute it and/or modify
 7  
  * it under the terms of the GNU General Public License as published by
 8  
  * the Free Software Foundation, either version 3 of the License.
 9  
  *
 10  
  * JTheque is distributed in the hope that it will be useful,
 11  
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 12  
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 13  
  * GNU General Public License for more details.
 14  
  *
 15  
  * You should have received a copy of the GNU General Public License
 16  
  * along with JTheque.  If not, see <http://www.gnu.org/licenses/>.
 17  
  */
 18  
 
 19  
 import org.jtheque.core.managers.Managers;
 20  
 import org.jtheque.core.managers.beans.IBeansManager;
 21  
 import org.jtheque.core.managers.language.ILanguageManager;
 22  
 import org.jtheque.primary.od.able.Language;
 23  
 import org.jtheque.primary.services.able.ILanguagesService;
 24  
 
 25  
 import javax.annotation.Resource;
 26  
 import javax.swing.undo.AbstractUndoableEdit;
 27  
 
 28  
 /**
 29  
  * An edit for a deletion of language.
 30  
  *
 31  
  * @author Baptiste Wicht
 32  
  */
 33  
 public final class DeletedLanguageEdit extends AbstractUndoableEdit {
 34  
     private final Language language;
 35  
 
 36  
     @Resource
 37  
     private ILanguagesService languagesService;
 38  
 
 39  
     /**
 40  
      * Construct a new DeletedLanguageEdit.
 41  
      *
 42  
      * @param lending The deleted language.
 43  
      */
 44  
     public DeletedLanguageEdit(Language lending) {
 45  0
         super();
 46  
 
 47  0
         Managers.getManager(IBeansManager.class).inject(this);
 48  
 
 49  0
         language = lending;
 50  0
     }
 51  
 
 52  
     @Override
 53  
     public void undo() {
 54  0
         super.undo();
 55  
 
 56  0
         languagesService.create(language);
 57  0
     }
 58  
 
 59  
     @Override
 60  
     public void redo() {
 61  0
         super.redo();
 62  
 
 63  0
         languagesService.delete(language);
 64  0
     }
 65  
 
 66  
     @Override
 67  
     public String getPresentationName() {
 68  0
         return Managers.getManager(ILanguageManager.class).getMessage("undo.edits.delete");
 69  
     }
 70  
 }