Hey Guys,
I have come across what looks to be an issue with your bean/object inspector, and how calls are issued to java object methods from the Method Editor:
When both java-beans convention get/set methods are encountered, they are treated like a public variable and servoy makes the method calls under the hood.
object.property = “blah” translates to object.setProperty(“blah”);
This is intuitive enough.
But I’ve noticed that in special cases, where a subclass overrides one, but not both, of the get/set methods, problems occur.
The method that the subclass has overridden apears as a function in the method editor’s inspector and is callable. But the other of the two methods, while implemented in the superclass, is not present in the Method Editor’s inspector at all.
Upon inspecting the superclass, I find the Method Editor’s inspector shows the get/set methods as a property, presumably because the superclass implements both get/set methods. However refering this property in my code produces an error: The JS evaluator cannot find a public field or method named ‘property’ - Servoy fails to convert this property reference into a method call.
The problem is twofold: The appearence of the object’s proprties and methods in the Method Editors inspector is inconsistent between sub and superclass. But worse, one of the two get/set methods can not be accessed at all.
As a real world example, I was using one of objectplanet’s EZ Chart Beans. BarChart, which inherits from Chart, overrides the method public String[] getLegendLabels(), but not the corresponding set method. for In the Method Editor’s inspector, this method shows up as a function and can be called without error. While inspecting the Chart superclass, you can see the legendLabels property. However the following code:
chart.legendLabels = new Array(“label1”, “label2”);
produces an error to the effect that legendLabels is not a property or method of the BarChart class. For good measure, I tried the set method as well - no luck.
Version R2 2.2.1rc3-build 332
Java version 1.5.0_04-b05 (Windows XP)
Is this observation correct? Maybe I’m missing something. If so, please help.
Thanks,
Sean