public class ThemeStylingServiceImpl extends DefaultComponent implements ThemeStylingService
ThemeStylingService
ThemeStylingService.PRESET_CATEGORY
Modifier and Type | Field and Description |
---|---|
protected FlavorRegistry |
flavorReg |
protected NegotiationRegistry |
negReg |
protected PageRegistry |
pageReg |
protected static String |
WR_EX |
lastModified
FLAVOR_MARKER, PAGE_STYLE_CLASS_NAME_PREFIX, PAGE_STYLE_NAME_SUFFIX
Constructor and Description |
---|
ThemeStylingServiceImpl() |
Modifier and Type | Method and 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 page
|
FlavorDescriptor |
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 page
|
List<FlavorDescriptor> |
getFlavors(String themePageName)
Returns the flavors for a given theme page
|
LogoDescriptor |
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) |
deactivate, getAdapter, getLastModified, registerExtension, setLastModified, setModifiedNow, start, stop, unregisterExtension
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
applicationStarted, getApplicationStartedOrder
protected static final String WR_EX
protected PageRegistry pageReg
protected FlavorRegistry flavorReg
protected NegotiationRegistry negReg
public ThemeStylingServiceImpl()
public void activate(ComponentContext context)
Component
This method is called by the runtime when a component is activated.
activate
in interface Component
activate
in class DefaultComponent
context
- the runtime contextpublic void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
registerContribution
in class DefaultComponent
public void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
unregisterContribution
in class DefaultComponent
protected void registerFlavor(FlavorDescriptor flavor, RuntimeContext extensionContext)
protected List<FlavorPresets> computePresets(FlavorDescriptor flavor, List<String> flavors)
protected void registerResource(Resource resource, RuntimeContext extensionContext)
protected void unregisterResource(Resource resource)
protected ResourceDescriptor getResourceFromStyle(SimpleStyle style)
protected URL getUrlFromPath(String path, RuntimeContext extensionContext)
public String getDefaultFlavorName(String themePageName)
ThemeStylingService
getDefaultFlavorName
in interface ThemeStylingService
public FlavorDescriptor getFlavor(String flavorName)
ThemeStylingService
If not defined on the local flavor, flavor attributes will be resolved from the extended flavor if any.
getFlavor
in interface ThemeStylingService
public LogoDescriptor getLogo(String flavorName)
ThemeStylingService
getLogo
in interface ThemeStylingService
protected LogoDescriptor computeLogo(FlavorDescriptor flavor, List<String> flavors)
protected PalettePreview computePalettePreview(FlavorDescriptor flavor, List<String> flavors)
protected List<IconDescriptor> computeIcons(FlavorDescriptor flavor, List<String> flavors)
public List<String> getFlavorNames(String themePageName)
ThemeStylingService
getFlavorNames
in interface ThemeStylingService
public List<FlavorDescriptor> getFlavors(String themePageName)
ThemeStylingService
getFlavors
in interface ThemeStylingService
protected Map<String,Map<String,String>> getPresetsByCat(FlavorDescriptor flavor)
public Map<String,String> getPresetVariables(String flavorName)
ThemeStylingService
Returns an empty map if flavor is not resolved.
getPresetVariables
in interface ThemeStylingService
public PageDescriptor getPage(String name)
ThemeStylingService
Resources and bundles declared for all pages will also be attached to returned page.
getPage
in interface ThemeStylingService
public List<PageDescriptor> getPages()
ThemeStylingService
Resources and bundles declared for all pages will also be attached to returned pages.
getPages
in interface ThemeStylingService
protected void mergePage(PageDescriptor page, PageDescriptor globalPage)
public String negotiate(String target, Object context)
ThemeStylingService
Context can be dependent on the target variable, depending on how this method is called/used and corresponding negotiator implementations.
negotiate
in interface ThemeStylingService
Copyright © 2018 Nuxeo. All rights reserved.