Class PtolemyEffigy

  • All Implemented Interfaces:
    java.lang.Cloneable, Changeable, ChangeListener, Debuggable, DebugListener, Derivable, Instantiable, ModelErrorHandler, MoMLExportable, Moveable, Nameable
    Direct Known Subclasses:
    ConfigurationEffigy, DocBuilderEffigy, PlotEffigy

    public class PtolemyEffigy
    extends Effigy
    implements ChangeListener
    An effigy for a Ptolemy II model. An effigy represents model metadata, and is contained by the model directory or by another effigy. This class adds to the base class an association with a Ptolemy II model. The model, strictly speaking, is any Ptolemy II object (an instance of NamedObj). The Effigy class extends CompositeEntity, so an instance of Effigy can contain entities. By convention, an effigy contains all open instances of Tableau associated with the model.
    Since:
    Ptolemy II 1.0
    Version:
    $Id$
    Author:
    Steve Neuendorffer and Edward A. Lee
    Pt.AcceptedRating:
    Yellow (janneck)
    Pt.ProposedRating:
    Green (eal)
    • Constructor Detail

      • PtolemyEffigy

        public PtolemyEffigy​(Workspace workspace)
        Create a new effigy in the specified workspace with an empty string for its name.
        Parameters:
        workspace - The workspace for this effigy.
    • Method Detail

      • changeExecuted

        public void changeExecuted​(ChangeRequest change)
        React to the fact that a change has been successfully executed. This method does nothing.
        Specified by:
        changeExecuted in interface ChangeListener
        Parameters:
        change - The change that has been executed.
      • changeFailed

        public void changeFailed​(ChangeRequest change,
                                 java.lang.Exception exception)
        React to the fact that a change has triggered an error by reporting the error in a top-level dialog.
        Specified by:
        changeFailed in interface ChangeListener
        Parameters:
        change - The change that was attempted.
        exception - The exception that resulted.
      • clone

        public java.lang.Object clone​(Workspace workspace)
                               throws java.lang.CloneNotSupportedException
        Clone the object into the specified workspace. This calls the base class and then clones the associated model into a new workspace, if there is one.
        Overrides:
        clone in class CompositeEntity
        Parameters:
        workspace - The workspace for the new effigy.
        Returns:
        A new effigy.
        Throws:
        java.lang.CloneNotSupportedException - If a derived class contains an attribute that cannot be cloned.
        See Also:
        NamedObj.exportMoML(Writer, int, String), NamedObj.setDeferringChangeRequests(boolean)
      • getModel

        public NamedObj getModel()
        Return the ptolemy model that this is an effigy of.
        Returns:
        The model, or null if none has been set.
        See Also:
        setModel(NamedObj)
      • masterEffigy

        public Effigy masterEffigy()
        Return the effigy that is "in charge" of this effigy. In this base class, this returns the effigy associated with the top-level of the associated model. If there is no model, or it has no effigy, then delegate to the base class.
        Overrides:
        masterEffigy in class Effigy
        Returns:
        The effigy associated with the top-level of the model.
        See Also:
        Effigy.topEffigy()
      • setModel

        public void setModel​(NamedObj model)
        Set the ptolemy model that this is an effigy of. Register with that model as a change listener.
        Parameters:
        model - The model.
        See Also:
        getModel()
      • writeFile

        public void writeFile​(java.io.File file)
                       throws java.io.IOException
        Write the model associated with this effigy to the specified file in MoML format. Change the name of the model to match the file name, up to its first period.
        Overrides:
        writeFile in class Effigy
        Parameters:
        file - The file to write to.
        Throws:
        java.io.IOException - If the write fails.