Package org.apache.jetspeed.decoration

Examples of org.apache.jetspeed.decoration.Theme


                if (icon == null)
                {
                    icon = "";
                }
                ThemeBean theme = new ThemeBean(decor.getName(), title, icon);               
                Theme pageTheme = (Theme)rc.getRequest().getAttribute("org.apache.jetspeed.theme");
                if (overrideTheme == null)
                  overrideTheme = pageTheme.getPageLayoutDecoration().getName();
                if (overrideTheme.equals(decor.getName()))
                    theme.setSelected(true);
                themes.add(theme);
            }
        }
View Full Code Here


        ContentCacheKey themeContentCacheKey = createCacheKey(context, page.getId());
        CacheElement themeCacheElem = get(themeContentCacheKey);
       
        if (themeCacheElem != null)
        {
            Theme theme = (Theme) themeCacheElem.getContent();
            theme.setInvalidated(true);
        }
    }
View Full Code Here

           
            // enable desktop
            request.setAttribute( JetspeedDesktop.DESKTOP_ENABLED_REQUEST_ATTRIBUTE, Boolean.TRUE );
           
            // get decorations
            Theme theme = decorationFactory.getTheme( page, request );
           
            HeaderResource hr = getHeaderResourceFactory().getHeaderResouce( request );
            JetspeedDesktopContext desktopContext = new JetspeedDesktopContextImpl( request, this.baseUrlAccess, theme, hr, defaultLayoutTemplateExtension );
           
            String layoutTemplateIdPropertyName = null;
            if ( "true".equals( request.getRequest().getParameter( "jsprintmode" ) ) )
                layoutTemplateIdPropertyName = JetspeedDesktopContext.LAYOUT_PRINT_TEMPLATE_ID_PROP;
           
            layoutDecorationTemplatePath = desktopContext.getLayoutTemplatePath( layoutTemplateIdPropertyName );
            layoutDecorationTemplatePathWasAssigned = true;
           
            RequestDispatcher dispatcher = request.getRequest().getRequestDispatcher( layoutDecorationTemplatePath );
           
            hr.dojoEnable();
           
            request.getRequest().setAttribute( JetspeedDesktopContext.DESKTOP_CONTEXT_ATTRIBUTE, desktopContext );
            request.getRequest().setAttribute( JetspeedDesktopContext.DESKTOP_REQUEST_CONTEXT_ATTRIBUTE, request );
            request.getRequest().setAttribute( JetspeedDesktopContext.DESKTOP_COMPONENT_MANAGER_ATTRIBUTE, Jetspeed.getComponentManager() );
           
            String portletDecorationsBasePath = decorationFactory.getPortletDecorationsBasePath();
            String portletDecorationsBaseRelative = portletDecorationsBasePath;
            if ( portletDecorationsBaseRelative != null && portletDecorationsBaseRelative.length() > 1 && portletDecorationsBaseRelative.indexOf( '/' ) == 0 )
            {
                portletDecorationsBaseRelative = portletDecorationsBaseRelative.substring( 1 );
            }
            StringBuffer dojoConfigAddOn = new StringBuffer();
            dojoConfigAddOn.append( "    " ).append( DOJO_CONFIG_LAYOUT_DECORATION_PATH_VAR_NAME ).append( " = \"" ).append( desktopContext.getLayoutBasePath() ).append( "\";" ).append( EOL );
            dojoConfigAddOn.append( "    " ).append( DOJO_CONFIG_LAYOUT_VAR_NAME ).append( " = \"" ).append( desktopContext.getLayoutDecorationName() ).append( "\";" ).append( EOL );
            dojoConfigAddOn.append( "    " ).append( DOJO_CONFIG_PORTLET_DECORATIONS_PATH_VAR_NAME ).append( " = \"" ).append( portletDecorationsBasePath ).append( "\";" ).append( EOL );
            String portletDecorationNamesContent = HeaderResourceLib.makeJSONStringArray( decorationFactory.getDesktopPortletDecorations( request ) );
            dojoConfigAddOn.append( "    " ).append( DOJO_CONFIG_PORTLET_DECORATIONS_ALLOWED_VAR_NAME ).append( " = " ).append( portletDecorationNamesContent ).append( ";" );
            hr.addHeaderSectionFragment( DOJO_CONFIG_LAYOUT_VAR_NAME, HeaderResource.HEADER_SECTION_DOJO_CONFIG, dojoConfigAddOn.toString() );
           
            if ( hr.isHeaderSectionIncluded( HeaderResource.HEADER_SECTION_DESKTOP_STYLE_LAYOUT ) )
            {
                hr.setHeaderSectionType( HeaderResource.HEADER_SECTION_DESKTOP_STYLE_LAYOUT, HeaderResource.HEADER_TYPE_LINK_TAG );
                StringBuffer desktopThemeStyleLink = new StringBuffer();
                int stylesheetCount = 0;
                Iterator stylesheetIter = theme.getStyleSheets().iterator();
                while ( stylesheetIter.hasNext() )
                {
                    String stylesheetHref = (String)stylesheetIter.next();
                    if ( stylesheetHref != null && stylesheetHref.length() > 0 )
                    {
View Full Code Here

                page = retrievePage(requestContext, pageName);
            }
            resultMap.put(STATUS, status);
            resultMap.put(PAGE, page);
           
            Theme theme = (Theme)requestContext.getAttribute(PortalReservedParameters.PAGE_THEME_ATTRIBUTE);
            String pageDecoratorName = null;
            if ( theme != null )
            {
                pageDecoratorName = theme.getPageLayoutDecoration().getName();
            }
            else
            {
                pageDecoratorName = page.getDefaultDecorator( LAYOUT );
            }
View Full Code Here

    }
   
    public void invalidate(RequestContext context)
    {
        String themeCacheKey = createSessionKey(context);
        Theme theme = (Theme)context.getRequest().getSession().getAttribute(themeCacheKey);       
        if (theme != null)
        {
            theme.setInvalidated(true);
        }
    }
View Full Code Here

        ContentCacheKey themeContentCacheKey = createCacheKey(context, page.getId());
        CacheElement themeCacheElem = get(themeContentCacheKey);
       
        if (themeCacheElem != null)
        {
            Theme theme = (Theme) themeCacheElem.getContent();
            theme.setInvalidated(true);
        }
    }
