| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| JThequeSimpleAction |
|
| 1.0;1 |
| 1 | package org.jtheque.core.managers.view.impl.actions; | |
| 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.language.ILanguageManager; | |
| 21 | ||
| 22 | import javax.swing.AbstractAction; | |
| 23 | import javax.swing.Action; | |
| 24 | import javax.swing.ImageIcon; | |
| 25 | ||
| 26 | /** | |
| 27 | * A simple JTheque action. | |
| 28 | * | |
| 29 | * @author Baptiste Wicht | |
| 30 | */ | |
| 31 | 0 | public abstract class JThequeSimpleAction extends AbstractAction { |
| 32 | /** | |
| 33 | * Set the text key. | |
| 34 | * | |
| 35 | * @param key The internationalization key. | |
| 36 | */ | |
| 37 | protected final void setTextKey(String key) { | |
| 38 | 0 | setText(Managers.getManager(ILanguageManager.class).getMessage(key)); |
| 39 | 0 | } |
| 40 | ||
| 41 | /** | |
| 42 | * Set the text of the action. | |
| 43 | * | |
| 44 | * @param text The text. | |
| 45 | */ | |
| 46 | protected final void setText(String text) { | |
| 47 | 0 | putValue(Action.NAME, text); |
| 48 | 0 | } |
| 49 | ||
| 50 | /** | |
| 51 | * Set the icon of te action. | |
| 52 | * | |
| 53 | * @param icon The icon. | |
| 54 | */ | |
| 55 | public final void setIcon(ImageIcon icon) { | |
| 56 | 0 | putValue(Action.SMALL_ICON, icon); |
| 57 | 0 | } |
| 58 | ||
| 59 | @Override | |
| 60 | public final Object clone() throws CloneNotSupportedException { | |
| 61 | 0 | return super.clone(); |
| 62 | } | |
| 63 | } |