| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| ChoiceViewAction |
|
| 1.0;1 |
| 1 | package org.jtheque.primary.view.impl.actions.choice; | |
| 2 | ||
| 3 | import org.jtheque.core.managers.view.impl.actions.JThequeAction; | |
| 4 | import org.jtheque.core.utils.CoreUtils; | |
| 5 | import org.jtheque.primary.controller.able.IChoiceController; | |
| 6 | ||
| 7 | import java.awt.event.ActionEvent; | |
| 8 | ||
| 9 | /* | |
| 10 | * This file is part of JTheque. | |
| 11 | * | |
| 12 | * JTheque is free software: you can redistribute it and/or modify | |
| 13 | * it under the terms of the GNU General Public License as published by | |
| 14 | * the Free Software Foundation, either version 3 of the License. | |
| 15 | * | |
| 16 | * JTheque is distributed in the hope that it will be useful, | |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 19 | * GNU General Public License for more details. | |
| 20 | * | |
| 21 | * You should have received a copy of the GNU General Public License | |
| 22 | * along with JTheque. If not, see <http://www.gnu.org/licenses/>. | |
| 23 | */ | |
| 24 | ||
| 25 | /** | |
| 26 | * An action to launch the choice view with a specific action and data type. | |
| 27 | * | |
| 28 | * @author Baptiste Wicht | |
| 29 | */ | |
| 30 | public final class ChoiceViewAction extends JThequeAction { | |
| 31 | private final String action; | |
| 32 | private final String dataType; | |
| 33 | ||
| 34 | /** | |
| 35 | * Construct a new ChoiceViewAction. | |
| 36 | * | |
| 37 | * @param key The internationalization key. | |
| 38 | * @param action The choice action. | |
| 39 | * @param dataType The datatype of the data container. | |
| 40 | */ | |
| 41 | public ChoiceViewAction(String key, String action, String dataType){ | |
| 42 | 0 | super(key); |
| 43 | ||
| 44 | 0 | this.action = action; |
| 45 | 0 | this.dataType = dataType; |
| 46 | 0 | } |
| 47 | ||
| 48 | @Override | |
| 49 | public void actionPerformed(ActionEvent event){ | |
| 50 | 0 | IChoiceController choiceController = CoreUtils.getBean("choiceController"); |
| 51 | ||
| 52 | 0 | choiceController.setAction(action); |
| 53 | 0 | choiceController.setContent(dataType); |
| 54 | 0 | choiceController.displayView(); |
| 55 | 0 | } |
| 56 | } |