| 1 | |
package org.jtheque.films.controllers.impl.undo.delete; |
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
|
| 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.films.persistence.od.RealizerImpl; |
| 23 | |
import org.jtheque.films.services.able.IRealizersService; |
| 24 | |
|
| 25 | |
import javax.annotation.Resource; |
| 26 | |
import javax.swing.undo.AbstractUndoableEdit; |
| 27 | |
import javax.swing.undo.CannotRedoException; |
| 28 | |
import javax.swing.undo.CannotUndoException; |
| 29 | |
|
| 30 | |
|
| 31 | |
|
| 32 | |
|
| 33 | |
|
| 34 | |
|
| 35 | |
public final class DeletedRealizerEdit extends AbstractUndoableEdit { |
| 36 | |
private static final long serialVersionUID = -3037357344759861059L; |
| 37 | |
|
| 38 | |
private final RealizerImpl actor; |
| 39 | |
|
| 40 | |
@Resource |
| 41 | |
private IRealizersService realizersService; |
| 42 | |
|
| 43 | |
|
| 44 | |
|
| 45 | |
|
| 46 | |
|
| 47 | |
|
| 48 | |
public DeletedRealizerEdit(RealizerImpl actor) { |
| 49 | 0 | super(); |
| 50 | |
|
| 51 | 0 | Managers.getManager(IBeansManager.class).inject(this); |
| 52 | |
|
| 53 | 0 | this.actor = actor; |
| 54 | 0 | } |
| 55 | |
|
| 56 | |
@Override |
| 57 | |
public void undo() throws CannotUndoException { |
| 58 | 0 | super.undo(); |
| 59 | |
|
| 60 | 0 | realizersService.create(actor); |
| 61 | 0 | } |
| 62 | |
|
| 63 | |
@Override |
| 64 | |
public void redo() throws CannotRedoException { |
| 65 | 0 | super.redo(); |
| 66 | |
|
| 67 | 0 | realizersService.delete(actor); |
| 68 | 0 | } |
| 69 | |
|
| 70 | |
@Override |
| 71 | |
public String getPresentationName() { |
| 72 | 0 | return Managers.getManager(ILanguageManager.class).getMessage("undo.edits.delete"); |
| 73 | |
} |
| 74 | |
} |