01: /* uDig - User Friendly Desktop Internet GIS client
02: * http://udig.refractions.net
03: * (C) 2004, Refractions Research Inc.
04: *
05: * This library is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU Lesser General Public
07: * License as published by the Free Software Foundation;
08: * version 2.1 of the License.
09: *
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * Lesser General Public License for more details.
14: */
15: package net.refractions.udig.project.ui.internal;
16:
17: import net.refractions.udig.project.internal.Layer;
18:
19: import org.eclipse.jface.viewers.Viewer;
20: import org.eclipse.jface.viewers.ViewerSorter;
21:
22: /**
23: * Sorts the layers for display in a view. So the first layer drawn is at the bottom.
24: *
25: * @author Jesse
26: * @since 1.1.0
27: */
28: public class ViewerLayerSorter extends ViewerSorter {
29: /**
30: * @see org.eclipse.jface.viewers.ViewerSorter#compare(org.eclipse.jface.viewers.Viewer,
31: * java.lang.Object, java.lang.Object)
32: */
33: public int compare(Viewer viewer, Object e1, Object e2) {
34: return ((Layer) e2).compareTo((Layer) e1);
35: }
36:
37: }
|