Hello, I just stumbled over Norbert Barbosa's Thinlet add-on that lets you script Thinlets using Beanshell (bsh) - a Java-like dynamic scripting language.
Norbert writes: I have extended thinlet to add BSH (beanShell) scripting inside the XUL document. I found thinlet very nice, except the requirement to write all methods required to manage UI logic (like enabled a button when selecting item on a list) as handler methods. I want to code only my business logic as handler methods. For example, the calculator.xml thinlet looks like: <panel> <textfield name="number1" columns="4" /> <label text="+" /> <textfield name="number2" columns="4" /> <button text="="> <script method="action"> <![CDATA[ System.out.println("action called"); n1 = thinlet.getString(number1, "text"); n2 = thinlet.getString(number2, "text"); try{ i1 = Integer.parseInt(n1); i2 = Integer.parseInt(n2); thinlet.setString(result, "text", Integer.toString(i1+i2)); }catch(Exception e){ thinlet.getToolkit().beep(); } ]]> </script> </button> <textfield name="result" editable="false" /> </panel> Changes made to the Thinlet class are minor: * allow the thinlet parser to manage CDATA section * change the private policy to protected for some methods * I've also changed the thinlet method behavior, by allowing to define String, boolean and integer parameters, like: <checkbox init="initFromProperty(this, [foo.bar.myProperty], [b:false])" ... And I've created a ScriptableThinlet class that extends Thinlet and does all the stuff, that is, register named components as bsh variables, and call scripts when need. The only limitation is that you cannot use the 'this' reference inside scripts to refer to the enclosing component. Full story @ http://perso.club-internet.fr/sjobic/thinlet - Gerald ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click _______________________________________________ xul-announce mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/xul-announce