Olá a todos, estou tentando fazer o seguinte: Eu tenho um documento ncl (pai) e um documento ncl dentro dele (filho) na forma de um elemento de mídia (<media type=“application/x-ncl-NCL” ...>) esse nó filho tem uma propriedade que é externada dentro do pai (<media ...><property id="colorHandler" /></media>) e a qual é relacionada dentro do filho com a propriedade de cor de um texto (<port id="colorHandler" component="texto" interface="fontColor" />), tal qual como é especificado em "Part 11 – Declarative Objects in NCL: Nesting Objects with NCL Code in NCL Documents", página 13, quarto e quinto parágrafo.
No entanto o efeito esperado, passar uma cor a partir do documento externo para o interno por um ponto de interface não se observa. A atribuição é feita (segundo as mensagens de debug) no ponto de interface, não tem efeito no nó interno, aparentemente só afetando como seu valor no documento pai somente.
O código dos dois arquivos está a seguir, os textos dos elementos de mídia, e a base de conectores, não acredito que sejam de utilidade para resolução desse problema.
O validador ncl (nclvalidator feito em java) não acusa nenhum erro.
parent.ncl
<?xml version="1.0" encoding="UTF-8"?>
<ncl id="parent" xmlns="http://www.ncl.org.br/NCL3.0/EDTVProfile">
<head>
<regionBase>
<region id="rLabelVerde" top="80%" left="16%" width="12%" height="5%" />
<region id="rLabelAzul" top="80%" left="44%" width="12%" height="5%" />
<region id="rLabelVermelho" top="80%" left="72%" width="12%" height="5%" />
<region id="rChild" top="25%" left="25%" width="50%" height="50%" />
</regionBase>
<descriptorBase>
<descriptor
id="dLabelVerde"
region="rLabelVerde"
focusIndex="ix0"
moveRight="ix1" />
<descriptor
id="dLabelAzul"
region="rLabelAzul"
focusIndex="ix1"
moveRight="ix2"
moveLeft="ix0"/>
<descriptor
id="dLabelVermelho"
region="rLabelVermelho"
focusIndex="ix2"
moveLeft="ix1"/>
<descriptor
id="dChild"
region="rChild"/>
</descriptorBase>
<connectorBase>
<importBase alias="connBase" documentURI="causalConnBase.ncl" />
</connectorBase>
</head>
<body id="bodyParent">
<port id="parentInit" component="labelVerde" />
<link id="initLink" xconnector="connBase#onBeginStartN">
<bind component="labelVerde" role="onBegin"/>
<bind component="labelAzul" role="start"/>
<bind component="labelVermelho" role="start"/>
<bind component="child" interface="initChild" role="start"/>
</link>
<media type="application/x-ginga-settings" id="programSettings">
<property name="service.currentKeyMaster" value="bodyParent"/>
<property name="service.currentFocus" value="ix0"/>
</media>
<media id="labelVerde" src="verde.txt" descriptor="dLabelVerde" />
<media id="labelAzul" src="azul.txt" descriptor="dLabelAzul" />
<media id="labelVermelho" src="vermelho.txt" descriptor="dLabelVermelho" />
<media id="child" src="child.ncl" descriptor="dChild" >
<area id="initChild" label="initChild" />
<property name="colorHandler" value="white" />
</media>
<link id="bVerde" xconnector="connBase#onSelectionSetVar">
<bind component="labelVerde" role="onSelection" />
<bind component="child" interface="colorHandler" role="set">
<bindParam name="var" value="green" />
</bind>
</link>
<link id="bAzul" xconnector="connBase#onSelectionSetVar">
<bind component="labelAzul" role="onSelection" />
<bind component="child" interface="colorHandler" role="set">
<bindParam name="var" value="blue" />
</bind>
</link>
<link id="bVermelho" xconnector="connBase#onSelectionSetVar">
<bind component="labelVermelho" role="onSelection" />
<bind component="child" interface="colorHandler" role="set">
<bindParam name="var" value="red" />
</bind>
</link>
</body>
</ncl>
child.ncl
<?xml version="1.0" encoding="UTF-8"?><ncl id="child" xmlns="http://www.ncl.org.br/NCL3.0/EDTVProfile">
<head>
<regionBase>
<region id="rTexto" />
</regionBase>
<descriptorBase>
<descriptor id="dTexto" region="rTexto" />
</descriptorBase>
<connectorBase>
<importBase alias="connBase" documentURI="causalConnBase.ncl" />
</connectorBase>
</head>
<body>
<port id="initChild" component="texto" />
<port id="colorHandler" component="texto" interface="fontColor" />
<media id="texto" src="texto.txt" descriptor="dTexto" >
<property name="fontColor" />
</media>
<link id="reAtribui" xconnector="connBase#onEndAttributionSet">
<bind component="texto" interface="fontColor" role="onEndAttribution" />
<bind component="texto" interface="fontColor" role="corAtual" />
<bind component="texto" interface="fontColor" role="set">
<bindParam name="var" value="$corAtual" />
</bind>
</link>
</body>
</ncl>
Autor: Henrique Becker
22 comentários