Custom persistence behavior and modifying the PersistenceDialog [message #1784563] |
Thu, 29 March 2018 11:30 |
Alexander Farel Messages: 4 Registered: March 2018 |
Junior Member |
|
|
Hello,
Let me begin by describing the following scenario where we use Nattable.
We want to provide mass edition capabilities for our users, so basically users drag and drop elements in a view and depending on some features of the dropped elements - we construct a table having as many columns as editable features.
If new elements that don't share all the features with all the existing ones in our table are added, we change the table's structure and we display only their common features. We do this by create a new custom and then creating new data providers for all our data layers and updating the existing data layers using the method setDataProvider(IDataProvider dataProvider) .
We now want to enable users to save the current configuration of their tables using the persistence mechanism that already exists. We export their configuration to a file and re-import it when a new table is created. The problem is that the validity of a exported configuration depends on which classes of elements were present when the configuration was exported.
Example (Conf1 applies when elements for ClassA and ClassB are present in the table since they have 10 common features that are editable, but not for ClassC that only has 2 editable features).
We therefore want to display only the valid configurations for the current elements that are present in the table. The DisplayPersistenceDialogCommandHandler contains all the logic and it also contains the PersistenceDialog that is displayed. We wanted to modify some of the behavior for the PersistenceDialog in order to only display the valid configurations for the current contained elements, but all the needed fields including the TableViewer are private and not protected ...
We found a workaround but this approach is not sufficient for our needs. We do this by creating a custom PersistenceDialogCommandHandler that registers a state change listener, and when a new configuration is created it also adds a new key to the properties object that contains the present classes. And when the custom PersistenceDialogCommandHandler is created, we basicaly delete all invalid configurations that don't match with the current elements.
What options do we have in order to reuse the existing PersistenceDialog and avoid duplicating the code on our side?
[Updated on: Tue, 03 April 2018 15:12] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.03161 seconds