public interface IHtmlDialogContext
The IHtmlDialogContext specifies the interface of the ivy.html
environment variable.
This environment variable / interface provides methods to generate form
controls, build links, format process attributes and many other useful things
for HTML process pages. All these methods will mostly be used as macros
inside process pages
(e.g. <a href="<%=ivy.html.ref("LinkA.ivp")%>">My Link</a>)
Use the HtmlDialogContextFactory
to create a new object that
implements this interface
HtmlDialogContextFactory
,
HtmlDialogContext
Modifier and Type | Method and Description |
---|---|
String |
applicationHomeRef()
Returns the URL to the application home.
|
String |
coref(IContentObject co)
Returns the reference to the specified content object for download
(empty string, if co is
null or not downloadable). |
String |
coref(String cmsUri)
Returns the reference to the specified content object URI for download
(empty string, if co does not exist or is not downloadable).
|
String |
escape(Object obj)
Does format the object with the default format and then escape the
characters in a
String using HTML entities. |
String |
escape(String str)
Escapes the characters in a
String using HTML entities. |
String |
fileref(File file)
Returns the url to the specified file for download (empty string
if file is
null ). |
String |
fileref(String path,
boolean isTemporary)
Returns the url to the specified file for download (empty string
if path is
null ). |
String |
get(String attributeName)
Gets the default formatted and HTML-escaped value of the specified process
attribute.
|
String |
get(String attributeName,
String format)
Gets the formatted and HTML-escaped value of the specified process
attribute.
|
String |
getCurrentContentPageUri()
Gets the current content page cms uri if available.
|
String |
getFormValue(String attributeName)
Gets the default formatted and HTML-escaped value of the specified process
attribute for the use in an HTML form input field.
|
String |
getFormValue(String attributeName,
String format)
Gets the formatted and HTML-escaped value of the specified process
attribute for the use in an HTML form input.
|
Object |
getObject(String attributeName)
Gets the value object of the specified process attribute.
|
String |
pageArchiveRef(IPageArchive pageArchive)
Returns the URL to the specified page archive.
|
String |
pageArchiveRef(IPageArchive pageArchive,
ISession session)
Returns the URL to the specified page archive.
|
String |
processStartListRef()
Returns the URL to the process start list.
|
String |
ref(String linkName)
Returns the url to the specified process link.
|
String |
ref(String linkName,
boolean useSecureProtocol)
Returns the url to the specified process link.
|
String |
startref(String startName)
Returns the url to the specified process link.
|
String |
taskListRef()
Returns the URL to the task list.
|
String |
taskstartref(ITask taskToStart)
Gets a reference to start the specified task (empty string if task
is
null or not in a startable state). |
String |
wr(String relativeWebContentUri)
Creates a link to a file in the static webContent folder of the current project.
|
String get(String attributeName)
IApplicationRequest.getFormattingLocale()
).
E.g. english (en) or US (en_US) locale: ivy.html.get("in.date") = "1/31/2000" ivy.html.get("in.time") = "9:01:59" ivy.html.get("in.dateTime") = "1/31/2000 9:01:59" ivy.html.get("in.number") = "123456.789" ivy.html.get("in.notInitialized") = "" ivy.html.get("in.invalid") = ""
E.g. switzerland (de_CH, fr_CH, it_CH) locale: ivy.html.get("in.date") = "31.01.2000" ivy.html.get("in.time") = "09:01:59" ivy.html.get("in.dateTime") = "31.01.2000 09:01:59" ivy.html.get("in.number") = "123456.789" ivy.html.get("in.notInitialized") = "" ivy.html.get("in.invalid") = ""
E.g. UK (en_UK) locale: ivy.html.get("in.date") = "31/01/2000" ivy.html.get("in.time") = "09:01:59" ivy.html.get("in.dateTime") = "31/01/2000 09:01:59" ivy.html.get("in.number") = "123456.789" ivy.html.get("in.notInitialized") = "" ivy.html.get("in.invalid") = ""
E.g. german (de) or germany (de_DE) locale: ivy.html.get("in.date") = "31.01.2000" ivy.html.get("in.time") = "09:01:59" ivy.html.get("in.dateTime") = "31.01.2000 09:01:59" ivy.html.get("in.number") = "123456,789" ivy.html.get("in.notInitialized") = "" ivy.html.get("in.invalid") = ""
attributeName
- The name of the attribute to get (e.g.
'in.xhrm.employee.name')String get(String attributeName, String format)
This method will only work correctly if invoked on a page request (i.e. when rendering a process page).
attributeName
- the name of the attribute to get (e.g. 'in.xhrm.employee.name')format
- the name of the format config or a pattern to format the attribute with.Object getObject(String attributeName)
This method will only work correctly if invoked on a page request (i.e. when rendering a process page).
attributeName
- The name of the attribute to get (e.g. 'in.xhrm.employee.name')Object
or null
if not on a pageString ref(String linkName)
This method will only work correctly if invoked on a page request (i.e. when rendering a process page).
The protocol of the url will be the same as the protocol of the page request (i.e. if the page request uses https the generated url also uses https and if it uses http the generated url also uses http.)
linkName
- the name of the process link (e.g. 'LinkA.ivp')IHtmlDialogContext.ref(String, boolean)
String ref(String linkName, boolean useSecureProtocol)
This method will only work correctly if invoked on a page request (i.e. when rendering a process page).
The protocol of the url will be https if useSecureProtocol
is true
and http if false
linkName
- the name of the process link (e.g. 'LinkA.ivp')useSecureProtocol
- if true the generated url uses https. If false uses http.IHtmlDialogContext.ref(String)
String fileref(File file)
null
).file
- the file to get an URL forString fileref(String path, boolean isTemporary)
null
).path
- the path of the file (relative)isTemporary
- if file is temporaryString taskstartref(ITask taskToStart)
null
or not in a startable state).taskToStart
- the task to get an URL fornull
or in a state that doesn't allow starting it)String startref(String startName)
E.g. 'MyProcess/start.ivp' -> 'http://hostname/ivy/pro/myapp/MyProcess/1571D80B8D735240/start.ivp'
The search scope is the current case's project or - if not available - the current project of the request and all of it's required projects.
startName
- name of the process start (Format: ProcessName/startName.ivp) to get an URL forString coref(IContentObject co)
null
or not downloadable).co
- the co to get an URL forString coref(String cmsUri)
cmsUri
- the uri of the content object to create an URL forString wr(String relativeWebContentUri) throws PersistencyException
Creates a link to a file in the static webContent folder of the current project. This method is useful to refer to e.g. JavaScript extensions or other static web content. For images, banners and labels it is recommended to link to content management system entries.
Only the current project's webContent folder will be searched. The webContent folders of any required projects will not be taken into consideration.
Example: An argument such as myDir/myStyle.css
will reference .../webContent/myDir/myStyle.css
.
Important Note: This method has visibility EXPERT because it is not really needed. You can address all webContent files of a project with a link that is relative to the current JSP page.
Example: A link <a href="myDir/myStyle.css">MyLink</a>
on a JSP page will have exactly the same effect
as <a href="<%=ivy.html.wr("myDir/myStyle.css")%>">MyLink</a>
. Obviously the version without macro is much
simpler and better readable and thus recommended.
relativeWebContentUri
- relative URI to a file in webContent folder, e.g. myDir/myStyle.css
PersistencyException
- if anything goes wrongString getCurrentContentPageUri()
This method will only work correctly if invoked on a page request (i.e. when rendering a process page).
String pageArchiveRef(IPageArchive pageArchive)
pageArchive
- the page archive to get an URL forString pageArchiveRef(IPageArchive pageArchive, ISession session)
IHtmlDialogContext.pageArchiveRef(IPageArchive)
the returned link is extended with the given session
informations, that the page archive could be executed with the permissions of the given session, as long as the given
session exists. E.g. used to display page archive entries in a web browser outside a RIA context.pageArchive
- the page archive to get an URL forsession
- The session in which the request should be executed.String taskListRef()
Returns the URL to the task list. The task list contains all tasks on which the currently logged in user can work.
Consult the engine guide to learn how to customize the task list for your application.
String processStartListRef()
Returns the URL to the process start list. The process start list contains all processes which the currently logged in user can start.
Consult the engine guide to learn how to customize the process start list for your application.
String applicationHomeRef()
Returns the URL to the application home. The application home is the entry point to the application.
Consult the engine guide to learn how to customize the application home page for your application.
String escape(Object obj)
Does format the object with the default format and then escape the
characters in a String
using HTML entities.
For example:
"bread" & "butter"
"bread" & "butter"
Supports all known HTML 4.0 entities, including funky accents. Note that the commonly used apostrophe escape character (') is not a legal entity and so is not supported).
obj
- the String
to escape, may be nullString
, null
if null object
inputIHtmlDialogContext.escape(String)
,
StringEscapeUtils.escapeHtml(String)
String escape(String str)
Escapes the characters in a String
using HTML entities.
For example:
"bread" & "butter"
"bread" & "butter"
Supports all known HTML 4.0 entities, including funky accents. Note that the commonly used apostrophe escape character (') is not a legal entity and so is not supported).
str
- the String
to escape, may be nullString
, null
if null string
inputIHtmlDialogContext.escape(Object)
,
StringEscapeUtils.escapeHtml(String)
String getFormValue(String attributeName)
Gets the default formatted and HTML-escaped value of the specified process
attribute for the use in an HTML form input field. Line breaks will not be converted
to <br> tags. The format depends on the formatting locale of the current request
( IApplicationRequest.getFormattingLocale()
).
Examples of the format can be seen in the documentation of the IHtmlDialogContext.get(String)
method.
This method will only work correctly if invoked on a page request
(i.e. when rendering a process page).
attributeName
- The name of the attribute to get (e.g. 'in.xhrm.employee.name')String getFormValue(String attributeName, String format)
Gets the formatted and HTML-escaped value of the specified process attribute for the use in an HTML form input. It is formatted with the specified format (either the name of a config or a pattern). Line breaks will not be converted to <br> tags.
In case the attribute is a Number and the format uses digit grouping, the thousands separators will be removed to ensure that the number can be parsed back after submitting the form.
The formating depends on the formating locale of the
request ( IApplicationRequest.getFormattingLocale()
).
This method will only work correctly if invoked on a page request
(i.e. when rendering a process page).
attributeName
- The name of the attribute to get (e.g. 'in.xhrm.employee.name')format
- The name of the format config or a pattern to format the attribute with. If null
then the default format will be used.Copyright © 2024
AXON IVY AG
All Rights Reserved Documentation was generated
on April 28, 2024