0

I want to implement menu in GWT as shown on this website:

http://www.openkm.com/en/

I have created the menu system and I am able to display alerts from menu using following code:

Command cmd = new Command() {
  public void execute() {
    Window.alert("Menu item have been selected");
  }
}

I want to get rid of window.alert() and display my application pages from menu.

dting
  • 38,604
  • 10
  • 95
  • 114

3 Answers3

0

First create an array list of views

public List<UIObject> viewsList = new ArrayList<UIObject>();

Add a view to that list

 viewsList.add(addMovieView);

Send the view you want to select to the helper method

public void changeView(UIObject selectedView) {
  for(UIObject view : viewsList) {
    if(selectedView.equals(view)) {
      view.setVisible(true);
    } else {
      view.setVisible(false);
    }
  }
}
dting
  • 38,604
  • 10
  • 95
  • 114
zawhtut
  • 8,335
  • 5
  • 52
  • 76
0

Create and load the appropriate page. For example if you use UiBinder then:

MyPage selectedPage = new MyPage(); // creating of your panel
RootPanel.get().clear(); // cleaning of rhe RootPanel    
RootPanel.get().add(selectedPage); // adding the panel to the RootPanel
kapandron
  • 3,546
  • 2
  • 25
  • 38
0

Are you trying to make the entire page GWT, or just the menu? If it's just the menu, you will need to embed a GWT element into your overall HTML, then call something like

Window.open(linkURL, "_self", "");

from the appropriate menu items, which will navigate to another page.

Marconius
  • 683
  • 1
  • 5
  • 13