/** * Creates a new selection model that also presents a list of the selection. * * The {@link AdvancedListSelectionModel} listens to this {@link EventList} in order * to adjust selection when the {@link EventList} is modified. For example, * when an element is added to the {@link EventList}, this may offset the * selection of the following elements. * * <p>The returned selection model is <strong>not thread-safe</strong>. Unless otherwise * noted, all methods are only safe to be called from the event dispatch thread. * To do this programmatically, use {@link SwingUtilities#invokeAndWait(Runnable)} and * wrap the source list (or some part of the source list's pipeline) using * GlazedListsSwing#swingThreadProxyList(EventList).</p> * * @param source the {@link EventList} whose selection will be managed. This should * be the same {@link EventList} passed to the constructor of your * {@link AdvancedTableModel} or {@link EventListModel}. */ public static <E> AdvancedListSelectionModel<E> eventSelectionModel(EventList<E> source) { return new DefaultEventSelectionModel<E>(source); }
/** * Creates a new selection model that also presents a list of the selection. * * The {@link AdvancedListSelectionModel} listens to this {@link EventList} in order * to adjust selection when the {@link EventList} is modified. For example, * when an element is added to the {@link EventList}, this may offset the * selection of the following elements. * * <p>The returned selection model is <strong>not thread-safe</strong>. Unless otherwise * noted, all methods are only safe to be called from the event dispatch thread. * To do this programmatically, use {@link SwingUtilities#invokeAndWait(Runnable)} and * wrap the source list (or some part of the source list's pipeline) using * {@link GlazedListsSwing#swingThreadProxyList(EventList)}.</p> * * @param source the {@link EventList} whose selection will be managed. This should * be the same {@link EventList} passed to the constructor of your * {@link AdvancedTableModel} or {@link EventListModel}. */ public static <E> AdvancedListSelectionModel<E> eventSelectionModel(EventList<E> source) { return new DefaultEventSelectionModel<E>(source); }
/** * Creates a new selection model that also presents a list of the selection. * * The {@link AdvancedListSelectionModel} listens to this {@link EventList} in order * to adjust selection when the {@link EventList} is modified. For example, * when an element is added to the {@link EventList}, this may offset the * selection of the following elements. * * <p>The returned selection model is <strong>not thread-safe</strong>. Unless otherwise * noted, all methods are only safe to be called from the event dispatch thread. * To do this programmatically, use {@link SwingUtilities#invokeAndWait(Runnable)} and * wrap the source list (or some part of the source list's pipeline) using * {@link GlazedListsSwing#swingThreadProxyList(EventList)}.</p> * * @param source the {@link EventList} whose selection will be managed. This should * be the same {@link EventList} passed to the constructor of your * {@link AdvancedTableModel} or {@link EventListModel}. */ public static <E> AdvancedListSelectionModel<E> eventSelectionModel(EventList<E> source) { return new DefaultEventSelectionModel<E>(source); }
public static <E> DefaultEventSelectionModel<E> createSelectionModel(EventList<E> source) { return new DefaultEventSelectionModel<E>(createSwingThreadProxyList(source)); }
/** * Creates a new selection model that also presents a list of the selection. * While holding a read lock, it wraps the source list using * {@link GlazedListsSwing#swingThreadProxyList(EventList)}. The * {@link AdvancedListSelectionModel} listens to this {@link EventList} in order to adjust * selection when the {@link EventList} is modified. For example, when an element is added to * the {@link EventList}, this may offset the selection of the following elements. * <p> * The returned selection model is <strong>not thread-safe</strong>. Unless otherwise noted, * all methods are only safe to be called from the event dispatch thread. * </p> * * @param source the {@link EventList} whose selection will be managed. This should be the * same {@link EventList} passed to the constructor of your * {@link AdvancedTableModel} or {@link EventListModel}. */ public static <E> AdvancedListSelectionModel<E> eventSelectionModelWithThreadProxyList(EventList<E> source) { final EventList<E> proxySource = createSwingThreadProxyList(source); return new DefaultEventSelectionModel<E>(proxySource, true); }
/** * Creates a new selection model that also presents a list of the selection. It wraps the * source list using GlazedListsSwing#swingThreadProxyList(EventList). The * {@link AdvancedListSelectionModel} listens to this {@link EventList} in order to adjust * selection when the {@link EventList} is modified. For example, when an element is added to * the {@link EventList}, this may offset the selection of the following elements. * <p> * The returned selection model is <strong>not thread-safe</strong>. Unless otherwise noted, * all methods are only safe to be called from the event dispatch thread. * </p> * * @param source the {@link EventList} whose selection will be managed. This should be the * same {@link EventList} passed to the constructor of your * {@link AdvancedTableModel} or {@link EventListModel}. */ public static <E> AdvancedListSelectionModel<E> eventSelectionModelWithThreadProxyList(EventList<E> source) { final EventList<E> proxySource = createSwingThreadProxyList(source); return new DefaultEventSelectionModel<E>(proxySource, true); }
/** * Creates a new selection model that also presents a list of the selection. * While holding a read lock, it wraps the source list using * {@link GlazedListsSwing#swingThreadProxyList(EventList)}. The * {@link AdvancedListSelectionModel} listens to this {@link EventList} in order to adjust * selection when the {@link EventList} is modified. For example, when an element is added to * the {@link EventList}, this may offset the selection of the following elements. * <p> * The returned selection model is <strong>not thread-safe</strong>. Unless otherwise noted, * all methods are only safe to be called from the event dispatch thread. * </p> * * @param source the {@link EventList} whose selection will be managed. This should be the * same {@link EventList} passed to the constructor of your * {@link AdvancedTableModel} or {@link EventListModel}. */ public static <E> AdvancedListSelectionModel<E> eventSelectionModelWithThreadProxyList(EventList<E> source) { final EventList<E> proxySource = createSwingThreadProxyList(source); return new DefaultEventSelectionModel<E>(proxySource, true); }
/** * Instantiates a new movie selection model. Usage in MoviePanel * * @param sortedList * the sorted list * @param source * the source * @param matcher * the matcher */ public MovieSelectionModel(SortedList<Movie> sortedList, EventList<Movie> source, MovieMatcherEditor matcher) { this.sortedList = sortedList; this.selectionModel = new DefaultEventSelectionModel<>(source); this.selectionModel.addListSelectionListener(this); this.matcherEditor = matcher; this.selectedMovies = selectionModel.getSelected(); propertyChangeListener = new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getSource() == selectedMovie) { firePropertyChange(evt); } } }; }
AdvancedTableModel<TvShowEpisodeChooserModel> episodeTableModel = GlazedListsSwing.eventTableModelWithThreadProxyList(textFilteredEpisodes, new EpisodeTableFormat()); DefaultEventSelectionModel<TvShowEpisodeChooserModel> selectionModel = new DefaultEventSelectionModel<>(textFilteredEpisodes); selectedEpisodes = selectionModel.getSelected();
tableMovies = new ZebraJTable(movieTableModel); DefaultEventSelectionModel<MovieRenamerPreviewContainer> tableSelectionModel = new DefaultEventSelectionModel<>(results); resultSelectionModel = new ResultSelectionModel(); tableSelectionModel.addListSelectionListener(resultSelectionModel);
/** * Creates a new selection model that also presents a list of the selection. * * The {@link EventSelectionModel} listens to this {@link EventList} in order * to adjust selection when the {@link EventList} is modified. For example, * when an element is added to the {@link EventList}, this may offset the * selection of the following elements. * * @param source the {@link EventList} whose selection will be managed. This should * be the same {@link EventList} passed to the constructor of your * {@link EventTableModel} or {@link EventListModel}. */ public EventSelectionModel(EventList<E> source) { // lock the source list for reading since we want to prevent writes // from occurring until we fully initialize this EventSelectionModel source.getReadWriteLock().readLock().lock(); try { swingThreadSource = GlazedListsSwing.swingThreadProxyList(source); delegateSelectionModel = new DefaultEventSelectionModel<E>(swingThreadSource); } finally { source.getReadWriteLock().readLock().unlock(); } }
/** * Creates a new selection model that also presents a list of the selection. * * The {@link EventSelectionModel} listens to this {@link EventList} in order * to adjust selection when the {@link EventList} is modified. For example, * when an element is added to the {@link EventList}, this may offset the * selection of the following elements. * * @param source the {@link EventList} whose selection will be managed. This should * be the same {@link EventList} passed to the constructor of your * {@link EventTableModel} or {@link EventListModel}. */ public EventSelectionModel(EventList<E> source) { // lock the source list for reading since we want to prevent writes // from occurring until we fully initialize this EventSelectionModel source.getReadWriteLock().readLock().lock(); try { swingThreadSource = GlazedListsSwing.swingThreadProxyList(source); delegateSelectionModel = new DefaultEventSelectionModel<E>(swingThreadSource); } finally { source.getReadWriteLock().readLock().unlock(); } }
/** * Creates a new selection model that also presents a list of the selection. * * The {@link EventSelectionModel} listens to this {@link EventList} in order * to adjust selection when the {@link EventList} is modified. For example, * when an element is added to the {@link EventList}, this may offset the * selection of the following elements. * * @param source the {@link EventList} whose selection will be managed. This should * be the same {@link EventList} passed to the constructor of your * {@link EventTableModel} or {@link EventListModel}. */ public EventSelectionModel(EventList<E> source) { // lock the source list for reading since we want to prevent writes // from occurring until we fully initialize this EventSelectionModel source.getReadWriteLock().readLock().lock(); try { swingThreadSource = GlazedListsSwing.swingThreadProxyList(source); delegateSelectionModel = new DefaultEventSelectionModel<E>(swingThreadSource); } finally { source.getReadWriteLock().readLock().unlock(); } }