Package net.sf.tacos.markup

Examples of net.sf.tacos.markup.ExtendedMarkupWriterImpl


    @Override
    protected String createComponentTemplate(Flow flow, IRequestCycle cycle, INamespace containerNamespace, Location location) {
        String flowName = flow.getFlowPropertyProviderName();
        StringWriter sw = new StringWriter();
        IExtendedMarkupWriter writer = new ExtendedMarkupWriterImpl(createMarkupWriter(new PrintWriter(sw)));
        //writer.create("span", JWCID, "allFlow@If", "renderTag", "false", "condition", "ognl:visibleFlow").println();
        // 10/15/2007 - TODO Tap bug #? -- there is an issue with the cancel listener being
        // discarded if the flow component is in an external form.
        writer.create("span", JWCID, "inF@If", "renderTag", "false", "condition", OGNL+"insideForm").println();
        writer.createEmpty("span", JWCID, "@RenderBlock", "block", "component:flowBlock");
        writer.end();

        writer.create("span", JWCID, "orF@Else", "renderTag", "false").println();

        // TODO 2007/10/15 -- we should make this stateless form. ... need to embed current flowstate into form.
        writer.create("form", JWCID, flowName + "FlowForm@Form",
                ASYNC, OGNL+ASYNC, "clientValidationEnabled", "true",
                "class", OGNL +"className", "delegate", OGNL + "delegate",
                "cancel", "listener:doCancelForm",
                "refresh", "listener:doRefreshForm",
                "stateful", OGNL +"stateful"
        );
        writer.createEmpty("span", JWCID, "@RenderBlock", "block", "component:flowBlock");
        writer.createEmpty("span", JWCID, "@flow:AttachFlowValidators", "validators", "validators:flow");
        writer.end();

        writer.end();
        writer.println();

        writer.create("span", JWCID, "flowBlock@Block").println();
        writer.create("div", JWCID, VISIBLE_FLOW_IF +
                "@If", "condition", OGNL+"visibleFlow", "renderTag", "false").println();
        int counter = 0;
        for (FlowActivity activity: flow.getActivities()) {
            String componentName = activity.getComponentName();
            // Cannot just look at isPossiblyVisible() because that method also looks for a page name.
            if ( StringUtils.isBlank(componentName)) {
                continue;
            }
            IComponentSpecification specification;
            try {
                componentSpecificationResolver.resolve(cycle, containerNamespace, componentName, location);
                specification = componentSpecificationResolver.getSpecification();
            } catch (ApplicationRuntimeException e) {
                // couldn't find the component :-( ... normal for invisible components.
                // TODO : isn't it better if we just clear the ComponentName?
                ((FlowActivityImplementor)activity).setInvisible(true);
                continue;
            }
            String blockName = FlowWebUtils.getBlockName(activity.getIndex());
            writer.create("div", JWCID, blockName + "@Block").println();
            String flowComponentName = FlowWebUtils.getFlowComponentName(counter);
            writer.createEmpty("div", JWCID, flowComponentName + "@" + componentName);

            HashSet<String> matchedParameters = new HashSet<String>();
            assignFlowParameters(flow, writer, activity, specification, flowComponentName, matchedParameters);
            writer.end();
            writer.println();
            counter++;
        }

        writer.create("div",
                JWCID, FullFlowComponent.FLOW_BORDER_COMPONENT_NAME+"@"+FLOW_BORDER_COMPONENT,
                HIDE_FLOW_CONTROL, OGNL+HIDE_FLOW_CONTROL,
                UPDATE_COMPONENTS, OGNL+UPDATE_COMPONENTS,
                END_LISTENER, OGNL+END_LISTENER,
                CANCEL_LISTENER, OGNL+CANCEL_LISTENER,
                FINISH_LISTENER, OGNL+FINISH_LISTENER,
                ASYNC, OGNL+ASYNC,
                NEXT_LISTENER, OGNL+NEXT_LISTENER,
                PREVIOUS_LISTENER, OGNL+PREVIOUS_LISTENER
        );
        if (debugCondition!=null) {
            writer.attribute(DEBUG, debugCondition);
        }
        if (additionalUpdateComponents!=null) {
            writer.attribute(ADDITIONAL_UPDATE_COMPONENTS, additionalUpdateComponents);
        }
        Set<String> matchedParameters = new HashSet<String>(Arrays.asList(HIDE_FLOW_CONTROL,
                UPDATE_COMPONENTS, END_LISTENER, CANCEL_LISTENER, FINISH_LISTENER, NEXT_LISTENER, PREVIOUS_LISTENER, ASYNC,
                DEBUG, ADDITIONAL_UPDATE_COMPONENTS, "usingLinkSubmit", "disabled"));

        // TODO can we figure out a way to have the IComponentSpecification for FlowBorder to be cached?
        componentSpecificationResolver.resolve(cycle, containerNamespace, FLOW_BORDER_COMPONENT, location);
        IComponentSpecification flowBorderSpecification = componentSpecificationResolver.getSpecification();
        assignFlowParameters(flow, writer, null, flowBorderSpecification, FullFlowComponent.FLOW_BORDER_COMPONENT_NAME, matchedParameters);

        writer.createEmpty("span", JWCID, "@RenderBody").println();
        writer.createEmpty("div", JWCID, "@RenderBlock", "block", OGNL +"currentBlock").println();
        writer.end();
        writer.end();
        writer.println();
        // close the @Block now
        writer.end();
        writer.println();
        // close the if visible
        //writer.end();
        //writer.println();

        String content = sw.toString();
View Full Code Here

TOP

Related Classes of net.sf.tacos.markup.ExtendedMarkupWriterImpl

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.