Opening Views

  1. Create a new view, e.g. CustomerView   and add a few UI components.
  2. Add a button in MainView and register a buttonClickHandler event.
  3. In the code view, move the cursor under the generated Button.ClickEvent Handler. 
  4. Under Palette click Navigation.
  5. In the following Navigation wizard, under View to open, select Customer View out.
  6. In the URL field, enter a sub path (URI) through which the view is to be accessible at runtime, e.g. customer.
Result:
private void button_buttonClick(Button.ClickEvent event) {
	Navigation.to("customer").navigate();
}
Note:
  • If the view that is to be called is not yet registered in the Navigator, it will be automatically registered by the wizard. 
  • Only views that are registered in the Navigator can be invoked using the Navaigation.to() method. 
  • The Navigation wizard works bidirectionally. By clicking the  icon in the code editor, you can reopen the Navigator wizard.

Passing parameters

  1. In the Navigation wizard, click Add to add the parameter you want to pass to the view that is to be invoked.
  2. Under Parameters > Value, enter the parameter you want to pass; e.g., the username string, and press Enter.
  3. Under Name, specify how you want to call the parameter that is passed to the view, e.g. username.
  4. Click OK.
  5. Click Save.
Result:
  • In the current view

    private void button_buttonClick(Button.ClickEvent event) {
    	Navigation.to("customer").parameter("username", username).navigate();
    		 
    	}
  • In the invoked view - When the parameters that are to be passed are saved, they are automatically defined in the target class.

    @NavigationParameter
    	private String username;
    /**
     * 
     */
    public CustomerView() {
    	super();
    	this.initUI();
    }
    
    @Override
    public void enter(ViewChangeListener.ViewChangeEvent event) {
    	super.enter(event);
    
    	this.username = Navigation.getParameter(event, "username", String.class);
    }
Note:
  • Any variables, method calls, and objects; e.g., UI components, can be used as parameters..
  • The parameters are passed via the session array.
  • Strings must be enclosed in quotes.
  • The arguments that are deleted later in the Navigation wizard are not automatically deleted in the invoked view.


XDEV Software Corp. - One Embarcadero Center, San Francisco, CA 94111, US
Copyright © 2015. XDEV Software Corp. All rights reserved.