Package su.onno.ui

Class RelatedListBuilder<E,J>

java.lang.Object
su.onno.ui.RelatedListBuilder<E,J>

public class RelatedListBuilder<E,J> extends Object
Builds one RelatedList panel for a catalog editor. Obtained from EntityConfigBuilder.relatedList(String, Class) inside an EntityView.fields(su.onno.ui.EntityConfigBuilder<E>) lambda.

Chain via(String) / display(String) / columns(String...); call relatedList(String, Class) to add another panel or field(String) to switch back to per-field hints on the same entity.

  • Method Details

    • via

      public RelatedListBuilder<E,J> via(String field)
      The Ref field on the junction that scopes rows to the record being edited — the back-reference to this catalog. Required.
    • via

      public RelatedListBuilder<E,J> via(Field<J,Ref<E>> field)
      Compiler-checked back-reference to the entity owning this related list.
    • display

      public RelatedListBuilder<E,J> display(String field)
      The Ref field on the junction shown (and picked) per row — the "other side" of the relationship. Resolved to its description for display and used as the add-row picker's target catalog. Required.
    • display

      public <T> RelatedListBuilder<E,J> display(Field<J,Ref<T>> field)
      Compiler-checked reference shown as the related row's primary value.
    • columns

      public RelatedListBuilder<E,J> columns(String... fields)
      Extra join-row fields to render as columns (e.g. a role or sortOrder attribute on the junction). When unset, the panel shows just the display ref. The display ref is always rendered as the row's primary (name) column whether or not it appears here, so an explicit list adds columns on top of the name rather than replacing it; listing the display field is fine and is not duplicated. A field name that matches no attribute on the junction (a typo, or a field on a different entity) is dropped with a WARN at metadata resolution.
    • columns

      @SafeVarargs public final RelatedListBuilder<E,J> columns(Field<J,?>... fields)
      Compiler-checked join-row columns.
    • label

      public RelatedListBuilder<E,J> label(String label)
      Heading for the panel; blank derives one from the panel name.
    • hideInDetail

      public RelatedListBuilder<E,J> hideInDetail()
      Hide this panel in the read/detail view, keeping it only in the edit form. By default a related list renders read-only in the detail view (so the roster is visible without entering edit mode) and editable in the form; call this to opt a panel out of the detail render.
    • relatedList

      public <K> RelatedListBuilder<E,K> relatedList(String name, Class<K> junction)
      Add another related-list panel on the same entity.
    • field

      public FieldHintBuilder<E,Object> field(String name)
      Switch back to configuring a plain field on the same entity.
    • field

      public <V> FieldHintBuilder<E,Object> field(Field<E,V> field)
      Switch back to a compiler-checked field on the owning entity.