How to call data binding from a toolbar handler [message #867280] |
Tue, 01 May 2012 04:02  |
Eclipse User |
|
|
|
Hi all,
Good day! I would like to ask for help regarding the
accessing of data binding from the handler side.Declaration of the UI component, model and binding context are declared in viewpart. The scenario is: upon clicking the next button in the toolbar the next row will be selected in the table and the databinding should be activated so that the details form in the right side will be called.I already make a working code only for table traversal in the viewpart without error. Now when I called it in the handler it kinda work but throws error.Thanks in advance! I hope I can receive a positive response. I am new to data binding and handler usage.
Regards,
Lanz
|
|
|
|
|
|
Re: How to call data binding from a toolbar handler [message #869159 is a reply to message #869031] |
Wed, 02 May 2012 22:35  |
Eclipse User |
|
|
|
Hi Vincenzo,
I'm sorry I am having a hard time implementing your suggestion. The table and the other UI components for detail information are
all in a single viewpart. The handler need to activate the data binding when the user clicks
on the toolbar item next and previous button. What I did was I created a dummy text field in the viewpart
with a dummy attribute in the model class(Germplasm); and make this this dummy text field invisible. Now it's working.
//-->> in the viewpart
dummyFieldText = new Text(grpSeedTraits, SWT.BORDER);
dummyFieldText.setBounds(304, 75, 76, 19);
dummyFieldText.setVisible(false);
//<<--
//-->> in the handler
DataBindingContext ctx = germplasmDataEntryViewPart.getBindingContext();
IObservableValue widgetValue = WidgetProperties.text(SWT.Modify).observe(germplasmDataEntryViewPart.getDummyFieldText());
IObservableValue modelValue = BeanProperties.value(Germplasm.class, "dummyField").observeDetail(
masterSelection);
ctx.bindValue(widgetValue, modelValue);
//<<--
You're ideas are welcome.
Regards,
Lanz
|
|
|
Powered by
FUDForum. Page generated in 0.04052 seconds