public DetailData getDetailData() { return new BufferListDetailData(this); }
private Object[][] buildData(Object[] rows) { if (rows==null) return null; Object[][] localData=new Object[rows.length][]; int numCols=getColCount(); for (int i=0;i<rows.length;i++) { localData[i]=resize(getRow(rows[i]), numCols); } return localData; }
public BufferListDetailData(BufferList bufferList) { initalize(bufferList); }
private void initalize(BufferList bufferList) { /* object is value object. * if header is bigger than data of first row then return header up to column width * if header is smaller than data then PAD HEADER with colN * if first row is smaller than subsequent rows then use colsize of first row and exclude other cols * if first row is bigger than subsequent rows then pad row with nulls */ Object[] rows=getAllRows(bufferList); if (rows!=null) { firstRow=getRow(rows[0]); colsInFirstRow=firstRow.length; } colsInHeader=(bufferList.getHeader()==null) ? 0 : bufferList.getHeader().length; header=buildHeader(bufferList.getHeader()); data=buildData(rows); }
/** Get the buffer as an array, so it can be displayed. Use getDetailData() method instead. */ @Deprecated public Object[][] getData() { return new BufferListDetailData(this).getData(); }
private String[] buildHeader(String[] h) { // if header is bigger than data of first row then return header up to column width // if header is smaller than data then PAD HEADER with colN Object[] head=resize(h, getColCount()); if (head==null) return null; String[] headerStr=new String[head.length]; for (int i=0;i<head.length;i++) { if (head[i]==null) { headerStr[i]="col"+i; } else headerStr[i]=head[i].toString(); } return headerStr; }
public int getRowCount() { if (isEmpty()) return 0; else return data.length; }
public boolean hasData() { return !isEmpty(); }
public DetailData getDetailData() { return new BufferListDetailData(list); }