Hi, I am trying to implement auto-refresh feature following the guide (
https://isis.apache.org/guides/ugvw/ugvw.html#_ugvw_customisation_auto-refresh
) and have an issue there.

I have implemented my own HomePage view model, this has an getXxx method
representing an field showing in the home page.

@DomainObject(nature = Nature.VIEW_MODEL, editing = Editing.DISABLED,
objectType = "StandardHomePage")
public class StandardHomePage  {

public StandardHomePage() {
}

public String cssClass() {
    return "my-special-auto-updating-entity";
}

...

@PropertyLayout(named = "Hupe Status")
@MemberOrder(name = Layout.LAYOUT_HORN, sequence = "4.1")
public String getCurrentHornState() {
    TitleBuffer titleBuffer = new TitleBuffer();
    final SignalHorn horn = deviceRepository.getSignalHorn();
    if (horn == null)
        return "Hupe nicht vorhanden";
    return horn.title();
}

...

}

I create home page thru domain service


@DomainService(nature = NatureOfService.VIEW_CONTRIBUTIONS_ONLY)
public class HomePageService {

    //region > homePage (action)
    @Action(semantics = SemanticsOf.SAFE)
    @HomePage
    public BgwHomePage homePage() {
       return new StandardHomePage();
    }

And my application.js looks

$(function() {
    if ($(".my-special-auto-updating-entity").length) {
        setTimeout(function() {document.location.reload(true);},
15000); // 1000 is 1 sec, 30 sec
    }
});


In debugger I observe that StandardHomePage constructor and getXxx
method is called differently:

1. after login browser goes to e.g.
http://localhost:9090/wicket/entity?2  and auto-reload after e.g. 15
seconds calls only constructor but not the getXxx method
3. after clicking on upper-left hand side icon representing the home
page I get the again the url e.g..
(http://localhost:9090/wicket/entity?32) and the auto refresh calls
only the constructor
4. after clicking on home page title - browser URL shows reference to
that view model  (something like
http://localhost:9090/wicket/entity/*StandardHomePage:PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPG1lbWVudG8vPg==)
and constructor and getXxx method are called, and after that the auto
refresh behaviour is fine.

My problem are case #1 and #2  where method getXxx is not called - I
guess the view model is being deserialized for memento.

How can I fix this and prevent usage of serialized view model
representing the home page?

I am working with Isis version 1.14.x

Thanks,Vladimir

Reply via email to