Package com.volantis.mcs.layouts

Examples of com.volantis.mcs.layouts.Segment


     * Tests that attributes are passed through correctly.
     * @throws Exception if an error occurs
     */
    public void testAttributesPassed() throws Exception {
        // Create a segment
        Segment segment = new Segment((MontageLayout) layout);

        segment.setAttribute(FormatConstants.BORDER_COLOUR_ATTRIBUTE, "teal");
        segment.setAttribute(FormatConstants.FRAME_BORDER_ATTRIBUTE, "true");
        segment.setAttribute(FormatConstants.MARGIN_HEIGHT_ATTRIBUTE, "1");
        segment.setAttribute(FormatConstants.MARGIN_WIDTH_ATTRIBUTE, "2");
        // NB: Name attribute is not passed through
        segment.setAttribute(FormatConstants.NAME_ATTRIBUTE, "seggy");
        segment.setAttribute(FormatConstants.SCROLLING_ATTRIBUTE,
                             FormatConstants.SCROLLING_VALUE_YES);
        // NB: Style class should NOT be passed through for segments
        segment.setAttribute(FormatConstants.STYLE_CLASS, "rowIteratorStyle");

        SegmentInstance instance =
                (SegmentInstance) dlContext.getFormatInstance(segment,
                NDimensionalIndex.ZERO_DIMENSIONS);

View Full Code Here


        if (logger.isDebugEnabled()) {
            logger.debug("Default segment name is " + name);
        }

        Segment segment = (Segment)
                deviceLayout.retrieveFormat(name, FormatType.SEGMENT);
        if (segment == null) {
            logger.error("segment-non-existant", new Object[]{name});
            return null;
        }
View Full Code Here

    // javadoc inherited
    public void render(final FormatRendererContext context, final FormatInstance instance)
            throws RendererException {
        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;
View Full Code Here

        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));
        }
View Full Code Here

TOP

Related Classes of com.volantis.mcs.layouts.Segment

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.