Class PageBuilder

java.lang.Object
org.knime.core.webui.page.PageBuilder
Direct Known Subclasses:
FromFilePageBuilder

public class PageBuilder extends Object
Builds a Page.
Since:
4.5
Author:
Martin Horn, KNIME GmbH, Konstanz, Germany
  • Constructor Details

    • PageBuilder

      protected PageBuilder(Resource pageResource)
      Parameters:
      pageResource -
  • Method Details

    • addResource

      public PageBuilder addResource(Supplier<InputStream> content, String relativePath)
      Adds another resource to the 'context' of a page (such js-resource).
      Parameters:
      content - the actual content of the resource
      relativePath - the relative path to the resource (including the resource name itself)
      Returns:
      this page builder instance
    • addResources

      public PageBuilder addResources(Function<String,InputStream> supplier, String relativePathPrefix, boolean areStatic)
      Allows one to add multiple resources at once with a single function which dynamically maps paths to resources. I.e. no need to define the exact path upfront (apart from a path-prefix).
      Parameters:
      supplier - the mapping function from relative path to resource content
      relativePathPrefix - the path prefix; if there are resources registered with 'overlapping' path prefixes, the resources with the 'longest' match are being used
      areStatic - whether the returned resources can be considered static or not - see Resource.isStatic()
      Returns:
      this page builder instance
    • addResourceFromString

      public PageBuilder addResourceFromString(Supplier<String> content, String relativePath)
      Adds another resource to the 'context' of a page (such js-resource).
      Parameters:
      content - the actual content of the resource
      relativePath - the relative path to the resource (including the resource name itself)
      Returns:
      this page builder instance
    • build

      public Page build()
      Returns:
      a new page instance