Bastian
Bastian

Reputation: 518

Java: How to store data for using in Jface/TreeViewer and TableViewer

I would like to show the same data in a SWT/Jface TreeViewer and TableViewer. The question is how to store the data in a good way that both viewers can use the same data?

My raw data are stored in an array:

Id | Level | Type    | Value
1  | 1     | Heading | Heading 1
2  | 2     | Text    | This is a text
3  | 2     | Text    | This is another text
4  | 1     | Heading | Heading 2
5  | 2     | Heading | Heading 2.1
6  | 3     | Heading | Heading 2.2
7  | 4     | Text    | This is more text
...

The TreeViewer shall display the item with type "heading" only:

The TableViewer shall display the values in the same order as stored in the array.

My thoughts:

Can you give me some hint?

Background:

Maybe someone knows the software DOORS. You have an outline view on the left (TreeViewer) and a list in the main view (TableViewer). Both share the same data.

Upvotes: 0

Views: 58

Answers (0)

Related Questions