Re: How To Lookup Widgets
Gerald Bauer <[email protected]> Tue, 23 Sep 2003 12:47:50 -0700 (PDT)
| Newsgroups | gmane.comp.java.luxor-xul.user |
|---|---|
| Message-ID | <[email protected]> |
Hi Anakrewn Meidis, Hi all, > It's fine. > Only that the scripts should take a reference to the > frames > that have been created and orphan JPanelEx > (those who do not belong to any JFrame) if any. Ok. There are multiple options. You might wonna look into the exisiting registries/maps managed by the XulManager or create new ones or use a completely different approach as you see fit. > In the sources I sent, XulManager has a list with > the JFrame instances. > An other solution would be to have a method (e.g > lookupFrame(String name)) > declared at XulManager (or some other class which > the scripts have access). First, let me clear up what I think is a possible confusion of terms. A frame in XUL/HTML speak is basically a HTML browser widget and a window in XUL speak is what a frame (e.g. JFrame) is in Java Swing. Luxor follows the XUL "terminology" and thus window is preferred over frame. Now back to Luxor if you want to lookup Swing JFrames by name there's currently the lookupWindow method in place. I'm not sure if it meets your needs. > Only that the method should not create a new > instance each time is called. > If for example a JFrame with name "MAIN" is allready > created that instance > should be returned, otherwise a new instance will be > created or null should > be returned(I don't know what would be best). I agree it's hard to know what's best. Currently Luxor uses a two method pair approach, that is, there is a lookupWindow() method and a createWindow() method. The difference is that createWindow() throws an exception if the window id doesn't exist while the lookupWindow() method just returns null. To add your use case, that is, a lookup that doesn't create the window/frame if it doesn't exist, I suggest to create a new lookupWindow method either with an argument such a boolean create or using a slightly different name such a lookupWindowNoCreate() or whatever. - Gerald ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf