001/*
002 Copyright (c) 2011-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 */
026
027package ptolemy.actor.injection;
028
029import ptolemy.actor.gui.Placeable;
030
031///////////////////////////////////////////////////////////////////
032//// PortablePlaceable
033/**
034 * This interface is analogous to the {@link Placeable} interface.  However, this
035 * interface is platform independent, and it's expected that implementers of the
036 * interface are also platform independent.  By platform independent, we mean there is
037 * no dependency on java.awt or java.swing packages that are specific to Java SE
038 * version of the Java and not available on Android, for example.
039 * <p>
040 * It is an interface for objects that have UI components that can be placed in containers.
041 * These objects can be fairly tricky to write because of the fact that they
042 * might be placed in a control panel, or be expected to create their own
043 * container.  Moreover, from one run to the next, this situation might change.
044 * That is, it might create a container on one run, but on the next run, place
045 * the display in specified container (like a control panel).
046 * Objects that implement this interface should pass the following tests:</p>
047 * <ol>
048 * <li>Run the model from the toolbar. The object creates a container.</li>
049 * <li>Close the container during the run. The run continues without the container.</li>
050 * <li>Move and resize the container during the run.</li>
051 * <li>Save the model and close it. Then open and re-run.
052 * Placement and size is preserved.</li>
053 * <li>Re-run the model from the toolbar. Move and resize is preserved.</li>
054 * <li>Run the model from the View:Run menu. If a frame is visible, it first
055 * gets closed.</li>
056 * <li>Close the run control panel and run from the toolbar. A frame is opened,
057 * using the last size and placement.
058 * <li>Delete the actor. Frame should close, or display in the control
059 * panel should disappear.</li>
060 * </ol>
061 *
062 * @author Edward A. Lee Contributor: Anar Huseynov
063 * @version $Id$
064 * @since Ptolemy II 10.0
065 * @Pt.ProposedRating Red (ahuseyno)
066 * @Pt.AcceptedRating Red (ahuseyno)
067 * @see Placeable
068 */
069public interface PortablePlaceable {
070
071    ///////////////////////////////////////////////////////////////////
072    ////                         public methods                    ////
073
074    /** Place the object that implements this interface into the specified container.
075     *  Obviously, this method needs to be called before the object
076     *  is actually placed in a container.  Otherwise, the object will be
077     *  expected to create its own frame into which to place itself.
078     *  For actors, this method should be called before initialize().
079     *  @param container The container in which to place the object, or
080     *   null to specify that there is no current container.
081     */
082    public void place(PortableContainer container);
083}