Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.theme.themes
Class ThemeManager

java.lang.Object
  extended by org.nuxeo.theme.themes.ThemeManager
All Implemented Interfaces:
Registrable

public final class ThemeManager
extends Object
implements Registrable


Field Summary
static String THEME_REGISTERED_EVENT_ID
           
static String THEME_TOPIC
           
 
Constructor Summary
ThemeManager()
           
 
Method Summary
static boolean belongToSameTheme(Element element1, Element element2)
           
 void clear()
          This method is called when the object is unregistered.
static ThemeDescriptor createCustomTheme(String name)
           
 Layout createLayout()
           
 Style createStyle()
           
static void createThemeDir()
           
 Widget createWidget()
           
static ThemeDescriptor customizeTheme(ThemeDescriptor themeDescriptor)
           
 void deleteFormat(Format format)
           
 void deletePage(String path)
           
 void deleteTheme(String src)
           
static void deleteThemeDescriptor(String src)
           
 void destroyElement(Element element)
           
 Element duplicateElement(Element element, boolean duplicateFormats)
           
 Format duplicateFormat(Format format)
           
 void fillScratchPage(String themeName, Element element)
           
static Format getAncestorFormatOf(Format format)
           
 String getCachedStyles(String themeName, String basePath, String collectionName)
           
static String getCollectionCssMarker()
           
static String getCollectionNameByUrl(URL url)
           
static List<File> getCustomThemeFiles()
           
static String getCustomThemePath(String themeName)
           
static String getDefaultTemplateEngineName()
           
static String getDefaultTheme(String... paths)
           
static String getDefaultTheme(String applicationPath)
           
static Element getElementById(Integer id)
           
static Element getElementById(String id)
           
static Element getElementByUrl(URL url)
           
static EngineType getEngineByUrl(URL url)
           
static Format getFormatById(Integer id)
           
static Format getFormatById(String id)
           
 List<Format> getFormatsByTypeName(String formatTypeName)
           
 Set<String> getFormatTypeNames()
           
 Map<String,Info> getGlobalInfoMap()
           
 byte[] getImageResource(String path)
           
 Long getLastModified(String themeName)
           
 Long getLastModified(URL url)
           
 ModelType getModelByClassname(String className)
           
 Identifiable getNamedObject(String themeName, String realm, String name)
           
 List<Identifiable> getNamedObjects(String themeName, String realm)
           
 List<Style> getNamedStyles(String themeName)
           
 List<String> getOrderedResourcesAndDeps(List<String> resourceNames)
          Returns all the ordered resource names and their dependencies, given a list of resources names.
 PageElement getPageByPath(String path)
           
static String getPageNameFromPagePath(String path)
           
 Set<String> getPageNames(String themeName)
           
static String getPagePathByUrl(URL url)
           
 List<PageElement> getPagesOf(String themeName)
           
static List<PageElement> getPagesOf(ThemeElement theme)
           
static PerspectiveType getPerspectiveByUrl(URL url)
           
 String getResource(String name)
           
static ResourceBank getResourceBank(String name)
           
static List<ResourceBank> getResourceBanks()
           
 List<String> getResourceOrdering()
           
 List<Style> getSortedNamedStyles(String themeName)
           
 List<Style> getStyles()
           
 List<Style> getStyles(String themeName)
           
static TemplateEngineType getTemplateEngineByUrl(URL url)
           
static String getTemplateEngineName(String applicationPath)
           
static List<String> getTemplateEngineNames()
           
 ThemeElement getThemeByName(String name)
           
 ThemeElement getThemeBySrc(String src)
           
 ThemeElement getThemeByUrl(URL url)
           
static ThemeDescriptor getThemeDescriptor(String src)
           
static ThemeDescriptor getThemeDescriptorByThemeName(String themeName)
           
static ThemeDescriptor getThemeDescriptorByThemeName(String templateEngine, String themeName)
           
static List<ThemeDescriptor> getThemeDescriptors()
           
static File getThemeDir()
           
static String getThemeNameByUrl(URL url)
           
 String getThemeNameOfNamedObject(Identifiable object)
           
static Set<String> getThemeNames()
           
static Set<String> getThemeNames(String templateEngine)
           
static ThemeElement getThemeOf(Element element)
           
static ThemeElement getThemeOfFormat(Format format)
           
 PageElement getThemePageByUrl(URL url)
           
 ThemeSet getThemeSetByName(String name)
           
 List<ThemeSet> getThemeSets()
           
static List<String> getUnusedStyleViews(Style style)
           
