Navigation "Design Pattern"

Hi,

I am implementing a new project and I would like to know the best way to handle navigation.

The requirements for the website is:

  1. Login Page
  2. MainPage with a menu, a “content area” and footer
  3. Some “content area” need to refresh automatically using “setPollInterval”
  4. Some “content area” may redirect to another “content area”
  5. Data need to be passed around all pages
  6. User cannot reach MainPage without log in

You can see an prototype here : https://www.dropbox.com/s/7vffgko3szqjjrq/forumquestion.png

The implementation I am currently using is based on book of vaadin, that is:

  1. a Navigator with two views: Login and MainView
  2. Login page redirect to MainView
  3. MainView has a Menubar. Each command in the menu sets the “content area” accordingly
  4. The “content area” is a VerticalLayout
  5. The data would be passed around using VaadinSession (not tested yet)

The problem with this implementation is the polling. I cannot set polling interval of a “content area” of type VerticalLayout, since “setPollInterval” only works with UI

My questions are:

  1. How can I automatically set the polling for the content area
  2. Is my “Design Pattern” correct? Is there a better implementation?

Maybe I have found the solution:

Pass the reference of the MyWebSiteUI (extends UI) to every “content area”.
And then:

[code]
public class ContentArea extends VerticalLayout implements View {

public ContentArea(UI MyWebSiteUI) {
label = new Label(“Hello World”);

    addComponent(label);

    appUI.setPollInterval(3000);

    appUI.addPollListener(new UIEvents.PollListener(){


}
[/code]Is this the best solution?

I didn’t read everything but you can get a reference to the current UI instance without having to pass it to every class in which you want to use it by:

UI.getCurrent()