Navigation

Navigation in Arena is very simple: you instantiate a Panel and then you open it. Panel can be a subclass of Window or Dialog.

Suppose you are in a Search Window with a "New" button. What should this button do?

// Xtend
new CreateCustomerDialog(this).open

// Java
new CreateCustomerDialog(this).open();

Navigation back

Dialogs offer a way to define behavior once they are closed. This can be done before they are opened:

// Xtend
val dialog = new SomeKindOfDialog(this, modelObjectForSomeKindOfDialog)
dialog.onAccept [ | modelObject.search ]   
dialog.open

// Java
SomeKindOfDialog dialog = new SomeKindOfDialog(this, modelObjectForSomeKindOfDialog);
dialog.onAccept(getModelObject()::search);
dialog.open();

In the above example we instantiate the dialog, and before we open it we define that as soon as the dialog is closed we should trigger a search the model object in the parent view.

Passing data to another view

As windows are objects, we can use two well known mechanisms to pass data between two views:

  • sending objects in the constructor
  • assigning a reference in a setter method
public void editCustomer() {
   this.openDialog(new EditCustomerWindow(this, this.getModelObject().getCustomerSelected()));
}