Examples of SegmentAttributes


Examples of com.volantis.mcs.papi.SegmentAttributes

    protected int exprElementEnd(
            MarinerRequestContext context,
            PAPIAttributes papiAttributes)
            throws PAPIException {

        SegmentAttributes attributes
                = (SegmentAttributes) papiAttributes;

        MarinerPageContext pageContext
                = ContextInternals.getMarinerPageContext(context);

        String name = attributes.getName();
        Segment segment = pageContext.getSegment(name);
        if (segment == null) {
            logger.error("segment-not-called", new Object[]{name});
            throw new PAPIException(
                    exceptionLocalizer.format("missing-segment", name));
        }

        SegmentInstance segmentInstance
                = (SegmentInstance) pageContext.getFormatInstance(segment,
                NDimensionalIndex.ZERO_DIMENSIONS);

        // the attribute values should be set on the segment attributes retrieved
        // from the segment instance so that they can be used later.
        com.volantis.mcs.protocols.SegmentAttributes pattributes
                = segmentInstance.getAttributes();

        // Copy the core attributes.
        pattributes.setId(attributes.getId());

        // Copy the other attributes.
        pattributes.setName(name);

        // get the styles for the current element and set it on the MCSAttributes
        pattributes.setStyles(pageContext.getStylingEngine().getStyles());

        PolicyReferenceResolver resolver =
                pageContext.getPolicyReferenceResolver();

        // Resolve the src string to a mariner expression
        LinkAssetReference expression = resolver.resolveQuotedLinkExpression(
                attributes.getSrc(), PageURLType.SEGMENT);
        pattributes.setSrc(expression);

        pattributes.setLongDesc(attributes.getLongDesc());
        pattributes.setTitle(attributes.getTitle());

        return CONTINUE_PROCESSING;
    }
View Full Code Here

Examples of com.volantis.mcs.protocols.SegmentAttributes

        }

        SegmentInstance segmentInstance
                = (SegmentInstance) context.getFormatInstance(segment,
                NDimensionalIndex.ZERO_DIMENSIONS);
        SegmentAttributes attributes = segmentInstance.getAttributes();

        if (attributes == null) {
            logger.error("segment-attributes-missing", new Object[]{name});
            return null;
        }

        LinkAssetReference object = attributes.getSrc();
        if (object == null) {
            logger.error("segment-src-missing", new Object[]{name});
            return null;
        }
View Full Code Here

Examples of com.volantis.mcs.protocols.SegmentAttributes

        try {
            if (!instance.isEmpty()) {
                Segment segment = (Segment)instance.getFormat();
                SegmentInstance segmentInstance = (SegmentInstance) instance;

                SegmentAttributes attributes = segmentInstance.getAttributes();

                if (logger.isDebugEnabled()) {
                    logger.debug("Segment.writeOutput() for "
                                 + attributes.getName());
                }

                String value;
                int ivalue;

                value = (String) segment.getAttribute(
                        FormatConstants.BORDER_COLOUR_ATTRIBUTE);
                attributes.setBorderColor(value);

                value = (String) segment.getAttribute(
                        FormatConstants.FRAME_BORDER_ATTRIBUTE);
                attributes.setFrameBorder("true".equalsIgnoreCase(value));

                value =
                (String)segment.getAttribute(FormatConstants.RESIZE_ATTRIBUTE);
                attributes.setResize("true".equalsIgnoreCase(value));

                value = (String) segment.getAttribute(
                        FormatConstants.SCROLLING_ATTRIBUTE);
                if (value == null ||
                        value.equals(FormatConstants.SCROLLING_VALUE_AUTOMATIC)) {
                    attributes.setScrolling(
                            SegmentAttributes.SCROLLING_AUTOMATIC);
                } else if (value.equals(FormatConstants.SCROLLING_VALUE_NO)) {
                    attributes.setScrolling(SegmentAttributes.SCROLLING_NO);
                } else if (value.equals(FormatConstants.SCROLLING_VALUE_YES)) {
                    attributes.setScrolling(SegmentAttributes.SCROLLING_YES);
                } else {
                    if (logger.isDebugEnabled()) {
                        logger.debug("Unknown scrolling type of " + value);
                    }
                }

                value = (String) segment.getAttribute(
                        FormatConstants.MARGIN_HEIGHT_ATTRIBUTE);
                try {
                    ivalue = Integer.parseInt(value);
                } catch (NumberFormatException nfe) {
                    ivalue = 0;
                }
                attributes.setMarginHeight(ivalue);

                value = (String) segment.getAttribute(
                        FormatConstants.MARGIN_WIDTH_ATTRIBUTE);
                try {
                    ivalue = Integer.parseInt(value);
                } catch (NumberFormatException nfe) {
                    ivalue = 0;
                }
                attributes.setMarginWidth(ivalue);

                // Get the module.
                LayoutModule module = context.getLayoutModule();

                module.writeOpenSegment(attributes);
View Full Code Here

Examples of com.volantis.mcs.protocols.SegmentAttributes

    /**
     * This method tests the method public void writeOpenSegment ( SegmentAttributes )
     * for the com.volantis.mcs.protocols.VolantisProtocol class.
     */
    public void testWriteOpenSegment() throws Exception {
        final SegmentAttributes attributes =
                (SegmentAttributes) ProtocolIntegrationTestHelper.
                provideAttributes(SegmentAttributes.class);

        final VolantisProtocol protocol = getProtocol();

View Full Code Here

Examples of com.volantis.mcs.protocols.SegmentAttributes

    /**
     * Create a new <code>SegmentInstance</code>.
     */
    public SegmentInstance(NDimensionalIndex index) {
        super(index);
        attributes = new SegmentAttributes();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.