001/* A GUI property that encloses a JToolBar 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.JToolBar;
032
033import ptolemy.kernel.util.IllegalActionException;
034import ptolemy.kernel.util.NameDuplicationException;
035import ptolemy.kernel.util.NamedObj;
036
037//////////////////////////////////////////////////////////////////////////
038//// ToolBar
039
040/**
041 A GUI property that encloses a JToolBar 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 ToolBar 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 ToolBar(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
084    public ToolBar(NamedObj container, String name, JToolBar component)
085            throws IllegalActionException, NameDuplicationException {
086        super(container, name, component);
087    }
088
089    /** Construct a GUI property with the given name contained by the specified
090     *  entity with the given Java Swing component and the given layout
091     *  constraint. The container argument must not be null, or a
092     *  NullPointerException will be thrown.  This attribute
093     *  will use the workspace of the container for synchronization and version
094     *  counts. If the name argument is null, then the name is set to the empty
095     *  string. Increment the version of the workspace.
096     *  @param container The container.
097     *  @param name The name of this attribute.
098     *  @param component The Java Swing component.
099     *  @param constraint The layout constraint.
100     *  @exception IllegalActionException If the attribute is not of an
101     *   acceptable class for the container, or if the name contains a period.
102     *  @exception NameDuplicationException If the name coincides with
103     *   an attribute already in the container.
104     */
105    public ToolBar(NamedObj container, String name, JToolBar component,
106            Object constraint)
107            throws IllegalActionException, NameDuplicationException {
108        super(container, name, component, constraint);
109    }
110
111    /** Construct a GUI property with the given name contained by the specified
112     *  entity with the given layout
113     *  constraint. The container argument must not be null, or a
114     *  NullPointerException will be thrown.  This attribute
115     *  will use the workspace of the container for synchronization and version
116     *  counts. If the name argument is null, then the name is set to the empty
117     *  string. Increment the version of the workspace.
118     *  @param container The container.
119     *  @param name The name of this attribute.
120     *  @param constraint The layout constraint.
121     *  @exception IllegalActionException If the attribute is not of an
122     *   acceptable class for the container, or if the name contains a period.
123     *  @exception NameDuplicationException If the name coincides with
124     *   an attribute already in the container.
125     */
126    public ToolBar(NamedObj container, String name, Object constraint)
127            throws IllegalActionException, NameDuplicationException {
128        super(container, name, constraint);
129    }
130
131    /** Create a new Java Swing component.
132     *
133     *  @return A Swing component that can be enclosed in this GUI property.
134     *  @exception IllegalActionException Not thrown in this base class.
135     */
136    @Override
137    protected JComponent _createComponent() throws IllegalActionException {
138        return new JToolBar();
139    }
140}