Package org.nuxeo.theme.styling.service
Class ThemeStylingServiceImpl
- java.lang.Object
-
- org.nuxeo.runtime.model.DefaultComponent
-
- org.nuxeo.theme.styling.service.ThemeStylingServiceImpl
-
- All Implemented Interfaces:
Adaptable,Component,Extensible,TimestampedService,ThemeStylingService
public class ThemeStylingServiceImpl extends DefaultComponent implements ThemeStylingService
Default implementation for theThemeStylingService- Since:
- 5.5
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.nuxeo.theme.styling.service.ThemeStylingService
ThemeStylingService.PRESET_CATEGORY
-
-
Field Summary
Fields Modifier and Type Field Description protected FlavorRegistryflavorRegprotected NegotiationRegistrynegRegprotected PageRegistrypageRegprotected static StringWR_EX-
Fields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, name
-
Fields inherited from interface org.nuxeo.theme.styling.service.ThemeStylingService
FLAVOR_MARKER, PAGE_STYLE_CLASS_NAME_PREFIX, PAGE_STYLE_NAME_SUFFIX
-
-
Constructor Summary
Constructors Constructor Description ThemeStylingServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactivate(ComponentContext context)Activates the component.protected List<IconDescriptor>computeIcons(FlavorDescriptor flavor, List<String> flavors)protected LogoDescriptorcomputeLogo(FlavorDescriptor flavor, List<String> flavors)protected PalettePreviewcomputePalettePreview(FlavorDescriptor flavor, List<String> flavors)protected List<FlavorPresets>computePresets(FlavorDescriptor flavor, List<String> flavors)StringgetDefaultFlavorName(String themePageName)Returns the default flavor for a given theme pageFlavorDescriptorgetFlavor(String flavorName)Returns the flavor for given name, or null if not found.List<String>getFlavorNames(String themePageName)Returns the flavor names for a given theme pageList<FlavorDescriptor>getFlavors(String themePageName)Returns the flavors for a given theme pageLogoDescriptorgetLogo(String flavorName)Returns the logo configured for given flavor name, and fallbacks on the extends flavor logo if not set.PageDescriptorgetPage(String name)Returns the page for given name.List<PageDescriptor>getPages()Rerurns all pages declared on the service, except the global one named "*".protected Map<String,Map<String,String>>getPresetsByCat(FlavorDescriptor flavor)Map<String,String>getPresetVariables(String flavorName)Returns the map of variable replacements for given flavor.protected ResourceDescriptorgetResourceFromStyle(SimpleStyle style)protected URLgetUrlFromPath(String path, RuntimeContext extensionContext)protected voidmergePage(PageDescriptor page, PageDescriptor globalPage)Stringnegotiate(String target, Object context)Returns the negotiated String value for given target variable.voidregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)protected voidregisterFlavor(FlavorDescriptor flavor, RuntimeContext extensionContext)protected voidregisterResource(Resource resource, RuntimeContext extensionContext)voidunregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)protected voidunregisterResource(Resource resource)-
Methods inherited from class org.nuxeo.runtime.model.DefaultComponent
addRuntimeMessage, addRuntimeMessage, deactivate, getAdapter, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerExtension, setLastModified, setModifiedNow, setName, start, stop, unregister, unregisterExtension
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.nuxeo.runtime.model.Component
applicationStarted, getApplicationStartedOrder
-
-
-
-
Field Detail
-
WR_EX
protected static final String WR_EX
- See Also:
- Constant Field Values
-
pageReg
protected PageRegistry pageReg
-
flavorReg
protected FlavorRegistry flavorReg
-
negReg
protected NegotiationRegistry negReg
-
-
Method Detail
-
activate
public void activate(ComponentContext context)
Description copied from interface:ComponentActivates the component.This method is called by the runtime when a component is activated.
- Specified by:
activatein interfaceComponent- Overrides:
activatein classDefaultComponent- Parameters:
context- the runtime context
-
registerContribution
public void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
- Overrides:
registerContributionin classDefaultComponent
-
unregisterContribution
public void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
- Overrides:
unregisterContributionin classDefaultComponent
-
registerFlavor
protected void registerFlavor(FlavorDescriptor flavor, RuntimeContext extensionContext)
-
computePresets
protected List<FlavorPresets> computePresets(FlavorDescriptor flavor, List<String> flavors)
-
registerResource
protected void registerResource(Resource resource, RuntimeContext extensionContext)
-
unregisterResource
protected void unregisterResource(Resource resource)
-
getResourceFromStyle
protected ResourceDescriptor getResourceFromStyle(SimpleStyle style)
-
getUrlFromPath
protected URL getUrlFromPath(String path, RuntimeContext extensionContext)
-
getDefaultFlavorName
public String getDefaultFlavorName(String themePageName)
Description copied from interface:ThemeStylingServiceReturns the default flavor for a given theme page- Specified by:
getDefaultFlavorNamein interfaceThemeStylingService
-
getFlavor
public FlavorDescriptor getFlavor(String flavorName)
Description copied from interface:ThemeStylingServiceReturns the flavor for given name, or null if not found.If not defined on the local flavor, flavor attributes will be resolved from the extended flavor if any.
- Specified by:
getFlavorin interfaceThemeStylingService
-
getLogo
public LogoDescriptor getLogo(String flavorName)
Description copied from interface:ThemeStylingServiceReturns the logo configured for given flavor name, and fallbacks on the extends flavor logo if not set.- Specified by:
getLogoin interfaceThemeStylingService
-
computeLogo
protected LogoDescriptor computeLogo(FlavorDescriptor flavor, List<String> flavors)
-
computePalettePreview
protected PalettePreview computePalettePreview(FlavorDescriptor flavor, List<String> flavors)
-
computeIcons
protected List<IconDescriptor> computeIcons(FlavorDescriptor flavor, List<String> flavors)
-
getFlavorNames
public List<String> getFlavorNames(String themePageName)
Description copied from interface:ThemeStylingServiceReturns the flavor names for a given theme page- Specified by:
getFlavorNamesin interfaceThemeStylingService
-
getFlavors
public List<FlavorDescriptor> getFlavors(String themePageName)
Description copied from interface:ThemeStylingServiceReturns the flavors for a given theme page- Specified by:
getFlavorsin interfaceThemeStylingService
-
getPresetsByCat
protected Map<String,Map<String,String>> getPresetsByCat(FlavorDescriptor flavor)
-
getPresetVariables
public Map<String,String> getPresetVariables(String flavorName)
Description copied from interface:ThemeStylingServiceReturns the map of variable replacements for given flavor.Returns an empty map if flavor is not resolved.
- Specified by:
getPresetVariablesin interfaceThemeStylingService
-
getPage
public PageDescriptor getPage(String name)
Description copied from interface:ThemeStylingServiceReturns the page for given name.Resources and bundles declared for all pages will also be attached to returned page.
- Specified by:
getPagein interfaceThemeStylingService
-
getPages
public List<PageDescriptor> getPages()
Description copied from interface:ThemeStylingServiceRerurns all pages declared on the service, except the global one named "*".Resources and bundles declared for all pages will also be attached to returned pages.
- Specified by:
getPagesin interfaceThemeStylingService
-
mergePage
protected void mergePage(PageDescriptor page, PageDescriptor globalPage)
-
negotiate
public String negotiate(String target, Object context)
Description copied from interface:ThemeStylingServiceReturns the negotiated String value for given target variable.Context can be dependent on the target variable, depending on how this method is called/used and corresponding negotiator implementations.
- Specified by:
negotiatein interfaceThemeStylingService
-
-