[jsword-devel] Patch for clean install

Joe Walker jsword-devel@crosswire.org
Fri, 26 Mar 2004 09:31:12 +0000


Thanks, that is what I had in mind. I've applied it and it seems to 
work. I got an exception the first time I used it, I just picked 
Leviticus and boom! I can only think that there must have been a problem 
with out of sync class files or something because I have been totally 
unable to reproduce it.
I set some breakpoints and ran it again to discover that I'd lost the 
stack trace because I had "Remove terminated launches" turned on. Arrgh.

I'm working on getting rid of the plethora of directories created in the 
.jsword directory each time we start up, and on chasing down this 
intermittent blank opening display problem. I suspect threading issues 
somewhere.

I'll check in later because I've got load of setBackground(Color.BLAH) 
calls everywhere at the moment to suss out what has gone missing.

Joe.


DM Smith wrote:

> 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/ 
>