TeleMidia / ginga

A Ginga iTV middleware implementation by TeleMídia/PUC-Rio
http://ginga.org.br
GNU General Public License v2.0
51 stars 8 forks source link

Fix use of a second, not instSame and nested MediaSettings #94

Closed alanlivio closed 6 years ago

alanlivio commented 6 years ago

The following code (tests-ncl/test-settings-two-instances-same-ctx.ncl) works

<ncl>
  <head>
    <connectorBase>
      <causalConnector id="onBeginSet">
        <connectorParam name="var"/>
        <simpleCondition role="onBegin"/>
        <simpleAction role="set" value="$var"/>
      </causalConnector>
    </connectorBase>
  </head>
  <body>
    <port id="start2" component="m1"/>
    <media id="settings1" type="application/x-ginga-settings">
      <property name="p1" />
    </media>
    <media id="settings2" type="application/x-ginga-settings">
      <property name="p1" />
    </media>
    <media id="m1">
      <property name="background" value="red"/>
    </media>
    <link xconnector="onBeginSet">
      <bind role="onBegin" component="m1"/>
      <bind role="set" component="settings2" interface="p1">
        <bindParam name="var" value="1"/>
      </bind>
      <bind role="set" component="m1" interface="background">
        <bindParam name="var" value="green"/>
      </bind>
    </link>
  </body>
</ncl>

But the following code (tests-ncl/test-settings-two-instances-different-ctx.ncl) receive the error Element <bind> at line 26: Bad value 'settings2' for attribute 'component' (no such object in scope).

<ncl>
  <head>
    <connectorBase>
      <causalConnector id="onBeginSet">
        <connectorParam name="var"/>
        <simpleCondition role="onBegin"/>
        <simpleAction role="set" value="$var"/>
      </causalConnector>
    </connectorBase>
  </head>
  <body>
    <port id="start" component="ctx1"/>
    <media id="settings1" type="application/x-ginga-settings">
      <property name="p1" />
    </media>
    <context id="ctx1">
      <port id="start1" component="m1"/>
      <media id="settings2" type="application/x-ginga-settings">
        <property name="p1" />
      </media>
      <media id="m1">
        <property name="background" value="red"/>
      </media>
      <link xconnector="onBeginSet">
        <bind role="onBegin" component="m1"/>
        <bind role="set" component="settings2" interface="p1">
          <bindParam name="var" value="1"/>
        </bind>
        <bind role="set" component="m1" interface="background">
          <bindParam name="var" value="green"/>
        </bind>
      </link>
    </context>
  </body>
</ncl>
alanlivio commented 6 years ago

@andrelbd1 report this error occur on velha ncl-app.

robertogerson commented 6 years ago

Any clue if it works when MediaSettings is instSame?

alanlivio commented 6 years ago

@gflima told me that are always one settings in the document and its is child of the body. I believe that is an parser problem.