|
Re: Connection Bindings [message #780651 is a reply to message #780065] |
Wed, 18 January 2012 21:50 |
Shenxue Zhou Messages: 60 Registered: July 2009 |
Member |
|
|
Hi Greg,
Sorry for the lack of documentation on connection bindings. Let me try to explain:
1. The difference between connections and embedded connections lies in how the endpoints of connections are attached. For connections, they are bound to a list in which both endpoints are explicitly specified. Using the Map sample, the high way routes explicitly define the endpoints to point to destinations:
<route>
<from-destination>New York</from-destination>
<to-destination>Washington DC</to-destination>
<distance>1000</distance>
</route>
<route>
<from-destination>New York</from-destination>
<to-destination>Chicago</to-destination>
<distance>1000</distance>
</route>
In the connection binding, you'd need to specify both endpoints explicitly:
<connection-binding>
<connection-id>highway_routes</connection-id>
<property>Routes</property>
<label>${Distance == null ? "<distance>" : Distance}</label>
<endpoint1>
<property>FromDestination</property>
<value>${Name}</value>
</endpoint1>
<endpoint2>
<property>ToDestination</property>
<value>${Name}</value>
</endpoint2>
<instance-id>${FromDestination}-${ToDestination}</instance-id>
</connection-binding>
For embedded connections, the connection list lies inside elements that are bound to diagram nodes. The railway routes in the map sample are embedded connections:
<destination>
<name>New York</name>
<railway-destinations>
<railway-destination>
<to-destination>Washington DC</to-destination>
<distance>1500</distance>
</railway-destination>
<railway-destination>
<to-destination>Chicago</to-destination>
<distance>1500</distance>
</railway-destination>
</railway-destinations>
</destination>
In connection binding for the embedded connections, the source endpoint is implicit. It assumes it's the element in which the embedded connection list is located. You'd only need to specify the target endpoint (endpoint2):
<connection-binding>
<connection-id>railway_routes</connection-id>
<property>RailwayRoutes</property>
<label>${Distance == null ? "<distance>" : Distance}</label>
<endpoint2>
<property>ToDestination</property>
<value>${Name}</value>
</endpoint2>
<instance-id>${ToDestination}</instance-id>
</connection-binding>
And the <connection-binding> element needs to be located inside the node specification in the sdef file.
2. Implicit connections are implied connections. They are bound to the diagram nodes. The semantics is for the list element which corresponds to a list of diagram nodes, if the elements of the list meets certain condition, then Sapphire Diagram will render implicit connections between the corresponding nodes on the diagram. Here is an example:
<implicit-connection-binding>
<connection-id>trainStops</connection-id>
<property>Activities</property>
<condition>${TrainStop != null && parent().Train}</condition>
</implicit-connection-binding>
In the diagram, you can't edit the implicit connections directly. The implicit connections will refresh if the conditions on the corresponding nodes change.
Hope that helps. Let me know if you have more questions on connection bindings.
Shenxue
|
|
|
|
Powered by
FUDForum. Page generated in 0.03423 seconds