Colocando como exemplo o seguinte switch :
<switch id="sControl">
<bindRule rule="rlRule1t1" constituent="mMedia1t1"/>
<defaultComponent component="defaultMedia"/>
<media id="mMedia1t1" descriptor="dScreen" src="images/number1.png">
<property name="top" />
</media>
<media id="defaultMedia" descriptor="dScreen" src="images/number2.png"/>
<switchPort id="pRule1t1">
<mapping component="mMedia1t1" />
</switchPort>
<switchPort id="pDefault">
<mapping component="defaultMedia" />
</switchPort>
</switch>
Como eu faço para referirme a variavel top a travez de um bind num link tipo :
<link xconnector="conn#onBeginSet" id="lnkRule1t1">
<bind role="onBegin" component="sControl" interface="pRule1t1" />
<bind role="get0" component="pRule1t1" interface="top"/>
<bind role="set" component="settings" interface="mMedia1t1Top">
<bindParam name="var" value="$get0"/>
</bind>
</link>
Ess seria um exemplo que como eu tentaria fazer-o logicamente, mas desse jeito não funciona.
Tem alguma sguerencia de como eu faço?
Obrigado!
Autor: Facundo Larrosa
33 comentários
<bind role="onBegin" component="sControl" interface="pRule1t1" />
<bind role="get0" component="pRule1t1" interface="top"/>
<bind role="set" component="settings" interface="mMedia1t1Top">
<bindParam name="var" value="$get0"/>
</bind>
</link> Para acessar uma propriedade interna de um nó que esteja dentro de um contexto ou de um switch, entretanto você pode mapear essa propriedade direto para uma porta. No caso, do contexto: <port id="p1" component="media1" interface="top"/> E no caso do switch (i.e. teu caso): <switchPort id="pRule1t1_top">
<mapping component="mMedia1t1" interface='top"/>
</switchPort> Dessa forma você pode mudar teu link para:
<link xconnector="conn#onBeginSet" id="lnkRule1t1">
<bind role="onBegin" component="sControl" interface="pRule1t1" />
<bind role="get0" component="sControl" interface="pRule1t1_top"/>
<bind role="set" component="settings" interface="mMedia1t1Top">
<bindParam name="var" value="$get0"/>
</bind>
</link>
<bind role="onBegin" component="sControl" interface="pRule1t1" />
<bind role="set" component="sControl" interface="pRule1t1_top">
<bindParam name="var" value="200"/>
</bind>
</link> Obrigado!
<!-- Generated by NCL Eclipse -->
<ncl id="set_switch_interface" xmlns="http://www.ncl.org.br/NCL3.0/EDTVProfile">
<head>
<ruleBase>
<rule id="rlRule1t1" var="test" comparator="eq" value="a"/>
</ruleBase>
<regionBase>
<region id="rgFullScreen"/>
</regionBase>
<descriptorBase>
<descriptor id="dScreen" region="rgFullScreen"/>
</descriptorBase>
<connectorBase>
<causalConnector id="onBeginSet_delay">
<connectorParam name="value"/>
<connectorParam name="delay"/>
<simpleCondition role="onBegin" />
<simpleAction role="set" value="$value" delay="$delay"/>
</causalConnector>
</connectorBase>
</head>
<body>
<port id="pSettings" component="settings"/>
<port id="test" component="sControl"/> <media id="settings" type="application/x-ginga-settings">
<property name="test" value="a"/>
</media> <switch id="sControl">
<bindRule rule="rlRule1t1" constituent="mMedia1t1"/>
<defaultComponent component="defaultMedia"/>
<media id="mMedia1t1" descriptor="dScreen" src="1.png">
<property name="top" value="0"/>
<property name="height" value="200"/>
<property name="width" value="100"/>
<property name="explicitDur" value="10s"/>
</media>
<media id="defaultMedia" descriptor="dScreen" src="2.png"/>
<switchPort id="pRule1t1">
<mapping component="mMedia1t1"/>
</switchPort>
<switchPort id="pDefault">
<mapping component="defaultMedia"/>
</switchPort>
<switchPort id="pRule1t1_width">
<mapping component="mMedia1t1" interface="top"/>
</switchPort>
</switch> <link xconnector="onBeginSet_delay">
<bind role="onBegin" component="sControl"/>
<bind role="set" component="sControl" interface="pRule1t1_width">
<bindParam name="value" value="200"/>
<bindParam name="delay" value="2s"/>
</bind>
</link>s
</body>
</ncl>