1 | |
package org.jtheque.films.view.impl.actions.lendings; |
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.view.able.IViewManager; |
22 | |
import org.jtheque.core.managers.view.impl.actions.JThequeAction; |
23 | |
import org.jtheque.films.controllers.able.ILendingsController; |
24 | |
import org.jtheque.films.view.able.ILendingsView; |
25 | |
|
26 | |
import java.awt.event.ActionEvent; |
27 | |
import java.util.Collection; |
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
public final class AcReturnCurrentFilm extends JThequeAction { |
35 | |
|
36 | |
|
37 | |
|
38 | |
public AcReturnCurrentFilm() { |
39 | 0 | super("lendings.view.actions.return"); |
40 | 0 | } |
41 | |
|
42 | |
@Override |
43 | |
public void actionPerformed(ActionEvent e) { |
44 | 0 | ILendingsController lendingsController = Managers.getManager(IBeansManager.class).getBean("lendingsController"); |
45 | |
|
46 | 0 | ILendingsView view = (ILendingsView) lendingsController.getView(); |
47 | |
|
48 | 0 | Collection<Integer> ids = view.getSelectedLendingsID(); |
49 | |
|
50 | 0 | if (ids.isEmpty()) { |
51 | 0 | Managers.getManager(IViewManager.class).displayI18nText("lendings.dialogs.selectLending"); |
52 | |
} else { |
53 | 0 | for (int id : ids) { |
54 | 0 | lendingsController.deleteLending(id); |
55 | |
} |
56 | |
} |
57 | 0 | } |
58 | |
} |