|
Re: Custom Field with additional state [message #1840889 is a reply to message #1840832] |
Wed, 28 April 2021 08:41 |
|
Hi Nils
> I would like to display the state as an additional icon inside of the input field (like the eye-icon in password fields)
In order to place an icon inside a field, you need to write a custom JavaScript widget (take a look at the SmartField.js for instance). This cannot be done with Java only.
As for your Java-only options: I would solve that with an AbstractSequenceBox that is a composite of an AbstractStringField and an AbstractBooleanField (aka checkbox). You could style the checkbox differently in the UI by using a @ModelVariant. The sequence box handles all the state logic, like setting the string field to read only when the calculated flag is set. It register property change listeners to update the two fields when something on the model changes.
Instead of the BooleanField you could also simply add a property "private boolean m_calculated" to your AbstractSequenceBox and use an AbstractImageField to display two different icons depending on the calculated state.
In Scout this concept is called "Template Fields". You find additional infos on that subject here:
https://eclipsescout.github.io/11.0/one-day-tutorial.html#sec-contacts_form_templatefields
Cheers
André
Eclipse Scout Homepage | Documentation | GitHub
|
|
|
|
|
Re: Custom Field with additional state [message #1840994 is a reply to message #1840974] |
Fri, 30 April 2021 05:15 |
|
Hi Nils
Your new field looks great, good job! :) You're right: the @ModelVariant is indeed only needed when you need to change the behavior of an existing JS widget or need to make changes to DOM of the widget. For that you must write JavaScript. For a lot of cases setting a CSS class and do some styling with pure CSS/LESS is sufficient.
Cheers
André
Eclipse Scout Homepage | Documentation | GitHub
|
|
|
Powered by
FUDForum. Page generated in 0.03312 seconds