https://projects.ecoinformatics.org/ecoinfo/https://projects.ecoinformatics.org/ecoinfo/ecoinfo/favicon.ico?14691340362012-06-15T15:00:19ZEcoinformatics RedmineKepler - Bug #5266: Two empty boxes inside Sinewave actor and other icon problems for attributeshttps://projects.ecoinformatics.org/ecoinfo/issues/5266?journal_id=182352012-06-15T15:00:19ZChristopher Brookscxh@eecs.berkeley.edu
<ul></ul><p>The reported problem here is that if a Sinewave actor is dragged onto the<br />canvas in Kepler, then two blank boxes appear.</p>
<p>One is an attribute that is actually an old-style annotation that is supposed<br />to say "Generate a sine wave".</p>
<p>The second is a SingletonAttribute that when clicked is supposed to bring<br />up the documentation for the composite.</p>
<p>The contents of the Sinewave actor appear fine inside Ptolemy II, the problem<br />is with Kepler.</p>
<p>For the first one, we could just substitute in a more recent TextAttribute,<br />but the real fix would be to make it so that Kepler would properly display<br />these because presumably there are other models that have these old annotations.<br />In ptII, the code that possibly displays these annotations might be in<br />ptolemy/vergil/icon/XMLIcon.java</p>
<p>For the second one, we need to look at how Kepler displays the SingletonAttribute.</p> Kepler - Bug #5266: Two empty boxes inside Sinewave actor and other icon problems for attributeshttps://projects.ecoinformatics.org/ecoinfo/issues/5266?journal_id=182362012-06-26T20:24:34ZChristopher Brookscxh@eecs.berkeley.edu
<ul></ul><p>There are problems with singleton attributes.<br />See also bug <a class="issue tracker-1 status-3 priority-2 priority-default closed" title="Bug: Text in attributes not rendered properly (Resolved)" href="https://projects.ecoinformatics.org/ecoinfo/issues/4903">#4903</a>.</p> Kepler - Bug #5266: Two empty boxes inside Sinewave actor and other icon problems for attributeshttps://projects.ecoinformatics.org/ecoinfo/issues/5266?journal_id=182372012-08-07T21:48:26ZSean Riddleswriddle@gmail.com
<ul></ul><p>I get this behavior under kepler trunk, reporting suite is not needed.</p> Kepler - Bug #5266: Two empty boxes inside Sinewave actor and other icon problems for attributeshttps://projects.ecoinformatics.org/ecoinfo/issues/5266?journal_id=182382012-08-07T23:17:45ZChristopher Brookscxh@eecs.berkeley.edu
<ul></ul><p>Hi Sean,<br />If I were you, I'd focus on the other bug because the Sinewave icon bug may be tricky because Sinewave is an actor-oriented class. If there clone(Workspace) method is not implemented properly, then there will be problems.</p>
<p>Ptolemy is not affected by this bug.<br />To run Ptolemy from the Kepler tree:<br />cd build-area<br />java -classpath ../ptolemy/target/classes:../ptolemy/src ptolemy.vergil.VergilApplication -ptiny ../ptolemy/src/ptolemy/actor/lib/Sinewave.xml</p>
<p>The SingletonAttribute is a yellow box, if you double click on it, then the Documentation comes up.</p>
<p>I'll attach screenshots of both to the bug.</p>
<p>On 8/7/12 4:00 PM, Sean Riddle wrote:</p>
<blockquote>
<p>Hi all,<br />I'm currently looking at a bug with the sinewave composite that comes bundled with Ptolemy. Basically, two of the actors in the composite that need special graphics rendered (like text in an attribute) are instead rendered as plain green boxes. Could anyone who used this actor before or who has a version of Kepler (or Ptolemy) unaffected by this bug please tell me what these two actors are intended for? One appears to be a SingletonAttribute that contains documentation, and one is a DocViewerAttribute.<br />- Sean</p>
</blockquote> Kepler - Bug #5266: Two empty boxes inside Sinewave actor and other icon problems for attributeshttps://projects.ecoinformatics.org/ecoinfo/issues/5266?journal_id=182402012-08-08T14:13:57ZChristopher Brookscxh@eecs.berkeley.edu
<ul></ul><p>Edward writes:</p>
<blockquote>
<p>This sort of bug usually arises from something being<br />done outside the Swing event thread that should be done inside<br />the Swing event thread. Perhaps the reporting suite has<br />a bug here?</p>
</blockquote>
<p>BTW - the bug happens in regular Kepler, the reporting suite is not required.</p> Kepler - Bug #5266: Two empty boxes inside Sinewave actor and other icon problems for attributeshttps://projects.ecoinformatics.org/ecoinfo/issues/5266?journal_id=182412012-08-23T19:26:24ZChristopher Brookscxh@eecs.berkeley.edu
<ul></ul><p>Redispatching to myself so that I can create a non-Actor Oriented Class version<br />of Sinewave.</p> Kepler - Bug #5266: Two empty boxes inside Sinewave actor and other icon problems for attributeshttps://projects.ecoinformatics.org/ecoinfo/issues/5266?journal_id=182442012-08-23T22:46:43ZChristopher Brookscxh@eecs.berkeley.edu
<ul></ul><p>I've uploaded a Sinewave that is not an actor oriented composite and the<br />screen shot.</p>
<p>The problem persists.</p>
<p>I've reassigned this to Sean.</p> Kepler - Bug #5266: Two empty boxes inside Sinewave actor and other icon problems for attributeshttps://projects.ecoinformatics.org/ecoinfo/issues/5266?journal_id=182452012-10-01T21:07:16ZSean Riddleswriddle@gmail.com
<ul></ul><p>Adding _icon properties to the problem attributes allows the SVG attached to the attributes to be attached to a ValueIcon. For instance, the property 'annotation' had properties '_iconDescription' and '_smallIconDescription', which contain SVG definitions of the full-size icon and the icon displayed in the library tree, respectively. These alone, though, will not cause a custom icon to be displayed.</p>
<p>The following declaration is needed:</p>
<pre><code>&lt;property name="_icon" class="ptolemy.vergil.icon.ValueIcon"&gt;<br /> &lt;property name="_color" class="ptolemy.actor.gui.ColorAttribute" value="{1.0, 0.0, 0.0, 1.0}"&gt;<br /> &lt;/property&gt;<br /> &lt;/property&gt;</code></pre>
<p>This specifies that the icon is going to be an instance of ValueIcon, and ValueIcon presumably gets the definitions from _iconDescription and _smallIconDescription and instantiates and displays the SVG appropriately.</p>
<p>This change has been sent to Christopher for review prior to commit.</p> Kepler - Bug #5266: Two empty boxes inside Sinewave actor and other icon problems for attributeshttps://projects.ecoinformatics.org/ecoinfo/issues/5266?journal_id=182462012-10-01T21:15:23ZChristopher Brookscxh@eecs.berkeley.edu
<ul></ul><p>Sean's patch is below.</p>
<p>The issue here is that this will fix it for one actor.</p>
<p>There are no doubt many other actors that have the same issue.</p>
<p>To close this bug requires fixing the underlying problem, perhaps<br />with a MoMLFilter.</p>
<p>However, I don't see how we could have filter know that the icon <br />should be updated?</p>
<p>It could be that when this actor was created, it was not created with an _icon<br />attribute. One solution would be modify MoMLParser so that if _icon was not<br />present in the appropriate context then it would be added.</p>
<p>Index: src/ptolemy/actor/lib/Sinewave.xml
===================================================================<br />--- src/ptolemy/actor/lib/Sinewave.xml (revision 64734) <br />+<ins>+ src/ptolemy/actor/lib/Sinewave.xml (working copy) <br /><code>@ -22,6 +22,10 </code>@<br /> <property name="_iconDescription" class="ptolemy.kernel.util.SingletonConfigurableAttribute"> <br /> <configure><svg><text x="20" y="20" style="font-size:14; font-family:SansSerif; fill:blue">Generate a sine wave.</text></svg></c\<br />onfigure> <br /> </property> <br /></ins> <property name="_icon" class="ptolemy.vergil.icon.ValueIcon"> <br />+ <property name="_color" class="ptolemy.actor.gui.ColorAttribute" value="{1.0, 0.0, 0.0, 1.0}"> <br />+ </property> <br />+ </property> <br /> <property name="_smallIconDescription" class="ptolemy.kernel.util.SingletonConfigurableAttribute"> <br /> <configure> <br /> <svg> <br /><code>@ -75,6 +79,10 </code>@<br /> </svg> <br /> </configure> <br /> </property> <br />+ <property name="_icon" class="ptolemy.vergil.icon.ValueIcon"> <br />+ <property name="_color" class="ptolemy.actor.gui.ColorAttribute" value="{1.0, 0.0, 0.0, 1.0}"> <br />+ </property> <br />+ </property> <br /> <property name="_location" class="ptolemy.kernel.util.Location" value="[240.0, 100.0]"> <br /> </property> <br /> </property></p> Kepler - Bug #5266: Two empty boxes inside Sinewave actor and other icon problems for attributeshttps://projects.ecoinformatics.org/ecoinfo/issues/5266?journal_id=182472012-10-02T02:19:40ZChristopher Brookscxh@eecs.berkeley.edu
<ul></ul><p>Note that the change to ValueIcon was backed out because of bug <a class="issue tracker-1 status-3 priority-2 priority-default closed" title="Bug: parameter values no longer appear on canvas (Resolved)" href="https://projects.ecoinformatics.org/ecoinfo/issues/5719">#5719</a>, see<br /><a class="external" href="http://bugzilla.ecoinformatics.org/show_bug.cgi?id=5719#c2">http://bugzilla.ecoinformatics.org/show_bug.cgi?id=5719#c2</a></p> Kepler - Bug #5266: Two empty boxes inside Sinewave actor and other icon problems for attributeshttps://projects.ecoinformatics.org/ecoinfo/issues/5266?journal_id=182482012-10-17T19:04:48ZSean Riddleswriddle@gmail.com
<ul></ul><p>(In reply to comment <a class="issue tracker-1 status-3 priority-5 priority-highest closed" title="Bug: metacat doesn't allow updates or deletes (Resolved)" href="https://projects.ecoinformatics.org/ecoinfo/issues/13">#13</a>)</p>
<blockquote>
<p>Note that the change to ValueIcon was backed out because of bug <a class="issue tracker-1 status-3 priority-2 priority-default closed" title="Bug: parameter values no longer appear on canvas (Resolved)" href="https://projects.ecoinformatics.org/ecoinfo/issues/5719">#5719</a>, see<br /><a class="external" href="http://bugzilla.ecoinformatics.org/show_bug.cgi?id=5719#c2">http://bugzilla.ecoinformatics.org/show_bug.cgi?id=5719#c2</a></p>
</blockquote>
<p>I have a minor alteration of my earlier patch that I think would fix the problem. The part of code that generates the label would be changed to:</p>
<p>String truncated = StringUtilities.truncateString(value, width, 1);<br />LabelFigure label;<br />if (container instanceof Parameter) {<br /> label = new LabelFigure(truncated, _labelFont, 1.0, SwingConstants.SOUTH_WEST);<br />}<br />else {<br /> label = new LabelFigure(name + ": " + truncated, _labelFont, 1.0, SwingConstants.SOUTH_WEST);<br />}</p>
<p>This prevents the label from being displayed as 'ParameterType: ParameterValue'.</p>
<p>The reason that my patch caused all parameter labels to disappear is that inexplicably all parameters declare _hideName. So simply removing the _hideName property will make the labels visible. The above refinement to the patch is only to make the resulting names in line with what they were originally.</p>
<p>Is this an acceptable solution?</p> Kepler - Bug #5266: Two empty boxes inside Sinewave actor and other icon problems for attributeshttps://projects.ecoinformatics.org/ecoinfo/issues/5266?journal_id=182492012-10-17T21:39:40ZChristopher Brookscxh@eecs.berkeley.edu
<ul></ul><p>Could you post the entire file as an attachment? I'm not sure where your changes would go.</p> Kepler - Bug #5266: Two empty boxes inside Sinewave actor and other icon problems for attributeshttps://projects.ecoinformatics.org/ecoinfo/issues/5266?journal_id=182502012-10-17T23:10:52ZSean Riddleswriddle@gmail.com
<ul></ul><p>This revised ValueIcon class should fix the problem. Any parameters that have invisible labels probably need _hideName to be removed from their XML declaration in actors.</p> Kepler - Bug #5266: Two empty boxes inside Sinewave actor and other icon problems for attributeshttps://projects.ecoinformatics.org/ecoinfo/issues/5266?journal_id=182512012-10-18T00:11:40ZChristopher Brookscxh@eecs.berkeley.edu
<ul></ul><p>The Revised ValueIcon.java file at<br /><a class="external" href="http://bugzilla.ecoinformatics.org/attachment.cgi?id=440">http://bugzilla.ecoinformatics.org/attachment.cgi?id=440</a><br />still has the problem where when I drag in a Parameter, the Parameter<br />name is not shown.</p>
<p>Indeed, the xml has _hideName set:</p>
<pre><code>&lt;property name="Parameter" class="ptolemy.data.expr.Parameter"&gt;<br /> &lt;property name="_hideName" class="ptolemy.kernel.util.SingletonAttribute"&gt;<br /> &lt;/property&gt;<br /> &lt;property name="_icon" class="ptolemy.vergil.icon.ValueIcon"&gt;<br /> &lt;property name="_color" class="ptolemy.actor.gui.ColorAttribute" value="{0.0, 0.0, 1.0, 1.0}"&gt;<br /> &lt;/property&gt;<br /> &lt;/property&gt;<br /> &lt;property name="_smallIconDescription" class="ptolemy.kernel.util.SingletonConfigurableAttribute"&gt;<br /> &lt;configure&gt;<br /> &lt;svg&gt;<br /> &lt;text x="20" style="font-size:14; font-family:SansSerif; fill:blue" y="20"&gt;-P-&lt;/text&gt;<br /> &lt;/svg&gt;<br /> &lt;/configure&gt;</code></pre>
<p>ptolemy/configs/utilityParameter.xml defines the Parameter that is dragged<br />in and indeed, it defines _hideName.</p>
<p>This change would require that almost every model be updated.</p>
<p>In addition, the names and values of PortParameters are not shown,<br />For example, see $PTII/ptolemy/actor/lib/Sinewave.xml</p>
<p>I'm not sure how to proceed. Sean has offered a solution, but the solution<br />would require updating many models. Even before Sean's solution,<br />it seems like _hideName in Parameters was being set as a hacky fix to a problem.</p> Kepler - Bug #5266: Two empty boxes inside Sinewave actor and other icon problems for attributeshttps://projects.ecoinformatics.org/ecoinfo/issues/5266?journal_id=182522012-11-30T03:28:12ZDaniel Crawldanielcrawl@gmail.com
<ul></ul><p>The change to ValueIcon.java in r64716 was reverted, leaving ShowTypes and MonitorReceiverContents with titles. The documentation for ValueIcon describes it as: "An icon that displays a bullet, the name, and, ... its value." These attributes should not be displayed as bullets, so I changed the _icon class from ValueIcon to XMLIcon in these attributes' XML files in actors/resources/kar/CoreActors/, and they are now displayed correctly.</p>
<p>MonitorManager also had a title. I fixed this by adding a _hideName attribute in its constructor.</p>
<p>I updated ComponentEntityConfig to not use the default green box icon for attributes. This fixed the author attribute in the MatlabExpression demo and the "Generate a sine wave" attribute in the Sinewave actor.</p>
<p>The "Documentation" attribute in Sinewave was still not displayed, which was due to the SVG x and y having negative values. Batik does not appear to render icons with negative x and y.</p>
<p>Kepler uses batik for SVG, but Ptolemy does not. As far as I can tell, all Kepler icons have positive x and y, and most Ptolemy icons have negative x and y. Conveniently, there are no attributes other than directors with Kepler-specific icons, so I changed KeplerXMLIcon to use diva instead of batik to render attributes. If Kepler icons are created for attributes in the future, we'll need to find a better solution.</p>
<p>As far as I can tell, all the icon problems are now fixed; reassigning to Christopher to test.</p>
<p>By the way, it appears that diva.util.java2d.svg.SVGPaintedObject is only referenced by Kepler, and is the only Ptolemy class using the batik jar...</p> Kepler - Bug #5266: Two empty boxes inside Sinewave actor and other icon problems for attributeshttps://projects.ecoinformatics.org/ecoinfo/issues/5266?journal_id=182532012-12-07T18:39:04ZChristopher Brookscxh@eecs.berkeley.edu
<ul></ul><p>Fixed by Daniel!</p> Kepler - Bug #5266: Two empty boxes inside Sinewave actor and other icon problems for attributeshttps://projects.ecoinformatics.org/ecoinfo/issues/5266?journal_id=182542013-03-27T21:29:49ZRedmine Admin
<ul></ul><p>Original Bugzilla ID was 5266</p>