comparison dwtx/jface/viewers/ViewerSorter.d @ 10:b6c35faf97c8

Viewers
author Frank Benoit <benoit@tionex.de>
date Mon, 31 Mar 2008 00:47:19 +0200
parents
children
comparison
equal deleted inserted replaced
9:6c14e54dfc11 10:b6c35faf97c8
1 /*******************************************************************************
2 * Copyright (c) 2000, 2006 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * IBM Corporation - initial API and implementation
10 * Port to the D programming language:
11 * Frank Benoit <benoit@tionex.de>
12 *******************************************************************************/
13 module dwtx.jface.viewers.ViewerSorter;
14
15 import dwtx.jface.viewers.ViewerComparator;
16
17 import dwt.dwthelper.utils;
18
19 /**
20 * A viewer sorter is used by a {@link StructuredViewer} to reorder the elements
21 * provided by its content provider.
22 * <p>
23 * The default <code>compare</code> method compares elements using two steps.
24 * The first step uses the values returned from <code>category</code>.
25 * By default, all elements are in the same category.
26 * The second level is based on a case insensitive compare of the strings obtained
27 * from the content viewer's label provider via <code>ILabelProvider.getText</code>.
28 * </p>
29 * <p>
30 * Subclasses may implement the <code>isSorterProperty</code> method;
31 * they may reimplement the <code>category</code> method to provide
32 * categorization; and they may override the <code>compare</code> methods
33 * to provide a totally different way of sorting elements.
34 * </p>
35 * <p>
36 * It is recommended to use <code>ViewerComparator</code> instead.
37 * </p>
38 * @see IStructuredContentProvider
39 * @see StructuredViewer
40 */
41 public class ViewerSorter : ViewerComparator {
42 /**
43 * The collator used to sort strings.
44 *
45 * @deprecated as of 3.3 Use {@link ViewerComparator#getComparator()}
46 */
47 protected Collator collator;
48
49 /**
50 * Creates a new viewer sorter, which uses the default collator
51 * to sort strings.
52 */
53 public this() {
54 this(Collator.getInstance());
55 }
56
57 /**
58 * Creates a new viewer sorter, which uses the given collator
59 * to sort strings.
60 *
61 * @param collator the collator to use to sort strings
62 */
63 public this(Collator collator) {
64 super(collator);
65 this.collator = collator;
66 }
67
68 /**
69 * Returns the collator used to sort strings.
70 *
71 * @return the collator used to sort strings
72 * @deprecated as of 3.3 Use {@link ViewerComparator#getComparator()}
73 */
74 public Collator getCollator() {
75 return collator;
76 }
77
78 }