Package org.apache.velocity.tools

Examples of org.apache.velocity.tools.ToolContext


    if (!(velocityContext instanceof ToolContext)) {
      return;
    }

    ToolContext ctxt = (ToolContext) velocityContext;
   
    // get the output encoding
    Object outputEncodingObj = ctxt.get("outputEncoding");
    if (outputEncodingObj instanceof String) {
      this.outputEncoding = (String) outputEncodingObj;
    }
  }
View Full Code Here


    if (!(velocityContext instanceof ToolContext)) {
      return;
    }

    ToolContext ctxt = (ToolContext) velocityContext;
   
    Object projectObj = ctxt.get("project");
    if (projectObj instanceof MavenProject) {
      MavenProject project = (MavenProject) projectObj;
      String artifactId = project.getArtifactId();
      // use artifactId "sluggified" as the projectId
      projectId = HtmlTool.slug(artifactId);
    }
   
    // calculate the page ID from the current file name
    Object currentFileObj = ctxt.get("currentFileName");
    if (currentFileObj instanceof String) {

      String currentFile = (String) currentFileObj;

      // drop the extension
      int lastDot = currentFile.lastIndexOf(".");
      if (lastDot >= 0) {
        currentFile = currentFile.substring(0, lastDot);
      }
     
      // get the short ID (in case of nested files)
//      String fileName = new File(currentFile).getName();
//      fileShortId = HtmlTool.slug(fileName);
     
      // full file ID includes the nested dirs
      // replace nesting "/" with "-"
      fileId = HtmlTool.slug(currentFile.replace("/", "-").replace("\\", "-"));
    }
   
    Object decorationObj = ctxt.get("decoration");

    if (!(decorationObj instanceof DecorationModel)) {
      return;
    }
View Full Code Here

    }

    @Override
    public ToolContext createContext(Map<String,Object> toolProps)
    {
        ToolContext context = super.createContext(toolProps);
        context.putToolProperty(ViewContext.SERVLET_CONTEXT_KEY, servletContext);
        debug("Non-ViewToolContext was requested from ViewToolManager.");
        return context;
    }
View Full Code Here

    }

    @Override
    public ToolContext createContext(Map<String,Object> toolProps)
    {
        ToolContext context = super.createContext(toolProps);
        context.putToolProperty(ViewContext.SERVLET_CONTEXT_KEY, servletContext);
        debug("Non-ViewToolContext was requested from ViewToolManager.");
        return context;
    }
View Full Code Here

TOP

Related Classes of org.apache.velocity.tools.ToolContext

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.