001/* Interface for objects that have UI components that can be placed in panels. 002 003 Copyright (c) 1997-2013 The Regents of the University of California. 004 All rights reserved. 005 Permission is hereby granted, without written agreement and without 006 license or royalty fees, to use, copy, modify, and distribute this 007 software and its documentation for any purpose, provided that the above 008 copyright notice and the following two paragraphs appear in all copies 009 of this software. 010 011 IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY 012 FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 013 ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF 014 THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF 015 SUCH DAMAGE. 016 017 THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, 018 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 019 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE 020 PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF 021 CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, 022 ENHANCEMENTS, OR MODIFICATIONS. 023 024 PT_COPYRIGHT_VERSION_2 025 COPYRIGHTENDKEY 026 027 028 */ 029package ptolemy.actor.gui; 030 031import java.awt.Container; 032 033/////////////////////////////////////////////////////////////////// 034//// Placeable 035 036/** 037 Interface for objects that have UI components that can be placed in containers. 038 These objects can be fairly tricky to write because of the fact that they 039 might be placed in a control panel, or be expected to create their own 040 frame. Moreover, from one run to the next, this situation might change. 041 That is, it might create a frame on one run, but on the next run, place 042 the display in specified frame (like a control panel). 043 Objects that implement this interface should pass the following tests: 044 <ol> 045 <li>Run the model from the toolbar. The object creates a frame.</li> 046 <li>Close the frame during the run. The run continues without the display.</li> 047 <li>Move and resize the frame during the run.</li> 048 <li>Save the model and close it. Then open and re-run. 049 Placement and size is preserved.</li> 050 <li>Re-run the model from the toolbar. Move and resize is preserved.</li> 051 <li>Run the model from the View:Run menu. If a frame is visible, it first 052 gets closed.</li> 053 <li>Close the run control panel and run from the toolbar. A frame is opened, 054 using the last size and placement. 055 <li>Delete the actor. Frame should close, or display in the control 056 panel should disappear.</li> 057 </ol> 058 059 @author Edward A. Lee 060 @version $Id$ 061 @since Ptolemy II 0.3 062 @Pt.ProposedRating Green (eal) 063 @Pt.AcceptedRating Yellow (cxh) 064 */ 065public interface Placeable { 066 /////////////////////////////////////////////////////////////////// 067 //// public methods //// 068 069 /** Specify the container into which this object should be placed. 070 * Obviously, this method needs to be called before the object 071 * is actually placed in a container. Otherwise, the object will be 072 * expected to create its own frame into which to place itself. 073 * For actors, this method should be called before initialize(). 074 * @param container The container in which to place the object, or 075 * null to specify that there is no current container. 076 */ 077 public void place(Container container); 078}