| 1 | |
package org.kuali.student.common.ui.client.widgets.table.scroll; |
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | 0 | class TablePredicateFactory { |
| 7 | |
|
| 8 | |
static interface Predicate { |
| 9 | |
boolean indexCondition(int index, int count); |
| 10 | |
|
| 11 | |
int nextIndex(int index); |
| 12 | |
|
| 13 | |
MoveType moveType(); |
| 14 | |
} |
| 15 | |
|
| 16 | 0 | static enum MoveType { |
| 17 | 0 | UP_LEFT, |
| 18 | 0 | DOWN_RIGHT, |
| 19 | |
} |
| 20 | |
|
| 21 | 0 | static Predicate UP_LEFT_PREDICATE = new Predicate() { |
| 22 | |
@Override |
| 23 | |
public boolean indexCondition(int row, int rowCount) { |
| 24 | 0 | return row > 0; |
| 25 | |
} |
| 26 | |
|
| 27 | |
@Override |
| 28 | |
public int nextIndex(int row) { |
| 29 | 0 | return row - 1; |
| 30 | |
} |
| 31 | |
|
| 32 | |
@Override |
| 33 | |
public MoveType moveType() { |
| 34 | 0 | return MoveType.UP_LEFT; |
| 35 | |
} |
| 36 | |
}; |
| 37 | |
|
| 38 | 0 | static Predicate DOWN_RIGHT_PREDICATE = new Predicate() { |
| 39 | |
@Override |
| 40 | |
public boolean indexCondition(int row, int rowCount) { |
| 41 | 0 | return row + 1 < rowCount; |
| 42 | |
} |
| 43 | |
|
| 44 | |
@Override |
| 45 | |
public int nextIndex(int row) { |
| 46 | 0 | return row + 1; |
| 47 | |
} |
| 48 | |
|
| 49 | |
@Override |
| 50 | |
public MoveType moveType() { |
| 51 | 0 | return MoveType.DOWN_RIGHT; |
| 52 | |
} |
| 53 | |
}; |
| 54 | |
} |