ninguem pode me ajudar? =/ bom no site do dynamic jasper diz…:
setDatasource(, , )
Where:
path to the data source: A string that points to the data source.
origin of the data source: A constant from DJConstants class which can be: SUBREPORT_DATA_SOURCE_ORIGIN_FIELD or SUBREPORT_DATA_SOURCE_ORIGIN_PARAMETER, it just tells the subreport where to look for the data source (the parameters map, or if its a property of the current row)
For example, if path to the data source is “subreportDatasource” and origin of the data source is SUBREPORT_DATA_SOURCE_ORIGIN_PARAMETER, then it will look in the parameters map for an object under the key of “subreportDatasource”, on the other hand if we pass SUBREPORT_DATA_SOURCE_ORIGIN_FIELD, in the current row, there must be a property with the name “subreportDatasource” that returns an object of the type DATA_SOURCE_TYPE_
type of the data source: A constant from DJConstants class, all types constants has a name like DATA_SOURCE_TYPE_, where represents the type. Most known types are java.sql.ResultSet, Collection, Array, Xml, etc.
Bom… os argumentos estão bem explicados e td mais… e no código de exemplo do site ele passa o parametro assim:
djcross.setDatasource(“sr”,DJConstants.DATA_SOURCE_ORIGIN_PARAMETER, DJConstants.DATA_SOURCE_TYPE_COLLECTION)
montando o datasource… essa parte eu entendi, e no final do código ele fala:
//put a collection in the parameters map to be used by the crosstab
params.put(“sr”, SortUtils.sortCollection(TestRepositoryProducts.getDummyCollection(),djcross));
é aih que eu não entendi… daonde surgiu essa collection? E essa collection deve ter oq nela… pra quando vc montar as linhas e as colunas serem identificadas como? por exmeplo… aqui ele monta o que serão as linhas e as colunas e a measures:
djcross.addColumn(“State”,“state”,String.class.getName(),false)
djcross.addColumn(“Branch”,“branch”,String.class.getName(),false)
djcross.addRow(“Product Line”, “productLine”, String.class.getName(),false)
djcross.addRow(“Item”, “item”, String.class.getName(),true)
djcross.addMeasure(“amount”,Float.class.getName(), ColumnsGroupVariableOperation.SUM , “Amount”,measureStyle)
minha dúvida então é a seguinte… como passar uma collection como parametro e como ela tem q ser definida pra que eu consiga definir o que é linha, coluna e measures.
Por favor alguem pode me ajudar??