1 13 package com.tonbeller.jpivot.table.span; 14 15 import java.util.ArrayList ; 16 import java.util.List ; 17 18 23 public class SpanConfigSupport implements SpanConfig { 24 25 int defaultDirection = SpanConfig.NO_SPAN; 26 List clsList = new ArrayList (); 27 List dirList = new ArrayList (); 28 29 39 public void setDirection(Class clazz, int direction) { 40 clsList.add(clazz); 41 dirList.add(new Integer (direction)); 42 } 43 44 48 public int chooseSpanDirection(Span span) { 49 Object obj = span.getObject(); 50 if (obj == null) 51 return defaultDirection; 52 Class clazz = obj.getClass(); 53 int N = clsList.size(); 54 for (int i = 0; i < N; i++) { 55 Class c = (Class )clsList.get(i); 56 if (c.isAssignableFrom(clazz)) 57 return ((Integer )dirList.get(i)).intValue(); 58 } 59 return defaultDirection; 61 } 62 63 67 public int getDefaultDirection() { 68 return defaultDirection; 69 } 70 71 75 public void setDefaultDirection(int defaultDirection) { 76 this.defaultDirection = defaultDirection; 77 } 78 79 82 public boolean equals(Span span1, Span span2) { 83 return span1.getObject().equals(span2.getObject()); 84 } 85 86 } 87 | Popular Tags |