Class MultiDomainEditLayout

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.orderedlayout.VerticalLayout
com.ocs.dynamo.ui.component.DefaultVerticalLayout
com.ocs.dynamo.ui.composite.layout.BaseCustomComponent
com.ocs.dynamo.functional.ui.MultiDomainEditLayout
All Implemented Interfaces:
com.ocs.dynamo.ui.Buildable, com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.ClickNotifier<com.vaadin.flow.component.orderedlayout.VerticalLayout>, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.HasComponents, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasEnabled, com.vaadin.flow.component.HasOrderedComponents, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.orderedlayout.FlexComponent, com.vaadin.flow.component.orderedlayout.ThemableLayout, Serializable

public class MultiDomainEditLayout extends com.ocs.dynamo.ui.composite.layout.BaseCustomComponent
A layout that allows the user to easily manage multiple domains. The list of domain classes can be passed to the constructor. Please note that for every domain class, you must define a (default) service
Author:
bas.rutten
See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from interface com.vaadin.flow.component.orderedlayout.FlexComponent

    com.vaadin.flow.component.orderedlayout.FlexComponent.Alignment, com.vaadin.flow.component.orderedlayout.FlexComponent.JustifyContentMode
  • Constructor Summary

    Constructors
    Constructor
    Description
    MultiDomainEditLayout(com.ocs.dynamo.ui.composite.layout.FormOptions formOptions, List<Class<? extends Domain>> domainClasses)
    Constructor
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addCustomField(String path, Class<? extends Domain> clazz, Function<com.ocs.dynamo.ui.component.CustomFieldContext,com.vaadin.flow.component.Component> function)
    Adds a custom field for a certain attribute
    void
    addEntityModelOverride(Class<?> clazz, String reference)
    Adds an entity model override
    final void
    addFieldEntityModel(String path, String reference)
    Adds a entity model for a field
    void
    addFieldFilter(String property, com.vaadin.flow.function.SerializablePredicate<?> filter)
    Adds a filter for a field
    void
     
    boolean
     
     
    protected void
    onAttach(com.vaadin.flow.component.AttachEvent attachEvent)
     
    final void
    registerComponent(com.vaadin.flow.component.Component comp)
    Registers a component.
    final void
    Reloads the screen
    final void
    selectDomain(Class<? extends Domain> clazz)
    Constructs a layout for editing a certain domain

    Methods inherited from class com.ocs.dynamo.ui.composite.layout.BaseCustomComponent

    constructLabel, getEntityModelFactory, getMessageService, getService, handleSaveException, message, message, navigate, navigate, showErrorNotification, showNotifification, showSuccessNotification, showTrayNotification

    Methods inherited from class com.vaadin.flow.component.orderedlayout.VerticalLayout

    addAndExpand, getAlignItems, getAlignSelf, getDefaultHorizontalComponentAlignment, getHorizontalComponentAlignment, setAlignItems, setAlignSelf, setDefaultHorizontalComponentAlignment, setHorizontalComponentAlignment, setPadding, setSpacing

    Methods inherited from class com.vaadin.flow.component.Component

    addListener, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisible

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.vaadin.flow.component.AttachNotifier

    addAttachListener

    Methods inherited from interface com.vaadin.flow.component.ClickNotifier

    addClickListener, addClickShortcut

    Methods inherited from interface com.vaadin.flow.component.DetachNotifier

    addDetachListener

    Methods inherited from interface com.vaadin.flow.component.orderedlayout.FlexComponent

    expand, getFlexGrow, getFlexShrink, getJustifyContentMode, replace, setFlexGrow, setFlexShrink, setJustifyContentMode

    Methods inherited from interface com.vaadin.flow.component.HasComponents

    add, add, add, addComponentAsFirst, addComponentAtIndex, remove, remove, removeAll

    Methods inherited from interface com.vaadin.flow.component.HasElement

    getElement

    Methods inherited from interface com.vaadin.flow.component.HasEnabled

    isEnabled, setEnabled

    Methods inherited from interface com.vaadin.flow.component.HasOrderedComponents

    getChildren, getComponentAt, getComponentCount, indexOf

    Methods inherited from interface com.vaadin.flow.component.HasSize

    getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFull

    Methods inherited from interface com.vaadin.flow.component.HasStyle

    addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName

    Methods inherited from interface com.vaadin.flow.component.orderedlayout.ThemableLayout

    getBoxSizing, getThemeList, isMargin, isPadding, isSpacing, setBoxSizing, setMargin
  • Constructor Details

    • MultiDomainEditLayout

      public MultiDomainEditLayout(com.ocs.dynamo.ui.composite.layout.FormOptions formOptions, List<Class<? extends Domain>> domainClasses)
      Constructor
      Parameters:
      formOptions - the form options
      domainClasses - the classes of the domains
  • Method Details

    • addCustomField

      public void addCustomField(String path, Class<? extends Domain> clazz, Function<com.ocs.dynamo.ui.component.CustomFieldContext,com.vaadin.flow.component.Component> function)
      Adds a custom field for a certain attribute
      Parameters:
      path - the path to the attribute
      function - the function used to construct the custom component
    • addEntityModelOverride

      public void addEntityModelOverride(Class<?> clazz, String reference)
      Adds an entity model override
      Parameters:
      clazz - the entity class
      reference - the reference to use for the overridden model
    • build

      public void build()
    • checkDeleteAllowed

      public boolean checkDeleteAllowed(Class<?> clazz)
    • getSelectedItem

      public Domain getSelectedItem()
      Returns:
      the currently selected item
    • onAttach

      protected void onAttach(com.vaadin.flow.component.AttachEvent attachEvent)
      Overrides:
      onAttach in class com.vaadin.flow.component.Component
    • registerComponent

      public final void registerComponent(com.vaadin.flow.component.Component comp)
      Registers a component. The component will be disabled or enabled depending on whether an item is selected
      Parameters:
      comp - the component to register
    • reload

      public final void reload()
      Reloads the screen
    • selectDomain

      public final void selectDomain(Class<? extends Domain> clazz)
      Constructs a layout for editing a certain domain
      Parameters:
      clazz - the domain class
    • addFieldEntityModel

      public final void addFieldEntityModel(String path, String reference)
      Adds a entity model for a field
      Parameters:
      path - field
      reference - entity model
    • addFieldFilter

      public void addFieldFilter(String property, com.vaadin.flow.function.SerializablePredicate<?> filter)
      Adds a filter for a field
      Parameters:
      property - field
      filter - filter