Task #1471

Updated by Sebastien Jacquot over 5 years ago

The current Concordance/Edition and other editor communications is hard coded which makes it not really easy to add links.

This ticket is a proposal to 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))
- define and implement a method as doSomething(Object param) which specifies something to do and use it on some events.
- define and implement a method as updateLinkedEditorsFromEvent(Object event) which loops in some events loop through all the linked editors and call doSomething(Event event) or other parameter 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

- 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)