Initializing data model [message #459654] |
Tue, 05 December 2006 11:20  |
Eclipse User |
|
|
|
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 #459662 is a reply to message #459661] |
Tue, 05 December 2006 17:42  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.02947 seconds