Package org.apache.roller.weblogger.business.themes

Examples of org.apache.roller.weblogger.business.themes.ThemeManager


            String[] split = name.split(":", 2);
            if(split.length < 2)
                return last_mod;
           
            // lookup the template from the proper theme
            ThemeManager themeMgr = WebloggerFactory.getWeblogger().getThemeManager();
            Theme theme = themeMgr.getTheme(split[0]);
            ThemeTemplate template = theme.getTemplateByName(split[1]);
           
            if(template == null)
                return last_mod;
           
View Full Code Here


    public Theme getTheme() {
       
        if(theme == null && themeName != null) {
            try {
                ThemeManager themeMgr = WebloggerFactory.getWeblogger().getThemeManager();
                theme = themeMgr.getTheme(themeName);
            } catch(ThemeNotFoundException tnfe) {
                // bogus theme specified ... don't worry about it
            } catch(WebloggerException re) {
                log.error("Error looking up theme "+themeName, re);
            }
View Full Code Here

        return Collections.singletonList(WeblogPermission.ADMIN);
    }
   
   
    public void myPrepare() {
        ThemeManager themeMgr = WebloggerFactory.getWeblogger().getThemeManager();
        setThemes(themeMgr.getEnabledThemesList());
    }
View Full Code Here

            if(WebloggerRuntimeConfig.getBooleanProperty("themes.customtheme.allowed")) {
               
                // do theme import if necessary
                SharedTheme t = null;
                if(isImportTheme() && !StringUtils.isEmpty(getImportThemeId())) try {
                    ThemeManager themeMgr = WebloggerFactory.getWeblogger().getThemeManager();
                    t = themeMgr.getTheme(getImportThemeId());
                    themeMgr.importTheme(getActionWeblog(), t);
                } catch(Exception re) {
                    log.error("Error customizing theme for weblog - "+getActionWeblog().getHandle(), re);
                    // TODO: i18n
                    addError("Error importing theme");
                }
               
                if(!hasActionErrors()) try {
                    weblog.setEditorTheme(WeblogTheme.CUSTOM);
                    log.debug("Saving custom theme for weblog "+weblog.getHandle());
                   
                    // save updated weblog and flush
                    WebloggerFactory.getWeblogger().getWeblogManager().saveWeblog(weblog);
                    WebloggerFactory.getWeblogger().flush();
                   
                    // make sure to flush the page cache so ppl can see the change
                    CacheManager.invalidate(weblog);
                   
                    // TODO: i18n
                    addMessage("Successfully set theme to - "+WeblogTheme.CUSTOM);
                    if (t != null) {
                        addMessage("Successfully copied templates from theme - " + t.getName());
                    }
                   
                    // reset import theme options
                    setImportTheme(false);
                    setImportThemeId(null);
                   
                } catch(WebloggerException re) {
                    log.error("Error saving weblog - "+getActionWeblog().getHandle(), re);
                    addError("Error setting theme");
                }
            } else {
                // TODO: i18n
                addError("Sorry, custom themes are not allowed");
            }
           
        // we are dealing with a shared theme scenario
        } else if("shared".equals(getThemeType())) {
           
            // make sure theme is valid and enabled
            Theme newTheme = null;
            if(getThemeId() == null) {
                // TODO: i18n
                addError("No theme specified");
               
            } else {
                try {
                    ThemeManager themeMgr = WebloggerFactory.getWeblogger().getThemeManager();
                    newTheme = themeMgr.getTheme(getThemeId());
                   
                    if(!newTheme.isEnabled()) {
                        // TODO: i18n
                        addError("Theme not enabled");
                    }
View Full Code Here

        if(!hasActionErrors()) try {
           
            WeblogTemplate stylesheet = getTemplate();
           
            // lookup the theme used by this weblog
            ThemeManager tmgr = WebloggerFactory.getWeblogger().getThemeManager();
            Theme theme = tmgr.getTheme(getActionWeblog().getEditorTheme());
           
            // lookup
            stylesheet.setLastModified(new Date());
            stylesheet.setContents(theme.getStylesheet().getContents());
           
View Full Code Here

        }
    }
   
   
    public List getThemes() {
        ThemeManager themeMgr = WebloggerFactory.getWeblogger().getThemeManager();
        return themeMgr.getEnabledThemesList();
    }
View Full Code Here

    public Theme getTheme() {
       
        if(theme == null && themeName != null) {
            try {
                ThemeManager themeMgr = WebloggerFactory.getWeblogger().getThemeManager();
                theme = themeMgr.getTheme(themeName);
            } catch(ThemeNotFoundException tnfe) {
                // bogus theme specified ... don't worry about it
            } catch(WebloggerException re) {
                log.error("Error looking up theme "+themeName, re);
            }
View Full Code Here

     * Get the Theme object in use by this weblog, or null if no theme selected.
     */
    public WeblogTheme getTheme() {
        try {
            // let the ThemeManager handle it
            ThemeManager themeMgr = WebloggerFactory.getWeblogger().getThemeManager();
            return themeMgr.getTheme(this);
        } catch (WebloggerException ex) {
            log.error("Error getting theme for weblog - "+getHandle(), ex);
        }
       
        // TODO: maybe we should return a default theme in this case?
View Full Code Here

TOP

Related Classes of org.apache.roller.weblogger.business.themes.ThemeManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.