Re: How to use CSVDataExporter

2014-11-05 Thread Francois Meillet
We have IExportableColumn
where T is the type of each row in the table.
where S is the type of the sort property of the table.
 
and the method 
public  void exportData(IDataProvider dataProvider, 
List> columns, OutputStream outputStream)

try
List> columns = new 
ArrayList>();


François Meillet
Formation Wicket - Développement Wicket





Le 5 nov. 2014 à 15:47, suvojit168  a écrit :

> Hi,
> 
> I am trying to export data to csv in my wicket pages. I am using
> CSVDataExporter for this purpose. Due to some constraints I am not using it
> in conjunction to ExportToolbar. There is a link and on click of the link I
> am trying to call exportData() on instance of CSVDataExporter. 
> I am using AbstractExportableColumn for columns writing data to columns. 
> 
> However I am getting a compile time error on exportData. Follwoing is the
> code (excelDataImport is the link here ):
> 
> excelDataImport.add(new AjaxEventBehavior("onclick") {
>   private static final long serialVersionUID = 1L;
> 
>   protected void onEvent(AjaxRequestTarget target) {
>   List String, String>> columns = new
> ArrayList>();
>   columns.add(new 
> AbstractExportableColumn String>(new Model("Affiliate Name"), "name") {
> 
>   @Override
>   public IModel getDataModel(
>   IModel 
> arg0) {
>   // TODO Auto-generated method 
> stub
>   return null;
>   }
>   
>   });
>   
>   try {
>   new CSVDataExporter().exportData(new 
> AffiliateDataProvider(null),
> columns, new FileOutputStream("test.xls"));
>   } catch (FileNotFoundException e) {
>   // TODO Auto-generated catch block
>   e.printStackTrace();
>   } catch (IOException e) {
>   // TODO Auto-generated catch block
>   e.printStackTrace();
>   } catch (Exception e) {
>   // TODO Auto-generated catch block
>   e.printStackTrace();
>   }
> 
>   
>   
> 
>   }
>   });
> 
> The error message is  : "The method exportData(IDataProvider,
> List>, OutputStream) in the type CSVDataExporter
> is not applicable for the arguments (AffiliateDataProvider,
> List>,
> FileOutputStream)".
> 
> I think I did it all correctly (as per whatever knowledge I could get on
> this subject), am I doing something wrong here?
> 
> Also, can anyone share with me some sample examples and description/details
> for CSVDataExporter? I have gone through example in  DataTablePage.java in
> wicket example but that is using  DataTable and ExportToolbar. 
> 
> Thanks,
> Suvojit
> 
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/How-to-use-CSVDataExporter-tp4668270.html
> Sent from the Users forum mailing list archive at Nabble.com.
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 



Re: How to use CSVDataExporter

2014-11-06 Thread suvojit168
Francois Meillet wrote
> try
> List> columns = new
> ArrayList>();

Hi François,

Thanks for reply. I am using wicket 6.16. As per this  Link

   
we have,

Interface IExportableColumn

Type Parameters:
T - The type of each row in the table.
S - The type of the sort property of the table.
D - The type of the data displayed by this column.

When I try : 
List> columns = new
ArrayList>(); 

I  get compile time error "Incorrect number of arguments for type
IExportableColumn; it cannot be parameterized with arguments
".

Nonetheless, this works :
List> columns = new
ArrayList>();

I am getting a null pointer exception inside exportData (...) now which I am
looking at. Will add reply if I need assistance.

PS: It will be great if you can share some
examples/tutorials/articals/anything on CSVDataExporter ( I am not very much
comfortable with CSVDataExporter as of now).


Thanks,
Suvojit

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-use-CSVDataExporter-tp4668270p4668280.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: How to use CSVDataExporter

2014-11-06 Thread Francois Meillet
Hi Suvojit,

I don't know CSVDataExporter but I noticed that the second bounded type 
parameter was a 
wildcard and not a defined type.

I use Wicket 7 where there are only 2 parameters.

See some examples:
http://www.7thweb.net/wicket-jquery-ui/kendo/datatable/CommandsDataTablePage;jsessionid=2926A68F12DAE4CAC910C18699676209?0
https://doc.codelutin.com/cantharella/xref/nc/ird/cantharella/web/utils/data/TableExportToolbar.html


François


François Meillet
Formation Wicket - Développement Wicket





Le 6 nov. 2014 à 13:07, suvojit168  a écrit :

> Francois Meillet wrote
>> try
>> List> columns = new
>> ArrayList>();
> 
> Hi François,
> 
> Thanks for reply. I am using wicket 6.16. As per this  Link
> 
>
> we have,
> 
> Interface IExportableColumn
> 
> Type Parameters:
> T - The type of each row in the table.
> S - The type of the sort property of the table.
> D - The type of the data displayed by this column.
> 
> When I try : 
> List> columns = new
> ArrayList>(); 
> 
> I  get compile time error "Incorrect number of arguments for type
> IExportableColumn; it cannot be parameterized with arguments
> ".
> 
> Nonetheless, this works :
> List> columns = new
> ArrayList>();
> 
> I am getting a null pointer exception inside exportData (...) now which I am
> looking at. Will add reply if I need assistance.
> 
> PS: It will be great if you can share some
> examples/tutorials/articals/anything on CSVDataExporter ( I am not very much
> comfortable with CSVDataExporter as of now).
> 
> 
> Thanks,
> Suvojit
> 
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/How-to-use-CSVDataExporter-tp4668270p4668280.html
> Sent from the Users forum mailing list archive at Nabble.com.
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 



Re: How to use CSVDataExporter

2014-11-06 Thread Sebastien
Hi François, Suvojit

Actually the Wicket Kendo UI's DataTable (first example) is using a custom
CSVDataExporter (largely inspired - not to say copy/paste - from the
original). But it can still itself be used for inspiration...

Source:
https://github.com/sebfz1/wicket-jquery-ui/blob/master/wicket-kendo-ui/src/main/java/com/googlecode/wicket/kendo/ui/datatable/export/CSVDataExporter.java

Best regards,
Sebastien



On Thu, Nov 6, 2014 at 2:37 PM, Francois Meillet  wrote:

> Hi Suvojit,
>
> I don't know CSVDataExporter but I noticed that the second bounded type
> parameter was a
> wildcard and not a defined type.
>
> I use Wicket 7 where there are only 2 parameters.
>
> See some examples:
>
> http://www.7thweb.net/wicket-jquery-ui/kendo/datatable/CommandsDataTablePage;jsessionid=2926A68F12DAE4CAC910C18699676209?0
>
> https://doc.codelutin.com/cantharella/xref/nc/ird/cantharella/web/utils/data/TableExportToolbar.html
>
>
> François
>
>
> François Meillet
> Formation Wicket - Développement Wicket
>