View Full Code Here

           
            // enable desktop
            request.setAttribute( JetspeedDesktop.DESKTOP_ENABLED_REQUEST_ATTRIBUTE, Boolean.TRUE );
           
            // get decorations
            Theme theme = decorationFactory.getTheme( page, request );
           
            HeaderResource hr = getHeaderResourceFactory().getHeaderResouce( request );
            JetspeedDesktopContext desktopContext = new JetspeedDesktopContextImpl( request, this.baseUrlAccess, theme, hr, defaultLayoutTemplateExtension );
           
            String layoutTemplateIdPropertyName = null;
            if ( "true".equals( request.getRequest().getParameter( "jsprintmode" ) ) )
                layoutTemplateIdPropertyName = JetspeedDesktopContext.LAYOUT_PRINT_TEMPLATE_ID_PROP;
           
            layoutDecorationTemplatePath = desktopContext.getLayoutTemplatePath( layoutTemplateIdPropertyName );
            layoutDecorationTemplatePathWasAssigned = true;
           
            RequestDispatcher dispatcher = request.getRequest().getRequestDispatcher( layoutDecorationTemplatePath );
           
            hr.dojoEnable();
           
            request.getRequest().setAttribute( JetspeedDesktopContext.DESKTOP_CONTEXT_ATTRIBUTE, desktopContext );
            request.getRequest().setAttribute( JetspeedDesktopContext.DESKTOP_REQUEST_CONTEXT_ATTRIBUTE, request );
            request.getRequest().setAttribute( JetspeedDesktopContext.DESKTOP_COMPONENT_MANAGER_ATTRIBUTE, Jetspeed.getComponentManager() );
           
            String portletDecorationsBasePath = decorationFactory.getPortletDecorationsBasePath();
            String portletDecorationsBaseRelative = portletDecorationsBasePath;
            if ( portletDecorationsBaseRelative != null && portletDecorationsBaseRelative.length() > 1 && portletDecorationsBaseRelative.indexOf( '/' ) == 0 )
            {
                portletDecorationsBaseRelative = portletDecorationsBaseRelative.substring( 1 );
            }
            StringBuffer dojoConfigAddOn = new StringBuffer();
            dojoConfigAddOn.append( "    " ).append( DOJO_CONFIG_LAYOUT_DECORATION_PATH_VAR_NAME ).append( " = \"" ).append( desktopContext.getLayoutBasePath() ).append( "\";" ).append( EOL );
            dojoConfigAddOn.append( "    " ).append( DOJO_CONFIG_LAYOUT_VAR_NAME ).append( " = \"" ).append( desktopContext.getLayoutDecorationName() ).append( "\";" ).append( EOL );
            dojoConfigAddOn.append( "    " ).append( DOJO_CONFIG_PORTLET_DECORATIONS_PATH_VAR_NAME ).append( " = \"" ).append( portletDecorationsBasePath ).append( "\";" ).append( EOL );
            String portletDecorationNamesContent = HeaderResourceLib.makeJSONStringArray( theme.getPortletDecorationNames() );
            dojoConfigAddOn.append( "    " ).append( DOJO_CONFIG_PORTLET_DECORATIONS_ALLOWED_VAR_NAME ).append( " = " ).append( portletDecorationNamesContent ).append( ";" );
            hr.addHeaderSectionFragment( DOJO_CONFIG_LAYOUT_VAR_NAME, HeaderResource.HEADER_SECTION_DOJO_CONFIG, dojoConfigAddOn.toString() );
           
            if ( hr.isHeaderSectionIncluded( HeaderResource.HEADER_SECTION_DESKTOP_STYLE_LAYOUT ) )
            {
                hr.setHeaderSectionType( HeaderResource.HEADER_SECTION_DESKTOP_STYLE_LAYOUT, HeaderResource.HEADER_TYPE_LINK_TAG );
                StringBuffer desktopThemeStyleLink = new StringBuffer();
                int stylesheetCount = 0;
                Iterator stylesheetIter = theme.getStyleSheets().iterator();
                while ( stylesheetIter.hasNext() )
                {
                    String stylesheetHref = (String)stylesheetIter.next();
                    if ( stylesheetHref != null && stylesheetHref.length() > 0 )
                    {
View Full Code Here

           
            // enable desktop
            request.setAttribute( JetspeedDesktop.DESKTOP_ENABLED_REQUEST_ATTRIBUTE, Boolean.TRUE );
           
            // get decorations
            Theme theme = decorationFactory.getTheme( page, request );
           
            HeaderResource hr = getHeaderResourceFactory().getHeaderResouce( request );
            JetspeedDesktopContext desktopContext = new JetspeedDesktopContextImpl( request, this.baseUrlAccess, theme, hr, defaultLayoutTemplateExtension );
           
            String layoutTemplateIdPropertyName = null;
            if ( "true".equals( request.getRequest().getParameter( "jsprintmode" ) ) )
                layoutTemplateIdPropertyName = JetspeedDesktopContext.LAYOUT_PRINT_TEMPLATE_ID_PROP;
           
            layoutDecorationTemplatePath = desktopContext.getLayoutTemplatePath( layoutTemplateIdPropertyName );
            layoutDecorationTemplatePathWasAssigned = true;
           
            RequestDispatcher dispatcher = request.getRequest().getRequestDispatcher( layoutDecorationTemplatePath );
           
            hr.dojoEnable();
           
            request.getRequest().setAttribute( JetspeedDesktopContext.DESKTOP_CONTEXT_ATTRIBUTE, desktopContext );
            request.getRequest().setAttribute( JetspeedDesktopContext.DESKTOP_REQUEST_CONTEXT_ATTRIBUTE, request );
            request.getRequest().setAttribute( JetspeedDesktopContext.DESKTOP_COMPONENT_MANAGER_ATTRIBUTE, Jetspeed.getComponentManager() );
           
            String layoutDecorationName = desktopContext.getLayoutDecorationName();
            boolean inclStyleLayout = hr.isHeaderSectionIncluded( HeaderResource.HEADER_SECTION_DESKTOP_STYLE_LAYOUT );
            String dojoConfigContentCacheKey = DOJO_CONFIG_LAYOUT_VAR_NAME + "." + layoutDecorationName;
            String dojoConfigContent = getCachedContent( dojoConfigContentCacheKey );
           
            if ( dojoConfigContent == null )
            {
              String portletDecorationsBasePath = decorationFactory.getPortletDecorationsBasePath();
              StringBuffer dojoConfigAddOn = new StringBuffer();
              dojoConfigAddOn.append( "    " ).append( DOJO_CONFIG_LAYOUT_DECORATION_PATH_VAR_NAME ).append( " = \"" ).append( desktopContext.getLayoutBasePath() ).append( "\";" ).append( EOL );
              dojoConfigAddOn.append( "    " ).append( DOJO_CONFIG_LAYOUT_VAR_NAME ).append( " = \"" ).append( layoutDecorationName ).append( "\";" ).append( EOL );
              dojoConfigAddOn.append( "    " ).append( DOJO_CONFIG_PORTLET_DECORATIONS_PATH_VAR_NAME ).append( " = \"" ).append( portletDecorationsBasePath ).append( "\";" ).append( EOL );

              LayoutDecoration desktopLayoutDecoration = decorationFactory.getLayoutDecoration( layoutDecorationName, request );
              if ( desktopLayoutDecoration != null )
              {
                boolean atLeastOneFound = false;
                StringBuffer loadingPropsBuffer = new StringBuffer();
                  loadingPropsBuffer.append( "    " ).append( DOJO_CONFIG_LOADING_IMGPROPS_NAME ).append( " = { " );
                  for ( int i = 0 ; i < DESKTOP_LOADING_PROPERTY_NAMES.length ; i++ )
                  {
                      String propValue = desktopLayoutDecoration.getProperty( DESKTOP_LOADING_IMG_NAME_PREFIX + DESKTOP_LOADING_PROPERTY_NAMES[ i ] );
                      if ( propValue != null )
                      {
                          if ( atLeastOneFound )
                          {
                              loadingPropsBuffer.append( ", " );
                          }
                          else
                          {
                            atLeastOneFound = true;
                          }
                          String usePropertyName = DESKTOP_LOADING_PROPERTY_NAMES[ i ];
                          if ( DESKTOP_LOADING_OUTPUT_PROPERTY_NAMES != null && DESKTOP_LOADING_OUTPUT_PROPERTY_NAMES.length > i && DESKTOP_LOADING_OUTPUT_PROPERTY_NAMES[i] != null )
                            usePropertyName = DESKTOP_LOADING_OUTPUT_PROPERTY_NAMES[i];
                           
                          loadingPropsBuffer.append( usePropertyName ).append( ": " ).append( propValue );
                      }
                  }
                  loadingPropsBuffer.append( " };" );
                  if ( atLeastOneFound )
                    dojoConfigAddOn.append( loadingPropsBuffer.toString() ).append( EOL );
                 
                  addPageEditorSettings( dojoConfigAddOn, desktopLayoutDecoration );
              }
              else
              {
                log.error( "Failed to find desktop layout decoration " + layoutDecorationName + " - layout decoration properties cannot be added to content." );
              }
             
              Set desktopPortletDecorationsNames = decorationFactory.getDesktopPortletDecorations( request );
              String portletDecorationNamesContent = HeaderResourceLib.makeJSONStringArray( desktopPortletDecorationsNames );
              dojoConfigAddOn.append( "    " ).append( DOJO_CONFIG_PORTLET_DECORATIONS_ALLOWED_VAR_NAME ).append( " = " ).append( portletDecorationNamesContent ).append( ";" );

              StringBuffer pDecsOut = new StringBuffer();
              Iterator desktopPortletDecorationsNamesIter = desktopPortletDecorationsNames.iterator();
              while ( desktopPortletDecorationsNamesIter.hasNext() )
              {
                  String desktopPortletDecorationName = (String)desktopPortletDecorationsNamesIter.next();
             
                  PortletDecoration desktopPortletDecoration = decorationFactory.getPortletDecoration( desktopPortletDecorationName, request );
                 
                  StringBuffer pOut = new StringBuffer();
                 
                  String actionButtonOrderContent = desktopPortletDecoration.getProperty( HeaderResource.HEADER_CONFIG_DESKTOP_WINDOW_ACTION_BUTTON_ORDER );
                  if ( actionButtonOrderContent != null && actionButtonOrderContent.length() > 0 )
                  {
                      pOut.append( ( pOut.length() > 0 ) ? ", " : "" ).append( HeaderResource.DESKTOP_JSON_WINDOW_ACTION_BUTTON_ORDER ).append( ": " ).append( actionButtonOrderContent );
                  }
                 
                  String actionNoImageContent = desktopPortletDecoration.getProperty( HeaderResource.HEADER_CONFIG_DESKTOP_WINDOW_ACTION_NOIMAGE );
                  if ( actionNoImageContent != null && actionNoImageContent.length() > 0 )
                  {
                    pOut.append( ( pOut.length() > 0 ) ? ", " : "" ).append( HeaderResource.DESKTOP_JSON_WINDOW_ACTION_NOIMAGE ).append( ": " ).append( actionNoImageContent );
                  }
                 
                  String actionMenuOrderContent = desktopPortletDecoration.getProperty( HeaderResource.HEADER_CONFIG_DESKTOP_WINDOW_ACTION_MENU_ORDER );
                  if ( actionMenuOrderContent != null && actionMenuOrderContent.length() > 0 )
                  {
                    pOut.append( ( pOut.length() > 0 ) ? ", " : "" ).append( HeaderResource.DESKTOP_JSON_WINDOW_ACTION_MENU_ORDER ).append( ": " ).append( actionMenuOrderContent );
                  }
                 
                  String windowActionButtonTooltip = desktopPortletDecoration.getProperty( HeaderResource.HEADER_CONFIG_DESKTOP_WINDOW_ACTION_BUTTON_TOOLTIP );
                  if ( windowActionButtonTooltip != null && windowActionButtonTooltip.length() > 0 )
                  {
                      pOut.append( ( pOut.length() > 0 ) ? ", " : "" ).append( HeaderResource.DESKTOP_JSON_WINDOW_ACTION_BUTTON_TOOLTIP ).append( ": " ).append( windowActionButtonTooltip );
                  }

                  String windowActionButtonMax = desktopPortletDecoration.getProperty( HeaderResource.HEADER_CONFIG_DESKTOP_WINDOW_ACTION_BUTTON_MAX );
                  if ( windowActionButtonMax != null && windowActionButtonMax.length() > 0 )
                  {
                      pOut.append( ( pOut.length() > 0 ) ? ", " : "" ).append( HeaderResource.DESKTOP_JSON_WINDOW_ACTION_BUTTON_MAX ).append( ": " ).append( windowActionButtonMax );
                  }
                 
                  String iconEnabledContent = desktopPortletDecoration.getProperty( HeaderResource.HEADER_CONFIG_DESKTOP_WINDOW_ICON_ENABLED );
                  if ( iconEnabledContent != null && iconEnabledContent.length() > 0 )
                  {
                    pOut.append( ( pOut.length() > 0 ) ? ", " : "" ).append( HeaderResource.DESKTOP_JSON_WINDOW_ICON_ENABLED ).append( ": " ).append( iconEnabledContent );
                  }
                 
                  String iconPathContent = desktopPortletDecoration.getProperty( HeaderResource.HEADER_CONFIG_DESKTOP_WINDOW_ICON_PATH );
                  if ( iconPathContent != null && iconPathContent.length() > 0 )
                  {
                    pOut.append( ( pOut.length() > 0 ) ? ", " : "" ).append( HeaderResource.DESKTOP_JSON_WINDOW_ICON_PATH ).append( ": " ).append( iconPathContent ).append( ";" ).append( EOL );
                  }
                 
                  String titlebarEnabledContent = desktopPortletDecoration.getProperty( HeaderResource.HEADER_CONFIG_DESKTOP_WINDOW_TITLEBAR_ENABLED );
                  if ( titlebarEnabledContent != null && titlebarEnabledContent.length() > 0 )
                  {
                    pOut.append( ( pOut.length() > 0 ) ? ", " : "" ).append( HeaderResource.DESKTOP_JSON_WINDOW_TITLEBAR_ENABLED ).append( ": " ).append( titlebarEnabledContent );
                  }
                 
                  String resizebarEnabledContent = desktopPortletDecoration.getProperty( HeaderResource.HEADER_CONFIG_DESKTOP_WINDOW_RESIZEBAR_ENABLED );
                  if ( resizebarEnabledContent != null && resizebarEnabledContent.length() > 0 )
                  {
                    pOut.append( ( pOut.length() > 0 ) ? ", " : "" ).append( HeaderResource.DESKTOP_JSON_WINDOW_RESIZEBAR_ENABLED ).append( ": " ).append( resizebarEnabledContent );
                  }
                 
                  if ( pOut.length() > 0 )
                  {
                    if ( pDecsOut.length() == 0 )
                    {
                      pDecsOut.append( DOJO_CONFIG_PORTLET_DECORATIONS_CONFIG_VAR_NAME ).append( " = { " );
                    }
                    else
                    {
                      pDecsOut.append( ", " );
                    }
                    pDecsOut.append( "\"" ).append( desktopPortletDecorationName ).append( "\": { " ).append( pOut.toString() ).append( " }" ).append( EOL );
                  }
              }   // while ( desktopPortletDecorationsNamesIter.hasNext() )
              if ( pDecsOut.length() > 0 )
              {
                pDecsOut.append( " }" );
                dojoConfigAddOn.append( EOL ).append( "    " ).append( pDecsOut.toString() ).append( ";" );
              }
             
              dojoConfigContent = dojoConfigAddOn.toString();
              setCachedContent( dojoConfigContentCacheKey, dojoConfigContent );               
            }           
           
            if ( dojoConfigContent != null )
            {
              hr.addHeaderSectionFragment( DOJO_CONFIG_LAYOUT_VAR_NAME, HeaderResource.HEADER_SECTION_DOJO_CONFIG, dojoConfigContent );
            }
           
            if ( inclStyleLayout )
            {
              String contextPath = request.getRequest().getContextPath();
              String styleLayoutContentCacheKey = (HeaderResource.HEADER_SECTION_DESKTOP_STYLE_LAYOUT + "." + layoutDecorationName + "." + contextPath);
              String styleLayoutContent = getCachedContent( styleLayoutContentCacheKey );
              if ( styleLayoutContent == null )
                {
                String portletDecorationsBasePath = decorationFactory.getPortletDecorationsBasePath();
                  String portletDecorationsBaseRelative = portletDecorationsBasePath;
                  if ( portletDecorationsBaseRelative != null && portletDecorationsBaseRelative.length() > 1 && portletDecorationsBaseRelative.indexOf( '/' ) == 0 )
                  {
                      portletDecorationsBaseRelative = portletDecorationsBaseRelative.substring( 1 );
                  }
                  StringBuffer desktopThemeStyleLink = new StringBuffer();
                 
                  int stylesheetCount = 0;
                  Iterator stylesheetIter = theme.getStyleSheets().iterator();
                  while ( stylesheetIter.hasNext() )
                  {
                      String stylesheetHref = (String)stylesheetIter.next();
                      if ( stylesheetHref != null && stylesheetHref.length() > 0 )
                      {
View Full Code Here

                page = retrievePage( requestContext, pageName );
            }
            resultMap.put( STATUS, status );
            resultMap.put( PAGE, page );
           
            Theme theme = (Theme)requestContext.getAttribute( PortalReservedParameters.PAGE_THEME_ATTRIBUTE );
            String pageDecoratorName = null;
            if ( theme != null )
            {
                pageDecoratorName = theme.getPageLayoutDecoration().getName();
            }
            else
            {
                pageDecoratorName = page.getDefaultDecorator( LAYOUT );
            }
View Full Code Here

    }
   
    public void invalidate(RequestContext context)
    {
        String themeCacheKey = createSessionKey(context);
        Theme theme = (Theme)context.getRequest().getSession().getAttribute(themeCacheKey);       
        if (theme != null)
        {
            theme.setInvalidated(true);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.decoration.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.