static String getUrlDescription(URL url)
           
static String getViewModeByUrl(URL url)
           
static List<ViewType> getViewTypesForFragmentType(FragmentType fragmentType)
           
static List<Format> listAncestorFormatsOf(Format format)
           
 List<Format> listFormats()
           
static List<Format> listFormatsDirectlyInheritingFrom(Format format)
           
static void loadRemoteStyle(String resourceBankName, Style style)
           
 void loadTheme(String src)
           
 void loadTheme(String src, String xmlSource)
           
static void loadTheme(ThemeDescriptor themeDescriptor)
           
 void makeElementUseNamedStyle(Element element, String inheritedName, String themeName)
           
 void makeFormatInherit(Format format, Format ancestor)
           
 void registerFormat(Format format)
           
 void registerModelByClassname(ModelType modelType)
           
 void registerPage(ThemeElement theme, PageElement page)
           
 void registerTheme(ThemeElement theme)
           
static void removeInheritanceFrom(Format ancestor)
           
static void removeInheritanceTowards(Format descendant)
           
 void removeNamedObject(String themeName, String realm, String name)
           
 void removeNamedObjects(String themeName)
           
 void removeNamedStylesOf(String themeName)
           
 void removeOrphanedFormats()
           
static String renderElement(URL url)
           
static void repairTheme(ThemeElement theme)
           
static void saveTheme(String src)
           
static void saveTheme(String src, int indent)
           
 void setCachedStyles(String themeName, String basePath, String collectionName, String css)
           
 void setLastModified(String themeName, Long date)
           
 void setNamedObject(String themeName, String realm, Identifiable object)
           
 void setResource(String name, String content)
           
static void setStyleInheritance(String styleName, String ancestorStyleName, String themeName, boolean allowMany)
           
 void stylesModified(String themeName)
           
 void themeModified(String themeName)
           
static ThemeDescriptor uncustomizeTheme(ThemeDescriptor themeDescriptor)
           
 void unregisterFormat(Format format)
           
 void unregisterModelByClassname(ModelType modelType)
           
 void unregisterPage(PageElement page)
           
 void unregisterResourceOrdering(ResourceType resourceType)
           
 void unregisterTheme(ThemeElement theme)
           
 void updateResourceOrdering()
           
static void updateThemeDescriptors()
           
static boolean validateThemeName(String themeName)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

THEME_TOPIC

public static final String THEME_TOPIC
See Also:
Constant Field Values

THEME_REGISTERED_EVENT_ID

public static final String THEME_REGISTERED_EVENT_ID
See Also:
Constant Field Values
Constructor Detail

ThemeManager

public ThemeManager()
Method Detail

createThemeDir

public static void createThemeDir()

getThemeDir

public static File getThemeDir()

clear

public void clear()
Description copied from interface: Registrable
This method is called when the object is unregistered. Clean up local variables here.

Specified by:
clear in interface Registrable

getGlobalInfoMap

public Map<String,Info> getGlobalInfoMap()

validateThemeName

public static boolean validateThemeName(String themeName)

getCustomThemePath

public static String getCustomThemePath(String themeName)
                                 throws ThemeIOException
Throws:
ThemeIOException

getCustomThemeFiles

public static List<File> getCustomThemeFiles()

customizeTheme

public static ThemeDescriptor customizeTheme(ThemeDescriptor themeDescriptor)
                                      throws ThemeException
Throws:
ThemeException

uncustomizeTheme

public static ThemeDescriptor uncustomizeTheme(ThemeDescriptor themeDescriptor)
                                        throws ThemeException
Throws:
ThemeException

createCustomTheme

public static ThemeDescriptor createCustomTheme(String name)
                                         throws ThemeException
Throws:
ThemeException

updateThemeDescriptors

public static void updateThemeDescriptors()

getDefaultTheme

public static String getDefaultTheme(String applicationPath)

getDefaultTheme

public static String getDefaultTheme(String... paths)

getThemeNames

public static Set<String> getThemeNames(String templateEngine)

getThemeDescriptorByThemeName

public static ThemeDescriptor getThemeDescriptorByThemeName(String templateEngine,
                                                            String themeName)

getThemeDescriptorByThemeName

public static ThemeDescriptor getThemeDescriptorByThemeName(String themeName)

getThemeNames

public static Set<String> getThemeNames()

getPageNames

public Set<String> getPageNames(String themeName)

getPagesOf

public static List<PageElement> getPagesOf(ThemeElement theme)

getPagesOf

public List<PageElement> getPagesOf(String themeName)

getThemeOf

