001/*
002 * Copyright (c) 2009-2010 The Regents of the University of California.
003 * All rights reserved.
004 *
005 * '$Author: crawl $'
006 * '$Date: 2015-08-24 22:44:14 +0000 (Mon, 24 Aug 2015) $' 
007 * '$Revision: 33630 $'
008 * 
009 * Permission is hereby granted, without written agreement and without
010 * license or royalty fees, to use, copy, modify, and distribute this
011 * software and its documentation for any purpose, provided that the above
012 * copyright notice and the following two paragraphs appear in all copies
013 * of this software.
014 *
015 * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
016 * FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
017 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
018 * THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
019 * SUCH DAMAGE.
020 *
021 * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
022 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
023 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
024 * PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
025 * CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
026 * ENHANCEMENTS, OR MODIFICATIONS.
027 *
028 */
029
030package org.kepler.gui;
031
032import java.awt.event.ActionEvent;
033import java.net.URL;
034
035import javax.swing.Action;
036import javax.swing.ImageIcon;
037import javax.swing.KeyStroke;
038
039import org.apache.commons.logging.Log;
040import org.apache.commons.logging.LogFactory;
041import org.kepler.configuration.ConfigurationManager;
042import org.kepler.configuration.ConfigurationProperty;
043import org.kepler.util.StaticResources;
044
045import diva.gui.GUIUtilities;
046import ptolemy.actor.gui.TableauFrame;
047import ptolemy.vergil.toolbox.FigureAction;
048
049/**
050 * This action imports a kar file to the system
051 * 
052 * @author Chad Berkley
053 * @created 10/4/2006
054 */
055public class AboutAction extends FigureAction {
056
057        // ////////////////////////////////////////////////////////////////////////////
058        // LOCALIZABLE RESOURCES - NOTE that these default values are later
059        // overridden by values from the uiDisplayText resourcebundle file
060        // ////////////////////////////////////////////////////////////////////////////
061
062        private static String DISPLAY_NAME = StaticResources.getDisplayString(
063                        "actions.actor.displayName", "About");
064
065        private TableauFrame parent;
066
067        private final static Log log = LogFactory.getLog(ActorDialogAction.class
068                        .getName());
069        private final static boolean isDebugging = log.isDebugEnabled();
070        private static ImageIcon LARGE_ICON = null;
071        private static KeyStroke ACCELERATOR_KEY = null;
072        private static String TOOLTIP = StaticResources.getDisplayString(
073                        "actions.actor.tooltip", "About Kepler");
074
075        /**
076         * Constructor
077         * 
078         * @param parent
079         *            the "frame" (derived from ptolemy.gui.Top) where the menu is
080         *            being added.
081         */
082        public AboutAction(TableauFrame parent) {
083                super("");
084                this.parent = parent;
085
086                this.putValue(Action.NAME, DISPLAY_NAME);
087                this.putValue(GUIUtilities.LARGE_ICON, LARGE_ICON);
088                this.putValue("tooltip", TOOLTIP);
089                this.putValue(GUIUtilities.ACCELERATOR_KEY, ACCELERATOR_KEY);
090        }
091
092        /**
093         * Invoked when an action occurs.
094         * 
095         * @param e
096         *            ActionEvent
097         */
098        public void actionPerformed(ActionEvent e) {
099
100                // must call this first...
101                super.actionPerformed(e);
102                ConfigurationProperty commonProperty = ConfigurationManager.getInstance().getProperty(
103                                                ConfigurationManager.getModule("common"));
104                String splashname = commonProperty.getProperty("splash.image").getValue();
105                final URL splashURL = ClassLoader.getSystemClassLoader().getResource(splashname);
106                SplashWindow.splash(splashURL, true);
107        }
108}