/** * Creates a {@link SortedList} that sorts the specified {@link EventList} * using the specified {@link Comparator} to determine sort order. If the * specified {@link Comparator} is <code>null</code>, then this {@link List} * will be unsorted. */ public SortedList(EventList<E> source, Comparator<? super E> comparator) { super(source); setComparator(comparator); source.addListEventListener(this); }
/** * Sort movies. * * @param column * the column * @param ascending * the ascending */ public void sortMovies(MovieExtendedComparator.SortColumn column, boolean ascending) { Comparator<Movie> comparator = new MovieExtendedComparator(column, ascending); sortedList.setComparator(comparator); } }
/** * Creates a {@link SortedList} that sorts the specified {@link EventList} * using the specified {@link Comparator} to determine sort order. If the * specified {@link Comparator} is <code>null</code>, then this {@link List} * will be unsorted. */ public SortedList(EventList<E> source, Comparator<? super E> comparator) { super(source); setComparator(comparator); source.addListEventListener(this); }
/** * Change the {@link Comparator} which determines the groupings presented * by this List * * @param comparator the {@link Comparator} used to determine groupings; * <tt>null</tt> will be treated as {@link GlazedLists#comparableComparator()} */ public void setComparator(Comparator<? super E> comparator) { if (comparator == null) comparator = (Comparator) GlazedLists.comparableComparator(); ((SortedList<E>) source).setComparator(comparator); }
/** * Change the {@link Comparator} which determines the groupings presented * by this List * * @param comparator the {@link Comparator} used to determine groupings; * <tt>null</tt> will be treated as {@link GlazedLists#comparableComparator()} */ public void setComparator(Comparator<? super E> comparator) { if (comparator == null) comparator = (Comparator) GlazedLists.comparableComparator(); ((SortedList<E>) source).setComparator(comparator); }
/** * Change the {@link Comparator} which determines the unique elements * of this List. * * @param comparator the {@link Comparator} used to determine groupings; * <tt>null</tt> will be treated as {@link GlazedLists#comparableComparator()} */ public void setComparator(Comparator<? super E> comparator) { if (comparator == null) comparator = (Comparator) GlazedLists.comparableComparator(); ((SortedList<E>) this.source).setComparator(comparator); }
/** * Creates a {@link SortedList} that sorts the specified {@link EventList} * using the specified {@link Comparator} to determine sort order. If the * specified {@link Comparator} is <code>null</code>, then this {@link List} * will be unsorted. */ public SortedList(EventList<E> source, Comparator<? super E> comparator) { super(source); setComparator(comparator); source.addListEventListener(this); }
/** * Change the {@link Comparator} which determines the unique elements * of this List. * * @param comparator the {@link Comparator} used to determine groupings; * <tt>null</tt> will be treated as {@link GlazedLists#comparableComparator()} */ public void setComparator(Comparator<? super E> comparator) { if (comparator == null) comparator = (Comparator) GlazedLists.comparableComparator(); ((SortedList<E>) this.source).setComparator(comparator); }
/** * Change the {@link Comparator} which determines the groupings presented * by this List * * @param comparator the {@link Comparator} used to determine groupings; * <tt>null</tt> will be treated as {@link GlazedLists#comparableComparator()} */ public void setComparator(Comparator<? super E> comparator) { if (comparator == null) comparator = (Comparator) GlazedLists.comparableComparator(); ((SortedList<E>) source).setComparator(comparator); }
/** * Change the {@link Comparator} which determines the unique elements * of this List. * * @param comparator the {@link Comparator} used to determine groupings; * <tt>null</tt> will be treated as {@link GlazedLists#comparableComparator()} */ public void setComparator(Comparator<? super E> comparator) { if (comparator == null) comparator = (Comparator) GlazedLists.comparableComparator(); ((SortedList<E>) this.source).setComparator(comparator); }
/** * Modify the behaviour of this {@link SortedList} to one of the predefined modes. * * @param mode either {@link #STRICT_SORT_ORDER} or {@link #AVOID_MOVING_ELEMENTS}. */ public void setMode(int mode) { if(mode != STRICT_SORT_ORDER && mode != AVOID_MOVING_ELEMENTS) throw new IllegalArgumentException("Mode must be either SortedList.STRICT_SORT_ORDER or SortedList.AVOID_MOVING_ELEMENTS"); if(mode == this.mode) return; // apply the new mode this.mode = mode; // we need to re-sort the table on the off-chance that an element // was out of order before if(this.mode == STRICT_SORT_ORDER) { setComparator(getComparator()); } } /**
/** * Modify the behaviour of this {@link SortedList} to one of the predefined modes. * * @param mode either {@link #STRICT_SORT_ORDER} or {@link #AVOID_MOVING_ELEMENTS}. */ public void setMode(int mode) { if(mode != STRICT_SORT_ORDER && mode != AVOID_MOVING_ELEMENTS) throw new IllegalArgumentException("Mode must be either SortedList.STRICT_SORT_ORDER or SortedList.AVOID_MOVING_ELEMENTS"); if(mode == this.mode) return; // apply the new mode this.mode = mode; // we need to re-sort the table on the off-chance that an element // was out of order before if(this.mode == STRICT_SORT_ORDER) { setComparator(getComparator()); } } /**
/** * Modify the behaviour of this {@link SortedList} to one of the predefined modes. * * @param mode either {@link #STRICT_SORT_ORDER} or {@link #AVOID_MOVING_ELEMENTS}. */ public void setMode(int mode) { if(mode != STRICT_SORT_ORDER && mode != AVOID_MOVING_ELEMENTS) throw new IllegalArgumentException("Mode must be either SortedList.STRICT_SORT_ORDER or SortedList.AVOID_MOVING_ELEMENTS"); if(mode == this.mode) return; // apply the new mode this.mode = mode; // we need to re-sort the table on the off-chance that an element // was out of order before if(this.mode == STRICT_SORT_ORDER) { setComparator(getComparator()); } } /**
sortedList.setComparator(comparator); } finally { sortedList.getReadWriteLock().writeLock().unlock();
sortedList.setComparator(comparator); } finally { sortedList.getReadWriteLock().writeLock().unlock();
/** * Updates the comparator in use and applies it to the table. */ protected void rebuildComparator() { final Comparator<E> rebuiltComparator = sortingState.buildComparator(); // select the new comparator sortedList.getReadWriteLock().writeLock().lock(); try { sortedListComparator = rebuiltComparator; sortedList.setComparator(rebuiltComparator); } finally { sortedList.getReadWriteLock().writeLock().unlock(); } }
/** * Updates the comparator in use and applies it to the table. */ protected void rebuildComparator() { final Comparator<E> rebuiltComparator = sortingState.buildComparator(); // select the new comparator sortedList.getReadWriteLock().writeLock().lock(); try { sortedListComparator = rebuiltComparator; sortedList.setComparator(rebuiltComparator); } finally { sortedList.getReadWriteLock().writeLock().unlock(); } }
/** * Updates the comparator in use and applies it to the table. */ protected void rebuildComparator() { final Comparator<E> rebuiltComparator = sortingState.buildComparator(); // select the new comparator sortedList.getReadWriteLock().writeLock().lock(); try { sortedListComparator = rebuiltComparator; sortedList.setComparator(rebuiltComparator); } finally { sortedList.getReadWriteLock().writeLock().unlock(); } }
sortedList.setComparator(comparator);
sortedList.setComparator(comparator);