Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » Classic field style for all fields
Classic field style for all fields [message #1847332] Fri, 22 October 2021 17:20 Go to next message
Seydou Zakou is currently offline Seydou ZakouFriend
Messages: 44
Registered: May 2020
Member
I see that we can set field to be displayed as on scout 6.x style with
setFieldStyle(IFormField.FIELD_STYLE_CLASSIC);
.

Is there a way to define the style for all fields in one place ?

I know that we can style the application with css, but i only want to have the classic look for all my input fields.

Thanks.
Re: Classic field style for all fields [message #1847780 is a reply to message #1847332] Mon, 08 November 2021 08:51 Go to previous messageGo to next message
Andre Wegmueller is currently offline Andre WegmuellerFriend
Messages: 204
Registered: September 2012
Location: Baden-Dättwil, Switzerla...
Senior Member
Hi.

I don't see a framework feature that allows to set the field style globally. However, you could make a custom abstract form like 'AbstractLegacyStyleForm' which extends AbstractForm.

In the AbstractLegacyStyleForm you implement execInitForm(), and then call the #setFieldStyle(String, boolean) method on the rootGroupBox of the form. Which should call the setFieldStyle() method on every field in the form recursively.

All the forms in your project should now inherit from AbstractLegacyStyleForm instead of AbstractForm.

Cheers, André


Eclipse Scout Homepage | Documentation | GitHub
Re: Classic field style for all fields [message #1847785 is a reply to message #1847332] Mon, 08 November 2021 09:34 Go to previous messageGo to next message
Matthias Villiger is currently offline Matthias VilligerFriend
Messages: 232
Registered: September 2011
Senior Member
Hi Seydou

You could try to create an extension for IFormField. Something like:

public class MyExtension extends AbstractFormFieldExtension<IFormField> {

  public MyExtension (IFormField ownerField) {
    super(ownerField);
  }

  @Override
  public void execInitField(FormFieldInitFieldChain chain) {
    super.execInitField(chain);
    getOwner().setFieldStyle(IFormField.FIELD_STYLE_CLASSIC);
  }
}


Then you can register the extension using a platform listener:

public class MyPlatformListener implements IPlatformListener {
  @Override
  public void stateChanged(PlatformEvent event) {
    if (event.getState() == State.PlatformStarted) {
      BEANS.get(IExtensionRegistry.class).register(MyExtension.class);
    }
  }
}


Does this work?

Kind regards
Mat
Re: Classic field style for all fields [message #1847929 is a reply to message #1847785] Fri, 12 November 2021 23:47 Go to previous messageGo to next message
Seydou Zakou is currently offline Seydou ZakouFriend
Messages: 44
Registered: May 2020
Member
Thanks for your responses.

I tried the solution proposed by @Matthias and it worked. But the extension doesn't accept IFormField as bound parameter. I used instead AbstractFormField .

Thanks again.
Re: Classic field style for all fields [message #1847935 is a reply to message #1847929] Sat, 13 November 2021 18:58 Go to previous message
Matthias Villiger is currently offline Matthias VilligerFriend
Messages: 232
Registered: September 2011
Senior Member
Hi Seydou, you are right, It needs to be AbstractFormField.

I'm glad it worked :)
Previous Topic:How to use Extension
Next Topic:NullPointer Exception at ServiceTunnelResponse
Goto Forum:
  


Current Time: Wed May 08 07:15:13 GMT 2024

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

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

Back to the top