Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » e(fx)clipse » How do I tell AdapterFactoryObservableList which feature of the root object to use?
How do I tell AdapterFactoryObservableList which feature of the root object to use? [message #1740387] Fri, 12 August 2016 13:32
Andreas Werner is currently offline Andreas WernerFriend
Messages: 1
Registered: July 2009
Junior Member

I'm trying to use a TableView as a viewer for my EMF data. I successfully managed to get this tutorial running and working:

Now, I have a problem when I try to reuse the ContactsTableView approach in my project:
public class MyTableViewController {

  @FXML private TableColumn<TestObject, Boolean> colValid;
  public void initTable(ModelService modelService) {
    tableView.setItems(new AdapterFactoryObservableList<TestObject>(adapterFactory, modelService.getModel()));
    colValid.setCellValueFactory(features -> BooleanProperty.booleanProperty(
      EMFEditFXProperties.value(editingDomain, features.getValue(),  MyTestPackage.eINSTANCE.getTestObject_Valid()));  // <-------------------------- Exception

As stated in the above code an exception is being thrown:
Caused by: java.lang.NullPointerException
	at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSettingDelegate(
	at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(
???	at org.dummy.model.impl.TestLevelImpl.eGet( 
	at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(
	at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(
	at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(
	at org.eclipse.fx.emf.databinding.edit.EMFEditFXProperties$EObjectProperty.getValue(
	at com.sun.javafx.binding.BidirectionalBinding.bind(

I guess the NPE is thrown, because the TestLevel class has no "valid" feature. But, I don't want to have TestLevel objects in my table - I only want TestObject objects in my table!!!

So, I guess there might be a problem with the AdapterFactoryObservableList and my model object, because it contains two containment references and all objects of both of these references are used as table items. My question is:

How can I control, that only those objects from the right containment reference are being used as items in the table?

Previous Topic:Possibly wrong dependency on EMF Edit (in 2.4 release)
Next Topic:Macosx export
Goto Forum:

Current Time: Tue Sep 29 21:33:48 GMT 2020

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

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

Back to the top