001/*
002 The portable container that wraps java.awt.Container.
003
004 Copyright (c) 2011-2014 The Regents of the University of California.
005 All rights reserved.
006 Permission is hereby granted, without written agreement and without
007 license or royalty fees, to use, copy, modify, and distribute this
008 software and its documentation for any purpose, provided that the above
009 copyright notice and the following two paragraphs appear in all copies
010 of this software.
011
012 IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
013 FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
014 ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
015 THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
016 SUCH DAMAGE.
017
018 THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
019 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
020 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
021 PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
022 CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
023 ENHANCEMENTS, OR MODIFICATIONS.
024
025 PT_COPYRIGHT_VERSION_2
026 COPYRIGHTENDKEY
027 */
028
029package ptolemy.actor.gui;
030
031import java.awt.Component;
032import java.awt.Container;
033
034import ptolemy.actor.injection.PortableContainer;
035
036///////////////////////////////////////////////////////////////////
037//// AWTContainer
038
039/**
040 * The portable container that wraps java.awt.Container.
041 * @author Anar Huseynov
042 * @version $Id$
043 * @since Ptolemy II 10.0
044 * @Pt.ProposedRating Red (ahuseyno)
045 * @Pt.AcceptedRating Red (ahuseyno)
046 */
047public class AWTContainer implements PortableContainer {
048
049    /**
050     * Create a new instance of the object by wrapping the provided container.
051     * @param container The container to wrap.
052     */
053    public AWTContainer(Container container) {
054        _container = container;
055    }
056
057    ///////////////////////////////////////////////////////////////////
058    ////                         public methods                    ////
059
060    /**
061     * Add the component to the container.
062     * @param component the component to be added to the container.
063     * @see ptolemy.actor.injection.PortableContainer#add(java.lang.Object)
064     */
065    @Override
066    public void add(Object component) {
067        _container.add((Component) component);
068    }
069
070    /**
071     * Return the AWT container that this instance wraps.
072     * @see ptolemy.actor.injection.PortableContainer#getPlatformContainer()
073     * @return the AWT container that this instance wraps.
074     */
075    @Override
076    public Container getPlatformContainer() {
077        return _container;
078    }
079
080    ///////////////////////////////////////////////////////////////////
081    ////                         private variables                 ////
082
083    /**
084     * The AWT container that this instance wraps.
085     */
086    private final Container _container;
087
088}