1. Domino Brix
  2. Slots

Assigning slots

Slots are named attachment points where presenters reveal their views. Declare a slot key on the presenter with @BrixSlot. Built-in slots like BrixSlots.BRIX_BODY_SLOT are registered automatically.

			@BrixPresenter
public class AdminPresenter extends Presenter<AdminView> {
  @Override
  public Set<String> getRoles() {
    return Set.of("admin");
  }

  @Override
  public Authorizer getAuthorizer() {
    return RolesAllowedAuthorizer.INSTANCE;
  }
}

		

Registering slots

Register custom slots before navigation or during presenter activation. Slots added inside a presenter should use registerSlot(...) so they clean up on deactivation.

			SecurityContext sc = (SecurityContext) Brix.get().getCoreComponent().core().getSecurityContext();
sc.setUser(new MyUser());
sc.setUnauthorizedAccessHandler(() -> window.alert("Access denied"));

		

Slots supplied by the view

Annotate the presenter with @RegisterSlots to force the view to supply slot instances. The processor emits a *Slots interface; implement it in the view and return slot instances for each key.

			public class DepartmentAuthorizer implements Authorizer {
  @Override
  public boolean isAuthorized(IsSecurityContext context, HasRoles hasRoles) {
    return context.isAuthenticated()
        && context.getUser().getAttributes().get("department").ifTypeIs(String.class, dept -> {
             return dept.equals("engineering");
           });
  }
}

		

Custom slot implementations

Implement Slot (or extend helpers like AcceptOneElementSlot) to control how content attaches. Slots registered globally live until removed; slots registered through registerSlot are automatically unregistered on deactivation.

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

Donate & Support Us