lievendoclo / Valkyrie-RCP

A fork from http://www.gitorious.org/valkyrie-rcp
Apache License 2.0
23 stars 10 forks source link

NPE when trying to show page #16

Closed alltomsport closed 10 years ago

alltomsport commented 10 years ago

Hi! I get a NPE for getPage().getId().equals() in AbstractApplicationWindow, the "id" is not set and I can't understand how to do it. Here is the config:

@Bean public PageDescriptor triggerViewPage() { VLDockingPageDescriptor pageDescriptor = new VLDockingPageDescriptor(); pageDescriptor.setViewDescriptors(Arrays.asList(new String[]{"triggerView"})); pageDescriptor.setId("testPage1"); return pageDescriptor; } @Bean public ViewDescriptor triggerView() { VLDockingViewDescriptor view = new VLDockingViewDescriptor("triggerView", TriggerView.class); return view;
}


pageDescriptor.setId("testPage1") doesn't seem to have any effect, would be helpful with a example with pages in "VLDockingSampleApplicationConfig".

AbstractApplicationWindow: .. .. @Override public void showPage(String pageId) { if (pageId == null) throw new IllegalArgumentException("pageId == null");

    if (getPage() == null || !getPage().getId().equals(pageId)) {
        showPage(createPage(this, pageId));
    } else {
        // asking for the same page, so ignore
    }
}
alltomsport commented 10 years ago

I use: getApplicationWindow().showPage("someOtherPage") to change page.

cmadsen commented 10 years ago

Did you do:

    @Override
    @Bean
    public ApplicationPageFactory applicationPageFactory() {
        return new VLDockingApplicationPageFactory();
    }

And try using the ShowPageCommand.java to switch page.

alltomsport commented 10 years ago

No, I had missed that annotations, but it doesn't help when I add them.

alltomsport commented 10 years ago

Using ShowPageCommand doesn't help either, since it uses the same code, notice that it is the current page that doesnät have a id, but the page to show has an id.

alltomsport commented 10 years ago

Solved by using @Bean(name="beanName") instead of just @Bean