[EMF Forms] Dynamic Auto-Complete on a single details page [message #1794026] |
Wed, 22 August 2018 15:41 |
Nikola Veber Messages: 31 Registered: December 2017 |
Member |
|
|
Hi Everyone,
I have a case, where the values of auto-complete proposals depend on another value in the same view. (I am extending the generic editor)
I could solve the problem by implementing following:
- in CommandStackListener, when the field is changed, upon which the autocomplete values depend, set a local field "jumpToAfterRendering" to the value of current selection
- set selection of the tree-master-detail to empty
tmd.setSelection(new StructuredSelection());
- implement the renderingFinished callback to the tree-master-detail
tmd.registerDetailPanelRenderingFinishedCallback(new DetailPanelRenderingFinishedCallback() {
@Override
public void renderingFinished(Object renderedObject) {
if (jumpToAfterRendering != null) {
tmd.setSelection(new StructuredSelection(jumpToAfterRendering));
jumpToAfterRendering = null;
}
}
});
This results in fresh rendering of the detail panel, with new call to the Autocomplete service.
Donwside is that there is a not-so-nice looking transition to empty selection and back.
Is there a more elegant way of implementing this?
Best regards
Nikola
P.S.
If I remember my recent analysis of the Autocomplete Control correctly, the values are calculated on rendering.
At that moment I thought, wouldn't it be possible to change the control in a way to make it call the autocomplete service when the values are required?
I will try to find time to look into it more closely, but maybe someone could point out a better solution, or disillusion me on this subject...
[Updated on: Thu, 23 August 2018 16:27] Report message to a moderator
|
|
|
Re: [EMF Forms] Dynamic Auto-Complete on a single details page [message #1794153 is a reply to message #1794026] |
Fri, 24 August 2018 13:52 |
|
Hi,
you could try to override
AutocompleteTextControlSWTRenderer.createJFaceViewer(Composite)
in order to keep track of the ComboViewer and the AutoCompleteField and then update the combo's input/the field's proposals every time the combo gets focus. However I haven't tried this myself and I am not sure if reacting on a focus change catches all cases.
The other option I see currently would be to add a callback/update-mechanism to the AutocompleteViewModelService at which the renderer registers itself. You could then update the service which will notify the renderer about the proposals change.
I hope this helps!
Cheers
Johannes
Johannes Faltermeier
Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.01737 seconds