Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Initializing data model
Initializing data model [message #459654] Tue, 05 December 2006 11:20 Go to next message
Eclipse UserFriend
Hi all,

I'm a newbie to RCP and Eclipse in general. I am writing a sort of chart viewer. The data model is created according to data loaded from an XML file into a datastructure. I want to know where do I have to declare, initialize and fill this data model and how to have it accessible by all the views to show his content.

I want also my views to auto update the informations displayed according to the modification done on the model.

Thanks to all
Re: Initializing data model [message #459655 is a reply to message #459654] Tue, 05 December 2006 12:44 Go to previous messageGo to next message
Eclipse UserFriend
Hi Nocif,

You probably want to create a ContentProvider class that implements
org.eclipse.jface.viewers.IStructuredContentProvider

The methods in you content provider will extract data from your XML file
and make these data available to your jface viewers.

Hope this helps.

Charlie


Nocif wrote:
> Hi all,
>
> I'm a newbie to RCP and Eclipse in general. I am writing a sort of chart viewer. The data model is created according to data loaded from an XML file into a datastructure. I want to know where do I have to declare, initialize and fill this data model and how to have it accessible by all the views to show his content.
>
> I want also my views to auto update the informations displayed according to the modification done on the model.
>
> Thanks to all
Re: Initializing data model [message #459661 is a reply to message #459655] Tue, 05 December 2006 15:48 Go to previous messageGo to next message
Eclipse UserFriend
Hi Charlie,

thanks for answering, I wanted to know if you can explain me more your solution. I will tell you more about the data model : my data model contains some arraylists holding data that is extracted from my XML files and then I want to display parts of this model each in a different view in a single perspective : each arraylist of my data model will be displayed in a different view.I want to fill all my model at a certain point and then have all my different views acessing to this instance of the model, so each view can display its specific data part (in this example each arraylist in a different view). And I want also that my views are notified about changes occuring into my data model due to Actions triggering. My defined Actions will modify my data in the model -> my views will display the new data.

Thanks for your cooperation, I hope that you will answer me soon.

Thanks in advance
Re: Initializing data model [message #459662 is a reply to message #459661] Tue, 05 December 2006 17:42 Go to previous message
Eclipse UserFriend
Hi Nocif,

In the case you describe, you probably want 1 ContentProvider class for
each ArrayList (perhaps you can use a static ArrayList for your data).

Have each of your views implement ISelectionProvider so that you can
monitor the item(s) within your view the user is working with.

It might be viable to have your Action(s) fire a PropertyChangeEvent and
have your ContentProvider classes listen for the events and change your
ArrayLists accordingly. The class that implments each of your views
will have access to the JFace viewer. Your class could have a public
method that calls the refresh() method on the viewer.

You will need to provide a class that implements ILabelProvider (tree or
table) for each of your views.

If you want to modify the data within a table, you'll need to have your
views implemnent ICellModifier.

For details on creating views, content providers, and label providers,
see "eclipse Rich Client Platform" by McAffer and Lemieux (published by
Addison Wesley).

For details about using cell modifiers, see "The Definitive Guide to SWT
and JFace" by Warner and Harris (published by APress).

Good luck. This is an ambitious project for a "beginner".

Charlie


Nocif wrote:
> Hi Charlie,
>
> thanks for answering, I wanted to know if you can explain me more your solution. I will tell you more about the data model : my data model contains some arraylists holding data that is extracted from my XML files and then I want to display parts of this model each in a different view in a single perspective : each arraylist of my data model will be displayed in a different view.I want to fill all my model at a certain point and then have all my different views acessing to this instance of the model, so each view can display its specific data part (in this example each arraylist in a different view). And I want also that my views are notified about changes occuring into my data model due to Actions triggering. My defined Actions will modify my data in the model -> my views will display the new data.
>
> Thanks for your cooperation, I hope that you will answer me soon.
>
> Thanks in advance
Previous Topic:two instance of the same rcp application running at the same time..???
Next Topic:Workbench or JFACE Wizard Dialog
Goto Forum:
  


Current Time: Mon Apr 14 17:17:30 EDT 2025

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

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

Back to the top