[jsword-devel] Patch for clean install

DM Smith jsword-devel@crosswire.org
Fri, 26 Mar 2004 00:03:03 -0500


This is a multi-part message in MIME format.

------=_NextPart_000_24eb_68d8_5ee4
Content-Type: text/plain; format=flowed

Joe,
I worked on it and have a potential solution. I guess I am in a different 
timezone (Eastern, USA).

I found a bug in setChapter and setVerse in BibleComboBoxModel. The first 
argument to the Verse ctor was the chapter when it should have been the 
book.

I changed the methods setBook to honor chapter and verse and setChapter to 
honor verse, if they could. Otherwise, I set them to 1.

I found that if this was not done, then it would be possible for book to 
change from what the user selected. For example, the user is in Psalm 119:6 
and then changes the Book combo to Genesis.
Internally, the verse is set to a later book than Genesis since it only has 
50 chapters. This triggers a call to cbo_book.setSelectedItem(book). 
However, the code in JComboBox causes it to be ignored since the JComboBox 
protects item changes during their processing.

Thus, it is not possible to change the selection while handling a selection 
change. I spent a lot of time in JComboBox and ComboBoxModel figuring this 
out. Bit of a bummer.

Anyway these changes were fairly simple.

The other change was to BibleComboBoxModelSet and it was a little bit more 
significant. First, I changed from ActionListener to ItemListener. 
ItemListener is the stated way of listening for selection changes. I moved 
the call to fireContentsChanged out of the listener and into the setVerse 
routine.

I made progress in the setVerse routine dependent upon whether the verse was 
different. This was needed to prevent infinite recursion. I then called 
setSelectedItem on the book, chapter and/or verse only if it differed from 
what it was.

Anyway, feel free to use this as a starting point or to throw it away for 
what you had in mind.

DM



Joe Walker wrote:
>
>About to go to bed.
>Had a quick look, applied - Thanks!
>I've got thoughts on the verse thing but more tomorrow.
>
>Joe.
>
>DM Smith wrote:
>
... stuff deleted........
>
>>I have found another bug in the workings of the commentary verse picker. 
>>If you change the book to Psalms and then the chapter to 119 and then 
>>change the book to 1 John, it still shows the chapter as 119, but the drop 
>>down does not list it. I began poking around in the code and I found 
>>another problem. 1 John 119.1 computes a verse based upon addition. 
>>According to the comment in the documentation for the Verse constructor, 
>>this allows for addition, Gen 1.50 would yeild something in Gen 2 because 
>>there are less than 50 verses in Gen 1. In the context of a verse picker, 
>>I think that this violates my "least suprise" principle.
>>
>>I think the user would be suprised that the selected verse was not valid 
>>and was re-adjusted to something else.
>>
>>I tried to simulate a different algorithm to establish the "viewed verse" 
>>for BibleComboBoxModelSet. I was able to get that to work by setting in 
>>BibleComboBoxModel the chapter and verse to 1 when a new book was selected 
>>and setting the verse to 1 when a new chapter is selected. However, the 
>>display did not update. When I tried to adjust the display, I got into an 
>>infinite loop. Anyway, I'll figure it out.

_________________________________________________________________
Free up your inbox with MSN Hotmail Extra Storage. Multiple plans available. 
http://join.msn.com/?pgmarket=en-us&page=hotmail/es2&ST=1/go/onm00200362ave/direct/01/

------=_NextPart_000_24eb_68d8_5ee4
Content-Type: application/x-zip-compressed; name="patchcombo.zip"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="patchcombo.zip"

UEsDBBQAAAAIAES9eTDb8s+/qQYAAPsdAAAOAAAAcGF0Y2hjb21iby50eHTt
WVlz2kgQfrar/B8mTwtGnAZj7LjKiUOq2HKyqSXr15SQBlBWaFhJgLPJ/vft
nkujC+ENydNOBaOjp49vunu+IZPApU/X5LO9tdvRzgsWbRYu2k7IIrgLaftz
tGOh2956dCffzxj7s/3am/n0nq1m7DV7esdc6rdQxdnp7fePs9OQxqFHt2CN
hPAVeSwg3Va3c3bqevM5aW5IM8R7UupGs9k8VkwnV+QtnZFep9MnvYvrzsV1
r0eaHRgnwqdGo3E0W71L8s4OhbFO/7o/vL7oCmNnp3d3pNkdDqwRaeBXb0Du
7s5OCR/nbXm13sx8zyFb5rkkovFrMFbzgpig1bqU+Qr4EDkeaRhRwnyX3KJ8
a0Fj/qhWv8lJbdauHVMQDOhOPKqhWgun48T7pb2OaVir6ydSlUXicENTGtEW
fB4BF+oKMaEepRpKKg6/oLf6/qTdJh/hWczIkgUsJM4mDCmE5wjTxA5cskVt
mUl/gPtd4s2JFxMvIgGLyRqWCFfBkMSxF5CUpGfYvc1hUCTNPUtky/TOSY3n
xySYs5a0EE0CvpZ8HclLZbiegkeNxKtuVvk/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