1 13 package com.tonbeller.jpivot.test.olap; 14 15 import java.util.Arrays ; 16 17 import com.tonbeller.jpivot.olap.model.Axis; 18 import com.tonbeller.jpivot.olap.model.Member; 19 import com.tonbeller.jpivot.olap.model.Position; 20 import com.tonbeller.jpivot.olap.navi.SortRank; 21 22 27 public class TestSortRank extends TestExtensionSupport implements SortRank { 28 Position sortPosition; 29 int sortMode = SortRank.ASC; 30 int topBottomCount = 10; 31 boolean sorting = true; 32 33 36 public boolean isSortable(Position position) { 37 Member[] members = position.getMembers(); 38 for (int i = 0; i < members.length; i++) 39 if (members[i].getLevel().getHierarchy().getDimension().isMeasure()) 40 return true; 41 return false; 42 } 43 44 47 public boolean isCurrentSorting(Position position) { 48 if (sortPosition == null) return false; 50 return Arrays.equals(sortPosition.getMembers(), position.getMembers()); 51 } 52 53 56 public void sort(Axis membersToSort, Position position) { 57 sortPosition = position; 58 fireModelChanged(); 59 } 60 61 65 public int getSortMode() { 66 return sortMode; 67 } 68 69 73 public int getTopBottomCount() { 74 return topBottomCount; 75 } 76 77 81 public void setSortMode(int sortMode) { 82 this.sortMode = sortMode; 83 fireModelChanged(); 84 } 85 86 90 public void setTopBottomCount(int topBottomCount) { 91 this.topBottomCount = topBottomCount; 92 fireModelChanged(); 93 } 94 95 public boolean isSorting() { 96 return sorting; 97 } 98 99 103 public void setSorting(boolean sorting) { 104 this.sorting = sorting; 105 fireModelChanged(); 106 } 107 108 } 109 | Popular Tags |