Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Nebula » Databinding on RadioGroupViewer sets 'null'
Databinding on RadioGroupViewer sets 'null' [message #668655] Fri, 06 May 2011 11:17
Jan Krakora is currently offline Jan Krakora
Messages: 477
Registered: December 2009
Location: Prague
Senior Member
Hi guys,

I've 2 problems with databinding on RadioGroupViewer. Assume the code below:
RadioGroupViewer radioGroupViewer = new RadioGroupViewer(groupOstatni, SWT.VERTICAL | SWT.LEFT_TO_RIGHT);
radioGroupViewer.setContentProvider(new ArrayContentProvider());
radioGroupViewer.setInput(MyEnum.values());

DataBindingContext context = new DataBindingContext()
context.bindValue(
        		ViewerProperties.singleSelection().observe(radioGroupViewer),
        		BeanProperties.value("property").observe(modelObject),
        		new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE),
        		new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE));

modelObject.addPropertyChangeListener(new PropertyChangeListener() {

		public void propertyChange(PropertyChangeEvent evt) {
			if (evt.getPropertyName().equals("property")) {
				System.out.println(evt.getOldValue());
				System.out.println(evt.getNewValue());
			}
		}
});

When I change the selection from A (the initial property value) to B, the PropertyChangeListener is called twice. It writes:
A
null
null
B

That's not what I expected. Why isn't the listener called only ones with oldValue A and the newValue B? I'm I missing something?
The second problem is that when the RadioGroupViewer is disposed, it sets all the radio buttons labels to same and the property to null! I really don't understand why this is happening.
Previous Topic:Xviewer Column Grouping
Next Topic:CDateTime status?
Goto Forum:
  


Current Time: Wed Apr 16 23:56:26 EDT 2014

Powered by FUDForum. Page generated in 0.10945 seconds