Project

General

Profile

Bug #2324

SVG - old-style icon still displayed for certain actors

Added by Matthew Brooke about 13 years ago. Updated over 9 years ago.

Status:
In Progress
Priority:
Normal
Category:
interface
Target version:
Start date:
12/16/2005
Due date:
% Done:

0%

Estimated time:
Bugzilla-Id:
2324

Description

For certain actors, described below, the old-style icon is still displayed when
an actor is dragged to the canvas:

1) for any actors that have an icon defined in the MOML file thus:
...
<property name="_icon" class="ptolemy.vergil.icon.BoxedValueIcon">
<property name="attributeName" class="ptolemy.kernel.util.StringAttribute"
value="value">
</property>
<property name="displayWidth" class="ptolemy.data.expr.Parameter" value="60">
</property>
</property>
...
(this is an example - not necessarily all "BoxedValueIcon". The thing to look
for is name="_icon")

Note that "ESRI Shape File Displayer" (org.kepler.gis.display.JumpSHPDisplayer)
actually has a custom icon (_iconDescription) defined inthe java code - so I am
not sure where this other "_icon" definition is coming from.

2) actors that have an accompanying "<actorname>Icon.xml" file - like
ptolemy.domains.sdf.lib.SequenceToArray has an accompanying
SequenceToArrayIcon.xml file in ptolemy/domains/sdf/lib/, which is automatically
pulled in by the MOMLParser and added to the actor.

===================================================

