Task #1471

Updated by Sebastien Jacquot almost 7 years ago

Implement a global interfaces system for editors communications and updating data/state of an editor from another one ?
First ideas:
- define an interface ILinkableEditor
store a list of linked editors in the source editors (e.g.: getLinkedEditor(int i), setLinkedEditor(ILinkableEditor linkedEditor)) i))
- define and implement a method as doSomething(Object param) which specifies specify something to do and use it on some events.
- in some events loop through all the linked editors and call doSomething(Event event) or other parameter param type
- when closing an editor, remove this editor from all the linked editors lists

e.g. for linking Progression and Concordance editors:

- on double-click on a Progression point, test if there is already a linked editor with result object of type "Concordance" (see getSource() of TXM CustomizableEditor class). If no, create a Concordance editor and add the Progression editor as linked editor to it. Also add the Concordance editor as linked editor to the Progression editor.
Loop through all the linked editors and call doSomething()
- on double-click on a Concordance row, call in the event listener all the doSomething(Object param) methods of all the linked editors

This system should permit, for a same kind of editor, an easy use of this editor without links, with one link and with multiple links

(NOTE: ATM the current Concordance/Edition and other editor communications is hard hardly coded which makes make it not really easy to add links)

- the method setLinkedEditor(ILinkableEditor linkedEditor)) may be have one more parameter to pass and store some custom data, e.g.: setLinkedEditor(ILinkableEditor linkedEditor), Object param)