001/* A GUI property that encloses a JPanel component.
002
003 Copyright (c) 2008-2014 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 */
028package ptolemy.actor.gui.properties;
029
030import javax.swing.JComponent;
031import javax.swing.JPanel;
032
033import ptolemy.kernel.util.IllegalActionException;
034import ptolemy.kernel.util.NameDuplicationException;
035import ptolemy.kernel.util.NamedObj;
036
037//////////////////////////////////////////////////////////////////////////
038//// Panel
039
040/**
041 A GUI property that encloses a JPanel component.
042
043 @author Thomas Huining Feng
044 @version $Id$
045 @since Ptolemy II 8.0
046 @Pt.ProposedRating Red (tfeng)
047 @Pt.AcceptedRating Red (tfeng)
048 */
049public class Panel extends GUIProperty {
050
051    /** Construct a GUI property with the given name contained by the specified
052     *  entity. The container argument must not be null, or a
053     *  NullPointerException will be thrown.  This attribute will use the
054     *  workspace of the container for synchronization and version counts.
055     *  If the name argument is null, then the name is set to the empty string.
056     *  Increment the version of the workspace.
057     *  @param container The container.
058     *  @param name The name of this attribute.
059     *  @exception IllegalActionException If the attribute is not of an
060     *   acceptable class for the container, or if the name contains a period.
061     *  @exception NameDuplicationException If the name coincides with
062     *   an attribute already in the container.
063     */
064    public Panel(NamedObj container, String name)
065            throws IllegalActionException, NameDuplicationException {
066        super(container, name);
067    }
068
069    /** Construct a GUI property with the given name contained by the specified
070     *  entity with the given Java Swing component. The container argument must
071     *  not be null, or a NullPointerException will be thrown.  This attribute
072     *  will use the workspace of the container for synchronization and version
073     *  counts. If the name argument is null, then the name is set to the empty
074     *  string. Increment the version of the workspace.
075     *  @param container The container.
076     *  @param name The name of this attribute.
077     *  @param component The Java Swing component.
078     *  @exception IllegalActionException If the attribute is not of an
079     *   acceptable class for the container, or if the name contains a period.
080     *  @exception NameDuplicationException If the name coincides with
081     *   an attribute already in the container.
082     */
083    public Panel(NamedObj container, String name, JComponent component)
084            throws IllegalActionException, NameDuplicationException {
085        super(container, name, component);
086    }
087
088    /** Construct a GUI property with the given name contained by the specified
089     *  entity with the given Java Swing component and the given layout
090     *  constraint. The container argument must not be null, or a
091     *  NullPointerException will be thrown.  This attribute
092     *  will use the workspace of the container for synchronization and version
093     *  counts. If the name argument is null, then the name is set to the empty
094     *  string. Increment the version of the workspace.
095     *  @param container The container.
096     *  @param name The name of this attribute.
097     *  @param component The Java Swing component.
098     *  @param constraint The layout constraint.
099     *  @exception IllegalActionException If the attribute is not of an
100     *   acceptable class for the container, or if the name contains a period.
101     *  @exception NameDuplicationException If the name coincides with
102     *   an attribute already in the container.
103     */
104    public Panel(NamedObj container, String name, JComponent component,
105            Object constraint)
106            throws IllegalActionException, NameDuplicationException {
107        super(container, name, component, constraint);
108    }
109
110    /** Construct a GUI property with the given name contained by the specified
111     *  entity with the given layout
112     *  constraint. The container argument must not be null, or a
113     *  NullPointerException will be thrown.  This attribute
114     *  will use the workspace of the container for synchronization and version
115     *  counts. If the name argument is null, then the name is set to the empty
116     *  string. Increment the version of the workspace.
117     *  @param container The container.
118     *  @param name The name of this attribute.
119     *  @param constraint The layout constraint.
120     *  @exception IllegalActionException If the attribute is not of an
121     *   acceptable class for the container, or if the name contains a period.
122     *  @exception NameDuplicationException If the name coincides with
123     *   an attribute already in the container.
124     */
125    public Panel(NamedObj container, String name, Object constraint)
126            throws IllegalActionException, NameDuplicationException {
127        super(container, name, constraint);
128    }
129
130    /** Create a new JPanel component.
131     *
132     *  @return A Swing component that can be enclosed in this GUI property.
133     *  @exception IllegalActionException Not thrown in this base class.
134     */
135    @Override
136    protected JComponent _createComponent() throws IllegalActionException {
137        return new JPanel();
138    }
139
140}