A LayoutHint is an Attribute for Ptolemy Relations that holds the
specification of bend points for links. Its value field contains a list of
<a href="../../../../../ptolemy/vergil/basic/layout/kieler/LayoutHint/LayoutHintItem.xml">ptolemy.vergil.basic.layout.kieler.LayoutHint.LayoutHintItem</a> objects because one Relation can correspond to
multiple links, which are not real objects in the Ptolemy abstract syntax and
therefore can not carry any attributes. Each item carries a list of
bendpoints for a specific link.
<p>
The LayoutHint uses a Ptolemy Expression as its value in which the
<a href="../../../../../ptolemy/vergil/basic/layout/kieler/LayoutHint/LayoutHintItem.xml">ptolemy.vergil.basic.layout.kieler.LayoutHint.LayoutHintItem</a> objects are encoded. Therefore the Expression is
expected to contain an <a href="../../../../../ptolemy/data/ArrayToken.xml">ptolemy.data.ArrayToken</a> of <a href="../../../../../ptolemy/vergil/basic/layout/kieler/LayoutHint/LayoutHintItem.xml">ptolemy.vergil.basic.layout.kieler.LayoutHint.LayoutHintItem</a> objects.</p>
<p>
A complete LayoutHint with two <a href="../../../../../ptolemy/vergil/basic/layout/kieler/LayoutHint/LayoutHintItem.xml">ptolemy.vergil.basic.layout.kieler.LayoutHint.LayoutHintItem</a>s could look like this:</p>
<pre>
{
{
head={id="Discard.input",x=60.0,y=115.0,index=2},
tail={id="CompositeActor.port3",x=300.0,y=380.0,index=3},
points={105.0,235.0,105.0,190.0,265.0,190.0,265.0,135.0}
},
{
head={id="Ramp.output",x=320.0,y=225.0},
tail={id="CompositeActor.port2",x=580.0,y=200.0,index=3},
points={135.0,25.0,135.0,125.0}
}
}
</pre>
<p>This storage works like a <a href="../../../../../java/util/Map.html">java.util.Map</a> with always two keys. One
<a href="../../../../../ptolemy/vergil/basic/layout/kieler/LayoutHint/LayoutHintItem.xml">ptolemy.vergil.basic.layout.kieler.LayoutHint.LayoutHintItem</a> is unambiguously identified by its head and tail,
which are Ptolemy objects like <a href="../../../../../ptolemy/kernel/Port.xml">ptolemy.kernel.Port</a>s or <a href="../../../../../ptolemy/kernel/Relation.xml">ptolemy.kernel.Relation</a>s. The
methods to access this are <a href="../../../../../ptolemy/vergil/basic/layout/kieler/LayoutHint.html#getLayoutHintItem">getLayoutHintItem(Object, Object)</a>,
<a href="../../../../../ptolemy/vergil/basic/layout/kieler/LayoutHint.html#setLayoutHintItem">setLayoutHintItem(NamedObj, NamedObj, double[])</a> and
<a href="../../../../../ptolemy/vergil/basic/layout/kieler/LayoutHint.html#removeLayoutHintItem">removeLayoutHintItem(LayoutHintItem)</a>.</p>
<p> The class extends <a href="../../../../../ptolemy/kernel/util/SingletonAttribute.xml">ptolemy.kernel.util.SingletonAttribute</a> because every
Relation is expected to have only one such Attribute, while one of
these Attributes can carry multiple <a href="../../../../../ptolemy/vergil/basic/layout/kieler/LayoutHint/LayoutHintItem.xml">ptolemy.vergil.basic.layout.kieler.LayoutHint.LayoutHintItem</a>s as
explained above. It is also <a href="../../../../../ptolemy/kernel/util/Settable.xml">ptolemy.kernel.util.Settable</a> as
it can be set by loading a MOML file or by setting it manually
through the GUI. However, usually its visibility is set to EXPERT
mode only.</p>
<p>
Some of the standard code for example for value listeners is copied from
<a href="../../../../../ptolemy/kernel/util/Location.xml">ptolemy.kernel.util.Location</a>.</p>
Hauke Fuhrmann, (kieler@informatik.uni-kiel.de)
Ptolemy II 10.0
Red (haf)
Red (haf)