All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.ztemplates.render.script.ZCssProcessor Maven / Gradle / Ivy

Go to download

java web framework - annotations - pojo - NO XML - state-free - clean, technology agnostic urls - REST - invisible to the web-client - JSP, Velocity, FreeMarker (others pluggable) - annotations for JavaScript/CSS dependencies - create reusable components

The newest version!
package org.ztemplates.render.script;

import java.util.List;

import org.ztemplates.web.script.css.ZICssPreprocessor;

public class ZCssProcessor implements ZICssProcessor
{
  private final String contextPath;

  private final String ztemplatesCssUrl;


  public ZCssProcessor(String contextPath)
  {
    super();
    this.contextPath = contextPath;
    this.ztemplatesCssUrl = "/ztemplates.css?ver=" + System.currentTimeMillis();
  }


  public String computeHtmlTags(List cssExposed, ZICssPreprocessor preprocessor) throws Exception
  {
    List preprocessed = preprocessor.preprocessCss(cssExposed);
    StringBuffer sb = new StringBuffer();

    for (String cssPath : cssExposed)
    {
      if (contextPath != null && cssPath.startsWith("/"))
      {
        cssPath = contextPath + cssPath;
      }
      sb.append("");
      sb.append('\n');
    }

    if (contextPath != null)
    {
      String path = contextPath + ztemplatesCssUrl;
      sb.append("\n");
    }
    else
    {
      String path = ztemplatesCssUrl;
      sb.append("\n");
    }

    return sb.toString();
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy