1. Domino Brix
  2. Views & handlers

Define the view contract

Presenters depend on a view interface. Extend View for simple attachable elements or Viewable when you expose a DominoElement.

			public interface DashboardView extends View, DashboardUiHandlers.HasUiHandlers {
  void showMessage(String text);
  void showUser(String userId);
}

		

Implement with @UiView

Annotate the implementation with @UiView. The processor generates the binding and Dagger module to inject the view into presenters.

			@UiView
public class DashboardViewImpl extends BrixView<Element, DashboardUiHandlers>
    implements DashboardView {

  @Handlers DashboardUiHandlers handlers;

  @Inject
  DashboardViewImpl() { setText("Loading..."); }

  @Override public void showMessage(String text) { setText(text); }
  @Override public void showUser(String userId) { handlers.onRefreshUser(userId); }
}

		

UI handlers: view → presenter

Define UI handler interfaces and mark presenter methods with @UiHandler. The generated handler bridges view events to the presenter.

			public interface DashboardUiHandlers extends UiHandlers {
  void onRefresh();
  void onRefreshUser(String userId);
  interface HasUiHandlers { void setUiHandlers(DashboardUiHandlers handlers); }
}

@BrixPresenter
public class DashboardPresenter extends Presenter<DashboardView>
    implements DashboardUiHandlers {

  @UiHandler public void onRefresh() { /* presenter logic */ }
  @UiHandler public void onRefreshUser(String userId) { /* presenter logic */ }
}

		

Slot-aware views

When a presenter uses @RegisterSlots, the processor generates a *Slots interface. Make your view implement it to supply slot instances so the presenter can register them during activation.

Use BrixView or your own View/Viewable implementations. Attach/detach callbacks from IsAttachable allow presenters to react to DOM lifecycle, and implementing CanConfirmNavigation lets the view block navigation while dirty.

We are a group of passionate people who love what we do

Donate & Support Us