Package com.volantis.mcs.papi

Examples of com.volantis.mcs.papi.AbstractAnchorAttributes


        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 =
                    protocol.getCanvasAttributes().getInitialFocus();
            if ((initialFocus != null)
                    && (initialFocus.equals(attributes.getId()))) {
                protocol.writeInitialFocus(tabindex);
            }
        }

        return PROCESS_ELEMENT_BODY;
View Full Code Here

TOP

Related Classes of com.volantis.mcs.papi.AbstractAnchorAttributes

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.