001/* 002 * Copyright (c) 2004-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; 033 034import javax.swing.Action; 035import javax.swing.ImageIcon; 036import javax.swing.KeyStroke; 037 038import org.apache.commons.logging.Log; 039import org.apache.commons.logging.LogFactory; 040import org.kepler.util.StaticResources; 041 042import diva.gui.GUIUtilities; 043import ptolemy.actor.gui.TableauFrame; 044import ptolemy.kernel.util.NamedObj; 045import ptolemy.vergil.toolbox.FigureAction; 046 047/** 048 * This action opens the Actor Tabbed Dialog. 049 * 050 *@author Matthew Brooke 051 *@since 26 February 2006 052 */ 053public class ActorDialogAction extends FigureAction { 054 055 // //////////////////////////////////////////////////////////////////////////// 056 // LOCALIZABLE RESOURCES - NOTE that these default values are later 057 // overridden by values from the uiDisplayText resourcebundle file 058 // //////////////////////////////////////////////////////////////////////////// 059 060 private static String DISPLAY_NAME = StaticResources.getDisplayString( 061 "actions.actor.displayName", "Configure"); 062 private static String TOOLTIP = StaticResources.getDisplayString( 063 "actions.actor.tooltip", "Change Settings for Actor"); 064 private static ImageIcon LARGE_ICON = null; 065 private static KeyStroke ACCELERATOR_KEY = null; 066 067 // = KeyStroke.getKeyStroke(KeyEvent.VK_C, Toolkit.getDefaultToolkit(). 068 // getMenuShortcutKeyMask()); 069 // ////////////////////////////////////////////////////////////////////////////// 070 071 /** 072 * Constructor 073 * 074 * @param parent 075 * the "frame" (derived from ptolemy.gui.Top) where the menu is 076 * being added. 077 */ 078 public ActorDialogAction(TableauFrame parent) { 079 super(""); 080 if (parent == null) { 081 IllegalArgumentException iae = new IllegalArgumentException( 082 "ActorDialogAction constructor received NULL argument for TableauFrame"); 083 iae.fillInStackTrace(); 084 throw iae; 085 } 086 this.parent = parent; 087 088 this.putValue(Action.NAME, DISPLAY_NAME); 089 this.putValue(GUIUtilities.LARGE_ICON, LARGE_ICON); 090 this.putValue("tooltip", TOOLTIP); 091 this.putValue(GUIUtilities.ACCELERATOR_KEY, ACCELERATOR_KEY); 092 } 093 094 /** 095 * Invoked when an action occurs. 096 * 097 *@param e 098 * ActionEvent 099 */ 100 public void actionPerformed(ActionEvent e) { 101 102 // must call this first... 103 super.actionPerformed(e); 104 // ...before calling this: 105 NamedObj target = super.getTarget(); 106 107 actorDialog = new ActorDialog(parent, target); 108 actorDialog.setVisible(true); 109 } 110 111 private TableauFrame parent; 112 private TabbedDialog actorDialog; 113 114 private static final Log log = LogFactory.getLog( 115 ActorDialogAction.class.getName()); 116 117 private static final boolean isDebugging = log.isDebugEnabled(); 118}