Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [EMF Forms] Dynamic Auto-Complete on a single details page
[EMF Forms] Dynamic Auto-Complete on a single details page [message #1794026] Wed, 22 August 2018 15:41 Go to next message
Nikola Veber is currently offline Nikola VeberFriend
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 Go to previous messageGo to next message
Johannes Faltermeier is currently offline Johannes FaltermeierFriend
Messages: 101
Registered: December 2013
Senior Member

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/
Re: [EMF Forms] Dynamic Auto-Complete on a single details page [message #1794173 is a reply to message #1794153] Sat, 25 August 2018 07:57 Go to previous messageGo to next message
Nikola Veber is currently offline Nikola VeberFriend
Messages: 31
Registered: December 2017
Member
Hello Johannes,

I will try the proposal with onFocus. That would't require any complex logic for updating, assuming it covers all cases. Maybe an additional method in the autocomplete service, isDynamic(), which would let one define the non-changing fields, so the service is not called unnecessarily.

Cheers
Nikola
Re: [EMF Forms] Dynamic Auto-Complete on a single details page [message #1794215 is a reply to message #1794173] Mon, 27 August 2018 15:04 Go to previous messageGo to next message
Nikola Veber is currently offline Nikola VeberFriend
Messages: 31
Registered: December 2017
Member
Implemented with onFocusListener. Looks good so far (still looking for cases not covered by this implementation).

Thanks!
Nikola
Re: [EMF Forms] Dynamic Auto-Complete on a single details page [message #1795466 is a reply to message #1794215] Sun, 23 September 2018 18:08 Go to previous messageGo to next message
Nikola Veber is currently offline Nikola VeberFriend
Messages: 31
Registered: December 2017
Member
As I haven't found any inconvenience with this approach so far (call for criticism is wide open!):
what do you think about the idea to extend the autocomplete annotation for the argument dynamic=true and take this as a feature?

I assume there are use cases for both variants, but often possible values depend on a value selected somewhere else in the form (like Country - State - CIty, as a common example...)

Best regards
Nikola
Re: [EMF Forms] Dynamic Auto-Complete on a single details page [message #1795504 is a reply to message #1795466] Mon, 24 September 2018 12:52 Go to previous messageGo to next message
Johannes Faltermeier is currently offline Johannes FaltermeierFriend
Messages: 101
Registered: December 2013
Senior Member

Hi,

Sounds good. Could you please open a feature request for this? https://bugs.eclipse.org/bugs/enter_bug.cgi?product=ECP

Also contributions are always welcome.

Cheers
Johannes


Johannes Faltermeier

Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
Re: [EMF Forms] Dynamic Auto-Complete on a single details page [message #1795564 is a reply to message #1795504] Tue, 25 September 2018 10:15 Go to previous message
Nikola Veber is currently offline Nikola VeberFriend
Messages: 31
Registered: December 2017
Member
Hi Johannes,

thanks! I have just submitted the feature request: https://bugs.eclipse.org/bugs/show_bug.cgi?id=539423

Will have to check with my management about contributing code, as I developed this during office hours...


Best regards,
Nikola
Previous Topic:Texo bi-directional association.
Next Topic:[EMF Forms] Non-ASCII viewmodel generation
Goto Forum:
  


Current Time: Thu Mar 28 10:07:12 GMT 2024

Powered by FUDForum. Page generated in 0.02965 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top