public class IlvDHTMLUtil extends Object
IlvDHTMLUtil
class gathers various utility methods used to
render JViews Faces DHTML components.Modifier and Type | Method and Description |
---|---|
static void |
debugDecodedParameters(jakarta.faces.component.UIComponent component,
HashMap map) |
static String |
encodeNamespace(jakarta.faces.context.FacesContext context,
String name)
Encodes the
name parameter by prefixing it by the namespace:
Portlet: Use renderResponse.getNamespace() to prefix the name. |
static void |
endScriptSection(Writer writer)
Renders to the writer the ending of a script section.
|
static IlvFacesManager |
findManager(jakarta.faces.context.FacesContext facesContext)
Find the manager that will manage the DHTML components (scripts,
dependencies).
|
static String |
getClientId(String jsRef)
Converts a JViews JavaScript reference to its client ID.
|
static String |
getControllerPath(jakarta.faces.context.FacesContext facesContext)
Returns the URL mapping of the controller servlet.
|
static String |
getControllerURL()
Returns the URL of the controller servlet.
|
static String |
getJSRef(String clientId)
Returns the JavaScript variable reference of a component.
|
static String |
getJSRef(jakarta.faces.component.UIComponent component)
Returns the JavaScript variable reference of a component.
|
static Object |
getObjectFromModel(jakarta.faces.context.FacesContext facesContext,
jakarta.faces.component.UIComponent component,
String property)
Returns the object described by the property from the model if the
component has a value binding registered for this property.
|
static boolean |
isDependencyRendered(jakarta.faces.component.UIComponent component,
IlvDependencyManager dependencyManager)
Returns
true if the dependency component has already rendered
itself, false otherwise. |
static void |
setPropertyFromModel(jakarta.faces.context.FacesContext context,
jakarta.faces.component.UIComponent component,
String property)
Refresh the local value of a property with the referenced value if a value
binding is defined on this property.
|
static void |
startScriptSection(Writer writer)
Renders to the writer the starting of a script section.
|
static void |
writeJSHandler(jakarta.faces.context.FacesContext context,
String jsRef,
String jsHandler,
String jsCode)
Writes a JavaScript handler on the event generated by the component
jsRef . |
static void |
writeJSHandler(jakarta.faces.context.FacesContext context,
String jsRef,
String jsHandler,
String jsCode,
String[] params)
Writes a JavaScript handler on the event generated by the component
jsRef . |
static void |
writeJSProperty(jakarta.faces.context.FacesContext context,
String jsRef,
String property,
String value)
Writes in the current response writer the JavaScript setting of a property
of a component.
|
static void |
writeJSStringProperty(jakarta.faces.context.FacesContext context,
String jsRef,
String property,
String value)
Writes in the current response writer the JavaScript setting of a property
of a component.
|
public static boolean isDependencyRendered(jakarta.faces.component.UIComponent component, IlvDependencyManager dependencyManager)
true
if the dependency component has already rendered
itself, false
otherwise.component
- The component that is being rendered.dependencyManager
- The dependency manager.true
if the dependency component has already rendered
itself, false
.
otherwise.public static String getJSRef(String clientId)
clientId
- The clientId
of the component.public static String getJSRef(jakarta.faces.component.UIComponent component)
component
- The component whose the JavaScript variable reference is returned.public static String encodeNamespace(jakarta.faces.context.FacesContext context, String name)
name
parameter by prefixing it by the namespace:
renderResponse.getNamespace()
to prefix the name.context
- The current faces context.name
- The name to encode.public static String getClientId(String jsRef)
jsRef
- The JavaScript reference of the component.public static Object getObjectFromModel(jakarta.faces.context.FacesContext facesContext, jakarta.faces.component.UIComponent component, String property)
facesContext
- The current context.component
- The component processed.property
- The property processed.public static void setPropertyFromModel(jakarta.faces.context.FacesContext context, jakarta.faces.component.UIComponent component, String property)
context
- The current faces context.component
- The component processed.property
- The property to refresh with the referenced value.public static IlvFacesManager findManager(jakarta.faces.context.FacesContext facesContext)
facesContext
- The current faces context.public static String getControllerPath(jakarta.faces.context.FacesContext facesContext)
facesContext
- The current faces context.public static void writeJSProperty(jakarta.faces.context.FacesContext context, String jsRef, String property, String value) throws IOException
writeJSStringProperty
instead.context
- The current faces context.jsRef
- The JavaScript reference of the component.property
- The property to set.value
- The value to set to the property.IOException
public static void writeJSStringProperty(jakarta.faces.context.FacesContext context, String jsRef, String property, String value) throws IOException
writeJSProperty
instead.context
- The current faces context.jsRef
- The JavaScript reference of the component.property
- The property to set.value
- The value to set to the property.IOException
public static void writeJSHandler(jakarta.faces.context.FacesContext context, String jsRef, String jsHandler, String jsCode, String[] params) throws IOException
jsRef
.context
- The current faces context.jsRef
- The JavaScript reference of the component.jsHandler
- The name of the JavaScript handler to add.jsCode
- The code that will be executed when the specified event is
sent.params
- The names of the parameters of the JavaScript handler.IOException
public static void writeJSHandler(jakarta.faces.context.FacesContext context, String jsRef, String jsHandler, String jsCode) throws IOException
jsRef
.
The implicit parameter of the listener is 'view'.context
- The current faces context.jsRef
- The JavaScript reference of the component.jsHandler
- The name of the JavaScript handler to add.jsCode
- The code that will be executed when the specified event is
sent.IOException
public static void debugDecodedParameters(jakarta.faces.component.UIComponent component, HashMap map)
public static String getControllerURL() throws IllegalStateException
IllegalStateException
- If the type of request is not handled.public static void startScriptSection(Writer writer) throws IOException
writer
- The writerIOException
public static void endScriptSection(Writer writer) throws IOException
writer
- the writerIOException
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.