SystemMessages mechanism is broken

Hi!

We tried to upgrade to 5.2.0, but noticed that Application class method setSessionExpiredURL has been removed. I researched this further and noticed that it has been replaced by a concept called SystemMessages. Application class instructs me to override the static method getSystemMessages, but this cannot be done! So there’s a design problem here.

So, I guess we cannot upgrade. :frowning: Any plans on fixing this?


Here’s the ticket

Cheers,

Kaitsu

Thanks for the report. After some evaluation I would say that the design is correct, but the implementation did not handle application runner special case correctly. Fixed the issue and closed ticket.

Here is an example on how to use the API:

package com.itmill.toolkit.tests.tickets;

import com.itmill.toolkit.Application;
import com.itmill.toolkit.ui.Button;
import com.itmill.toolkit.ui.Window;

public class Ticket1673 extends com.itmill.toolkit.Application {

    public void init() {

        final Window main = new Window("#1673");
        setMainWindow(main);

        main.addComponent(new Button("close", this, "close"));

    }

    public static Application.SystemMessages getSystemMessages() {
        Application.CustomizedSystemMessages msgs = new Application.CustomizedSystemMessages();

        msgs.setSessionExpiredURL("http://www.itmill.com/");
        msgs.setSessionExpiredCaption("Foo");
        msgs.setSessionExpiredMessage("Bar");

        return msgs;
    }
}

The 5.2.1 scheduled for monday should contain this fix.

Great, thanks a lot! :smiley:

Hi!

I just noticed that the implementation was actually working with 5.2.0, so I jumped to conclusions before sending the ticket :slight_smile:

Question: How do I make it work like it did before, i.e. when session expires I want to take the user directly to login screen and not show any system message? This was possible with the old implementation, but now I don’t see any way to get around the message box :frowning:

Cheers,

Kai

Setting the caption and messge to null should do the trick, if I remember correctly.


msgs.setSessionExpiredCaption(null);
msgs.setSessionExpiredMessage(null);

Best Regards,
Marc

:smiley: That did the trick! But it was not very obvious. Maybe there should be a method like
showNotification(boolean)
in the CustomizedSystemMessages to make it more understandable?

Cheers,

Kaitsu

At least we should add proper documentation…
http://dev.itmill.com/ticket/1768

No worries - I managed to find a special case where it was broken :) (now fixed in 5.2.1)

Added javadoc and implemented methods for disabling notifications (good suggestion, it’s much easier to figure out when it’s explicit).


http://dev.itmill.com/changeset/4746

Best Regards,
Marc