Class GrapesJsBlock.Builder
java.lang.Object
io.jmix.messagetemplatesflowui.kit.component.GrapesJsBlock.Builder
- Enclosing class:
- GrapesJsBlock
Builder for
GrapesJsBlock
that can be used to create blocks via the Fluent API.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()
getId()
getLabel()
withAttributes
(String attributes) Sets additional attributes of the block as a JSON string.withCategory
(String category) Sets the category to which the block will be located in the blocks section.withContent
(String content) Sets the HTML content for the block.Sets icon for the block in the block section.Sets the label of the block.
-
Field Details
-
block
-
-
Constructor Details
-
Builder
-
-
Method Details
-
getId
- Returns:
- unique id of the block
-
getLabel
- Returns:
- label of the block
-
withLabel
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
- Returns:
- category of the block in the blocks section
-
withCategory
Sets the category to which the block will be located in the blocks section.- Parameters:
category
- category to set- Returns:
- this
-
getContent
- Returns:
- HTML content of the block
-
withContent
Sets the HTML content for the block. The content will be rendered in theGrapesJs
template when you drag-n-drop a block into the template.- Parameters:
content
- HTML content to set- Returns:
- this
-
getAttributes
- Returns:
- additional attributes of the block
-
withAttributes
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
Sets icon for the block in the block section. Theicon
must be from an existing icon set (e.g.vaadin:picture
).- Parameters:
icon
- the icon name with collection prefix
-
build
- Returns:
- an instance of the
GrapesJsBlock
that was created using the Fluent API
-