From: Kay <Kay...@be...> - 2005-09-26 16:09:57
|
Hi Rahul, check out the latest gui4j from CVS. There's an interface=20 Gui4jResourceProvider with a single method: InputStream getResource(String fullyQualifiedName); All XML files are loaded via this method. There's a default implementation = that uses files. If you want to read the resources in a different way=20 you'll have to write your own implementation and provide Gui4j with an=20 instance of it via Gui4j.setResourceProvider(). The String argument of getResource() is the fully qualified name of the=20 required resource. Resource names use "/" as their separator, i.e. if you=20 loaded a resource "foo" which uses an include with url=3D"bar" then the=20 resource provide will be asked to load "foo/bar". Note that resources are cached, i.e. the resource provider is never asked=20 twice for the same resource. Also note that Gui4j itself resolves ".."=20 notation, i.e. if you loaded a resource "foo/bar" which uses an include=20 with url=3D"../hello" then the resource provider is asked to load=20 "foo/hello". Keep us posted on your progress with your resource provider. Kind Regards, Kay Kr=FCger-Barvels ---------------------------------------------------------------- beck et al. projects GmbH Theresienh=F6he 13, D-80339 M=FCnchen +49 89 544 253-14 mailto:Kay...@be... http://www.bea-projects.de ---------------------------------------------------------------- ----- Forwarded by Kay Kr=FCger-Barvels/BEAP on 26.09.2005 17:11 ----- Kay Kr=FCger-Barvels/BEAP=20 23.09.2005 16:05 To "Rahul Shrivastava" <shri=5F...@ho...>@BEAP=5FWEB cc Subject [Gui4j-user] how to read xml from an InputStream Hi Rahul, I'm afraid we won't be able to supply the switch to Gui4jResourceProvider=20 before next week. Time constraints on customer projects. Sorry. Kay=20 ----- Forwarded by Kay Kr=FCger-Barvels/BEAP on 23.09.2005 16:03 ----- Kay Kr=FCger-Barvels/BEAP 22.09.2005 13:16 To "Rahul Shrivastava" <shri=5F...@ho...>@BEAP=5FWEB cc Subject Re: [Gui4j-user] how to read xml from an InputStream Hi Rahul, the Gui4jResourceProvider will have to implement a method that provides=20 the xml as an InputStream. At least that's what I agreed on with Joachim.=20 I'm not up to date right now with how far his code changes are, but I will = talk to him tomorrow. The gui4j default implementation of Gui4jRexourceProvider will only be=20 able to read from files. Other implementations (like yours) will have to=20 cover other situations. I'll keep you informed about the progress on this topic. Thanks, Kay=20 ---------------------------------------------------------------- beck et al. projects GmbH Theresienh=F6he 13, D-80339 M=FCnchen +49 89 544 253-14 mailto:Kay...@be... http://www.bea-projects.de ---------------------------------------------------------------- "Rahul Shrivastava" <shri=5F...@ho...> wrote on 21.09.2005 02:27:06: > Hi Kay >=20 > Even i tried to change the source code but too many files required=20 changing=20 > and had to give up on that idea. Currently i am not using the import=20 > functionality but i will be using it in the future. The purpose of=20 using=20 > GUI4J was - messages are sent to me over the socket from a c/c++ program = and=20 > these messages are xml. The java program uses these messages to display=20 > dialog boxes and other small GUI frames. >=20 > So let me reiterate what u said in you mail - just to be clear. So you=20 > create an interface Gui4jResourceProvider which I can implement in any=20 way i=20 > want and provide you with the resource object. You take this object and=20 load=20 > the xml from it. So what i would want to know is that if you read from=20 the=20 > class that implements Gui4jResourceProvider - how do you read from it,=20 is it=20 > a StringBuffer that you read from or is it an InputStream that you read=20 from=20 > or it is something else. I do not want to convert the InputStream into a = > file resource from which you can already read. >=20 > Thanks > Rahul >=20 >=20 >=20 >=20 >=20 > ----Original Message Follows---- > From: KayKr=FCger-Barvels <Kay...@be...> > To: gui...@li... > Subject: Re: [Gui4j-user] how to read xml from an InputStream > Date: Fri, 16 Sep 2005 16:56:19 +0200 >=20 > Hi again, >=20 > I'm afraid it turns out that we have to change a little bit more > internally in order to encapsulate the mechanics of loading XML files in > one central place. We'll have to postpone that to next week. >=20 > Rahu, do you plan to use (or are you using) the include functionality of > gui4j (<Include> element)? If so, how would you like to handle those > includes if your original file was loaded in a custom manner and passed=20 to > gui4j via an InputStream? Our current idea is that there's a new=20 interface > named Gui4jResourceProvider and if you provide gui4j with an object of > that type it will be responsible for loading all XML input, also for > includes. That means, it is up to your implementation to interpret the > "url" attribute of <Include>. The content of "url" does not necessarily > need to be a real URL anymore, of course. >=20 > Regards, > Kay >=20 > > > > Hi, > > > > Reading in the xml is currently done via Java's Ressource mechanism, > > so it's not possible right now to simply read from a String or > InputStream. > > > > I've talked to Joachim about this and we think it would be a useful > > addition to be able to chose one of several ways to read in the xml > > definition. We'll provide a central hook in the code for loading xml > > definitions so that it's possible to provide different > > implementations. The default way will be the current Resource > > mechanism. After the hook is in place it should be easy for you to > > implement any loading > > mechanism you like. We'll be happy to include your contribution into > > gui4j then. > > > > We'll send a note when the hook is in CVS... > > > > Thanks, > > > > Kay > > > > >=20 >=20 |