StackOverflowError

Hi,

I have to revolve the next issue:
In an Edit screen when I change a field attribute I need to change automatically another attribute.

see below:


    @Subscribe
    public void onInit(InitEvent event) {
        transactionDc.addItemPropertyChangeListener((e -> checkQuote()));

    }
public void checkQuote() {
        if (transactionDc.getItem().getQuAmount() != null) {
            transactionDc.getItem().setStatus(TrStatusEnum.EVAL);
        }

Unfortunately I have stackoverflow when I try to modify the QuAmount value.
What is the right approach?

BR,
-n

transactionDc.addItemPropertyChangeListener(e -> {
    if (e.getProperty().equals("quAmount")) {
        checkQuote()
    }
});

This way you won’t trigger the event again, when you change the “status” programmatically.

1 Like

I manage to get rid of stackoverflow but the problem is when I save (ok button in edit), the modification doesn’t appear in Browser. I have to open again the Editor in order to persist the changes.

 @Subscribe
    public void onInit(InitEvent event) {
        transactionDc.addItemPropertyChangeListener((e ->{

            if(  e.getItem().getQuAmount()!=null)
            {
                transactionDc.getItem().setStatus(TrStatusEnum.EVAL);
            }
            if(  e.getItem().getProfAmount()!=null)
            {
                transactionDc.getItem().setStatus(TrStatusEnum.ORDERED);
            }

        }));


Try:

        getScreenData().getDataContext().commit();
        getScreenData().loadAll();

The key is to treat every combination, otherwise you’ll get stackoverflow…
Now it works.

 getScreenData().getDataContext().commit();
 getScreenData().loadAll();

is not necesarry.
Thank you!!