Package org.jdesktop.swingx.decorator

Examples of org.jdesktop.swingx.decorator.SortKey


            List<SortKey> newSortKeys = new ArrayList<SortKey>(getSortKeys());

            // see if we're already sorting with this column
            SortOrder columnSortOrder = SortOrder.ASCENDING;
            for(Iterator<? extends SortKey> s = newSortKeys.iterator(); s.hasNext(); ) {
                SortKey sortKey = s.next();
                if(sortKey.getSortOrder() == SortOrder.UNSORTED) continue;
                if(sortKey.getColumn() == columnIndex) {
                    columnSortOrder = (sortKey.getSortOrder() == SortOrder.ASCENDING) ? SortOrder.DESCENDING : SortOrder.ASCENDING;
                    s.remove();
                    break;
                }
            }

            // prepare the new sort order
            if(!multipleColumnSort) newSortKeys.clear();
            newSortKeys.add(new SortKey(columnSortOrder, columnIndex));

            // kick off the sort
            setSortKeys(newSortKeys);
        }
View Full Code Here


            this.sortKeys.addAll(sortKeys);

            // rebuild the SortedList's comparator
            List<Comparator> comparators = new ArrayList<Comparator>(this.sortKeys.size());
            for(int k = 0; k < this.sortKeys.size(); k++) {
                SortKey sortKey = this.sortKeys.get(k);
                if(sortKey.getSortOrder() == SortOrder.UNSORTED) continue;

                Comparator comparator = getComparator(sortKey.getColumn());
                if(sortKey.getSortOrder() == SortOrder.DESCENDING) comparator = GlazedLists.reverseComparator(comparator);

                comparators.add(comparator);
            }

            // figure out the final comparator
View Full Code Here

        }

        /** {@inheritDoc} */
        public SortOrder getSortOrder(int columnIndex) {
            for(int k = 0; k < this.sortKeys.size(); k++) {
                SortKey s = this.sortKeys.get(k);
                if(s.getColumn() == columnIndex) return s.getSortOrder();
            }
            return SortOrder.UNSORTED;
        }
View Full Code Here

TOP

Related Classes of org.jdesktop.swingx.decorator.SortKey

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.