Package org.knime.core.webui.page
Class Page
java.lang.Object
org.knime.core.webui.page.Page
- All Implemented Interfaces:
Resource
A (html) page of an ui-extension, e.g. a node view, port view or node dialog.
- Since:
- 4.5
- Author:
- Martin Horn, KNIME GmbH, Konstanz, Germany
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.knime.core.webui.page.Resource
Resource.ContentType -
Method Summary
Modifier and TypeMethodDescriptionstatic FromFilePageBuilderCreates aPageBuilder-instance to create a (static) page (and associated resources) from files.static FromFilePageBuilderCreates aPageBuilder-instance to create a (static) page (and associated resources) from files.static PageBuilderbuilder(Page.InputStreamSupplier content, String relativePath) Creates aPageBuilder-instance to create a (dynamic) page (and associated resources) from anInputStream.static PageBuilderbuilder(Page.StringSupplier content, String relativePath) Creates aPageBuilder-instance to create a (dynamic) page (and associated resources) from anInputStream.Creates the page id for a re-usuable and completely static page.getResource(String relativePath) Additional resources required by the page.booleanA page is regarded completely static if the page itself and all associated resources are static.booleanisStatic()A static resource will never change at runtime and thus potentially be 're-used' between, e.g., multiple node instances.
-
Method Details
-
getResource
Additional resources required by the page.- Parameters:
relativePath- the relative path to get the resource for- Returns:
- the resource for the given relative path or an empty optional if there isn't any
-
getRelativePath
- Specified by:
getRelativePathin interfaceResource- Returns:
- the resource's relative path (including the resource name itself, too)
-
getInputStream
- Specified by:
getInputStreamin interfaceResource- Returns:
- the actual resource content as
InputStream - Throws:
IOException
-
isStatic
public boolean isStatic()A static resource will never change at runtime and thus potentially be 're-used' between, e.g., multiple node instances. I.e. multiple node instances access a static resource at the very same URL which is independent from a specific node instance. -
isCompletelyStatic
public boolean isCompletelyStatic()A page is regarded completely static if the page itself and all associated resources are static.- Returns:
trueif the page itself and all the associated resources are static (i.e. invariable)
-
getPageIdForReusablePage
Creates the page id for a re-usuable and completely static page. Will only return a page-id if the page is marked as re-usable (seeFromFilePageBuilder.markAsReusable(String)).- Returns:
- the page-id or an empty optional if the page is not marked as re-usable
- Throws:
IllegalStateException- if the page is marked as re-usable but not completely static (seeisCompletelyStatic()); or if 're-usability' is not supported for the page'sResource.ContentType.
-
getContentType
- Specified by:
getContentTypein interfaceResource- Returns:
- the content type of the resource
-
getCharset
- Specified by:
getCharsetin interfaceResource- Returns:
- the charset the resource uses; an empty optional if it's not a text-based resource or if it's using the
default charset (i.e.
Charset.defaultCharset()).
-
builder
Creates aPageBuilder-instance to create a (static) page (and associated resources) from files.- Parameters:
clazz- a class which is part of the bundle where the references files are locatedbasePath- the base part (beneath the bundle root)relativeFilePath- the file to get the page content from- Returns:
- a new
PageBuilder-instance
-
builder
public static FromFilePageBuilder builder(String bundleID, String basePath, String relativeFilePath) Creates aPageBuilder-instance to create a (static) page (and associated resources) from files.- Parameters:
bundleID- the id of the bundle where the references files are locatedbasePath- the base part (beneath the bundle root)relativeFilePath- the file to get the page content from- Returns:
- a new
PageBuilder-instance
-
builder
Creates aPageBuilder-instance to create a (dynamic) page (and associated resources) from anInputStream.- Parameters:
content- the page content supplier for lazy initializationrelativePath- the relative path of the page (including the page resource name itself)- Returns:
- a new
PageBuilder-instance
-
builder
Creates aPageBuilder-instance to create a (dynamic) page (and associated resources) from anInputStream.- Parameters:
content- the page content supplier for lazy initializationrelativePath- the relative path of the page (including the page resource name itself)- Returns:
- a new
PageBuilder-instance
-