Skip to content

Key annotations

These are the annotations that define most of the Mateu DSL.

This page is intentionally selective: it focuses on the annotations that shape routing, UI structure, actions, relationships, behavior, security, and presentation.


Defines a UI root.

@UI("/products")
public class Products {}

Use it when a class should become a page or UI entry point.

  • value() → route or UI path
  • indexHtmlPath() → frontend entry html
  • frontendComponentPath() → renderer entry path

Defines additional routes and supports placeholders.

@Route("/example/:name")
public class ExamplePage {
String name;
}

Use it when:

  • you need path parameters
  • you want more than one route
  • you want nested routing with parentRoute
  • value() → route pattern
  • uis() → UI roots where the route applies
  • parentRoute() → parent route for composition

Adds a field to the application menu.

@Menu
Users users;

Use it to expose pages, modules or links in app navigation.

  • selected() → mark current option as selected

Marks a field or method as a button/action.

@Button
void save() {}

Use it for form-level actions.

Targets:

  • methods
  • fields

Places a field or method in the toolbar.

@Toolbar
void refresh() {}

Use it for top-level actions, typically in headers or listings.


Configures action behavior.

@Action(
validationRequired = true,
confirmationRequired = true
)

Use it when you need more than a bare button.

  • validation
  • confirmation dialogs
  • background execution
  • SSE
  • browser integration (href, js)
  • modal settings
  • selected-row requirement
  • fields to validate

Defines a relationship resolved dynamically by backend suppliers.

@Lookup(
search = PermissionOptionsSupplier.class,
label = PermissionLabelSupplier.class
)
List<String> permissions;

Use it when a field depends on remote or dynamic options.

  • search()LookupOptionsSupplier
  • label()LabelSupplier

Overrides the default inferred rendering type of a field.

@Stereotype(FieldStereotype.radio)
Status status;

Use it when the Java type is not enough to express how the field should be rendered.


Adds inline CSS style to a type, field or parameter.

@Style("max-width:900px;margin:auto;")

Use it for layout constraints and small visual adjustments.


Controls form rendering.

@FormLayout(columns = 1)
public class MixedPage {}

Use it when you want to change the default form layout.

  • columns()
  • theme()
  • style()

Defines dynamic browser-side behavior.

@Rule(
filter = "name == null || name == ''",
action = RuleAction.Set,
fieldName = "save",
fieldAttribute = RuleFieldAttribute.disabled,
value = "true",
expression = "",
actionId = "",
result = RuleResult.Value
)

Use it when the UI must change dynamically without a server round-trip.

  • field attributes
  • values
  • styles
  • css classes
  • actions

Defines when an action runs.

@Trigger(type = TriggerType.OnLoad, actionId = "refresh")

Use it when an action should be triggered automatically.

  • OnLoad
  • OnSuccess
  • OnError
  • OnValueChange
  • OnCustomEvent
  • OnEnter

Restricts access to parts of the UI.

@EyesOnly(roles = "admin")
@Menu
Users users;

Use it for authorization.

  • roles
  • groups
  • scopes
  • permissions

Secures a UI using Keycloak.

@UI("")
@KeycloakSecured(
url = "https://auth-server",
realm = "mateu",
clientId = "demo"
)
public class App {}

Use it for application authentication.

  • url()
  • realm()
  • clientId()
  • jsUrl()

These are also part of the public DSL and are worth knowing:

  • @PageTitle
  • @Title
  • @Subtitle
  • @Logo
  • @FavIcon
  • @Widget
  • @Footer
  • @Header
  • @Section
  • @Colspan
  • @ReadOnly
  • @HiddenInList
  • @HiddenInView
  • @HiddenInEditor
  • @HiddenInCreate
  • @EditableOnlyWhenCreating
  • @Status
  • @Representation
  • @Details
  • @VerticalLayout
  • @HorizontalLayout
  • @SplitLayout
  • @Accordion
  • @Tabs

The Mateu DSL is annotation-heavy by design.

Annotations define:

  • routing
  • structure
  • behavior
  • relationships
  • rendering
  • security

The result is a declarative application model instead of a separate frontend implementation.