[kepler-dev] [Bug 2324] - SVG - old-style icon still displayed for certain actors

bugzilla-daemon@ecoinformatics.org bugzilla-daemon at ecoinformatics.org
Wed Apr 12 15:18:01 PDT 2006


http://bugzilla.ecoinformatics.org/show_bug.cgi?id=2324





------- Comment #6 from brooke at nceas.ucsb.edu  2006-04-12 15:18 -------
note to self (or whoever has to change these "*Constant" icons in future...)

Actual icon is ptolemy.vergil.icon.BoxedValueIcon. If we need to change the
outline color, rounded corners, etc, we'll need to override this class

Assignment:
For PTII classes (notably ptolemy.actor.lib.Const and
ptolemy.actor.lib.Expression), the icon assignment isn't made in the actor code
or the actor moml file - it's made as the moml is parsed at runtime, in the
class ptolemy.moml.filter.AddIcon. This class contains a hard-coded HashMap
(aptly named "_actorsThatShouldHaveIcons"), which contains the names of actors
that get these icons added.

So - instead of adding the Kepler actors to this list (which didn't seem like
the right thing to do), I instead assigned the BoxedValueIcon in the specific
actor constructors (which also doesn't seem like the right thing to do, but
less-not-right than the other option...). Here's the code to put in the
constructor:

        BoxedValueIcon icon = new BoxedValueIcon(this, "_icon");
        icon.displayWidth.setExpression("25");
        icon.attributeName.setExpression("value");

(TODO the "25" max width should really be accessible from a common central
place, so all actors can be changed easily)

===
*** NOTE ***
For future reference, the AddIcon filter contains mappings for:
ptolemy.actor.lib.TrigFunction, 
ptolemy.actor.lib.MathFunction and 
ptolemy.actor.lib.Scale, 
...all of which receive the ptolemy.vergil.icon.AttributeValueIcon (which is
the superclass of BoxedValueIcon). HOWEVER - the AttributeValueIcon displays
the value ON TOP OF the new svg icon, whereas BoxedValueIcon overrides the new
SVG icon completely
===


More information about the Kepler-dev mailing list