/* ========================
* JSynoptic : a free Synoptic editor
* ========================
*
* Project Info: http://jsynoptic.sourceforge.net/index.html
*
* This program is free software; you can redistribute it and/or modify it under the terms
* of the GNU Lesser General Public License as published by the Free Software Foundation;
* either version 2.1 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this
* program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA.
*
* (C) Copyright 2001-2005, by :
* Corporate:
* EADS Astrium SAS
* EADS CRC
* Individual:
* Claude Cazenave
*
* $Id: AbstractViewerAction.java,v 1.1 2006/09/18 14:59:14 booba_skaya Exp $
*
* Changes
* -------
* 18 sept. 06 : Initial public release (CC);
*
*/
package simtools.logging.ui;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.ImageIcon;
import javax.swing.KeyStroke;
/**
* Class AbstractViewerAction
* This class permits to intanciate easyly Action.
* Using the given tag in the constructor, it will retrieve the resources values.
*/
public abstract class AbstractViewerAction extends AbstractAction{
public AbstractViewerAction(String tag){
putValue(Action.NAME, Viewer.instance.resources.getStringValue(tag + "Action"));
ImageIcon i = Viewer.instance.resources.getIcon(tag + "Image");
if (i == null) {
i = Viewer.instance.resources.getIcon("nullImage");
}
putValue(Action.SMALL_ICON, i);
KeyStroke k = Viewer.instance.resources.getKeyStroke(tag + "Shortcut");
if (k != null) {
putValue(Action.ACCELERATOR_KEY, k);
}
String tip = Viewer.instance.resources.getStringValue(tag + "Tip");
putValue(Action.SHORT_DESCRIPTION, tip);
}
}