Package ch.entwine.weblounge.common.content

Examples of ch.entwine.weblounge.common.content.Renderer


      // Flush all input that has been written to the response so far.
      pageContext.getOut().flush();

      // Render the pagelet
      Renderer renderer = null;
      Pagelet pagelet = pagePreview.getPagelets()[index];
      try {
        request.setAttribute(WebloungeRequest.PAGE, page);
        request.setAttribute(WebloungeRequest.PAGELET, pagelet);
        request.setAttribute(WebloungeRequest.COMPOSER, pagePreview);

        pageContext.setAttribute(PagePreviewTagVariables.PAGELET, pagelet);

        if (render) {

          String moduleId = pagelet.getModule();
          String rendererId = pagelet.getIdentifier();

          // Check access rights
          // TODO: Check access
          // Permission p = SystemPermission.READ;
          // if (!pagelet.checkOne(p, user.getRoleClosure()) &&
          // !pagelet.check(p, user)) {
          // logger.debug("Skipping pagelet " + i + " in composer " + composer_
          // +
          // " due to insufficient rights");
          // continue p;
          // }

          // Check publishing dates
          // TODO: Fix this. pagelet.isPublished() currently returns false,
          // as both from and to dates are null (see PublishingCtx)
          // if (!(request.getVersion() == Resource.WORK) &&
          // !pagelet.isPublished()) {
          // logger.debug("Skipping pagelet " + index + " in composer " + stage
          // + " since it is not yet published");
          // return false;
          // }

          // Select the renderer's module
          Module m = site.getModule(moduleId);
          if (m == null) {
            logger.warn("Unable to load renderer '" + rendererId + "' for " + pageUrl + ": module '" + moduleId + "' not found!");
            return false;
          }

          // Load renderer
          renderer = m.getRenderer(rendererId);
          if (renderer == null) {
            logger.warn("No suitable renderer '" + moduleId + "/" + rendererId + "' found to render on " + pageUrl);
            return false;
          }

          // Render pagelet
          try {
            renderer.render(request, response);
            writer.flush();
          } catch (Throwable e) {
            // String params = RequestSupport.getParameters(request);
            String msg = "Error rendering " + renderer + " on " + pageUrl + "'";
            String reason = "";
View Full Code Here


    // Add the search result to the main composer
    logger.trace("Adding search result to composer '{}'", stage);
    for (SearchResultItem item : result.getItems()) {

      Renderer renderer = item.getPreviewRenderer();

      // Is this search result coming from the search index or from a module?
      if (!(item instanceof ResourceSearchResultItem)) {
        renderer = item.getPreviewRenderer();
        if (!(renderer instanceof PageletRenderer)) {
View Full Code Here

  @Override
  public int doEndTag() throws JspException {
    Language language = request.getLanguage();

    // Get renderer and include in request
    Renderer renderer = module.getRenderer(this.rendererId);
    if (renderer != null) {
      try {
        pageContext.getOut().flush();

        // Create the virtual pagelet, define properties and elements
        PageletImpl pagelet = new PageletImpl(module.getIdentifier(), rendererId);
        if (properties != null) {
          for (Map.Entry<String, String> property : properties.entrySet()) {
            pagelet.addProperty(property.getKey(), property.getValue());
          }
        }
        if (elements != null) {
          for (Language l : elements.languages()) {
            for (Map.Entry<String, String> element : elements.get(l).entrySet()) {
              pagelet.setContent(element.getKey(), element.getValue(), language);
            }
          }
        }

        // Finally, render the pagelet
        request.setAttribute(WebloungeRequest.PAGELET, pagelet);
        renderer.render(request, response);
      } catch (Exception e) {
        logger.warn("Unable to render '" + renderer + "': " + e.getMessage());
      } finally {
        request.removeAttribute(WebloungeRequest.PAGELET);
      }
View Full Code Here

TOP

Related Classes of ch.entwine.weblounge.common.content.Renderer

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.