001/* A tableau representing an HTML Welcome Window (no menu, has don't show again)
002 Copyright (c) 2006-2014 The Regents of the University of California.
003 All rights reserved.
004 Permission is hereby granted, without written agreement and without
005 license or royalty fees, to use, copy, modify, and distribute this
006 software and its documentation for any purpose, provided that the above
007 copyright notice and the following two paragraphs appear in all copies
008 of this software.
009
010 IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
011 FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
012 ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
013 THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
014 SUCH DAMAGE.
015
016 THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
017 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
018 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
019 PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
020 CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
021 ENHANCEMENTS, OR MODIFICATIONS.
022
023 PT_COPYRIGHT_VERSION_2
024 COPYRIGHTENDKEY
025 */
026package ptolemy.actor.gui;
027
028import ptolemy.kernel.util.Attribute;
029import ptolemy.kernel.util.IllegalActionException;
030import ptolemy.kernel.util.NameDuplicationException;
031
032//////////////////////////////////////////////////////////////////////////
033//// WelcomeWindowTableau
034
035/**
036 A tableau representing a rendered HTML view in a toplevel window that
037 has no menu choices.
038
039 @author  Christopher Brooks
040 @version $Id$
041 @since Ptolemy II 5.2
042 @Pt.ProposedRating Red (cxh)
043 @Pt.AcceptedRating Red (cxh)
044 @see Effigy
045 @see WelcomeWindow
046 */
047public class WelcomeWindowTableau extends HTMLViewerTableau {
048
049    /** Construct a new tableau for the model represented by the given effigy.
050     *  This creates an instance of WelcomeWindow.  It does not make the frame
051     *  visible.  To do that, call show().
052     *  @param container The container.
053     *  @param name The name.
054     *  @exception IllegalActionException If the container does not accept
055     *   this entity (this should not occur).
056     *  @exception NameDuplicationException If the name coincides with an
057     *   attribute already in the container.
058     */
059    public WelcomeWindowTableau(Effigy container, String name)
060            throws IllegalActionException, NameDuplicationException {
061        super(container, name);
062        WelcomeWindow frame = new WelcomeWindow();
063        setFrame(frame);
064        frame.setTableau(this);
065    }
066
067    /** Handle cases where the <i>url</i> attribute is changed,
068     *  yet there is no frame. If the argument is the <i>url</i> parameter,
069     *  and there is no frame, then do nothing.  Otherwise, call the same
070     *  method in the super class.
071     *  @param attribute The attribute that changed.
072     *  @exception IllegalActionException Thrown by the parent class
073     *  if the URL cannot be opened, or if the base class throws it.
074     */
075    @Override
076    public void attributeChanged(Attribute attribute)
077            throws IllegalActionException {
078        if (attribute == url) {
079            if (getFrame() == null) {
080                return;
081            }
082        }
083        super.attributeChanged(attribute);
084    }
085}