Package com.volantis.mcs.context

Examples of com.volantis.mcs.context.MarinerPageContext


     */
    public void elementStart(MarinerRequestContext mrc,
                             AssetGroupAttributes attrs)
     throws RepositoryException {
        
        MarinerPageContext pageContext
            = ContextInternals.getMarinerPageContext (mrc);
       
        pageContext.pushIMDAPIElement(this);

        // Create the base URL builder.
        PolicyFactory factory = PolicyFactory.getDefaultInstance();
        BaseURLPolicyBuilder builder = factory.createBaseURLPolicyBuilder();
        builder.setName(attrs.getName());

        String locationTypeAsString = attrs.getLocationType();
        BaseLocation baseLocation = getBaseLocation(locationTypeAsString);
        builder.setBaseLocation(baseLocation);
        builder.setBaseURL(attrs.getPrefixURL());

        // Add it to the map.
        IMDPolicyFetcher fetcher = pageContext.getPagePolicyFetcher();
        fetcher.addInlinePolicyBuilder(builder);
    }
View Full Code Here


            PAPIAttributes papiAttributes)
            throws PAPIException {

        ScriptAttributes attributes = (ScriptAttributes) papiAttributes;

        MarinerPageContext pageContext
                = ContextInternals.getMarinerPageContext(context);

        VolantisProtocol protocol = pageContext.getProtocol();

        // Check if the Policy x-element.script.supported is set to default, via
        // the supportsScriptType() method of protocol. If so, exercise the same
        // behaviour as before VBM 20080131102 ie. check the "protocol"
        // support and followup check on boolean device policy "javascript".
        if ((protocol.supportsScriptType() == null) ||
             ("default".equals(protocol.supportsScriptType())) ) {

            // Check to see whether the protocol supports java script and the
            // device supports JavaScript, if either don't then skip the body.
            //
            // Note: This functionality is copied directly from the ScriptTag.
            if (!protocol.supportsJavaScript ()
              || !pageContext.getBooleanDevicePolicyValue (SUPPORTS_JAVASCRIPT)) {
               return SKIP_ELEMENT_BODY;
            }

        } else if ("full".equals(protocol.supportsScriptType())) {
            // Scripts are supported in an override due to the, so just check
            // on the device javascript policy to enable it fully. If it's not
            // set then return (SKIP), otherwise carry on. NOTE: Here, where are
            // getting the opinion of the actual device, not an inference derived
            // from the protocol.
            if (!pageContext.getBooleanDevicePolicyValue (SUPPORTS_JAVASCRIPT)) {
               return SKIP_ELEMENT_BODY;
            }
           
        } else {
        // If "none" or other is specified, SKIP this entirely irrespective
        // of any other settings.
               return SKIP_ELEMENT_BODY;
        }

        PolicyReferenceResolver resolver =
                pageContext.getPolicyReferenceResolver();

        // Parse the source expression.
        ScriptAssetReference src
                = resolver.resolveQuotedScriptExpression(attributes.getSrc());

        // Set the attributes used in both modes.
        String id = attributes.getId();
        pattributes.setId(id);
        pattributes.setDefer(attributes.getDefer());

        // @todo this code duplicates the functionality of the protocols Script
        // object. we should refactor it away...
        if (src != null && src.isPolicyReference()) {
            ScriptAsset asset = src.getScriptAsset();
            // If no asset was found then there is nothing more to do.
            if (asset == null) {
                return SKIP_ELEMENT_BODY;
            }

            // If an id was specified then we need to remember whether we found a
            // suitable ScriptAsset, or not.
            if (id != null) {
                pageContext.putIdValue(id, asset);
            }

            pattributes.setScriptReference(src);
            pattributes.setCharSet(asset.getCharacterSet());
            pattributes.setType(asset.getMimeType());
View Full Code Here

     * @param mrc the current request context.
     */
    public void elementEnd(MarinerRequestContext mrc,
                           ScriptAssetAttributes attrs) {
                              
        MarinerPageContext pageContext
            = ContextInternals.getMarinerPageContext (mrc);
       
        pageContext.popIMDAPIElement();
    }
View Full Code Here

        if (!opened) {
            return CONTINUE_PROCESSING;
        }

        MarinerPageContext pageContext
                = ContextInternals.getMarinerPageContext(context);

        VolantisProtocol protocol = pageContext.getProtocol();

        protocol.writeCloseScript(pattributes);

        return CONTINUE_PROCESSING;
    }
View Full Code Here

    private Old2NewConverter converter = new Old2NewConverter();

    void addPolicy(MarinerRequestContext mrc, ComponentContainer container)
            throws RepositoryException {

        MarinerPageContext pageContext
                = ContextInternals.getMarinerPageContext(mrc);

        PolicyBuilder policyBuilder =
                converter.oldContainer2NewPolicyBuilder(container);

        IMDPolicyFetcher fetcher = pageContext.getPagePolicyFetcher();
        fetcher.addInlinePolicyBuilder(policyBuilder);
    }
View Full Code Here

            BlockAttributes blockAttributes)
            throws PAPIException {
        LinkAssetReference expression;
        String value;

        MarinerPageContext pageContext =
                ContextInternals.getMarinerPageContext(context);

        AbstractAnchorAttributes attributes =
                (AbstractAnchorAttributes) blockAttributes;

        // Handle the common base attributes
        transferAttributes(context, attributes, pattributes);

        PolicyReferenceResolver resolver =
                pageContext.getPolicyReferenceResolver();

        // Resolve the href string to a mariner expression
        if ((value = attributes.getHref()) != null) {
            expression = resolver.resolveQuotedLinkExpression(value,
                    PageURLType.ANCHOR);
            pattributes.setHref(expression);
        }

        // Deal with the name attribute.
        String name = attributes.getName();
        String id = attributes.getId();
        // If the name attribute was set...
        if (name != null) {
            // ... and if the id attribute was also set ...
            if (id != null) {
                // .. and if they are not the same,
                if (!name.equals(id)) {
                    // then warn the user we are discarding the name.
                    // MCSPA0081W=Anchor id and name attribute values are
                    logger.warn("anchor-id-name-mismatch",
                            new Object[]{id, name});
                    // Note that id was already set above.
                }
            } else {
                // The id attribute was not set, but name was.
                // So set the id to be the name.
                // NOTE: this is really an ugly hack to recover from the fact
                // that we should never have defined the name attribute in
                // papi. Perhaps we should deprecate it?
                pattributes.setId(name);
            }
        }

        pattributes.setSegment(attributes.getSegment());
        pattributes.setTarget(attributes.getTarget());

        VolantisProtocol protocol = pageContext.getProtocol();
        protocol.writeOpenAnchor(pattributes);

        String tabindex = pattributes.getTabindex();
        if (tabindex != null) {
            String initialFocus =
View Full Code Here

    protected int elementEndImpl(
            MarinerRequestContext context,
            BlockAttributes blockAttributes)
            throws PAPIException {

        MarinerPageContext pageContext =
                ContextInternals.getMarinerPageContext(context);

        VolantisProtocol protocol = pageContext.getProtocol();

        try {
            protocol.writeCloseAnchor(pattributes);
        } catch (ProtocolException e) {
View Full Code Here

        // If no target has been specified then do nothing.
        if (target != null) {

            // We need to find the outermost page context as it is its regions which
            // define the mapping to browser panes.
            MarinerPageContext outermost = context;

         // This code is broken as we now only have a singe pageContext.
         // I could fix it by using the top level dlc but Paul D says not to.
           
         //   while (outermost.getIncludingPageContext() != null) {
         //       outermost = outermost.getIncludingPageContext();
         //   }

            // The value is the name of a region, if the region does not exist then
            // we do not generate a target.
            Region region = outermost.getRegion(target);
            if (region != null) {
                if ((target = region.getDestinationArea()) != null) {
                    goElement.setAttribute("target", target);
                }
            }
View Full Code Here

            skipped = true;
            return SKIP_ELEMENT_BODY;
        }

        // Get the page context.
        MarinerPageContext pageContext
                = ContextInternals.getMarinerPageContext(context);

        // Some XFFormField elements do not have to be inside a form.
        PAPIElement enclosingElement = pageContext.getCurrentElement();
        XFFormElementImpl formElement;
        if (enclosingElement instanceof XFFormElementImpl) {
            formElement = (XFFormElementImpl) enclosingElement;
        } else {
            if (allowedInline) {
                formElement = null;
            } else {
                throw new PAPIException(exceptionLocalizer.format(
                        "element-parent-not-form"));
            }
        }

        // Check to make sure that we are not working inline.
        if (formElement != null) {
            // Get the enclosing form element's attributes.
            formAttributes = formElement.getProtocolAttributes();

            // Get the enclosing form element's descriptor.
            formDescriptor = formElement.getFormDescriptor();

            // If the current form is fragmented then we may not have to output
            // anything for this field in the current fragment but we still need to
            // create its descriptor.
            fieldDescriptor = new FieldDescriptor();
            fieldDescriptor.setName(attributes.getName());
            fieldDescriptor.setInitialValue(getInitialValue(pageContext,
                    attributes));
            fieldDescriptor.setType(getFieldType(attributes));

            // Add the field descriptor to the form's descriptor.
            formDescriptor.addField(fieldDescriptor);
        }

        // Check the panes to see whether we actually have to output anything.
        if (checkPaneInstances(pageContext,
                attributes.getCaptionPane(),
                attributes.getEntryPane()) == SKIP_ELEMENT_BODY) {
            skipped = true;
            return SKIP_ELEMENT_BODY;
        }

        // At this point at least one of the panes will be non null and for those
        // which are non null we need to make sure that they are in the current
        // form fragment (if any). If they are not then we do not want to output
        // anything for this element.
        if ((captionPaneInstance != null
                && !inCurrentFragment(pageContext, captionPaneInstance))
                || (entryPaneInstance != null
                && !inCurrentFragment(pageContext, entryPaneInstance))) {
            skipped = true;
            return SKIP_ELEMENT_BODY;
        }

        // Push this element.
        pageContext.pushElement(this);

        return elementStartImpl(context, attributes);
    }
View Full Code Here

        if (skipped) {
            return CONTINUE_PROCESSING;
        }

        MarinerPageContext pageContext
                = ContextInternals.getMarinerPageContext(context);

        // Pop this element.
        pageContext.popElement(this);

        return elementEndImpl(context, papiAttributes);
    }
View Full Code Here

TOP

Related Classes of com.volantis.mcs.context.MarinerPageContext

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.