2009-01-22:
[10:48] <simono> i'm doing smth like the inspector but data is readonly and i'm more interested in showing macros/actions/skins.. with our 3+ repos it's getting confusing which Proto has what macros, which skins, etc.[10:48] <simono> so what i currently do, to get for all JS files for a prototype is this: http://helma.pastebin.com/m45670bae[10:49] <simono> i have no idea how to get to the functions themselves.. robert mentioned something about getAllIds() and I see it as method in helma-source but don't think it's exposed to javascript :([13:09] <hannesw> simono: HopObject code takes care not to enumerate prototype functions[13:09] <hannesw> this is to only enumerate data properties when looping through a hopobject's properties[13:09] <hannesw> so from javascript, it is difficult (or even impossible) to get to a HopObject's prototype functions.[13:09] <hannesw> here's the code that does that:[13:09] <hannesw> http://dev.helma.org/trac/helma/browser/helma/helma/trunk/src/helma/scripting/rhino/HopObject.java#L990[13:10] <hannesw> what robert was referrint to is this getAllIds():[13:10] <hannesw> http://dev.helma.org/trac/helma/browser/helma/helma/trunk/src/helma/scripting/rhino/HopObject.java#L979[13:10] <hannesw> the problem is: I don't think getAllIds() can be triggered from javascript[13:10] <hannesw> getIds() is called when you do a for (var i in o) in JS[13:10] <hannesw> but getAllIds() is for internal purposes only[13:11] <hannesw> so you'll have to get down to java in order to get to the properties of a HopObject prototype[13:22] <simono> hm, well thanks for the explanation[13:26] <simono> one more thing: when I do app.getPrototype("Story").getScriptableSkinMap() I get a SkinMap instance .. anyway I can enumerate its keys? I want a list of available skins for a certain prototype.[13:27] <hannesw> yes, wait a sec...[13:27] <simono> I looked at helma source but never am sure which methods are available in js and am tired of trying :)[13:28] <hannesw> i see[13:29] <hannesw> anything in helma.scripting.rhino.HopObject that starts with jsFunction_* or jsGet_* defines a HopObject function or property[13:29] <hannesw> and all global methods are defined in GlobalObject[13:29] <hannesw> http://dev.helma.org/trac/helma/browser/helma/helma/trunk/src/helma/scripting/rhino/GlobalObject.java[13:29] <simono> ah... that's where the global-funcs are[13:29] <hannesw> Coming back to your question:[13:30] <hannesw> you should be able to do wrapJavaMap(skinMap) to access the skinmap as a JS object[13:30] <simono> ah.. looking at GlobalObject I found unwrapJavaMap[13:30] <simono> yey will try it out now, thx[13:31] <hannesw> otherwise, you can access it like a java.util.Map[13:31] <hannesw> i.e. keys(), entries() etc[13:31] <hannesw> sorry, keySet(), entrySet() of course[13:33] <simono> I can use it like java.util.Map once its wrapped? b/c this doesn't work: app.getPrototype("Story").getScriptableSkinMap().keySet()[13:33] <simono> I'll work with wrap/unwrap and see where I can get with it[13:34] <hannesw> no, you can use it as a java.util.Map the way you get it[13:34] <hannesw> that *should* work[13:35] <simono> no... until I apply unwrapJavaMap() to the return value of getScriptableSkinMap() I can't access anything on it. all i can do is call toString()[13:35] <hannesw> ah, sorry - getScriptableSkinMap already returns the wrapped map[13:36] <hannesw> so you already get a map that looks like a JS object[13:36] <hannesw> if you want the plain map, use getSkinMap instead.[13:36] <simono> no problem... now it works. I hit those javamaps ofen, so that was a big help[13:36] <hannesw> ok
In the channel now:
Logs by date: