@DomainServiceLayout

Layout hints for domain services.

Also indicates the name, and menu ordering UI hints.

API

DomainServiceLayout.java
@interface DomainServiceLayout {
  MenuBar menuBar() default MenuBar.NOT_SPECIFIED;     (1)
  String named() default "";     (2)
}
1 menuBar

The menubar in which the menu that holds this service’s actions should reside.

2 named

Name of this class (overriding the name derived from its name in code).

Members

The menubar in which the menu that holds this service’s actions should reside.

named

Name of this class (overriding the name derived from its name in code).

A typical use case is if the desired name is a reserved Java keyword, such as default or package.

Usage Notes

The menuBar() element is a hint to specify where on the application menu a domain service’s actions should be rendered.

For example:

@DomainService
@DomainServiceLayout(menuBar=MenuBar.PRIMARY)
public class ToDoItems {
    ...
}

In the Web UI (Wicket viewer), domain services placed:

  • on the PRIMARY menu bar appears to the left.

  • on the SECONDARY menu bar appear to the right:

  • on the TERTIARY appear in the menu bar associated with the user’s name (far top-right)

The grouping of multiple domain services actions within a single drop-down is managed by the @Order annotation.

The RestfulObjects viewer does not support this attribute.

Alternatives

Alternatively, use menubars.layout.xml layout file to organize menu action items arbitrarily.

Names

The named() element explicitly specifies the domain service’s name, overriding the name that would normally be inferred from the Java source code.

For example:

@DomainService
@DomainServiceLayout(
    named="Customers"
)
public class CustomerRepository {
   ...
}