Package org.webmacro.servlet

Examples of org.webmacro.servlet.WebContext


     * @return processed template in a String
     */
    public void doBuild( RunData data ) throws Exception
    {
        /* Get the context needed by WebMacro */
        WebContext context = getContext( data );
        /* Screen results */
        String returnValue = "";

        /*
         * First, generate the screen and put it in the context so
         * we can grab it the layout template.
         */
        ConcreteElement results = ScreenLoader.getInstance()
            .eval(data, data.getScreen());
        if (results != null)
            returnValue = results.toString();

        /* variable for the screen in the layout template */
        context.put("screen_placeholder", returnValue);

        /* variable to reference the navigation screen in the layout template */
        context.put("navigation", new TemplateNavigation( data ));

        /* Grab the layout template set in the WebMacroSitePage.  If null, then
         * use the default layout template (done by the TemplateInfo object)  */
        String templateName = data.getTemplateInfo().getLayoutTemplate();

View Full Code Here


     */
    protected WebContext getContext(RunData data)
    {
        // attempt to get it from the session first.
        // if it doesn't exist, create it and then stuff it into the session
        WebContext wc = (WebContext)data.getTemplateInfo().getTemplateContext(
            WebMacroService.WEBMACRO_CONTEXT);
        if (wc == null)
        {
            wc = TurbineWebMacro.getContext(data);
            data.getTemplateInfo().setTemplateContext(
View Full Code Here

     */
    public void doBuild( RunData data )
        throws Exception
    {
        /* Get the context needed by WebMacro. */
        WebContext context = getContext( data );
        /* Screen results. */
        String returnValue = "";

        /*
         * First, generate the screen and put it in the context so we
         * can grab it the layout template.
         */
        ConcreteElement results = ScreenLoader.getInstance()
            .eval(data, data.getScreen());
        if (results != null)
            returnValue = results.toString();

        /* Variable for the screen in the layout template. */
        context.put("screen_placeholder", returnValue);

        /*
         * Variable to reference the navigation screen in the layout
         * template.
         */
        context.put("navigation", new TemplateNavigation( data ));

        /*
         * Grab the layout template set in the WebMacroSitePage.  If
         * null, then use the default layout template ( done by the
         * TemplateInfo object ).
View Full Code Here

     */
    protected WebContext getContext(RunData data)
    {
        // attempt to get it from the session first.
        // if it doesn't exist, create it and then stuff it into the session
        WebContext wc = (WebContext)data.getTemplateInfo().getTemplateContext(
            WebMacroService.WEBMACRO_CONTEXT);
        if (wc == null)
        {
            wc = TurbineWebMacro.getContext(data);
            data.getTemplateInfo().setTemplateContext(
View Full Code Here

     * @return A ConcreteElement.
     * @exception Exception, a generic exception.
     */
    public ConcreteElement buildTemplate( RunData data ) throws Exception
    {
        WebContext context = getContext(data);

        // This will already be properly set and will not be null
        // because of WebMacroSitePage.
        String templateName = data.getTemplateInfo().getScreenTemplate();

        // Template service adds the leading slash, but make it sure.
        if ((templateName.length() > 0) &&
            (templateName.charAt(0) != '/'))
        {
            templateName = '/' + templateName;
        }

        StringElement output = new StringElement();
        output.setFilterState(false);

        String screenData = null;
        try
        {
            screenData = buildWMTemplate(context, "screens" + templateName);
        }
        catch (Exception e)
        {
            // If there is an error, build a $processingException and
            // attempt to call the error.wm template in the screens
            // directory.
            context.put( "processingException", e.toString() );
            context.put( "stackTrace", StringUtils.stackTrace(e) );
            templateName = TurbineResources.getString(
                "template.error", "/error.wm");
            if ((templateName.length() > 0) &&
                (templateName.charAt(0) != '/'))
            {
View Full Code Here

     */
    public static WebContext getContext(RunData data)
    {
        // Attempt to get it from the session first.  If it doesn't
        // exist, create it and then stuff it into the session.
        WebContext wc = (WebContext)data.getTemplateInfo().getTemplateContext(
            WebMacroService.WEBMACRO_CONTEXT);
        if (wc == null)
        {
            wc = TurbineWebMacro.getContext(data);
            data.getTemplateInfo().setTemplateContext(
View Full Code Here

     * @param data Turbine information.
     * @exception Exception, a generic exception.
     */
    protected void doBuildBeforeAction(RunData data) throws Exception
    {
        WebContext wc_data = TurbineWebMacro.getContext(data);
        data.getTemplateInfo().setTemplateContext(
            WebMacroService.WEBMACRO_CONTEXT, wc_data);
    }
View Full Code Here

     * @exception Exception, a generic exception.
     */
    public ConcreteElement buildTemplate( RunData data )
        throws Exception
    {
        WebContext context = getContext( data );

        String templateName = data.getTemplateInfo().getNavigationTemplate();

        StringElement output = new StringElement();
        output.setFilterState(false);
View Full Code Here

    protected WebContext getContext(RunData data)
    {
        // Attempt to get it from the TemplateInfo first.  If it
        // doesn't exist, create it and then stuff it into the
        // TemplateInfo.
        WebContext wc = (WebContext)data.getTemplateInfo().getTemplateContext(
            WebMacroService.WEBMACRO_CONTEXT);
        if (wc == null)
        {
            wc = TurbineWebMacro.getContext(data);
            data.getTemplateInfo().setTemplateContext(
View Full Code Here

     * @return A ConcreteElement.
     * @exception Exception, a generic exception.
     */
    public ConcreteElement buildTemplate( RunData data ) throws Exception
    {
        WebContext context = getContext(data);

        // This will already be properly set and will not be null
        // because of WebMacroSitePage.
        String templateName = data.getTemplateInfo().getScreenTemplate();

        // Template service adds the leading slash, but make it sure.
        if ((templateName.length() > 0) &&
            (templateName.charAt(0) != '/'))
        {
            templateName = '/' + templateName;
        }

        StringElement output = new StringElement();
        output.setFilterState(false);

        String screenData = null;
        try
        {
            screenData = buildWMTemplate(context, "screens" + templateName);
        }
        catch (Exception e)
        {
            // If there is an error, build a $processingException and
            // attempt to call the error.wm template in the screens
            // directory.
            context.put( "processingException", e.toString() );
            context.put( "stackTrace", StringUtils.stackTrace(e) );
            templateName = TurbineResources.getString(
                "template.error", "/error.wm");
            if ((templateName.length() > 0) &&
                (templateName.charAt(0) != '/'))
            {
View Full Code Here

TOP

Related Classes of org.webmacro.servlet.WebContext

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.