1 13 package com.tonbeller.jpivot.test.olap; 14 15 import java.util.ArrayList ; 16 import java.util.Iterator ; 17 import java.util.List ; 18 19 import com.tonbeller.jpivot.olap.model.Member; 20 import com.tonbeller.jpivot.olap.model.Position; 21 import com.tonbeller.jpivot.olap.navi.ChangeSlicer; 22 23 28 public class TestChangeSlicer extends TestExtensionSupport implements ChangeSlicer { 29 30 33 public Member[] getSlicer() { 34 List list = new ArrayList (); 35 TestAxis axis = model().getSlicer(); 36 for (Iterator it = axis.getPositions().iterator(); it.hasNext(); ) { 37 Position p = (Position)it.next(); 38 if (p.getMembers().length != 1) 39 throw new IllegalArgumentException ("slicer position must have exactly one member"); 40 list.add(p.getMembers()[0]); 41 } 42 return (Member[])list.toArray(new Member[list.size()]); 43 } 44 45 48 public void setSlicer(Member[] members) { 49 TestAxis axis = TestOlapModelUtils.createAxis(members); 50 model().setSlicer(axis); 51 fireModelChanged(); 52 } 53 54 } 55 | Popular Tags |