<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Hi,<br>
<br>
Long story, but the short summary is that a change request is
created that adds<br>
<br>
<property name="_highlightColor"
class="ptolemy.actor.gui.ColorAttribute"
value="{1.0,0.0,0.0,1.0}"><br>
</property><br>
<br>
to model in a non-persistent manner.<br>
<br>
Try searching for _hightlightColor in the kepler/ptolemy
directory.<br>
<br>
<br>
ptolemy/vergil/basic/BasicGraphController.java has this method,
which is probably what does the highlighting:<br>
<blockquote type="cite"> /** Highlight the specified object and
all its containers
to <br>
* indicate that it is the source of an
error.
<br>
* @param culprit The
culprit.
<br>
*/<br>
public void highlightError(final Nameable culprit) {<br>
if (culprit instanceof NamedObj) {<br>
ChangeRequest request = new ChangeRequest(this,
"Error Highlighter") {<br>
@Override<br>
protected void _execute() throws Exception {<br>
_addErrorHighlightIfNeeded(culprit);<br>
NamedObj container = culprit.getContainer();<br>
while (container != null) {<br>
_addErrorHighlightIfNeeded(container);<br>
container = container.getContainer();<br>
}<br>
}<br>
};<br>
request.setPersistent(false);<br>
((NamedObj) culprit).requestChange(request);<br>
}<br>
}<br>
</blockquote>
<br>
The above method creates a change request and executes it. The
body of the change request invokes this method:<br>
<br>
<blockquote type="cite"> /** Add an error highlight color to
the specified culprit if it
is <br>
* not already
present.
<br>
* @param culprit The culprit to
highlight.
<br>
* @exception IllegalActionException If the highlight
cannot be added. <br>
* @exception NameDuplicationException Should not be
thrown. <br>
*/<br>
private void _addErrorHighlightIfNeeded(Nameable culprit)<br>
throws IllegalActionException,
NameDuplicationException {<br>
Attribute highlightColor = ((NamedObj) culprit)<br>
.getAttribute("_highlightColor");<br>
if (highlightColor == null) {<br>
highlightColor = new ColorAttribute((NamedObj)
culprit,<br>
"_highlightColor");<br>
((ColorAttribute) highlightColor)<br>
.setExpression("{1.0, 0.0, 0.0, 1.0}");<br>
highlightColor.setPersistent(false);<br>
((ColorAttribute)
highlightColor).setVisibility(Settable.EXPERT);<br>
_errorHighlights.add(highlightColor);<br>
}<br>
}<br>
<br>
</blockquote>
<br>
See also ptolemy/vergil/basic/DependencyHighlighter.java for code
that does highlighting.<br>
<br>
_Christopher<br>
<br>
<br>
On 11/5/14 12:30 AM, 陈军 wrote:<br>
</div>
<blockquote
cite="mid:CAGpdny_LQkde06w6xRy9TuB2MC_j5iPm=Y9vZA1KmMmEV8eO2Q@mail.gmail.com"
type="cite">
<div dir="ltr">Hi,
<div><br>
</div>
<div>I want to mark actors with custom colours.</div>
<div><br>
</div>
<div>Entities in a workflow will be encircled with red colour
when errors occur.</div>
<div>So I construct a bad workflow and run in debug mode trying
to see how actors are rendered red. But I still can not
figure out it.</div>
<div><br>
</div>
<div>Can anyone give some advice?</div>
<div>Thanks<br clear="all">
<div><br>
</div>
-- <br>
<div class="gmail_signature">
<div dir="ltr">
<div>陈军</div>
<div>School of Computer Science , Fudan University</div>
</div>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Kepler-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Kepler-dev@kepler-project.org">Kepler-dev@kepler-project.org</a>
<a class="moz-txt-link-freetext" href="http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-dev">http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-dev</a>
</pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
Christopher Brooks, PMP University of California
Academic Program Manager & Software Engineer US Mail: 337 Cory Hall
CHESS/iCyPhy/Ptolemy/TerraSwarm Berkeley, CA 94720-1774
<a class="moz-txt-link-abbreviated" href="mailto:cxh@eecs.berkeley.edu">cxh@eecs.berkeley.edu</a>, 707.332.0670 (Office: 545Q Cory)
</pre>
</body>
</html>