public static ThemeElement getThemeOf(Element element)

belongToSameTheme

public static boolean belongToSameTheme(Element element1,
                                        Element element2)

getEngineByUrl

public static EngineType getEngineByUrl(URL url)

getViewModeByUrl

public static String getViewModeByUrl(URL url)

getTemplateEngineByUrl

public static TemplateEngineType getTemplateEngineByUrl(URL url)

getThemeBySrc

public ThemeElement getThemeBySrc(String src)
                           throws ThemeException
Throws:
ThemeException

getThemeByUrl

public ThemeElement getThemeByUrl(URL url)

getThemeNameByUrl

public static String getThemeNameByUrl(URL url)

getPagePathByUrl

public static String getPagePathByUrl(URL url)

getThemePageByUrl

public PageElement getThemePageByUrl(URL url)

getPageByPath

public PageElement getPageByPath(String path)

getPageNameFromPagePath

public static String getPageNameFromPagePath(String path)

getThemeByName

public ThemeElement getThemeByName(String name)

fillScratchPage

public void fillScratchPage(String themeName,
                            Element element)
                     throws NodeException,
                            ThemeException
Throws:
NodeException
ThemeException

getElementByUrl

public static Element getElementByUrl(URL url)

getPerspectiveByUrl

public static PerspectiveType getPerspectiveByUrl(URL url)

getCollectionNameByUrl

public static String getCollectionNameByUrl(URL url)

getUrlDescription

public static String getUrlDescription(URL url)

getNamedObject

public Identifiable getNamedObject(String themeName,
                                   String realm,
                                   String name)

getThemeNameOfNamedObject

public String getThemeNameOfNamedObject(Identifiable object)

setNamedObject

public void setNamedObject(String themeName,
                           String realm,
                           Identifiable object)
                    throws ThemeException
Throws:
ThemeException

getNamedObjects

public List<Identifiable> getNamedObjects(String themeName,
                                          String realm)

removeNamedObject

public void removeNamedObject(String themeName,
                              String realm,
                              String name)

removeNamedObjects

public void removeNamedObjects(String themeName)

makeElementUseNamedStyle

public void makeElementUseNamedStyle(Element element,
                                     String inheritedName,
                                     String themeName)
                              throws ThemeException
Throws:
ThemeException

setStyleInheritance

public static void setStyleInheritance(String styleName,
                                       String ancestorStyleName,
                                       String themeName,
                                       boolean allowMany)
                                throws ThemeException
Throws:
ThemeException

loadRemoteStyle

public static void loadRemoteStyle(String resourceBankName,
                                   Style style)
                            throws ThemeException
Throws:
ThemeException

duplicateElement

public Element duplicateElement(Element element,
                                boolean duplicateFormats)
                         throws ThemeException
Throws:
ThemeException

destroyElement

public void destroyElement(Element element)
                    throws ThemeException,
                           NodeException
Throws:
ThemeException
NodeException

removeNamedStylesOf

public void removeNamedStylesOf(String themeName)
                         throws ThemeException
Throws:
ThemeException

duplicateFormat

public Format duplicateFormat(Format format)
                       throws ThemeException
Throws:
ThemeException

listFormats

public List<Format> listFormats()

registerFormat

public void registerFormat(Format format)
                    throws ThemeException
Throws:
ThemeException

unregisterFormat

public void unregisterFormat(Format format)
                      throws ThemeException
Throws:
ThemeException

getFormatTypeNames

public Set<String> getFormatTypeNames()

getFormatsByTypeName

public List<Format> getFormatsByTypeName(String formatTypeName)

getStyles

public List<Style> getStyles()

getStyles

public List<Style> getStyles(String themeName)

getNamedStyles

public List<Style> getNamedStyles(String themeName)

getSortedNamedStyles

public List<Style> getSortedNamedStyles(String themeName)

getLastModified

public Long getLastModified(String themeName)

setLastModified

public void setLastModified(String themeName,
                            Long date)

getLastModified

public Long getLastModified(URL url)

themeModified

public void themeModified(String themeName)

stylesModified

public void stylesModified(String themeName)

registerTheme

public void registerTheme(ThemeElement theme)

registerPage

public void registerPage(ThemeElement theme,
                         PageElement page)
                  throws NodeException
Throws:
NodeException

unregisterTheme

public void unregisterTheme(ThemeElement theme)

unregisterPage

public void unregisterPage(PageElement page)

loadTheme

public static void loadTheme(ThemeDescriptor themeDescriptor)

loadTheme

