JGantt 2nd

Hi,

I am a developer at NETRONIC Software and I would like to support a customer of us who wants to intergrate our JGantt JavaBean into his Servoy project. JGantt is a quite complex JavaBean which provides among others a lot of EventListeners.

Now my problem is how to transform the following Java code snippet of a client application to Servoy JavaScript:

public class JGanttTestJFrame extends javax.swing.JFrame
{
private de.netronic.jgantt.JGantt jGantt1;

NeAppDataAdapter updater = new NeAppDataAdapter (){
public void entityCreated(NeAppDataEvent evt){
NeIEntity node = evt.getEntity();
// do something with the node object
// after an entity has been created
}

};

private void initJGantt(){
// now add updater as listener
jGantt1.getAppData().addAppDataEventListener(
updater, “nodeset”, false);
}
}

NeAppDataAdapter (implements java.util.EventListener), NeAppDataEvent and NeIEntity are classes and interfaces exposed by the JGantt JavaBean. Is there any way to get it work in Servoy?

Thanks in advance,
Juergen

For complex beans you should wrap that bean into a simple bean of yourself. And then do all the high level stuff inside that simple bean (in java) so that you can use it very easy in javascript.

So the interface that you then see in javascript is what you define in your bean. Creating event listeners directly in javascript is not really doable.

It’s a pity, that there is no easier way to achieve our goal. But I think we shall now think about your proposal and about the effort this solution implicates.

Nevertheless, thank you very much for the quick response!

Juergen

If you are interested in discussing ways of how to do this, you could contact me. I have built some wrappers / beans for Servoy already and I am also interested in the gantt bean.

Based on the demand I see for advanced Gant Chart Beans in the Servoy market I’d say it’s worth your effort.

Servoy offers JavaScript though Rhino. Rhino allows you to assign a JavaScript method as an event listener, so technically, it’s possible to integrate a Java Bean without a wrapper, but in general you need more code than you would need if it was wrapped.

For a one-off, you could go without a wrapper, but if you plan to use the bean in many places or make the bean available to other developers, a good wrapper is the way to go.

Paul

Paul,
Please, could you give me some more information about what you mean with “…Rhino allows you to assign a JavaScript method as an event listener…”? Could you show a piece of code?

Thanks,
Juergen

I suggest to have a look here: http://www.mozilla.org/rhino/ScriptingJava.html

Paul

Thank you very much for all replies. (At the moment it is part of our management to decide how to proceed, because a comfortable solution seems not to be reachable by only little effort.)

For those of you not attending Servoy World we (IT2Be) have agreed with Netronic (developers of JGantt) to create the Gantt bean/wrapper for Servoy.

We will do our best to release a beta before the end of November…