Class GrapesJsBlock.Builder

java.lang.Object
io.jmix.messagetemplatesflowui.kit.component.GrapesJsBlock.Builder
Enclosing class:
GrapesJsBlock

public static class GrapesJsBlock.Builder extends Object
Builder for GrapesJsBlock that can be used to create blocks via the Fluent API.
  • Field Details

  • Constructor Details

    • Builder

      public Builder(String id)
  • Method Details

    • getId

      public String getId()
      Returns:
      unique id of the block
    • getLabel

      public String getLabel()
      Returns:
      label of the block
    • withLabel

      public GrapesJsBlock.Builder withLabel(String label)
      Sets the label of the block. The label is used to name a block in the blocks section.
      Parameters:
      label - label to set
      Returns:
      this
    • getCategory

      public String getCategory()
      Returns:
      category of the block in the blocks section
    • withCategory

      public GrapesJsBlock.Builder withCategory(String category)
      Sets the category to which the block will be located in the blocks section.
      Parameters:
      category - category to set
      Returns:
      this
    • getContent

      public String getContent()
      Returns:
      HTML content of the block
    • withContent

      public GrapesJsBlock.Builder withContent(String content)
      Sets the HTML content for the block. The content will be rendered in the GrapesJs template when you drag-n-drop a block into the template.
      Parameters:
      content - HTML content to set
      Returns:
      this
    • getAttributes

      public String getAttributes()
      Returns:
      additional attributes of the block
    • withAttributes

      public GrapesJsBlock.Builder withAttributes(String attributes)
      Sets additional attributes of the block as a JSON string. Additional attributes can be used to set additional parameters.
      For example, you can set text that will be displayed as a tooltip when hovering over a block:
      
       grapesJsBlock.setAttributes("""
                           {
                               "title": "Insert another one"
                           }
               """);
       
      Parameters:
      attributes - JSON string attributes to set
      Returns:
      this
    • withIcon

      public GrapesJsBlock.Builder withIcon(String icon)
      Sets icon for the block in the block section. The icon must be from an existing icon set (e.g. vaadin:picture).
      Parameters:
      icon - the icon name with collection prefix
    • build

      public GrapesJsBlock build()
      Returns:
      an instance of the GrapesJsBlock that was created using the Fluent API