Class DraftCardFragment

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.Composite<com.vaadin.flow.component.orderedlayout.HorizontalLayout>
io.jmix.flowui.fragment.Fragment<com.vaadin.flow.component.orderedlayout.HorizontalLayout>
io.jmix.flowui.fragmentrenderer.FragmentRenderer<com.vaadin.flow.component.orderedlayout.HorizontalLayout,DraftInfo>
io.jmix.uirecoveryflowui.view.draft.DraftCardFragment
All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasStyle, FacetOwner, FragmentOwner, Serializable

public class DraftCardFragment extends FragmentRenderer<com.vaadin.flow.component.orderedlayout.HorizontalLayout,DraftInfo>
Renders one card of the drafts list view: the view title, the drafted record and the save date, with a discard button that asks for confirmation before deleting the draft.

The card body is an Anchor pointing at the view the draft belongs to, so opening in a new browser tab, copying the address and keyboard activation work. It carries Vaadin's router-link attribute, so a plain click navigates inside the application instead of reloading the page. When the draft has no address the body stays plain text.

See Also:
  • Field Details

    • bodyAnchor

      @ViewComponent protected com.vaadin.flow.component.html.Anchor bodyAnchor
    • titleSpan

      @ViewComponent protected com.vaadin.flow.component.html.Span titleSpan
    • recordSpan

      @ViewComponent protected com.vaadin.flow.component.html.Span recordSpan
    • dateSpan

      @ViewComponent protected com.vaadin.flow.component.html.Span dateSpan
    • messageBundle

      @ViewComponent protected MessageBundle messageBundle
    • dialogs

      @Autowired protected Dialogs dialogs
  • Constructor Details

    • DraftCardFragment

      public DraftCardFragment()
  • Method Details

    • onDiscardButtonClick

      @Subscribe("discardButton") public void onDiscardButtonClick(com.vaadin.flow.component.ClickEvent<com.vaadin.flow.component.button.Button> event)
    • setItem

      public void setItem(@Nullable DraftInfo item)
      Description copied from class: FragmentRenderer
      Sets the corresponding item for the rendered fragment component.
      Overrides:
      setItem in class FragmentRenderer<com.vaadin.flow.component.orderedlayout.HorizontalLayout,DraftInfo>
      Parameters:
      item - the item for the rendered fragment component
    • setHref

      protected void setHref(@Nullable String url)
      Points the body at the drafted view and marks the anchor as a router link. Without an address the body is left as plain text.
      Parameters:
      url - address of the drafted view, or null if there is none
    • setText

      protected void setText(com.vaadin.flow.component.html.Span span, @Nullable String text)
      Sets the text of a line and hides the line when there is none.
      Parameters:
      span - line to fill
      text - text of the line, or null to hide it
    • discard

      protected void discard()