Class Title

  • All Implemented Interfaces:
    java.lang.Cloneable, HasTypeConstraints, Typeable, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable, Settable, ValueListener, WebExportable

    public class Title
    extends StringParameter
    implements WebExportable
    Attribute specifying a title for a model or a component in a model. This attribute provides a visual title in the model, rendered more suitably for a title than a normal annotation. Moreover, if you export to web, this is used as the title for the containing component and for any exported web page. By default, the title is not shown on the web page except as part of the image of the model. If you wish for the title to also be shown in the HTML text before the image, then set the showTitleInHTML parameter to true.
    Since:
    Ptolemy II 10.0
    Version:
    $Id$
    Author:
    Edward A. Lee
    Pt.AcceptedRating:
    Red (cxh)
    Pt.ProposedRating:
    Red (cxh)
    • Field Detail

      • bold

        public Parameter bold
        A boolean indicating whether the font should be bold. This defaults to false.
      • center

        public Parameter center
        A boolean parameter that controls whether the origin of the text is center (if true) or north-west.
      • fontFamily

        public StringParameter fontFamily
        The font family. This is a string that defaults to "SansSerif".
      • italic

        public Parameter italic
        A boolean indicating whether the font should be italic. This defaults to false.
      • showTitleInHTML

        public Parameter showTitleInHTML
        If set to true, then the title given by this parameter will be shown in the HTML prior to the image of the model (as well as in the image of the model, if it is visible when the export to web occurs). This is a boolean that defaults to false.
      • textColor

        public ColorAttribute textColor
        The text color. This is a string representing an array with four elements, red, green, blue, and alpha, where alpha is transparency. The default is "{0.0, 0.0, 0.0, 1.0}", which represents an opaque black.
      • textSize

        public Parameter textSize
        The text size. This is an int that defaults to 14.
      • _icon

        protected TextIcon _icon
        The text icon.
    • Method Detail

      • clone

        public java.lang.Object clone​(Workspace workspace)
                               throws java.lang.CloneNotSupportedException
        Clone the object into the specified workspace.
        Overrides:
        clone in class Parameter
        Parameters:
        workspace - The workspace for the new object.
        Returns:
        A new AbstractTextAttribute.
        Throws:
        java.lang.CloneNotSupportedException - If any of the attributes cannot be cloned.
        See Also:
        Object.clone()
      • getMimeType

        public java.lang.String getMimeType()
        A title is of type text/html.
        Specified by:
        getMimeType in interface WebExportable
        Returns:
        The string text/html
      • isOverwriteable

        public boolean isOverwriteable()
        Return true, since new title content should overwrite old title content.
        Specified by:
        isOverwriteable in interface WebExportable
        Returns:
        True, since new title content should overwrite old title content.
      • moveToFirst

        public int moveToFirst()
                        throws IllegalActionException
        Move this object to the first position in the list of attributes of the container. This overrides the base class to create an attribute named "_renderFirst" and to remove an attribute named "_renderLast", if it is present. This attribute is recognized by vergil, which then renders this attribute before entities, connections, and other attributes. This method gets write access on workspace and increments the version.
        Specified by:
        moveToFirst in interface Moveable
        Overrides:
        moveToFirst in class Attribute
        Returns:
        The index of the specified object prior to moving it, or -1 if it is not moved.
        Throws:
        IllegalActionException - If this object has no container.
      • moveToLast

        public int moveToLast()
                       throws IllegalActionException
        Move this object to the last position in the list of attributes of the container. This overrides the base class to create an attribute named "_renderLast" and to remove an attribute named "_renderFirst" if it is present. This attribute is recognized by vergil, which then renders this attribute after entities, connections, and other attributes. This method gets write access on workspace and increments the version.
        Specified by:
        moveToLast in interface Moveable
        Overrides:
        moveToLast in class Attribute
        Returns:
        The index of the specified object prior to moving it, or -1 if it is not moved.
        Throws:
        IllegalActionException - If this object has no container.
      • provideContent

        public void provideContent​(WebExporter exporter)
                            throws IllegalActionException
        Return a title for the model. The title can be returned as an attribute or an element, but not a document.
        Specified by:
        provideContent in interface WebExportable
        Parameters:
        exporter - The web exporter to which to write content.
        Throws:
        IllegalActionException - If there is a problem creating the content or setting the attribute.
      • _provideAttributes

        protected void _provideAttributes​(WebExporter exporter)
                                   throws IllegalActionException
        Provide a title for this object to the specified web exporter.
        Parameters:
        exporter - The WebExporter to add content to
        Throws:
        IllegalActionException - If something is wrong with the specification of the content.
      • validate

        public java.util.Collection validate()
                                      throws IllegalActionException
        Override the base class to set the text to be displayed in the icon.
        Specified by:
        validate in interface Settable
        Overrides:
        validate in class Variable
        Returns:
        The current list of value listeners, which are evaluated as a consequence of this call to validate().
        Throws:
        IllegalActionException - If this variable or a variable dependent on this variable cannot be evaluated (and is not lazy) and the model error handler throws an exception. Also thrown if the change is not acceptable to the container.