Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » TreeViewer Partial update(Only partially update - need help with Observables)
TreeViewer Partial update [message #486242] Wed, 16 September 2009 20:59
Brandon  is currently offline Brandon
Messages: 2
Registered: September 2009
Junior Member
Please bear with me, I'm pretty new to RCP development, and I'm having a hard time wrapping my head around the Observable framework to update the views and databind.

I'm writing an RCP app and want to view the models in a TreeViewer. After reviewing the code from EclipseCon 2009 RCPMail 2.0 application, I tried to mimic what they did for the TreeViewer. The problem is my viewer only reacts to changes to the top level elements, and none of the children. If I close the viewer after making a change to children, and then reopen it, the changes appear -- so the ContentProvider and LabelProvider are functioning properly. The event of the change just isn't being caught (as far as I can tell).

So my question then is - how do I 'register' the deeper (and often not instantiated yet) properties of my model to be reacted to on change? I'm pretty sure currently it's occurring in the ObservableListTreeContentProvider in the method getObservableListFactory()

public class EventModelDBContentProvider extends
    ObservableListTreeContentProvider
{
	public EventModelDBContentProvider()
	{
		//super( getObservableListFactory(), getTreeStructureAdvisor() );
		super( getObservableListFactory(), null );
	}

	// This factory returns an observable list of children for the given parent.
	private static IObservableFactory getObservableListFactory()
	{
		return new IObservableFactory()
		{
			public IObservable createObservable(Object parent)
			{
				if( parent instanceof Controller )
				{
					IObservableList list = BeanProperties.list("models").observe( parent );
					return list;
				}
                          return null;
                      }
... etc.


The label provider then calls this method in its constructor:
public EventModelDBLabelProvider( IObservableSet knownElements )
	{
		// We pass an array of properties so that appropriate listeners
		// are added automatically to each element displayed in the viewer.
		super(Properties.observeEach(knownElements, BeanProperties
				.values(new String[] {  "models", "designators",.... /*All the things I want to listen/react to*/ })));
	}


"models" is a List<EventModel>, but EventModel has List<Designator>, List<Tags>, etc... How do I register the lists within the EventModel and subsequently their members such that their respective firePropertyChange is reacted too?

Please, can anyone show me how to register the model members? I'm at a bit of a loss after trying and failing with many different attempts.

Thanks..
Previous Topic:Calling viewer.update(element, ...) on a filtered object does not 'unfilter' it.
Next Topic:checkbox state change (checked-grayed-unchecked) logic in CheckboxTreeviewer
Goto Forum:
  


Current Time: Sat Sep 20 06:11:13 GMT 2014

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

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