Package org.knime.core.webui.page
Class PageBuilder
java.lang.Object
org.knime.core.webui.page.PageBuilder
- Direct Known Subclasses:
FromFilePageBuilder
Builds a
Page.- Since:
- 4.5
- Author:
- Martin Horn, KNIME GmbH, Konstanz, Germany
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddResource(Supplier<InputStream> content, String relativePath) Adds another resource to the 'context' of a page (such js-resource).addResourceFromString(Supplier<String> content, String relativePath) Adds another resource to the 'context' of a page (such js-resource).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.build()
-
Constructor Details
-
PageBuilder
- Parameters:
pageResource-
-
-
Method Details
-
addResource
Adds another resource to the 'context' of a page (such js-resource).- Parameters:
content- the actual content of the resourcerelativePath- 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 contentrelativePathPrefix- the path prefix; if there are resources registered with 'overlapping' path prefixes, the resources with the 'longest' match are being usedareStatic- whether the returned resources can be considered static or not - seeResource.isStatic()- Returns:
- this page builder instance
-
addResourceFromString
Adds another resource to the 'context' of a page (such js-resource).- Parameters:
content- the actual content of the resourcerelativePath- the relative path to the resource (including the resource name itself)- Returns:
- this page builder instance
-
build
- Returns:
- a new page instance
-