01: /*
02: * The contents of this file are subject to the Mozilla Public License
03: * Version 1.1 (the "License"); you may not use this file except in
04: * compliance with the License. You may obtain a copy of the License at
05: * http://www.mozilla.org/MPL/
06: *
07: * Software distributed under the License is distributed on an "AS IS"
08: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
09: * License for the specific language governing rights and limitations
10: * under the License.
11: *
12: * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool.
13: *
14: * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool.
15: * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved.
16: *
17: * Contributor(s):
18: * Mark A. Kobold [mkobold <at> isqlviewer <dot> com].
19: *
20: * If you didn't download this code from the following link, you should check
21: * if you aren't using an obsolete version: http://www.isqlviewer.com
22: */
23: package org.isqlviewer.swing.table;
24:
25: /**
26: * An interface to indacte that it's contents are sortable.
27: * <p>
28: * This interface is mainly designed for use with TableModel implementations.
29: *
30: * @author Mark A. Kobold <mkobold at isqlviewer dot com>
31: * @version 1.0
32: */
33: public interface Sortable {
34:
35: /**
36: * Sorts the given column with a given direction.
37: * <p>
38: * Implementation should handle if the column index is out of bounds.
39: *
40: * @param column the desired column to sort.
41: * @param sortAscending the sorting direction flag.
42: */
43: public void sort(int column, boolean sortAscending);
44:
45: /**
46: * Reverse indexing of column names.
47: * <p>
48: * This method helps the sort icon show in the Table headers appear on the correct column even if it is reodered.
49: *
50: * @param ColumnName to reverse lookup
51: * @return int the true index of the column in the data model.
52: */
53: public int getIndexOfColumnName(String ColumnName);
54:
55: /**
56: * Checks to see if a given column can be sorted in a given direction.
57: * <p>
58: * Calls should be made to this method prior to calling sort(int, boolean). Invocation to the sort(int, boolean)
59: * method should only occur if this method returns true.
60: *
61: * @see #sort(int, boolean)
62: * @param column to check for sorting.
63: * @param ascending true for ascending, false for descending.
64: * @return if the given column is sortable.
65: */
66: public boolean canSort(int column, boolean ascending);
67:
68: }
|