Hi vincent,
On Wed, Jun 10, 2009 at 10:46 PM, Vincent Massol <vincent(a)massol.net> wrote:
It should not return a File but an OutputStream
instead. I'd call it
generate rather than build.
And remove outputDirectory. And mention it's generating an image.
so:
ChartImageGenerator.OutputStream generate(DataSource, Map);
Sounds good.
And
interface DataSource {
// Usual tablemodel like api (from dan's implementation)
void init (params) // Initializes this datasource from the
parameters
passed in, no need of a separate factory.
}
I don't understand why it doesn't have any method.
It has a lot of methods (in dan's implementation). I put a comment just to
explain. Following is a complete listing of methods:
public interface DataSource
{
int getRowCount();
int getColumnCount();
Number getCell(int rowIndex, int colIndex) throws
ChartGeneratorException;
Number[] getRow(int rowIndex) throws ChartGeneratorException;
Number[] getColumn(int colIndex) throws ChartGeneratorException;
Number[][] getAllCells();
boolean hasHeaderRow();
boolean hasHeaderColumn();
String getHeaderRowValue(int columnIndex) throws
ChartGeneratorException;
String[] getHeaderRow() throws ChartGeneratorException;
String getHeaderColumnValue(int rowIndex) throws
ChartGeneratorException;
String[] getHeaderColumn() throws ChartGeneratorException;
}
The purpose of the init(String param) method would be to initialize this
DataSource so that above methods will return actual data.
Thanks.
- Asiri