001/*
002 * Copyright (c) 2004-2010 The Regents of the University of California.
003 * All rights reserved.
004 *
005 * '$Author: welker $'
006 * '$Date: 2010-05-06 05:21:26 +0000 (Thu, 06 May 2010) $' 
007 * '$Revision: 24234 $'
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.WindowAdapter;
033import java.awt.event.WindowEvent;
034
035import org.apache.commons.logging.Log;
036import org.apache.commons.logging.LogFactory;
037import org.kepler.util.StaticResources;
038
039import ptolemy.actor.gui.TableauFrame;
040import ptolemy.kernel.util.NamedObj;
041
042/**
043 * Actor tabbed dialog
044 * 
045 * @author Matthew Brooke
046 * @since 27 February 2006
047 */
048public class ActorDialog extends TabbedDialog {
049
050        private static final boolean isModal = StaticResources.getBoolean(
051                        "diaogs.all.isModal", true);
052
053        private static String TITLE = StaticResources.getDisplayString(
054                        "dialogs.actor.titleBar", "");
055        private static String GENERAL = StaticResources.getDisplayString(
056                        "dialogs.actor.generalTab", "");
057        private static String PARAMS = StaticResources.getDisplayString(
058                        "dialogs.actor.parametersTab", "");
059        private static String PORTS = StaticResources.getDisplayString(
060                        "dialogs.actor.portsTab", "");
061        private static String ANNOT = StaticResources.getDisplayString(
062                        "dialogs.actor.annotationsTab", "");
063        private static String UNITS = StaticResources.getDisplayString(
064                        "dialogs.actor.unitsTab", "");
065
066        public ActorDialog(TableauFrame frame, NamedObj actor) {
067
068                super(frame, TITLE, isModal);
069                this._actor = actor;
070                init();
071                pack();
072        }
073
074        private void init() {
075                generalTab = new DialogGeneralTab(_actor,
076                                AbstractDialogTab.ACTOR_TARGET_TYPE, _frame);
077                _addTab(generalTab, GENERAL);
078                paramsTab = new DialogParametersTab(_actor,
079                                AbstractDialogTab.ACTOR_TARGET_TYPE, _frame);
080                _addTab(paramsTab, PARAMS);
081                portsTab = new DialogPortsTab(_actor,
082                                AbstractDialogTab.ACTOR_TARGET_TYPE, _frame);
083                _addTab(portsTab, PORTS);
084                annotTab = new DialogAnnotationsTab(_actor,
085                                AbstractDialogTab.ACTOR_TARGET_TYPE, _frame);
086                _addTab(annotTab, ANNOT);
087                unitsTab = new DialogUnitsTab(_actor,
088                                AbstractDialogTab.ACTOR_TARGET_TYPE, _frame);
089                _addTab(unitsTab, UNITS);
090        }
091
092        private static final Log log = LogFactory.getLog(
093                        ActorDialog.class.getName());
094        private static final boolean isDebugging = log.isDebugEnabled();
095        private DialogGeneralTab generalTab;
096        private DialogParametersTab paramsTab;
097        private DialogPortsTab portsTab;
098        private DialogAnnotationsTab annotTab;
099        private DialogUnitsTab unitsTab;
100        private final NamedObj _actor;
101
102        // //////////////////////////////////////////////////////////////////////////////
103
104        /**
105         * main for testing
106         * 
107         * @param param
108         *            String[]
109         */
110        public static void main(String[] param) {
111                StaticGUIResources.setLookAndFeel();
112
113                ActorDialog actorDialog = new ActorDialog(null, null);
114                actorDialog.addWindowListener(new WindowAdapter() {
115                        public void windowClosed(WindowEvent e) {
116                                System.exit(0);
117                        }
118                });
119                actorDialog.setLocation(200, 200);
120                actorDialog.setVisible(true);
121        }
122}