Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
ActionFactory |
|
| 1.0;1 |
1 | package org.jtheque.core.managers.view.impl.actions; | |
2 | ||
3 | import org.jtheque.core.managers.view.able.IView; | |
4 | import org.jtheque.core.managers.view.impl.actions.utils.CloseBeanViewAction; | |
5 | import org.jtheque.core.managers.view.impl.actions.utils.CloseViewAction; | |
6 | import org.jtheque.core.managers.view.impl.actions.utils.DisplayBeanViewAction; | |
7 | import org.jtheque.core.managers.view.impl.actions.utils.DisplayViewAction; | |
8 | ||
9 | import javax.swing.Action; | |
10 | ||
11 | /* | |
12 | * This file is part of JTheque. | |
13 | * | |
14 | * JTheque is free software: you can redistribute it and/or modify | |
15 | * it under the terms of the GNU General Public License as published by | |
16 | * the Free Software Foundation, either version 3 of the License. | |
17 | * | |
18 | * JTheque is distributed in the hope that it will be useful, | |
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | * GNU General Public License for more details. | |
22 | * | |
23 | * You should have received a copy of the GNU General Public License | |
24 | * along with JTheque. If not, see <http://www.gnu.org/licenses/>. | |
25 | */ | |
26 | ||
27 | /** | |
28 | * A factory to create generic actions. | |
29 | * | |
30 | * @author Baptiste Wicht | |
31 | */ | |
32 | public final class ActionFactory { | |
33 | /** | |
34 | * Construct a new ActionFactory. | |
35 | */ | |
36 | private ActionFactory(){ | |
37 | 0 | super(); |
38 | 0 | } |
39 | ||
40 | /** | |
41 | * Create an action to close the view. | |
42 | * | |
43 | *@param key The i18n key. | |
44 | * @param view The view to close. | |
45 | * | |
46 | * @return An action to close the view. | |
47 | */ | |
48 | public static Action createCloseViewAction(String key, IView view){ | |
49 | 0 | return new CloseViewAction(key, view); |
50 | } | |
51 | ||
52 | /** | |
53 | * Create an action to close the view. | |
54 | * | |
55 | *@param key The i18n key. | |
56 | * @param view The name of the view to close. The action will be searched in Spring context. | |
57 | * | |
58 | * @return An action to close the view. | |
59 | */ | |
60 | public static Action createCloseViewAction(String key, String view){ | |
61 | 0 | return new CloseBeanViewAction(key, view); |
62 | } | |
63 | ||
64 | /** | |
65 | * Create an action to display the view. | |
66 | * | |
67 | *@param key The i18n key. | |
68 | * @param view The view to close. | |
69 | * | |
70 | * @return An action to close the view. | |
71 | */ | |
72 | public static Action createDisplayViewAction(String key, IView view){ | |
73 | 0 | return new DisplayViewAction(key, view); |
74 | } | |
75 | ||
76 | /** | |
77 | * Create an action to display the view. | |
78 | * | |
79 | *@param key The i18n key. | |
80 | * @param view The name of the view to close. The action will be searched in Spring context. | |
81 | * | |
82 | * @return An action to close the view. | |
83 | */ | |
84 | public static Action createDisplayViewAction(String key, String view){ | |
85 | 0 | return new DisplayBeanViewAction(key, view); |
86 | } | |
87 | } |