Package org.pentaho.platform.api.ui

Examples of org.pentaho.platform.api.ui.Theme


        String themeId = themeNode.getName();
        String themeName = StringUtils.defaultIfEmpty( themeNode.attributeValue( "display-name" ), themeId );
        if ( themeName.startsWith( "${" ) ) {
          themeName = resourceBundle.getString( themeName );
        }
        Theme theme =
            new Theme( themeId, themeName, "content/" + pluginId + "/" + rootThemeFolder + "/" + themeId + "/" );
        theme.setHidden( "true".equals( themeNode.attributeValue( "hidden" ) ) );

        if ( "true".equals( themeNode.attributeValue( "system" ) ) ) {
          moduleThemeInfo.getSystemThemes().add( theme );
        } else {
          moduleThemeInfo.getModuleThemes().add( theme );
        }

        List<Element> resourceList = themeNode.elements();
        for ( Element res : resourceList ) {
          theme.addResource( new ThemeResource( theme, res.getText() ) );
        }

      }
      moduleThemes.put( pluginId, moduleThemeInfo );
    } catch ( Exception e ) {
View Full Code Here


      // Build-up JSON graph for system theme.
      JSONObject root = new JSONObject();
      JSONObject themeObject;

      for ( String systemThemeName : themeManager.getSystemThemeIds() ) {
        Theme theme = themeManager.getSystemTheme( systemThemeName );

        themeObject = new JSONObject();
        root.put( theme.getId(), themeObject );
        themeObject.put( "rootDir", theme.getThemeRootDir() );
        for ( ThemeResource res : theme.getResources() ) {
          themeObject.append( "resources", res.getLocation() );
        }
      }

      out.write( ( "var core_theme_tree = " + root.toString() + ";\n\n" ).getBytes() );
      out.write( "// Inject the theme script to handle the insertion of requested theme resources\n\n".getBytes() );

      ModuleThemeInfo moduleThemeinfo = themeManager.getModuleThemeInfo( moduleName );
      if ( moduleThemeinfo != null ) {
        // Build-up JSON graph for module theme.
        root = new JSONObject();
        for ( Theme theme : moduleThemeinfo.getModuleThemes() ) {
          themeObject = new JSONObject();
          root.put( theme.getName(), themeObject );
          themeObject.put( "rootDir", theme.getThemeRootDir() );
          for ( ThemeResource res : theme.getResources() ) {
            themeObject.append( "resources", res.getLocation() );
          }
        }

        out.write( ( "var module_theme_tree = " + root.toString() + ";\n\n" ).getBytes() );
View Full Code Here

        String themeId = themeNode.getName();
        String themeName = StringUtils.defaultIfEmpty( themeNode.attributeValue( "display-name" ), themeId );
        if ( themeName.startsWith( "${" ) && resourceBundle != null ) {
          themeName = resourceBundle.getString( themeName );
        }
        Theme theme = new Theme( themeId, themeName, pluginId + "/" + rootThemeFolder + "/" + themeId + "/" );
        theme.setHidden( "true".equals( themeNode.attributeValue( "hidden" ) ) );

        if ( "true".equals( themeNode.attributeValue( "system" ) ) ) {
          moduleThemeInfo.getSystemThemes().add( theme );
        } else {
          moduleThemeInfo.getModuleThemes().add( theme );
        }

        List<Element> resourceList = themeNode.elements();
        for ( Element res : resourceList ) {
          theme.addResource( new ThemeResource( theme, res.getText() ) );
        }

      }
      moduleThemes.put( pluginId, moduleThemeInfo );
    } catch ( Exception e ) {
View Full Code Here

    }
    return allThemes;
  }

  public Theme getSystemTheme( String themeId ) {
    Theme theme = (Theme) cache.getFromRegionCache( THEME_CACHE_REGION, SYSTEM_THEMES + "-" + themeId );
    if ( theme == null ) { // may have been flushed, try to fetch it
      theme = collectAllSystemThemes().get( themeId );
      if ( theme == null ) {
        logger.error( "Unable to find requested system theme: " + themeId );
      }
View Full Code Here

  public Theme getModuleTheme( String moduleName, String themeId ) {
    if ( themeId == null ) {
      return null;
    }
    Theme theme = null;
    ModuleThemeInfo moduleThemeInfo =
        (ModuleThemeInfo) cache.getFromRegionCache( THEME_CACHE_REGION, MODULE_THEMES + "-" + moduleName );
    if ( moduleThemeInfo == null ) { // may have been flushed, try to fetch it
      moduleThemeInfo = collectAllModuleThemes().get( moduleName );
      if ( moduleThemeInfo == null ) {
View Full Code Here

        .getUserSetting( "pentaho-user-activeThemeName", PentahoSystem.getSystemSetting( "default-activeThemeName", "onyx" ) )
          .getSettingValue() );
    }

    IThemeManager themeManager = PentahoSystem.get( IThemeManager.class, null );
    Theme theme = themeManager.getSystemTheme( activeThemeName );

    final ServletContext servletContext = (ServletContext) PentahoSystem.getApplicationContext().getContext();
    if ( servletContext != null ) {
      for ( ThemeResource res : theme.getResources() ) {
        if ( res.getLocation().endsWith( ".css" ) ) {
          out.write( ( "<link rel=\"stylesheet\" href=\"" + PentahoSystem.getApplicationContext().getFullyQualifiedServerURL() + theme.getThemeRootDir() + res.getLocation() + "\">" ).getBytes() );
        }
      }
    }

    out.write( "</head>\n<body>\n".getBytes() ); //$NON-NLS-1$
View Full Code Here

TOP

Related Classes of org.pentaho.platform.api.ui.Theme

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.