Patch for MsgBase was [jsword-devel] MsgBase bug
Joe Walker
jsword-devel@crosswire.org
Wed, 07 Apr 2004 22:20:06 +0100
Thanks for this. I've not had change to look at it, and to be honest I
doubt I will this evening, and I'm likely to be a bit short of time
tomorrow evening too. Sorry.
I'll apply it as soon as I can.
Have a good vacation!
Joe.
DM Smith wrote:
> I have fixed the MsgBase bug and design flaw (which I was going to do
> after vaction, but I had a "light bulb" experience and did it because it
> was so simple.)
>
> I also found and fixed a few other small bugs.
>
> Here are the changes:
> The static MsgBase.init is gone and it is removed from all the derived
> Msg classes. For this reason there are a lot of files that are in the
> patch.
>
> MsgBase constructor now gets its resources for the derived class and
> maintains them in a static map. The static map was the "Ah ha!" I am
> using CWClassLoader to do the finding of resources just like in
> ActionFactory.
>
> I made a minor change to how the parameterized string is handled if
> there are resources, but it is not found. What it did do was return the
> key that was used to do the lookup without calling MessageFormat.format.
> Now it calls MessageFormat.
>
> I added a toString(Object singleParam) to MsgBase. Most paramaterized
> messages only take one argument if any. I changed all the places that
> called toString with a single element Object array to use this.
>
> I also added Reporter.invoke(..., MsgBase msg, Object singleParam) and
> changed all the places that called it wiith a single element Object array.
>
> I found a design flaw in what I had done earlier for ActionFactory. I
> wanted to be able to derive from it and have the CWClassLoader use the
> derived class to do the lookup. It did not. Turns out I needed to add a
> constructor to CWClassLoader that takes a Class object for the derived
> class.
>
> In doing this I split out the inner class to a stand alone and made it a
> bit more general. (Many times I start with a specific implementation as
> an inner class and then break it out when I have another use.) In this
> case the other use turned out to not be needed.
>
> I also externalized the messages in desktop.Msg to a ResourceBundle.
> (This is was what triggered the changes above.
>
> I created the DesktopActionFactory and used it as I described in another
> note.
>
> I modified AboutPane to replace "OK" with a CWAction. This required
> adding a method to DesktopActions to handle the action.
>
> _________________________________________________________________
> FREE pop-up blocking with the new MSN Toolbar – get it now!
> http://toolbar.msn.com/go/onm00200415ave/direct/01/