rainb0w-light / lanterna

Automatically exported from code.google.com/p/lanterna
GNU Lesser General Public License v3.0
0 stars 0 forks source link

The selected element in a radiocheckboxlist is incorrect #45

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I see this issue with version 2.0.3. The selectedIndex in the RadioCheckBoxList 
is different from checkedIndex in this case. The checkedIndex value is right. 
But to retrieve the selected element I have to use getSelectedItem() which is 
coming from AbstractListBox. I think the best thing is to override these 
methods and return the checkedIndex when requesting the selectedItemIndex. This 
way getSelectedItem() would return the item selected based on the checkedIndex.

Original issue reported on code.google.com by m.vino...@gmail.com on 10 Oct 2012 at 2:57

GoogleCodeExporter commented 9 years ago
Another option would be to just add to new method getCheckedItem which uses 
checkedIndex.

Original comment by m.vino...@gmail.com on 10 Oct 2012 at 3:02

GoogleCodeExporter commented 9 years ago
Hm, yes, there's a bit of terminology confusion here, as AbstractListBox 
exposes the "select" field as which item is currently highlighted where as the 
"selected" item in the RadioCheckListBox context would intuitively indicate 
which item has been actively selected. Now, I want to be careful not to break 
API compatibility (for once!), so I've gone with your second suggestion; adding 
a getCheckedItem() method to RadioCheckListBox.

I've committed this to 2.0.x, 2.1.x and default branches and deployed snapshot 
to sonatype. If you have a chance, please give it a try.

I'll keep this issue open for now though, I think we need to rethink 
terminology and which methods to expose from AbstractListBox on the default 
branch. This issue ticket should serve as a reminder.

Original comment by mab...@gmail.com on 15 Oct 2012 at 12:48

GoogleCodeExporter commented 9 years ago
Yeah. The change in the SNAPSHOT looks good.

Original comment by m.vino...@gmail.com on 23 Oct 2012 at 7:33

GoogleCodeExporter commented 9 years ago
Would you be able to release just the 2.0.X version with this fix ? I am 
running tight on my schedule to get this working where I cant use the SNAPSHOT 
version. Thanks.  

Original comment by m.vino...@gmail.com on 24 Oct 2012 at 4:10

GoogleCodeExporter commented 9 years ago
Ok, I'll release it now.

Original comment by mab...@gmail.com on 28 Oct 2012 at 1:28