Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 301126 - [Table] TableColumn remove problem
Summary: [Table] TableColumn remove problem
Status: RESOLVED FIXED
Alias: None
Product: RAP
Classification: RT
Component: RWT (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 1.3 M5   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-01-28 09:18 EST by Balazs Brinkus CLA
Modified: 2010-01-28 14:07 EST (History)
1 user (show)

See Also:
ruediger.herrmann: iplog+


Attachments
TableColumn remove test application (1.02 KB, application/x-javascript)
2010-01-28 09:19 EST, Balazs Brinkus CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Balazs Brinkus CLA 2010-01-28 09:18:01 EST
Build Identifier: 

Hello,

the problem is that if you dispose a TableColumn then column won't be removed from the Table's _columnArea. 
So the table's columns count will be the same before the remove.

The test application (I attached the full test application):
	var table = new org.eclipse.swt.widgets.Table("w3", "");

	this.debug("Add columns");
	var column1 = new org.eclipse.swt.widgets.TableColumn(table);
	column1.setLabel("Column1")
	var column2 = new org.eclipse.swt.widgets.TableColumn(table);
	column2.setLabel("Column2")
	var column3 = new org.eclipse.swt.widgets.TableColumn(table);
	column3.setLabel("Column2")
	this.debug("Columns count: "+table.getColumnCount());			

	this.debug("Remove columns");
	column2.dispose();
	column3.dispose();
	column1.dispose();
	this.debug("Columns count: "+table.getColumnCount());

The FireBug output:

	DEBUG: applications.TableApplication[20]: Add columns
	DEBUG: applications.TableApplication[20]: Columns count: 3
	DEBUG: applications.TableApplication[20]: Remove columns
	DEBUG: applications.TableApplication[20]: Columns count: 3

So you need to extend the _removeColumn method:

	// org.eclipse.swt.widgets.Table line 1170
	_removeColumn : function( column ) {
		this._unhookColumnMove( column );		
		column.removeEventListener( "changeWidth", this._onColumnChangeSize, this );
>		this._columnArea.remove(column);
		this._updateScrollWidth();
		this._updateRows();
	},
	
I checked the Table's latest version (1.79) and it also contains this bug.
	

Regards,
Balazs Brinkus


Reproducible: Always
Comment 1 Balazs Brinkus CLA 2010-01-28 09:19:06 EST
Created attachment 157518 [details]
TableColumn remove test application
Comment 2 Rüdiger Herrmann CLA 2010-01-28 13:55:52 EST
Thanks for reportingthis and providing a fix.
The changes as in the description is in CVS HEAD.