Joey, Thanks for your input. Very good ideas - I think. I will go-ahead and implement some methods allowing to identify swing objects by name and probably use method signatures close to the ones available with Thinlets.
If uniqueness would be guaranteed, I could use a fast hash map and wouldn't have to perform a tree search. However, if you have some XML descriptor written by someone else ... So I think uniqueness will not be a requirement for the widgets name property value. While I like the "default-action" idea. How do you picture the implementation? Your example >> <menuitem icon="/icons/help.gif" text="Help Topics" Action="DoHelp"/> >> Creating this menu item would then cause the class DoHelp to be >> assigned to that menu item. requires the Swinglet to instantiate a DoHelp object. That would require a default constructor in the DoHelp etc. At this point I would rather keep it simple. There are other projects like enode.com and http://www.ognl.org/ that use XUL more like a programming language and less as a descriptor. There is always the risk to put to much into XUL and you end up re-creating JSP or ASP. Sub-classing should already be possible. The newly created classes would just have to be registered with a Tab Library object before the xml descriptor is parsed. Wolf -----Original Message----- From: Joey Edelstein [mailto:[EMAIL PROTECTED] Sent: Sunday, December 22, 2002 1:58 AM To: [EMAIL PROTECTED] Subject: [Theodore] Re: How to link the event handlers Hi! I have been looking for a good way to do my UI work in XML, ideally I want to use an Editor like Theodore to do the design. There are many many projects out there that deal in XML for GUI but surprisingly none seem to take the simple and obvious rout * Use XML as a description of the screen + provide a good GUI editor to do the design. * Provide access to the resulting screen objects to control their behavior. * Support custom controls * Keep it simple! I was happy to see that xml2swing seems to be in the right direction. The way I would like to see the link to event handlers is that the XML should allow you to name your GUI objects and then xml2swing would let you retrieve the actual swing object corresponding to the name So if you have : <button name="btn_A" text="Hello World" ToolTipText="My ToolTip1" enabled="true"/> You should be able to: JButton btnA = (JButton) xml2swing.GetObject("btn_A"); Then you can add your event listeners to btnA. There should also be a default action for every type of object and you should be able to specify the Action Object for that default action as part of the XML. So the XML would be : <menuitem icon="/icons/help.gif" text="Help Topics" Action="DoHelp"/> Creating this menu item would then cause the class DoHelp to be assigned to that menu item. Another issue is subclassing. There needs to be a way to allow the XML to specify a sub class of a swing class that would let me specialize the way a control works. So I could specify a JIntField instead of a JTextField where JIntField is a sub class of JTextField that only allows integer input. I should mention that the way I see things being done is influenced by the fact that I am working on applications not applets. I couldn't care less if something will run in a browser. The overly complex solutions I mentioned initially all seem to try to support Swing Applets some way. I think that if I was writing applets Theodor+Thinlets would be the way I would go. Keep up the good work Joey ------------------------ Yahoo! Groups Sponsor ---------------------~--> Get 128 Bit SSL Encryption! http://us.click.yahoo.com/CBxunD/vN2EAA/xGHJAA/nhFolB/TM ---------------------------------------------------------------------~-> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
