Skip to main content



      Home
Home » Eclipse Projects » Eclipse Scout » Classic field style for all fields
Classic field style for all fields [message #1847332] Fri, 22 October 2021 13:20 Go to next message
Eclipse UserFriend
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 03:51 Go to previous messageGo to next message
Eclipse UserFriend
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é
Re: Classic field style for all fields [message #1847785 is a reply to message #1847332] Mon, 08 November 2021 04:34 Go to previous messageGo to next message
Eclipse UserFriend
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 18:47 Go to previous messageGo to next message
Eclipse UserFriend
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 13:58 Go to previous message
Eclipse UserFriend
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: Sun Jun 22 02:51:18 EDT 2025

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

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

Back to the top