Package org.knime.core.webui.page
Class FromFilePageBuilder
java.lang.Object
org.knime.core.webui.page.PageBuilder
org.knime.core.webui.page.FromFilePageBuilder
Adds additional methods to the
PageBuilder which allows one to define the page content and associated
resources by referencing files.- Since:
- 4.5
- Author:
- Martin Horn, KNIME GmbH, Konstanz, Germany
-
Method Summary
Modifier and TypeMethodDescriptionaddResource(Supplier<InputStream> content, String relativePath) Adds another resource to the 'context' of a page (such js-resource).addResourceDirectory(String relativeDirPath) Adds all files in the given directory to the 'context' of a page (a directory containing, e.g., js- and css-files).addResourceFile(String relativeFilePath) Adds another resource file to the 'context' of a page (such as a js-file).addResourceFromString(Supplier<String> content, String relativePath) Adds another resource to the 'context' of a page (such js-resource).build()markAsReusable(String pageName) Marks this page as being re-usable by different nodes (e.g., as node dialog and/or view) and/or port (as port view).Methods inherited from class org.knime.core.webui.page.PageBuilder
addResources
-
Method Details
-
addResourceFile
Adds another resource file to the 'context' of a page (such as a js-file). NOTE: the referenced resource-file is expected to be UTF-8-encoded.- Parameters:
relativeFilePath- the relative path to the file- Returns:
- this page builder instance
-
addResourceDirectory
Adds all files in the given directory to the 'context' of a page (a directory containing, e.g., js- and css-files). NOTE: the referenced resource-files are expected to be UTF-8-encoded.- Parameters:
relativeDirPath- the relative path to the directory- Returns:
- this page builder instance
-
markAsReusable
Marks this page as being re-usable by different nodes (e.g., as node dialog and/or view) and/or port (as port view). A benefit of re-using pages is that the resources associated with the page only need to be requested once for different nodes/ports. Note that page re-use is only possible if the page itself and all associated resources are static (seeResource.isStatic()). And also note that in order for a page to be truly re-used, the very same instance of the page, created with this page builder, must be used by the different nodes/ports.- Parameters:
pageName- a name for the re-usable page; must not benull, otherwise it's not marked as re-usable- Returns:
- this page builder instance
-
build
- Overrides:
buildin classPageBuilder- Returns:
- a new page instance
-
addResource
Description copied from class:PageBuilderAdds another resource to the 'context' of a page (such js-resource).- Overrides:
addResourcein classPageBuilder- Parameters:
content- the actual content of the resourcerelativePath- the relative path to the resource (including the resource name itself)- Returns:
- this page builder instance
-
addResourceFromString
Description copied from class:PageBuilderAdds another resource to the 'context' of a page (such js-resource).- Overrides:
addResourceFromStringin classPageBuilder- Parameters:
content- the actual content of the resourcerelativePath- the relative path to the resource (including the resource name itself)- Returns:
- this page builder instance
-