01: package org.dbbrowser.ui.helper;
02:
03: import org.dbbrowser.db.engine.model.DBTableCell;
04: import org.dbbrowser.ui.helper.ColumnInfoComparator;
05:
06: import java.util.Comparator;
07:
08: /**
09: * Sorts the list of db table cells by name
10: */
11: public class DBTableCellComparator implements Comparator {
12: /**
13: * Returns 1 if firstObject(ColumnInfo) is before secondObject(ColumnInfo)
14: * @param firstObject
15: * @param secondObject
16: * @return
17: */
18: public int compare(Object firstObject, Object secondObject) {
19: ColumnInfoComparator columnInfoComparator = new ColumnInfoComparator();
20: DBTableCell dbTableCell1 = (DBTableCell) firstObject;
21: DBTableCell dbTableCell2 = (DBTableCell) secondObject;
22: int valueToReturn = columnInfoComparator.compare(dbTableCell1
23: .getColumnInfo(), dbTableCell2.getColumnInfo());
24:
25: columnInfoComparator = null;
26: return valueToReturn;
27: }
28: }
|