Convertion of JS Objects to Java

hi all,

there is a question. I have the application that uses smartgwt libraries and so written on Java. Now I have to integrate some UI parts written on JavaScript with using SmartClient library. How it can be done?

to clarify it, for example I have some .js file

isc.HLayout.create({
    name: "hl_mainLayout",
	width: "100%",
    height: "50%",
	border: "1px solid blue",
	members: [
		isc.Label.create({
            contents: "Navigation",
            align: "center",
            overflow: "hidden",
            width: "30%",
            showResizeBar: true,
            border: "1px solid blue"
        })
	]
})

I wrote a wrapper that loads the file from the server and make a conversion from js fragment into JavaScriptObject like

jso = JSOHelper.eval(jsFrag);

where jsFrag is the javascript code shown above with added $wnd.isc prefix

and then I try to create a java component based on layout

HLayout hl = new HLayout(jso);

in order to work with it futher (add a click handlers and so forth)

That approach works for simple components like buttons, labels and so on, but doesn’t work for more complicated components like nested layouts.
I get the error :

'Object doesn't support that property or method'
	in http://localhost:8080/crm_gwt/sc/modules/ISC_Core.js
	at line 505
    Array.addList(_1=>Array[2], _2=>undef, _3=>undef)  Layout.initWidget(Obj, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef)
    Canvas.init(_1=>Obj, _2=>undef, _3=>undef, _4=>undef, _5=>undef, _6=>undef, _7=>undef, _8=>undef, _9=>undef, _10=>undef, _11=>undef, _12=>undef, _13=>undef)

Maybe I’m wrong here. Could you please suggest a correct way to integrate interface parts written on JavaScript with Smartclient and get them within java code (SmartGWT) to work with them?

Just to specify my question more

why does it need:

we want to write the interface parts using JavaScript (with SmartClient) because the designer can easy develop them. And then we would like to get them like Java objects to add special code like event handlers and some other complicated logic because it’s more easy for us to do it with Java and SmartGWT.

could you suggest what is the best way to do that integration? Maybe are there some links with description?

Why not use JSNI then and write the code in Java but as javascript in the native methods, then you will still have easy access to the objects in java code for further use.

the problem is we want to separate the development of UI parts and logic for javascript and java developers. JavaScript developers could work on interface separately.