01: package jimm.datavision.gui;
02:
03: import jimm.datavision.Selectable;
04:
05: /**
06: * Used in lists to hold and display database column and sort order.
07: *
08: * @author Jim Menard, <a href="mailto:jimm@io.com">jimm@io.com</a>
09: * @see TwoListWin
10: * @see GroupWin
11: * @see SortWin
12: */
13: abstract class TLWListItem implements Comparable {
14:
15: Selectable selectable;
16: int sortOrder;
17:
18: /**
19: * Constructor.
20: *
21: * @param selectable a selectable thingie
22: * @param sortOrder a subclass-specific value for sort order
23: */
24: TLWListItem(Selectable selectable, int sortOrder) {
25: this .selectable = selectable;
26: this .sortOrder = sortOrder;
27: }
28:
29: public abstract boolean sortsAscending();
30:
31: public Selectable getSelectable() {
32: return selectable;
33: }
34:
35: public int getSortOrder() {
36: return sortOrder;
37: }
38:
39: public int compareTo(Object o) {
40: String otherName = ((TLWListItem) o).selectable
41: .getDisplayName();
42: return selectable.getDisplayName().compareTo(otherName);
43: }
44:
45: public String toString() {
46: return selectable.getDisplayName();
47: }
48:
49: }
|