Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » SmartField autoselection if only one choice is available
SmartField autoselection if only one choice is available [message #1083115] Fri, 09 August 2013 13:49 Go to next message
daniele fochetti is currently offline daniele fochettiFriend
Messages: 22
Registered: August 2013
Junior Member
Hi all

In my application the lookup data for the same smartfield might contain one to multiple entries.
In the current application version I allways have to select the desired value from the dropdown list, no matter if there is only one entry or many.
In case of only one entry, I want the value beeing selected/shown automatically when I enter the empty smartfield.

Is there a way to implement such a behavior by using standard scout functionality?

Best regards
Daniele
Re: SmartField autoselection if only one choice is available [message #1084966 is a reply to message #1083115] Mon, 12 August 2013 09:14 Go to previous messageGo to next message
daniele fochetti is currently offline daniele fochettiFriend
Messages: 22
Registered: August 2013
Junior Member
Found so far AbstractSmartField.setUniquelyDefinedValue(boolean background) which seems to suit my needs. Still the question is, how can this method be invoked while entering the SmartField. Do I have to write my own 'extended' SwtScoutSmartField to override 'handleSwtFocusGained()'?

By the way, AbstractSmartField provides a method 'addSmartFieldListener(SmartFieldListener listener)' and it also containes the private method fireSmartFieldEvent(SmartFieldEvent e) which is iterating over all registered SmartFieldListeners. Unfortunately the fireSmartFiledEvent method is never called in the class. Is this a bug or do I miss something?

Best regards
Daniele
Re: SmartField autoselection if only one choice is available [message #1084984 is a reply to message #1084966] Mon, 12 August 2013 09:37 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1252
Registered: October 2011
Senior Member
daniele fochetti wrote on Fri, 09 August 2013 15:49
In my application the lookup data for the same smartfield might contain one to multiple entries.
In the current application version I allways have to select the desired value from the dropdown list, no matter if there is only one entry or many.
In case of only one entry, I want the value beeing selected/shown automatically when I enter the empty smartfield.

Is there a way to implement such a behavior by using standard scout functionality?


Thanks for your interest in Scout.

I am afraid there is no standard functionality that is doing exactly what you describe out of the box. I hope we can manage to find something you can work with.

daniele fochetti wrote on Mon, 12 August 2013 11:14
Found so far AbstractSmartField.setUniquelyDefinedValue(boolean background) which seems to suit my needs.


Nice catch, I was'nt aware of this method.

ISmartField.setUniquelyDefinedValue(boolean) is in the model, you can call it from your form, when the value of another field changes.

daniele fochetti wrote on Mon, 12 August 2013 11:14

Still the question is, how can this method be invoked while entering the SmartField. Do I have to write my own 'extended' SwtScoutSmartField to override 'handleSwtFocusGained()'?


I think that the biggest problem is that the model doesn't know when the user enters a field.

SwtScoutSmartField is the rendering code that renders the model (SmartField class extending ISmartField). I do not know patterns where we call model methods from the UI rendering code.
Re: SmartField autoselection if only one choice is available [message #1085180 is a reply to message #1084984] Mon, 12 August 2013 15:08 Go to previous messageGo to next message
daniele fochetti is currently offline daniele fochettiFriend
Messages: 22
Registered: August 2013
Junior Member
Hi Jeremie

Thx for your explanations. I now have implemented a solution with setUniquelyDefinedValue(boolean background), depending on 'execChangedMasterValue(Object newMasterValue)'. It works but to the user it seems like a lot of magic, because up to six fields are filled automatically. The better solution in respect to the useres expectations would be the tabbing from field to field in conjunction with the 'autofill'.

Quote:
I do not know patterns where we call model methods from the UI rendering code.


Have a look at SwtScoutStringField.handleSwtDragRequest(). I guess this is propageted to the AbstractStringField.execDragRequest().

I would appreciate a similar mechanism for SwtScoutSmartField.handleSwtFocusGained() beeing propagated to a method like AbstractSmartField.execFocusGained().
Re: SmartField autoselection if only one choice is available [message #1085250 is a reply to message #1085180] Mon, 12 August 2013 16:55 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1252
Registered: October 2011
Senior Member
I understand your need. It make sense, but it isn't an easy API-change. Thanks for sharing it here.

Could you open a change request?
Re: SmartField autoselection if only one choice is available [message #1085683 is a reply to message #1085250] Tue, 13 August 2013 08:11 Go to previous messageGo to next message
Judith Gull is currently offline Judith GullFriend
Messages: 75
Registered: February 2010
Member
Hi Daniele

There is a change request for the focus lost event: https://bugs.eclipse.org/bugs/show_bug.cgi?id=411023. I "focus gained" is also needed, it would be good to do this two things together. So, if you need a change request, please at least link the tickets.

I think the most common way and the most user friendly way to fulfill this requirement is to update the field as soon as it is known that there is only one value available and not after a user enters the field.
Re: SmartField autoselection if only one choice is available [message #1086620 is a reply to message #1085683] Wed, 14 August 2013 12:46 Go to previous message
daniele fochetti is currently offline daniele fochettiFriend
Messages: 22
Registered: August 2013
Junior Member
Hi Judith, Jeremie

Thx for your support. I opened the enhancement bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=415056.

Cheers.
Daniele
Previous Topic:Html field in standard outline (tree)
Next Topic:OpenShift Tomcat Configuration
Goto Forum:
  


Current Time: Thu Apr 25 16:00:12 GMT 2024

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

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

Back to the top