Class FileViewerUtil
java.lang.Object
net.sf.basedb.clients.web.extensions.fileviewer.FileViewerUtil
Helper class for handling the "file-viewer" extension point.
A
JspContext
and FileViewerContext
is needed.
This class will initialize the extension point in the constructor.
To invoke extensions, first update the FileViewerContext with the
current file and other information and then call render()
.- Since:
- 3.16
- Author:
- nicklas
-
Field Summary
Modifier and TypeFieldDescriptionprivate final ExtensionsInvoker<ButtonAction>
private final FileViewerContext
private final JspContext
private String
private String
-
Constructor Summary
ConstructorDescriptionFileViewerUtil
(JspContext jspContext, FileViewerContext fileContext) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionstatic FileViewerUtil
get
(JspContext jspContext) Get an existing instance that is stored in the given JSP context.Get the file context.Get the invoker that is handling the extensions.Get the JSP context.static FileViewerUtil
getOrCreate
(JspContext jspContext, FileViewerContext fileContext) Get an existing instance or create a new instance.void
render()
Render the extensions with the current file context information and write it to the JSP output.Render the extensions with the current file context information and return it as a string.void
setPrefixAndSuffix
(String prefix, String suffix) Sets a prefix and suffix string to use before and after the list of actions.
-
Field Details
-
jspContext
-
fileContext
-
fileActions
-
prefix
-
suffix
-
-
Constructor Details
-
FileViewerUtil
Deprecated.In 3.17, usegetOrCreate(JspContext, FileViewerContext)
instead
-
-
Method Details
-
get
Get an existing instance that is stored in the given JSP context.- Returns:
- A FileViewerUtil instance or null
- Since:
- 3.17
-
getOrCreate
Get an existing instance or create a new instance. If a new instance is created it is stored in the given JSP context ifExtensionsInvoker.getNumExtensions()
is more than 0.- Returns:
- A FileViewerUtil instance
- Since:
- 3.17
-
getFileContext
Get the file context. -
getJspContext
Get the JSP context. -
getInvoker
Get the invoker that is handling the extensions.- Since:
- 3.17
-
setPrefixAndSuffix
Sets a prefix and suffix string to use before and after the list of actions. The default is "[" and "]". -
render
Render the extensions with the current file context information and write it to the JSP output.- Throws:
IOException
-
renderAsString
Render the extensions with the current file context information and return it as a string. Returns an empty string if there are no actions.
-
getOrCreate(JspContext, FileViewerContext)
instead