Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Custom ComboBoxCellEditor
Custom ComboBoxCellEditor [message #1772313] Fri, 08 September 2017 01:39 Go to next message
Louis Detweiler is currently offline Louis DetweilerFriend
Messages: 57
Registered: August 2017
Member
I am trying to implement a custom ComboBoxCellEditor. I would like to perform my own code whenever an option is selected from the combo box menu on a cell. Is there an easy way to change what happens when a user clicks on an option in the combo box cell editor menu?
Re: Custom ComboBoxCellEditor [message #1772320 is a reply to message #1772313] Fri, 08 September 2017 05:27 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2614
Registered: July 2012
Senior Member
Change the behavior completely? No, I think you also can't do this with another SWT widget.

Add some behavior? Yes, you can register a SelectionListener on the created NatCombo.

Of course you can also implement your own ComboBox (e.g. by extending NatCombo and override what you want). But not sure if that is so easy.
Re: Custom ComboBoxCellEditor [message #1772414 is a reply to message #1772320] Fri, 08 September 2017 21:02 Go to previous messageGo to next message
Louis Detweiler is currently offline Louis DetweilerFriend
Messages: 57
Registered: August 2017
Member
Ok. Ya I've been trying to implement my own ComboBoxCellEditor to use, but is this not the right thing to do? Should I instead be extending NatCombo as you said? Also if you could point me in the right direction for which method/methods I would need to override to perform my own code when an option is selected I would be very grateful.

Much thanks,

Louis
Re: Custom ComboBoxCellEditor [message #1772415 is a reply to message #1772414] Fri, 08 September 2017 21:41 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2614
Registered: July 2012
Senior Member
Of what are we talking? Selecting an item in the combo (multiselection) or what happens when an item is selected which triggers the commit?

I don't understand what you are trying to do.
Re: Custom ComboBoxCellEditor [message #1772416 is a reply to message #1772415] Fri, 08 September 2017 22:08 Go to previous messageGo to next message
Louis Detweiler is currently offline Louis DetweilerFriend
Messages: 57
Registered: August 2017
Member
I would like to change what happens when an item is selected which triggers the commit. I have a NatTable based upon an EMF model, where each row is represented by instances of a certain class, and each column is either an attribute of that class or a list of the objects of a certain type (based upon the column) that have reference to that class.

In the columns that are the list of objects that are referenced to the row object, I would like to have a combobox that appears with all of the possible objects that currently exist in the model of the type that corresponds with the column. I have already figured out how to do that part. However, when a selection is made I would like to change the EMF model by adding the selection to the list of references of the row object.

So basically I just need to intercept the method that causes the commit upon selection of an item in the combobox and perform my own code as opposed to what is done by default.

Thanks for your input,

Louis
Re: Custom ComboBoxCellEditor [message #1772417 is a reply to message #1772416] Fri, 08 September 2017 22:20 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2614
Registered: July 2012
Senior Member
Then override ComboBoxCellEditor#commit
Re: Custom ComboBoxCellEditor [message #1772421 is a reply to message #1772417] Fri, 08 September 2017 23:38 Go to previous message
Louis Detweiler is currently offline Louis DetweilerFriend
Messages: 57
Registered: August 2017
Member
Great thanks for your help! Not sure how I missed that method.
Previous Topic:Removing a row affects another row
Next Topic:cell border
Goto Forum:
  


Current Time: Sun Sep 23 22:04:08 GMT 2018

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

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

Back to the top