public class ThemeStylingServiceImpl extends DefaultComponent implements ThemeStylingService
ThemeStylingServiceThemeStylingService.PRESET_CATEGORY| Modifier and Type | Field and Description |
|---|---|
protected FlavorRegistry |
flavorReg |
protected NegotiationRegistry |
negReg |
protected PageRegistry |
pageReg |
protected static String |
WR_EX |
lastModified, nameFLAVOR_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, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerExtension, setLastModified, setModifiedNow, setName, start, stop, unregister, unregisterExtensionclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitapplicationStarted, getApplicationStartedOrderprotected static final String WR_EX
protected PageRegistry pageReg
protected FlavorRegistry flavorReg
protected NegotiationRegistry negReg
public ThemeStylingServiceImpl()
public void activate(ComponentContext context)
ComponentThis method is called by the runtime when a component is activated.
activate in interface Componentactivate in class DefaultComponentcontext - the runtime contextpublic void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
registerContribution in class DefaultComponentpublic void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
unregisterContribution in class DefaultComponentprotected 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)
ThemeStylingServicegetDefaultFlavorName in interface ThemeStylingServicepublic FlavorDescriptor getFlavor(String flavorName)
ThemeStylingServiceIf not defined on the local flavor, flavor attributes will be resolved from the extended flavor if any.
getFlavor in interface ThemeStylingServicepublic LogoDescriptor getLogo(String flavorName)
ThemeStylingServicegetLogo in interface ThemeStylingServiceprotected 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)
ThemeStylingServicegetFlavorNames in interface ThemeStylingServicepublic List<FlavorDescriptor> getFlavors(String themePageName)
ThemeStylingServicegetFlavors in interface ThemeStylingServiceprotected Map<String,Map<String,String>> getPresetsByCat(FlavorDescriptor flavor)
public Map<String,String> getPresetVariables(String flavorName)
ThemeStylingServiceReturns an empty map if flavor is not resolved.
getPresetVariables in interface ThemeStylingServicepublic PageDescriptor getPage(String name)
ThemeStylingServiceResources and bundles declared for all pages will also be attached to returned page.
getPage in interface ThemeStylingServicepublic List<PageDescriptor> getPages()
ThemeStylingServiceResources and bundles declared for all pages will also be attached to returned pages.
getPages in interface ThemeStylingServiceprotected void mergePage(PageDescriptor page, PageDescriptor globalPage)
public String negotiate(String target, Object context)
ThemeStylingServiceContext can be dependent on the target variable, depending on how this method is called/used and corresponding negotiator implementations.
negotiate in interface ThemeStylingServiceCopyright © 2019 Nuxeo. All rights reserved.