Screen Controller Legacy version to platform version 7+

Hi
I am migrating some existing screens to v7 that was originally built in version 6x where I have some questions related to screens:

What is the equivalent Event in screen controller in 6 and 7? for example:

  1. ready:
  2. preCommit:
  3. postValidate:
  4. initNewItem:

Thanks for your help.

Hi!

  1. Equivalent for ready is com.haulmont.cuba.gui.screen.Screen.AfterShowEvent event.
  2. com.haulmont.cuba.gui.screen.StandardEditor.BeforeCommitChangesEvent.
  3. Override com.haulmont.cuba.gui.screen.StandardEditor#validateAdditionalRules method.
  4. com.haulmont.cuba.gui.screen.StandardEditor.InitEntityEvent.

You can see all available events to subscribe on with Generate(Alt+Insert on Windows/
⌘+N or ^+Enter on Mac) -> Subscribe to Event action in code editor.

1 Like

Thank you Alexander. For the # 3 above, can you please share a code snippet or link where I can get more details?

Was

@Override
protected void postValidate(ValidationErrors errors) {
    errors.add("Some error");
}

Became

@Override
public void validateAdditionalRules(ValidationErrors errors) {
    errors.add("Some error");
}

Thank you Alexander