It turns out that starting up Vergil or HyVisual will 
fail if optional actors like Matlab or the Quicktime libraries
are not found.  

The problem is caused when we create a blank Graph Editor with a
director that is specified in the configuration file. 
Directors now have a SharedParameter and when we created the
Director, the SharedParameter traversed its containment hierarchy
which ended up getting in to the Configuration and instantiating all
the actors.

A workaround to ptolemy.moml.SharedParameter has been provided by
Professor Lee:

--start--
    OK, SharedParameter has:
    
         /** Return the top level of the containment hierarchy, unless
          *  one of the containers is an instance of EntityLibrary,
          *  in which case, return null.
          *  @return The top level, or null if this is within a library.
          */
         public NamedObj getRoot() {
             NamedObj result = this;
    
             while (result.getContainer() != null) {
                 result = (NamedObj) result.getContainer();
    
                 if (result instanceof EntityLibrary) {
                     return null;
                 }
             }
    
             return result;
         }
    
    If you change this to:
    
         /** Return the top level of the containment hierarchy, unless
          *  one of the containers is an instance of EntityLibrary,
          *  in which case, return null.
          *  @return The top level, or null if this is within a
          *   Configuration.
          */
         public NamedObj getRoot() {
             NamedObj result = this;
    
             while (result.getContainer() != null) {
                 result = (NamedObj) result.getContainer();
    
                 if (result instanceof Configuration) {
                     return null;
                 }
             }
    
             return result;
         }
    
    I think the problem will go away.
    However, this creates a new and unfortunate package
    dependency.  The moml package will now depend on actor.gui.
    I'm not sure how to get around this...
    Perhaps we should do a string comparison of the name
    of the class rather than instanceof?  This is more expensive,
    however, and I'm not sure how often this method is called.
---end--

I see two options:

1) Use a string comparison, which is gross and could be slow.

2) Create an intermediate class.
Since actor.gui.Configuration extends kernel.CompositeEntity,
perhaps we could create kernel.ConfigurationBase
and have Configuration extend ConfigurationBase?

I'm not sure which is worse.

My plan is to create new installers sometime soon.

_Christopher

----------------------------------------------------------------------------
Posted to the ptolemy-hackers mailing list.  Please send administrative
mail for this list to: [EMAIL PROTECTED]

Reply via email to