<Swing Dev> JList MULTIPLE_INTERVAL_SELECTION

Pavel Porvatov pavel.porvatov at oracle.com
Tue May 22 15:14:38 UTC 2012


Hi Paulo,

I don't think such changes are necessary because of two reasons:
1. There is a simple workaround
2. In such case we should implement something like 
SINGLE_INTERVAL_SELECTION_DEFENSIVE as well

Regards, Pavel
> Glazed list as a feature, that i consider more like a bug fix:
>
>
>     /**
>      * A selection mode where any element may be selected and freshly 
> added elements
>      * are always deselected. No equivalent policy exists in
>      * {@link javax.swing.ListSelectionModel}
>      */
>     public static final int MULTIPLE_INTERVAL_SELECTION_DEFENSIVE = 103;
>
>
> used like this:
> DefaultEventSelectionModel esm = new DefaultEventSelectionModel(sorted);
> esm.setSelectionMode(ListSelection.MULTIPLE_INTERVAL_SELECTION_DEFENSIVE);
>
> I've only seen the need to use it intheir filtering classes yet 
> (because they are constantly adding elements)
> but it really seems like a bug of MULTIPLE_INTERVAL_SELECTION.
> Part of the DefaultEventSelectionModel javadoc:
>
>  * <p>Alongside <code>MULTIPLE_INTERVAL_SELECTION</code>, this {@link 
> ListSelectionModel}
>  * supports an additional selection mode.
>  * <code>MULTIPLE_INTERVAL_SELECTION_DEFENSIVE</code> is a new 
> selection mode.
>  * It is identical to <code>MULTIPLE_INTERVAL_SELECTION</code> in 
> every way but
>  * one. When a row is inserted immediately before a selected row in the
>  * <code>MULTIPLE_INTERVAL_SELECTION</code> mode, it becomes selected. 
> But in
>  * the <code>MULTIPLE_INTERVAL_SELECTION_DEFENSIVE</code> mode, it 
> does not
>  * become selected.




More information about the swing-dev mailing list