com.liferay.faces.util.client
Class ScriptFactory

java.lang.Object
  extended by com.liferay.faces.util.client.ScriptFactory
All Implemented Interfaces:
javax.faces.FacesWrapper<ScriptFactory>

public abstract class ScriptFactory
extends Object
implements javax.faces.FacesWrapper<ScriptFactory>

A factory for creating a Script which can be rendered on the client via FacesContextHelperUtil.addScript(javax.faces.context.FacesContext, com.liferay.faces.util.client.Script).

Author:
Kyle Stiemann

Constructor Summary
ScriptFactory()
           
 
Method Summary
abstract  Script getScript(String sourceCode)
          Returns a new instance of Script with the specified source code.
abstract  Script getScript(String sourceCode, String[] modules, Script.ModulesType modulesType)
          Returns a new instance of Script with the specified source code, modules, and type.
static Script getScriptInstance(javax.faces.context.ExternalContext externalContext, String sourceCode)
          Returns a new instance of Script from the ScriptFactory found by the FactoryExtensionFinder.
static Script getScriptInstance(javax.faces.context.ExternalContext externalContext, String sourceCode, String[] modules, Script.ModulesType modulesType)
          Returns a new instance of Script from the ScriptFactory found by the FactoryExtensionFinder.
static Script getScriptInstance(String sourceCode)
          Deprecated. Call getScriptInstance(ExternalContext, String) instead.

Returns a new instance of Script from the ScriptFactory found by the FactoryExtensionFinder. The returned instance is guaranteed to be Serializable but not guaranteed to be thread-safe.

static Script getScriptInstance(String sourceCode, String[] modules, Script.ModulesType modulesType)
          Deprecated. Call getScriptInstance(ExternalContext, String, String[], Script.ModulesType) instead.

Returns a new instance of Script from the ScriptFactory found by the FactoryExtensionFinder. The returned instance is guaranteed to be Serializable but not guaranteed to be thread-safe.

abstract  ScriptFactory getWrapped()
          Returns the wrapped factory instance if this factory decorates another.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScriptFactory

public ScriptFactory()
Method Detail

getScriptInstance

@Deprecated
public static Script getScriptInstance(String sourceCode)
Deprecated. Call getScriptInstance(ExternalContext, String) instead.

Returns a new instance of Script from the ScriptFactory found by the FactoryExtensionFinder. The returned instance is guaranteed to be Serializable but not guaranteed to be thread-safe.

Parameters:
sourceCode - The source code of the script.

getScriptInstance

public static Script getScriptInstance(javax.faces.context.ExternalContext externalContext,
                                       String sourceCode)
Returns a new instance of Script from the ScriptFactory found by the FactoryExtensionFinder. The returned instance is guaranteed to be Serializable but not guaranteed to be thread-safe.

Parameters:
externalContext - The external context associated with the current faces context. It is needed in order for the FactoryExtensionFinder to be able to find the factory.
sourceCode - The source code of the script.
Since:
3.1, 2.1, 1.1

getScriptInstance

@Deprecated
public static Script getScriptInstance(String sourceCode,
                                                  String[] modules,
                                                  Script.ModulesType modulesType)
Deprecated. Call getScriptInstance(ExternalContext, String, String[], Script.ModulesType) instead.

Returns a new instance of Script from the ScriptFactory found by the FactoryExtensionFinder. The returned instance is guaranteed to be Serializable but not guaranteed to be thread-safe.

Parameters:
sourceCode - The source code of the Script.
modules - The modules which the Script depends on.
modulesType - The Script.ModulesType of the Script.

getScriptInstance

public static Script getScriptInstance(javax.faces.context.ExternalContext externalContext,
                                       String sourceCode,
                                       String[] modules,
                                       Script.ModulesType modulesType)
Returns a new instance of Script from the ScriptFactory found by the FactoryExtensionFinder. The returned instance is guaranteed to be Serializable but not guaranteed to be thread-safe.

Parameters:
externalContext - The external context associated with the current faces context. It is needed in order for the FactoryExtensionFinder to be able to find the factory.
sourceCode - The source code of the Script.
modules - The modules which the Script depends on.
modulesType - The Script.ModulesType of the Script.
Since:
3.1, 2.1, 1.1

getScript

public abstract Script getScript(String sourceCode)
Returns a new instance of Script with the specified source code. The returned instance is guaranteed to be Serializable but not guaranteed to be thread-safe. The Script can be rendered on the client via FacesContextHelperUtil.addScript(javax.faces.context.FacesContext, com.liferay.faces.util.client.Script). As a convenience, it is possible to call FacesContextHelperUtil.addScript(javax.faces.context.FacesContext, com.liferay.faces.util.client.Script) instead since it will create the Script and add it to the list of Scripts which will be rendered to the response.

Parameters:
sourceCode - The source code of the Script.

getScript

public abstract Script getScript(String sourceCode,
                                 String[] modules,
                                 Script.ModulesType modulesType)
Returns a new instance of Script with the specified source code, modules, and type. The returned instance is guaranteed to be Serializable but not guaranteed to be thread-safe. The Script can be rendered on the client via FacesContextHelperUtil.addScript(javax.faces.context.FacesContext, com.liferay.faces.util.client.Script).

Parameters:
sourceCode - The source code of the Script.
modules - The modules which the Script depends on.
modulesType - The Script.ModulesType of the Script.

getWrapped

public abstract ScriptFactory getWrapped()
Returns the wrapped factory instance if this factory decorates another. Otherwise, this method returns null.

Specified by:
getWrapped in interface javax.faces.FacesWrapper<ScriptFactory>


Copyright © 2019 Liferay, Inc.. All rights reserved.