Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Deletion of TableColumns
Deletion of TableColumns [message #451103] Wed, 23 February 2005 06:26 Go to next message
Sivakumar is currently offline SivakumarFriend
Messages: 15
Registered: July 2009
Junior Member
Hi,

I am using Eclipse 3.0.1. I am supposed to present some statistical
info in a Table. Based on the user input, the result table may change in
no. of Columns and rows. So when the user selected any cell or row header
or column header, accordingly i need to display diffenrent set of rows and
columns. For that, i have to delete the existing Columns and create the
new set of Columns.

First Time, when i created the table, it shows the contents. But after
getting a user request, when i redraw the table, the cell content is not
visible. I need a better way to delete the existing Columns. I have
included the source snipplet. Can anyone suggest me a better way to solve
this.


public class TestSummariserTable extends Composite{

Table tblSales;
TableViewer viewer;
Composite cmpSalesTable;

public TestSummariserTable(Composite arg0, int arg1) {
super(arg0, arg1);
cmpSalesTable = new Composite(this, SWT.NONE);
createTblSales();
cmpSalesTable.setLayout(new FillLayout());
}
private void createTblSales() {
tblSales = new Table(cmpSalesTable, SWT.NONE);
tblSales.setVisible(true);
tblSales.setLinesVisible(true);
tblSales.setHeaderVisible(true);
processTblSales();

}
private void processTblSales() {
createColumns();
viewer = new TableViewer(tblSales);
viewer.setContentProvider(new SalesDashboardContentProvider());
viewer.setLabelProvider(new SalesDashboardLabelProvider());
viewer.setInput("");
viewer.refresh();
addListener();
}

private void addListener() {
tblSales.addListener (SWT.MouseDown, new Listener () {

public void handleEvent (Event event) {
if (true)//Cell Selected
{
cmpSalesTable = null;
//Here , i need to some solution to drop the
existing Columns
createTblSales();
}
else if (true)//Row Header Selected
{
cmpSalesTable = null;
createTblSales();
}
else{
//if Column Header Selected
cmpSalesTable = null;
createTblSales();
}
}
});
}
private void createColumns() {
//Based On the User input, No. of Columns to be created varies
}

}
Re: Deletion of TableColumns [message #451107 is a reply to message #451103] Wed, 23 February 2005 12:42 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: melko.gmx.at

try this:

public static void renewTable(Table table){
TableColumn tblCol[] = table.getColumns();
int iSize = tblCol.length;
for(int i = iSize - 1; i >=0 ; i--)
tblCol[i].dispose();
table.clearAll();
table.removeAll();
}

I hope I could help you!!

take care.
Re: Deletion of TableColumns [message #451123 is a reply to message #451107] Wed, 23 February 2005 13:55 Go to previous messageGo to next message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
You don't need the clearAll().

"melko" <melko@gmx.at> wrote in message news:cvhtn4$84j$1@www.eclipse.org...
> try this:
>
> public static void renewTable(Table table){
> TableColumn tblCol[] = table.getColumns();
> int iSize = tblCol.length;
> for(int i = iSize - 1; i >=0 ; i--)
> tblCol[i].dispose();
> table.clearAll();
> table.removeAll();
> }
>
> I hope I could help you!!
>
> take care.
>
Re: Deletion of TableColumns [message #451139 is a reply to message #451123] Thu, 24 February 2005 11:09 Go to previous message
Sivakumar is currently offline SivakumarFriend
Messages: 15
Registered: July 2009
Junior Member
Thanks For the reply.

It works well.

Steve Northover wrote:

> You don't need the clearAll().

> "melko" <melko@gmx.at> wrote in message news:cvhtn4$84j$1@www.eclipse.org...
>> try this:
>>
>> public static void renewTable(Table table){
>> TableColumn tblCol[] = table.getColumns();
>> int iSize = tblCol.length;
>> for(int i = iSize - 1; i >=0 ; i--)
>> tblCol[i].dispose();
>> table.clearAll();
>> table.removeAll();
>> }
>>
>> I hope I could help you!!
>>
>> take care.
>>
Previous Topic:A widget with a possibility to write with different (in size) fonts
Next Topic:Jar creation failed. resource out of sync with the file system
Goto Forum:
  


Current Time: Thu Mar 28 09:03:51 GMT 2024

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

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

Back to the top