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 FlavorRegistry
flavorReg
protected NegotiationRegistry
negReg
protected PageRegistry
pageReg
protected static String
WR_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 void
activate(ComponentContext context)
Activates the component.protected List<IconDescriptor>
computeIcons(FlavorDescriptor flavor, List<String> flavors)
protected LogoDescriptor
computeLogo(FlavorDescriptor flavor, List<String> flavors)
protected PalettePreview
computePalettePreview(FlavorDescriptor flavor, List<String> flavors)
protected List<FlavorPresets>
computePresets(FlavorDescriptor flavor, List<String> flavors)
String
getDefaultFlavorName(String themePageName)
Returns the default flavor for a given theme pageFlavorDescriptor
getFlavor(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 pageLogoDescriptor
getLogo(String flavorName)
Returns the logo configured for given flavor name, and fallbacks on the extends flavor logo if not set.PageDescriptor
getPage(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 ResourceDescriptor
getResourceFromStyle(SimpleStyle style)
protected URL
getUrlFromPath(String path, RuntimeContext extensionContext)
protected void
mergePage(PageDescriptor page, PageDescriptor globalPage)
String
negotiate(String target, Object context)
Returns the negotiated String value for given target variable.void
registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
protected void
registerFlavor(FlavorDescriptor flavor, RuntimeContext extensionContext)
protected void
registerResource(Resource resource, RuntimeContext extensionContext)
void
unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
protected void
unregisterResource(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:Component
Activates the component.This method is called by the runtime when a component is activated.
- Specified by:
activate
in interfaceComponent
- Overrides:
activate
in classDefaultComponent
- Parameters:
context
- the runtime context
-
registerContribution
public void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
- Overrides:
registerContribution
in classDefaultComponent
-
unregisterContribution
public void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
- Overrides:
unregisterContribution
in 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:ThemeStylingService
Returns the default flavor for a given theme page- Specified by:
getDefaultFlavorName
in interfaceThemeStylingService
-
getFlavor
public FlavorDescriptor getFlavor(String flavorName)
Description copied from interface:ThemeStylingService
Returns 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:
getFlavor
in interfaceThemeStylingService
-
getLogo
public LogoDescriptor getLogo(String flavorName)
Description copied from interface:ThemeStylingService
Returns the logo configured for given flavor name, and fallbacks on the extends flavor logo if not set.- Specified by:
getLogo
in 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:ThemeStylingService
Returns the flavor names for a given theme page- Specified by:
getFlavorNames
in interfaceThemeStylingService
-
getFlavors
public List<FlavorDescriptor> getFlavors(String themePageName)
Description copied from interface:ThemeStylingService
Returns the flavors for a given theme page- Specified by:
getFlavors
in interfaceThemeStylingService
-
getPresetsByCat
protected Map<String,Map<String,String>> getPresetsByCat(FlavorDescriptor flavor)
-
getPresetVariables
public Map<String,String> getPresetVariables(String flavorName)
Description copied from interface:ThemeStylingService
Returns the map of variable replacements for given flavor.Returns an empty map if flavor is not resolved.
- Specified by:
getPresetVariables
in interfaceThemeStylingService
-
getPage
public PageDescriptor getPage(String name)
Description copied from interface:ThemeStylingService
Returns the page for given name.Resources and bundles declared for all pages will also be attached to returned page.
- Specified by:
getPage
in interfaceThemeStylingService
-
getPages
public List<PageDescriptor> getPages()
Description copied from interface:ThemeStylingService
Rerurns 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:
getPages
in interfaceThemeStylingService
-
mergePage
protected void mergePage(PageDescriptor page, PageDescriptor globalPage)
-
negotiate
public String negotiate(String target, Object context)
Description copied from interface:ThemeStylingService
Returns 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:
negotiate
in interfaceThemeStylingService
-
-