Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] TableViewer and cell editors queston

I forgot to give the code for populateFields method.

Here is the code

            //populate fields method
     populateFields(Row currentrow,String currentTable){
          //calls another method to get table fields in a string array
            String[] tempFields = loadCurrentTableFields(currentTable);
            currentrow.setComboFields(tempFields);
            String[] temp=currentrow.getComboFields();
            if (tempFields != null)
                    editors[1] = new ComboBoxCellEditor(table, temp,     SWT.READ_ONLY);

        }


vijay reddy <vijay_felicity@xxxxxxxxx> wrote:

I am using table viewer with 2 columns to populate database tables
in first column and corresponding table fields in second column.

I am using combobox cell editors on two columns.In my implementation I wrote listerners to keep
track of changes on selection of first column combo box.For every change in selection of combo item
I need to repopulate the corresponding fields in the second column.

            editors[0] = new ComboBoxCellEditor(table, populateTables(), SWT.READ_ONLY);
                        CCombo DBtableCCombo=(CCombo)tableCCombo.getControl();

            DBtableCCombo.addModifyListener(new ModifyListener() {
                public void modifyText(ModifyEvent e) {
                    String currentTable = DBtableCCombo.getText();
                    System.out.println("Table modified" + currentTable);

                        Row currentrow = (Row) ((IStructuredSelection)
                                tableviewer.getSelection()).getFirstElement();

                        //for currentrow,populate combo box in second column with current table fields
                        populateFields(currentrow,currentTable);

                    });

            //populate fields method
            populateFields(Row currentrow,String currentTable){
        
            }
Eventhough this code is repopulating the DBfields it is not populating the way I need.
Everytime a modifytext event is fired on DBtableCCOmbo the previously populated
DBfields in the second column are again repopulating with the current table's DBfields.

The way I need is that the previously populated DBfields should remain intact.Only currentrow's items are to be changed
when an modify event fires.

I think I can figure out this problem if there is a way where I can apply a comboboxcelleditor for each cell in the second column
instead of comboboxcelleditor for whole second column.

Any help will be appreciated
thanks
Vijay

How low will we go? Check out Yahoo! Messenger�s low PC-to-Phone call rates._______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev


Ring'em or ping'em. Make PC-to-phone calls as low as 1¢/min with Yahoo! Messenger with Voice.

Back to the top