Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » Face data binding strange behavior
Face data binding strange behavior [message #1836128] Tue, 22 December 2020 08:04
Christian Eugster is currently offline Christian EugsterFriend
Messages: 197
Registered: July 2009
Location: St. Gallen Switzerland
Senior Member
Hello
I am using face and core data binding in my project. The problem I have is following:

I use a ComboViewer to display a list of entries for selection and a list of jpa entities as input. When I select an entry in the gui then I get the following stack trace:

!ENTRY org.eclipse.core.databinding 2 0 2020-12-22 08:48:50.219
!MESSAGE Could not change value of ch.eugster.herakles.persistence.jpa.models.JpaSubmissionAgreement@b320427e.provenanceAgent
!STACK 0
java.lang.IllegalArgumentException: Missing public setter method for provenanceAgent property
	at org.eclipse.core.internal.databinding.beans.BeanPropertyHelper.writeProperty(BeanPropertyHelper.java:56)
	at org.eclipse.core.internal.databinding.beans.BeanValueProperty.doSetValue(BeanValueProperty.java:60)
	at org.eclipse.core.databinding.property.value.ValueProperty.setValue(ValueProperty.java:93)
	at org.eclipse.core.internal.databinding.property.value.SimplePropertyObservableValue.doSetValue(SimplePropertyObservableValue.java:104)
	at org.eclipse.core.databinding.observable.value.AbstractObservableValue.setValue(AbstractObservableValue.java:70)
	at org.eclipse.core.databinding.observable.value.DecoratingObservableValue.setValue(DecoratingObservableValue.java:117)
	at org.eclipse.core.internal.databinding.observable.masterdetail.DetailObservableValue.doSetValue(DetailObservableValue.java:133)
	at org.eclipse.core.databinding.observable.value.AbstractObservableValue.setValue(AbstractObservableValue.java:70)
	at org.eclipse.core.databinding.observable.value.DecoratingObservableValue.setValue(DecoratingObservableValue.java:117)
	at org.eclipse.core.databinding.UpdateValueStrategy.doSet(UpdateValueStrategy.java:481)
	at org.eclipse.core.databinding.ValueBinding.lambda$1(ValueBinding.java:209)
	at org.eclipse.core.databinding.ValueBinding$$Lambda$357/0x00000000c187d270.run(Unknown Source)
	at org.eclipse.core.databinding.Binding.lambda$3(Binding.java:194)
	at org.eclipse.core.databinding.Binding$$Lambda$356/0x00000000c187d008.run(Unknown Source)
	at org.eclipse.core.databinding.observable.Realm$1.run(Realm.java:151)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.core.databinding.observable.Realm.safeRun(Realm.java:155)
	at org.eclipse.core.databinding.observable.Realm.exec(Realm.java:173)
	at org.eclipse.core.databinding.Binding.execAfterDisposalCheck(Binding.java:192)
	at org.eclipse.core.databinding.ValueBinding.lambda$0(ValueBinding.java:202)
	at org.eclipse.core.databinding.ValueBinding$$Lambda$355/0x00000000c187cb98.run(Unknown Source)
	at org.eclipse.core.databinding.Binding.lambda$3(Binding.java:194)
	at org.eclipse.core.databinding.Binding$$Lambda$356/0x00000000c187d008.run(Unknown Source)
	at org.eclipse.core.databinding.observable.Realm$1.run(Realm.java:151)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.core.databinding.observable.Realm.safeRun(Realm.java:155)
	at org.eclipse.core.databinding.observable.Realm.exec(Realm.java:173)
	at org.eclipse.core.databinding.Binding.execAfterDisposalCheck(Binding.java:192)
	at org.eclipse.core.databinding.ValueBinding.doUpdate(ValueBinding.java:166)
	at org.eclipse.core.databinding.ValueBinding.access$4(ValueBinding.java:151)
	at org.eclipse.core.databinding.ValueBinding$1.handleValueChange(ValueBinding.java:47)
	at org.eclipse.core.databinding.observable.value.ValueChangeEvent.dispatch(ValueChangeEvent.java:73)
	at org.eclipse.core.databinding.observable.ChangeManager.fireEvent(ChangeManager.java:119)
	at org.eclipse.core.databinding.observable.value.DecoratingObservableValue.fireValueChange(DecoratingObservableValue.java:68)
	at org.eclipse.core.databinding.observable.value.DecoratingObservableValue.handleValueChange(DecoratingObservableValue.java:105)
	at org.eclipse.core.databinding.observable.value.DecoratingObservableValue$$Lambda$346/0x00000000c1896420.handleValueChange(Unknown Source)
	at org.eclipse.core.databinding.observable.value.ValueChangeEvent.dispatch(ValueChangeEvent.java:73)
	at org.eclipse.core.databinding.observable.ChangeManager.fireEvent(ChangeManager.java:119)
	at org.eclipse.core.databinding.observable.value.AbstractObservableValue.fireValueChange(AbstractObservableValue.java:86)
	at org.eclipse.core.internal.databinding.property.value.SimplePropertyObservableValue.notifyIfChanged(SimplePropertyObservableValue.java:120)
	at org.eclipse.core.internal.databinding.property.value.SimplePropertyObservableValue.lambda$1(SimplePropertyObservableValue.java:69)
	at org.eclipse.core.internal.databinding.property.value.SimplePropertyObservableValue$$Lambda$400/0x00000000c19007e0.run(Unknown Source)
	at org.eclipse.core.databinding.observable.Realm$1.run(Realm.java:151)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.core.databinding.observable.Realm.safeRun(Realm.java:155)
	at org.eclipse.core.databinding.observable.Realm.exec(Realm.java:173)
	at org.eclipse.core.internal.databinding.property.value.SimplePropertyObservableValue.lambda$0(SimplePropertyObservableValue.java:67)
	at org.eclipse.core.internal.databinding.property.value.SimplePropertyObservableValue$$Lambda$347/0x00000000c18ff9e0.handleEvent(Unknown Source)
	at org.eclipse.core.databinding.property.NativePropertyListener.fireChange(NativePropertyListener.java:71)
	at org.eclipse.jface.internal.databinding.viewers.SelectionChangedListener.selectionChanged(SelectionChangedListener.java:42)
	at org.eclipse.jface.viewers.Viewer$1.run(Viewer.java:151)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.ui.internal.JFaceUtil$$Lambda$231/0x00000000bb1c7ca8.run(Unknown Source)
	at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:174)
	at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:148)
	at org.eclipse.jface.viewers.StructuredViewer.updateSelection(StructuredViewer.java:2132)
	at org.eclipse.jface.viewers.StructuredViewer.handleSelect(StructuredViewer.java:1178)
	at org.eclipse.jface.viewers.StructuredViewer$4.widgetSelected(StructuredViewer.java:1207)
	at org.eclipse.jface.util.OpenStrategy.fireSelectionEvent(OpenStrategy.java:242)
	at org.eclipse.jface.util.OpenStrategy.access$4(OpenStrategy.java:237)
	at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:402)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4385)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1512)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1535)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1520)
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1324)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4172)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3789)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1157)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1046)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
	at org.eclipse.e4.ui.internal.workbench.swt.E4Application.start(E4Application.java:166)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:657)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:594)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1438)


