Hi,

I would like know if it's possible to intercept (have listeners) as soon as
Scriptable object has changed.
For instance if you execute this script :

function Person() {
      this.name = name;
   }
var jsPerson = new Person('P1');

and after if you execute this script.

jsPerson.name='P2'

I would like intercept that name property of jsPerson has changed. Rhino
provide
listeners for Context with ContextFactory#onContextCreated and
ContextFactory#onContextReleased.

So I would like manage property changed like this :
ContextFactory#onScriptablePropertyChanged(Scriptable parentScope, String
name, String propertyName)
in order to observe the property propertyName of Scriptable with name stored
into parentScope.

Indead, I would like manage binding with Scriptable Object and UI (SWT
widgets ans Swing widgets)
and I need detect as soon as Scriptable object has changed.

I'm using Rhino into my TK-UI <http://tk-ui.sourceforge.net/> project. TK-UI
is toolkit to describe your UI with any XML markup (XUL, HTML...)
and render it with swing or SWT widgets.

Rhino is used to manage javascript :

1. use javascript to manage logic. DOM "document"variable is provided into
Rhino context to manage UI with DOm Document like XUL or HTML
 (getElementById to retrieve widget , createElement to add widget...).

2. manage binding between Scriptable object and UI. For instance you can
write this  :

<script>
   function Person() {
      this.name = name;
   }
    var jsPerson = new Person('P1');
</script>
<textbox value="{Binding Source=jsPerson Path=name}" />

Textbox is bounded with name property of JS object jsPerson.

To manage binding with Javascript, I have implement Eclipse JFace
Databinding <http://wiki.eclipse.org/index.php/JFace_Data_Binding> with
Rhino.
But it doesn't works very good, because it's difficult for me to detect when
Scriptable object has changed.
For the moment I get the value of Scriptable object before creating context
and compare the value of scriptable object after the context is released,
but I think it will be very better to have listener which observe the update
of Scriptable object.

Thank for your help.

Regards Angelo
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino

Reply via email to