Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » A table with two columns
A table with two columns [message #843095] Thu, 12 April 2012 18:17 Go to next message
Aberforth Dumbledore is currently offline Aberforth DumbledoreFriend
Messages: 17
Registered: April 2012
Location: A planet called Earth
Junior Member
Hi there everyone !!!

I want to do two things:

1. Get the sum of the column "Price".
2. Save all table's content in a MySQL table.

For the second issue I try this:


for(int row = 0; row < vista.tdetalle.getItemCount(); row++)
{
//product = item.getText(0);
//price = item.getText(1);
product = item.getText(row); // How can I set the first column here???
price = item.getText(row);// How can I set the second column here???

facade.RegistrarBitacora(product,price);//Here save on DB
}


That code only saves the last row.

I fill my table like this:


for(CProductoDTO catalogoproductos :coleccion)
{
item = new TableItem(vista.tdetalle, SWT.NONE);
item.setText(new String[]
{
catalogoproductos.get_Nombre_Producto(),//product
catalogoproductos.get_Precio_Producto(),//price
});
}


I need some illustration here. Thanks.
Re: A table with two columns [message #843936 is a reply to message #843095] Fri, 13 April 2012 14:15 Go to previous messageGo to next message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
For examples of using SWT Tables see
http://www.eclipse.org/swt/snippets/#table . For examples of writing to
a database you'll need to look elsewhere (I'd think that google can help
with finding them).

Grant


On 4/12/2012 2:17 PM, Aberforth Dumbledore wrote:
> Hi there everyone !!!
>
> I want to do two things:
>
> 1. Get the sum of the column "Price".
> 2. Save all table's content in a MySQL table.
>
> For the second issue I try this:
>
>
> for(int row = 0; row < vista.tdetalle.getItemCount(); row++)
> {
> //product = item.getText(0);
> //price = item.getText(1); product = item.getText(row); // How can I set
> the first column here???
> price = item.getText(row);// How can I set the second column here???
>
> facade.RegistrarBitacora(product,price);//Here save on DB
> }
>
>
> That code only saves the last row.
>
> I fill my table like this:
>
>
> for(CProductoDTO catalogoproductos :coleccion)
> {
> item = new TableItem(vista.tdetalle, SWT.NONE);
> item.setText(new String[]
> { catalogoproductos.get_Nombre_Producto(),//product
> catalogoproductos.get_Precio_Producto(),//price
> });
> }
>
>
> I need some illustration here. Thanks.
Re: A table with two columns [message #846683 is a reply to message #843936] Mon, 16 April 2012 17:16 Go to previous message
Aberforth Dumbledore is currently offline Aberforth DumbledoreFriend
Messages: 17
Registered: April 2012
Location: A planet called Earth
Junior Member
Before asking here, I did a Google search, including snippets of SWT, thank you for your attention. Very Happy
Previous Topic:Javascript in webbrowser
Next Topic:how to embed swt shell into native window
Goto Forum:
  


Current Time: Thu Apr 25 16:28:28 GMT 2024

Powered by FUDForum. Page generated in 0.02355 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top