Package org.exoplatform.portal.resource
Class SkinService
java.lang.Object
org.exoplatform.portal.resource.AbstractResourceService
org.exoplatform.portal.resource.SkinService
- All Implemented Interfaces:
org.picocontainer.Startable
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringprotected static org.exoplatform.services.log.Logstatic final longFields inherited from class org.exoplatform.portal.resource.AbstractResourceService
compressor, contexts, mainResolver -
Constructor Summary
ConstructorsConstructorDescriptionSkinService(org.exoplatform.container.xml.InitParams initParams, org.exoplatform.container.ExoContainerContext context, ResourceCompressor compressor) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCategoryTheme(String categoryName) Add a new category for portlet themes if it does not existvoidaddPortalSkin(String module, String skinName, String cssPath) Add a portal skin with thepriorityis Integer.MAX_VALUE and theoverwriteis false by defaultvoidaddPortalSkin(String module, String skinName, String cssPath, boolean overwrite) Add a portal skin with thepriorityis Integer.MAX_VALUE by defaultvoidaddPortalSkin(String module, String skinName, String cssPath, int priority, boolean overwrite) Register a portal skinvoidaddPortalSkin(String module, String skinName, String cssPath, int priority, boolean overwrite, boolean filtered) Register a portal skinvoidaddPortalSkin(String module, String skinName, String cssPath, jakarta.servlet.ServletContext scontext) Deprecated.voidaddPortalSkin(String module, String skinName, String cssPath, jakarta.servlet.ServletContext scontext, boolean overwrite) Deprecated.useaddPortalSkin(String, String, String, boolean)insteadvoidaddPortalSkin(String module, String skinName, String cssPath, String cssData) Deprecated.This method is not supported anymore.voidAdd a skin with thepriorityis Integer.MAX_VALUE and theoverwriteis false by defaultvoidAdd a portal skin with thepriorityis Integer.MAX_VALUEvoidRegister the Skin for available portal Skins.voidaddSkin(String module, String skinName, String cssPath, int priority, boolean overwrite, List<String> additionalModules) voidDeprecated.useaddSkin(String, String, String)insteadvoidaddSkin(String module, String skinName, String cssPath, jakarta.servlet.ServletContext scontext, boolean overwrite) Deprecated.useaddSkin(String, String, String, boolean)insteadvoidDeprecated.voidaddSkinConfig(SkinConfigPlugin skinConfigPlugin) voidRegistry theme category with its themes for portlet ThemefindSkins(SkinVisitor visitor) Return a collection of SkinConfig based on SkinVisitor provided as the argumentGet names of all the currently registered skins.getCSS(org.exoplatform.web.ControllerContext context, boolean compress) Return the CSS content of the file specified by the given URI.getCustomPortalSkins(String skinName) Return the collection of custom portal skinslonggetLastModified(org.exoplatform.web.ControllerContext context) Returns last modified date of cached css.getMergedCSS(org.exoplatform.web.ControllerContext context, String path) Deprecated.getPortalSkin(String module, String skinName) Return a Portal SkinConfig mapping by the module and skin namegetPortalSkins(String skinName) Return a collection of Portal Skins that its elements are ordered by CSS priorityReturn the map of portlet themesReturn a SkinConfig mapping by the module and skin nameString[]Get all available skinvoidinvalidateCachedSkin(String path) Invalidate skin from the cachevoidinvalidatePortalSkinCache(String portalName, String skinName) Deprecated.the method name is wrong to the behaviour it does.merge(Collection<SkinConfig> skins) Merge several skins into one single skin.merge(Collection<SkinConfig> skins, String id) voidreloadSkin(String skinId) reload skin by skin IDvoidClean cache, reload all SkinsvoidDeprecated.The method name is not clear.voidDeprecated.This is deprecated as its name was not clear.voidremovePortalSkin(String module, String skinName) Remove a Skin from the service as well as its cachevoidremovePortalSkin(SkinKey key) Remove a Skin mapped to thekeyvoidremoveSkin(String module, String skinName) Remove a Skin from the service as well as its cachevoidremoveSkin(SkinKey key) Remove a Skin mapped to thekeyvoidremoveSkins(List<SkinKey> keys) Remove SkinConfig from Portal Skin Config by SkinKeyvoidremoveSupportedSkin(String skinName) Remove Skin from Portal available Skin by skin namebooleanrenderCSS(org.exoplatform.web.ControllerContext context, ResourceRenderer renderer, boolean compress) Render css content of the file specified by the given URIintsize()Return the number of skin config maintaining in this SkinServicevoidstart()Start service.voidstop()Stop service Remove org.exoplatform.portal.resource.GateInSkinConfigDeployer and org.exoplatform.portal.resource.GateInSkinConfigRemoval from ServletContainer.Methods inherited from class org.exoplatform.portal.resource.AbstractResourceService
addResourceResolver, registerContext, unregisterServletContext
-
Field Details
-
log
protected static org.exoplatform.services.log.Log log -
DEFAULT_SKIN_PARAM_NAME
- See Also:
-
CUSTOM_MODULE_ID
- See Also:
-
MAX_AGE
public static final long MAX_AGE
-
-
Constructor Details
-
SkinService
public SkinService(org.exoplatform.container.xml.InitParams initParams, org.exoplatform.container.ExoContainerContext context, ResourceCompressor compressor)
-
-
Method Details
-
addSkinConfig
-
getDefaultSkin
-
addCategoryTheme
Add a new category for portlet themes if it does not exist- Parameters:
categoryName- the category name
-
addPortalSkin
@Deprecated public void addPortalSkin(String module, String skinName, String cssPath, jakarta.servlet.ServletContext scontext) Deprecated.useaddPortalSkin(String, String, String)instead -
addPortalSkin
Add a portal skin with thepriorityis Integer.MAX_VALUE and theoverwriteis false by default- Parameters:
module-skinName-cssPath-
-
addPortalSkin
@Deprecated public void addPortalSkin(String module, String skinName, String cssPath, jakarta.servlet.ServletContext scontext, boolean overwrite) Deprecated.useaddPortalSkin(String, String, String, boolean)instead -
addPortalSkin
Add a portal skin with thepriorityis Integer.MAX_VALUE by default- Parameters:
module-skinName-cssPath-overwrite-
-
addPortalSkin
public void addPortalSkin(String module, String skinName, String cssPath, int priority, boolean overwrite) Register a portal skin- Parameters:
module- skin module identifierskinName- skin namecssPath- path uri to the css file. This is relative to the root context, use leading '/'priority- priority to support sorting in skin listoverwrite- if any previous skin should be replaced by that one
-
addPortalSkin
public void addPortalSkin(String module, String skinName, String cssPath, int priority, boolean overwrite, boolean filtered) Register a portal skin- Parameters:
module- skin module identifierskinName- skin namecssPath- path uri to the css file. This is relative to the root context, use leading '/'priority- priority to support sorting in skin listoverwrite- if any previous skin should be replaced by that onefiltered- if true, then the portal skin will be loaded only when required by a portlet
-
addPortalSkin
@Deprecated public void addPortalSkin(String module, String skinName, String cssPath, String cssData) Deprecated.This method is not supported anymore. The resource resolver pluggability mechanism should be used somehowRegister a portal skin with the specificcssData- Parameters:
module- skin module identifierskinName- skin namecssPath- path uri to the css file. This is relative to the root context, use leading '/'cssData- the content of css
-
addSkin
@Deprecated public void addSkin(String module, String skinName, String cssPath, jakarta.servlet.ServletContext scontext) Deprecated.useaddSkin(String, String, String)instead -
addSkin
Add a skin with thepriorityis Integer.MAX_VALUE and theoverwriteis false by default- Parameters:
module-skinName-cssPath-
-
addSkin
@Deprecated public void addSkin(String module, String skinName, String cssPath, jakarta.servlet.ServletContext scontext, boolean overwrite) Deprecated.useaddSkin(String, String, String, boolean)instead -
addSkin
Add a portal skin with thepriorityis Integer.MAX_VALUE- Parameters:
module-skinName-cssPath-overwrite-
-
addSkin
public void addSkin(String module, String skinName, String cssPath, int priority, boolean overwrite) Register the Skin for available portal Skins. Support priority- Parameters:
module- skin module identifierskinName- skin namecssPath- path uri to the css file. This is relative to the root context, use leading '/'priority- priority to support sorting in skin listoverwrite- if any previous skin should be replaced by that one
-
addSkin
-
addSkin
Deprecated.Register the Skin for available portal Skins. Do not replace existed Skin- Parameters:
module- skin module identifierskinName- skin namecssPath- path uri to the css file. This is relative to the root context, use leading '/'cssData-
-
merge
Merge several skins into one single skin.- Parameters:
skins- the skins to merge- Returns:
- the merged skin
-
merge
-
addTheme
Registry theme category with its themes for portlet Theme- Parameters:
categoryName- category name that will be registriedthemesName- list theme name of categoryName
-
getAvailableSkinNames
Get names of all the currently registered skins.- Returns:
- an unmodifiable Set of the currently registered skins
-
getCSS
Return the CSS content of the file specified by the given URI.- Parameters:
context-compress-- Returns:
- the css contet or null if not found.
-
renderCSS
public boolean renderCSS(org.exoplatform.web.ControllerContext context, ResourceRenderer renderer, boolean compress) throws RenderingException, IOException Render css content of the file specified by the given URI- Parameters:
context-renderer- the webapp'sResourceRenderercompress-- Returns:
trueif theCSS resourceis found and rendered;falseotherwise.- Throws:
RenderingExceptionIOException
-
getMergedCSS
Deprecated.Return CSS data corresponding to thepath- Parameters:
context-path- path uri to the css file- Returns:
- css content of URI file or null if not found
-
getPortalSkins
Return a collection of Portal Skins that its elements are ordered by CSS priority- Parameters:
skinName- name of Portal Skin- Returns:
- all org.exoplatform.portal.resource.SkinConfig of Portal Skin
-
findSkins
Return a collection of SkinConfig based on SkinVisitor provided as the argument- Parameters:
visitor-- Returns:
-
getCustomPortalSkins
Return the collection of custom portal skins- Parameters:
skinName-- Returns:
- the map of custom portal skins
-
getPortletThemes
Return the map of portlet themes- Returns:
- the map of portlet themes
-
getSkin
Return a SkinConfig mapping by the module and skin name- Parameters:
module-skinName-- Returns:
- SkinConfig by SkinKey(module, skinName), or SkinConfig by SkinKey(module, defaultSkin)
-
getPortalSkin
Return a Portal SkinConfig mapping by the module and skin name- Parameters:
module-skinName-- Returns:
- SkinConfig by SkinKey(module, skinName), or SkinConfig by SkinKey(module, SkinService.DEFAULT_SKIN)
-
invalidatePortalSkinCache
Deprecated.the method name is wrong to the behaviour it does. UseremoveSkin(String, String)insteadRemove SkinKey from SkinCache by portalName and skinName- Parameters:
portalName-skinName-
-
invalidateCachedSkin
Invalidate skin from the cache- Parameters:
path- the key
-
getLastModified
public long getLastModified(org.exoplatform.web.ControllerContext context) Returns last modified date of cached css.In development mode, it always returns
Long.MAX_VALUE. Return null if cached css can not be found- Parameters:
context-
-
remove
Deprecated.The method name is not clear. UsingremoveSkin(String, String)instead -
removeSkin
Remove a Skin from the service as well as its cache- Parameters:
module-skinName-
-
removeSkin
Remove a Skin mapped to thekey- Parameters:
key- key whose mapping skin is to be removed from the service
-
removePortalSkin
Remove a Skin from the service as well as its cache- Parameters:
module-skinName-
-
removePortalSkin
Remove a Skin mapped to thekey- Parameters:
key- key whose mapping skin is to be removed from the service
-
remove
Deprecated.This is deprecated as its name was not clear. UseremoveSkins(List)instead- Throws:
Exception
-
removeSkins
Remove SkinConfig from Portal Skin Config by SkinKey- Parameters:
keys- SkinKey list these will be removed
-
removeSupportedSkin
Remove Skin from Portal available Skin by skin name- Parameters:
skinName- name of skin that will be removed
-
size
public int size()Return the number of skin config maintaining in this SkinService- Returns:
- the number of skin config maintaining in this SkinService
-
getSkinList
Get all available skin- Returns:
- all available skin
-
reloadSkins
public void reloadSkins()Clean cache, reload all Skins -
reloadSkin
reload skin by skin ID- Parameters:
skinId- the skin ID that will be reloaded
-
start
public void start()Start service. Registry org.exoplatform.portal.resource.GateInSkinConfigDeployer and org.exoplatform.portal.resource.GateInSkinConfigRemoval into ServletContainer.- Specified by:
startin interfaceorg.picocontainer.Startable- See Also:
-
stop
public void stop()Stop service Remove org.exoplatform.portal.resource.GateInSkinConfigDeployer and org.exoplatform.portal.resource.GateInSkinConfigRemoval from ServletContainer.- Specified by:
stopin interfaceorg.picocontainer.Startable- See Also:
-
addPortalSkin(String, String, String)instead