Interface RichTextHandler


  • @ProviderType
    public interface RichTextHandler
    Manages XHTML rich text fragment formatting.

    The interface is implemented by a Sling Model. You can adapt from SlingHttpServletRequest or Resource to get a context-specific handler instance.

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      @NotNull RichTextBuilder get​(@Nullable java.lang.String text)
      Build formatter text from given raw text string.
      @NotNull RichTextBuilder get​(@Nullable org.apache.sling.api.resource.Resource resource)
      Build formatted text from content resource using default property names.
      boolean isEmpty​(@Nullable java.lang.String text)
      Check if the given formatted text block is empty.
    • Method Detail

      • get

        @NotNull
        @NotNull RichTextBuilder get​(@Nullable
                                     @Nullable org.apache.sling.api.resource.Resource resource)
        Build formatted text from content resource using default property names.
        Parameters:
        resource - Resource
        Returns:
        Rich text builder
      • get

        @NotNull
        @NotNull RichTextBuilder get​(@Nullable
                                     @Nullable java.lang.String text)
        Build formatter text from given raw text string.
        Parameters:
        text - Raw text
        Returns:
        Rich text builder
      • isEmpty

        boolean isEmpty​(@Nullable
                        @Nullable java.lang.String text)
        Check if the given formatted text block is empty. A text block containing only one paragraph element and whitespaces is considered as empty. A text block with more than 20 characters (raw data) is never considered as empty.
        Parameters:
        text - XHTML text string (root element not needed)
        Returns:
        true if text block is empty