BUT: This is only the case, when I name the model attribute's getter and setter in a particular way:

The respective jpa entity is named JpaSubmissionAgreement. It has an jpa entity attribute of type JpaPerson with getter and setter:

	@ManyToOne(optional = true)
	@JoinColumn(name = "submission_agreement_provenance_agent_id", referencedColumnName = "authority_id")
	private JpaPerson provenanceAgent;


	@Override
	public JpaPerson getProvenanceAgent()
	{
		return this.provenanceAgent;
	}

	@Override
	public void setProvenanceAgent(Person person)
	{
		this.propertyChangeSupport.firePropertyChange(new PropertyChangeEvent(this, "provenanceAgent", this.provenanceAgent, this.provenanceAgent = (JpaPerson) person));
	}


When I change the attribute name (and it's setter and getter) th e.g. provenancePerson no exception is thrown. I have tested with several names. The code for the gui looks as follows:

			Combo combo = new Combo(composite, fieldIdentifier.styles());
			this.toolkit.adapt(combo);
			combo.setLayoutData(fieldIdentifier.gridData());
			this.controls.put(fieldIdentifier.controlKey(), combo);
			ComboViewer comboViewer = new ComboViewer(Combo.class.cast(control));
			this.viewers.put(fieldIdentifier.viewerKey(), comboViewer);

			WritableValue<T> value = new WritableValue<T>();
			value.setValue(this.entity);
			this.values.put(fieldIdentifier.valueKey(), value);

			final IObservableValue<Object> target = ViewerProperties.singleSelection().observe(comboViewer);
			final IObservableValue<Object> model = BeanProperties.value(fieldIdentifier.attributeKey()).observeDetail(value);
			this.bindings.put(fieldIdentifier.bindingKey(), this.dataBindingContext.bindValue(target, model));


I tried with debugging but found no clue. What could be the problem here?

Thanks!
Previous Topic:Jface EOL versions?
Next Topic:Using TableViewerColumns does not refresh viewer entries
Goto Forum:
  


Current Time: Tue Apr 20 09:39:44 GMT 2021

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

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

Back to the top