public void loadTheme(String src,
                      String xmlSource)
               throws ThemeIOException,
                      ThemeException
Throws:
ThemeIOException
ThemeException

loadTheme

public void loadTheme(String src)
               throws ThemeIOException,
                      ThemeException
Throws:
ThemeIOException
ThemeException

deleteTheme

public void deleteTheme(String src)
                 throws ThemeIOException,
                        ThemeException
Throws:
ThemeIOException
ThemeException

deletePage

public void deletePage(String path)
                throws ThemeIOException,
                       ThemeException
Throws:
ThemeIOException
ThemeException

saveTheme

public static void saveTheme(String src)
                      throws ThemeIOException,
                             ThemeException
Throws:
ThemeIOException
ThemeException

saveTheme

public static void saveTheme(String src,
                             int indent)
                      throws ThemeIOException,
                             ThemeException
Throws:
ThemeIOException
ThemeException

repairTheme

public static void repairTheme(ThemeElement theme)
                        throws ThemeIOException
Throws:
ThemeIOException

renderElement

public static String renderElement(URL url)
                            throws ThemeException
Throws:
ThemeException

removeOrphanedFormats

public void removeOrphanedFormats()
                           throws ThemeException
Throws:
ThemeException

makeFormatInherit

public void makeFormatInherit(Format format,
                              Format ancestor)

removeInheritanceTowards

public static void removeInheritanceTowards(Format descendant)

removeInheritanceFrom

public static void removeInheritanceFrom(Format ancestor)

getAncestorFormatOf

public static Format getAncestorFormatOf(Format format)

listAncestorFormatsOf

public static List<Format> listAncestorFormatsOf(Format format)

listFormatsDirectlyInheritingFrom

public static List<Format> listFormatsDirectlyInheritingFrom(Format format)

deleteFormat

public void deleteFormat(Format format)
                  throws ThemeException
Throws:
ThemeException

getUnusedStyleViews

public static List<String> getUnusedStyleViews(Style style)

getCachedStyles

public String getCachedStyles(String themeName,
                              String basePath,
                              String collectionName)

setCachedStyles

public void setCachedStyles(String themeName,
                            String basePath,
                            String collectionName,
                            String css)

getResource

public String getResource(String name)

setResource

public void setResource(String name,
                        String content)

updateResourceOrdering

public void updateResourceOrdering()

getResourceOrdering

public List<String> getResourceOrdering()

getOrderedResourcesAndDeps

public List<String> getOrderedResourcesAndDeps(List<String> resourceNames)
Returns all the ordered resource names and their dependencies, given a list of resources names.

Parameters:
resourceNames -
Since:
5.4.3

unregisterResourceOrdering

public void unregisterResourceOrdering(ResourceType resourceType)

getImageResource

public byte[] getImageResource(String path)
                        throws ThemeException
Throws:
ThemeException

getViewTypesForFragmentType

public static List<ViewType> getViewTypesForFragmentType(FragmentType fragmentType)

getResourceBank

public static ResourceBank getResourceBank(String name)
                                    throws ThemeException
Throws:
ThemeException

getResourceBanks

public static List<ResourceBank> getResourceBanks()

getThemeDescriptors

public static List<ThemeDescriptor> getThemeDescriptors()

getThemeDescriptor

public static ThemeDescriptor getThemeDescriptor(String src)
                                          throws ThemeException
Throws:
ThemeException

deleteThemeDescriptor

public static void deleteThemeDescriptor(String src)
                                  throws ThemeException
Throws:
ThemeException

getTemplateEngineNames

public static List<String> getTemplateEngineNames()

getTemplateEngineName

public static String getTemplateEngineName(String applicationPath)

getDefaultTemplateEngineName

public static String getDefaultTemplateEngineName()

getElementById

public static Element getElementById(Integer id)

getElementById

public static Element getElementById(String id)

getFormatById

public static Format getFormatById(Integer id)

getFormatById

public static Format getFormatById(String id)

getThemeOfFormat

public static ThemeElement getThemeOfFormat(Format format)

createLayout

public Layout createLayout()

createWidget

public Widget createWidget()

createStyle

public Style createStyle()

registerModelByClassname

public void registerModelByClassname(ModelType modelType)

unregisterModelByClassname

public void unregisterModelByClassname(ModelType modelType)

getModelByClassname

public ModelType getModelByClassname(String className)

getThemeSets

public List<ThemeSet> getThemeSets()

getThemeSetByName

public ThemeSet getThemeSetByName(String name)

getCollectionCssMarker

public static String getCollectionCssMarker()

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.