Note that, in many cases, showing the old-style icon may still be appropriate
(for example, org.sdm.spa.StrinConst uses a box to display the user-entered
string inside. Replacing this with a big icon would probably not be a good idea.
A similar argument also applies to entries in the actor library under the
Variable->Parameter node (eg ColorParameter, FileParameter etc).

However, other actors, like the "ESRI Shape File Displayer"
(org.kepler.gis.display.JumpSHPDisplayer) could (and should) have its existing
icon replaced with an appropriate new-style icon.

So, since we can't distinguish between these 2 general cases programmatically
(without resorting to keeping a hard-coded list of actors in an "omissions"
list), how can we handle the situation?

How about a policy that allows actor developers to override the "designed" icon
by defining this as "<property name="_icon" ..etc" in the MOML, ONLY if it is
absolutely necessary (eg to present a box with user text in it)? Other,
non-essential uses of "<property name="_icon" ..etc" would then just be removed
from the MOML. If users want to define icons to show up under the old-style
rendering scheme, such icons could be defined in the MOML as an SVG
"_iconDescription". Same goeas for separate <actorname>Icon.xml files. However -
some of these exist in the PTII codebase, so we can't remove those.

Not sure what to do. Any comments, thoughts, other solutions?


Related issues

Blocked by Kepler - Bug #2245: TRACKING: Batik SVG Rendering - remaining tasksIn Progress2005-11-04

Blocks Kepler - Bug #2345: Actor Library classname/icon mapping problemsResolved2006-01-26

History

#1 Updated by Matthew Brooke almost 13 years ago

Additional info (specific case), reported by Dan:

if you look at the compositeBiodiversityExample.xml workflow (in workflows/eco/)
we now get a simple yellow rectangle ot the left of the composite labeled
'BiodiversityIndex'. Double clicking on the rectangle does bring up a html page
with equations as it should, but no one would know that from the box! (which is
a 'DocumentationAttribute'). It used to say 'Double click to see documentation'

#2 Updated by Matthew Brooke over 12 years ago

looked thru the 3 workflows created by Matt, which show all the current actors. According to these WFs, the following actors currently do not show the new-style icons (WF's are in kepler/workflows/test):

all-actors-displayed-part1a.xml
-------------------------------

Array To Sequence
Sequence To Array
Switch
Select
Repeat
TextAttribute (shows val)
Constant (shows val)
String Constant (shows val)
Single Fire Constant (should show val?)
Permanent String Constant (should show val?)
Equals
Boolean Switch

all-actors-displayed-part1b.xml
-------------------------------

Create Expression From Query
File Array Printer
ENM PCP
ESRI Shape File Displayer
GML Displayer

all-actors-displayed-part2.xml
-------------------------------

SProxy (shows val - should it?)
Multiply Or Divide
Average
Add Or Subtract
Absolute Value
Differential Equation
Integrator
Dot Product
Accumulator
Counter
Uniform Distribution Random Number Generator
Gaussian Distribution Random Number Generator
BasicUnits
CGSUnitBase
ElectronicUnitBase
SI
Parameter
ColorParameter
FileParameter
PortParameter
StringParameter
RequireVersion: 6.0-devel
ScopeExtendingAttribute
SingletonAttribute
(plus some repeats)


Other actors that don't have icons are the "shapes" (these show the actual shape reflected in their names - Ellipse etc) and the image display (which displays a user-settable image) - these are (presumably) OK

#3 Updated by Dan Higgins over 12 years ago

DocViewer seems to be missing from your list. It only displays a rectangle. It should have text saying something like 'Show Documentation'.

There is also a 'Documentation Attribute' (which doesn't even show up correctly in the actor tree.

#4 Updated by Matthew Brooke over 12 years ago

ah! - the DocViewer was in there, but it had no text label (as Dan had previously pointed out in an email), and its tooltip said "SingletonAttribute".

See Bug #2382 for a discussion of the missing "Documentation Attribute"

#5 Updated by Matthew Brooke over 12 years ago

changed icon assignments for:

Permanent String Constant (src/org/resurgence/actor/PermanentStringConstant.java)
and
Single Fire Constant (src/org/geon/ConstOnce.java)

...so icon actually displays the value of the constant typed in by the user.

#6 Updated by Matthew Brooke over 12 years ago

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 ===

#7 Updated by Matthew Brooke over 12 years ago

added a line to build-ptolemy.xml, to exclude files of the form *Icon.xml, since these interfere with new SVG icons.

For reference, the remaining actors that still don't display the new icon assignments are now shown in a new test workflow -

kepler/workflows/test/IconsNotShowing.xml

#8 Updated by Matthew Brooke over 12 years ago

Fixed some typos in uiSVGMappingsByClass props file, and removed some references to BoxedValueIcon in actor moml.

Only actors that still do not get new icons are all descendents of ptolemy.kernel.util.Attribute, which which does not yet have a call to:

ComponentEntityConfig.addIconTo(this);

...as previously added to Director and ComponentEntity

#9 Updated by Matthew Brooke over 12 years ago

The remaining actors without new icons are as follows:

BasicUnits (ptolemy.data.unit.UnitSystem)
CGSUnitBase (ptolemy.data.unit.UnitSystem)
ElectronicUnitBase (ptolemy.data.unit.UnitSystem)
SI (ptolemy.data.unit.UnitSystem)

DocViewer (ptolemy.kernel.util.SingletonAttribute)

Parameter (ptolemy.data.expr.Parameter)
ColorParameter (ptolemy.actor.gui.ColorAttribute)
FileParameter (ptolemy.data.expr.FileParameter)
PortParameter (ptolemy.actor.parameters.PortParameter)
StringParameter (ptolemy.data.expr.StringParameter)

ScopeExtendingAttribute (ptolemy.data.expr.ScopeExtendingAttribute)

RequireVersion (ptolemy.kernel.attributes.RequireVersion)

#10 Updated by Matthew Brooke over 12 years ago

OK - set icons by LSID (in uiSVGIconMappingsByLSID.properties) for:
BasicUnits, CGSUnitBase, ElectronicUnitBase, SI (all set to blank teal icon)
and DocViewer (set to new Documentation SVG icon).

Remaining changes are low priority:
a) Still need to change all these to a royal blue dot:

Parameter (ptolemy.data.expr.Parameter)
FileParameter (ptolemy.data.expr.FileParameter)
StringParameter (ptolemy.data.expr.StringParameter)
ScopeExtendingAttribute (ptolemy.data.expr.ScopeExtendingAttribute)
RequireVersion (ptolemy.kernel.attributes.RequireVersion)

b) change to royal blue dot, keep the arrow, but make arrow solid black:
PortParameter (ptolemy.actor.parameters.PortParameter)

c) Make dot show the actual color picked:
ColorParameter (ptolemy.actor.gui.ColorAttribute)

(Note - have removed the test workflow from cvs, now most of these are fixed - kepler/workflows/test/IconsNotShowing.xml)

#11 Updated by Chad Berkley over 9 years ago

As of 4/3/09, this is the status of this bug:

a) Still need to change all these to a royal blue dot:

(done)Parameter (ptolemy.data.expr.Parameter)
(green dot)FileParameter (ptolemy.data.expr.FileParameter)
(red dot)StringParameter (ptolemy.data.expr.StringParameter)
(done)ScopeExtendingAttribute (ptolemy.data.expr.ScopeExtendingAttribute)
(black dot)RequireVersion (ptolemy.kernel.attributes.RequireVersion)

b) change to royal blue dot, keep the arrow, but make arrow solid black:
(blue dot but with empty arrow)PortParameter (ptolemy.actor.parameters.PortParameter)

c) Make dot show the actual color picked:
(always shows pink)ColorParameter (ptolemy.actor.gui.ColorAttribute)

#12 Updated by Redmine Admin over 5 years ago

Original Bugzilla ID was 2324

Also available in: Atom PDF