Package com.volantis.mcs.dissection

Examples of com.volantis.mcs.dissection.DissectableAreaIdentity


        } catch (IllegalStateException ise) {
            fail(DissectionConstants.DISSECTABLE_CONTENTS_ELEMENT +
                    " element not found.");
        }

        DissectableAreaIdentity dissectableAreaIdentity
                = ((DissectableAreaAttributes) el.getAnnotation()).
                getIdentity();
        // check that all the attributes have been written out
        assertEquals("Invalid inclusion path attribute",
                atts.getInclusionPath(),
                dissectableAreaIdentity.getInclusionPath());

        assertEquals("Invalid pane name attribute",
                atts.getDissectingPane().getName(),
                dissectableAreaIdentity.getName());
    }
View Full Code Here


    }

    private DissectableAreaIdentity getDissectableAreaIdentity(Attributes attributes) {
        String name = attributes.getValue("name");
        String inclusionPath = attributes.getValue("inclusionPath");
        return new DissectableAreaIdentity(inclusionPath, name);
    }
View Full Code Here

                // Create a new attributes class.
                DissectableAreaAttributes attrs
                    = new DissectableAreaAttributes();

                // Get the dissectable area identity.
                DissectableAreaIdentity identity
                    = getDissectableAreaIdentity(attributes);

                // Initialise the attributes class.
                attrs.setIdentity(identity);

                // Set the annotation and the type.
                annotation = attrs;
                type = DissectionElementTypes.getDissectableAreaType();

            } else if (localName.equals(KEEP_TOGETHER)) {

                // Create a new attributes class.
                KeepTogetherAttributes attrs
                    = new KeepTogetherAttributes();

                // Initialise the attributes class.
                String after = attributes.getValue("forceBreakAfter");
                String before = attributes.getValue("forceBreakBefore");
                attrs.setForceBreakAfter("true".equalsIgnoreCase(after));
                attrs.setForceBreakBefore("true".equalsIgnoreCase(before));

                // Set the annotation and the type.
                annotation = attrs;
                type = DissectionElementTypes.getKeepTogetherType();

            } else if (localName.equals(SHARD_LINK)) {

                // Create a new attributes class.
                ShardLinkAttributes attrs
                    = new ShardLinkAttributes();

                // Initialise the attributes class.
                String value = attributes.getValue("action");
                ShardLinkAction action;
                if (value.equals("next")) {
                    action = ShardLinkAction.NEXT;
                } else if (value.equals("previous")) {
                    action = ShardLinkAction.PREVIOUS;
                } else {
                    throw new IllegalArgumentException("Unknown action: "
                                                       + value);
                }
                attrs.setAction(action);
                attrs.setUserData(attributes.getValue("userData"));

                annotation = attrs;
                type = DissectionElementTypes.getShardLinkType();

            } else if (localName.equals(SHARD_LINK_GROUP)) {

                // Get the dissectable area identity.
                DissectableAreaIdentity identity
                    = getDissectableAreaIdentity(attributes);

                // Create a new attributes class.
                ShardLinkGroupAttributes attrs
                    = new ShardLinkGroupAttributes();
View Full Code Here

            String inclusionPath,
            Styles styles) {

        ShardLinkGroupAttributes groupAttrs = new ShardLinkGroupAttributes();
        groupAttrs.setDissectableArea(
                new DissectableAreaIdentity(inclusionPath, paneName));
        ShardLinkMenu menu = new ShardLinkMenu(
                createElementDetails(styles), groupAttrs);

        // Return the created menu for the shard links.
        return menu;
View Full Code Here

        // is done by iterating over the dissectable areas looking to see if a
        // shard has been specified for them in the fragmentation state. If no
        // shard has been explicitly set then the first shard is used.
        int count = requestedShards.getCount();
        for (int i = 0; i < count; i += 1) {
            DissectableAreaIdentity identity
                = document.getDissectableAreaIdentity(i);

            // Get the shard index from the fragmentation state. Really we
            // should push the identity into the fragmentation state but for
            // now we will expand it here.
            String inclusionPath = identity.getInclusionPath();
            String name = identity.getName();
            int shardIndex;
            if (fragmentationState == null) {
                shardIndex = 0;
            } else {
                shardIndex = fragmentationState.getShardIndex(inclusionPath,
View Full Code Here

        if (type == null || type == DissectionElementTypes.getPlainElementType()) {
            // set no annotation
        } else if (type == DissectionElementTypes.getDissectableAreaType()) {
            DissectableAreaAttributes annotation = new DissectableAreaAttributes();
            annotation.setIdentity(
                    new DissectableAreaIdentity(
                            element.getAttributeValue(DissectionConstants.INCLUSION_PATH_ATTRIBUTE),
                            element.getAttributeValue(DissectionConstants.DISSECTING_PANE_NAME_ATTRIBUTE)));
            setNodeAnnotation(annotation);
        } else if (type == DissectionElementTypes.getKeepTogetherType()) {
            //todo: implement it
View Full Code Here

        // dissecting pane.
        setDissectionNeeded(true);

        Element element = dom.openElement(DISSECTABLE_CONTENTS_ELEMENT);
        // Set the attributes associated with the dissectable contents.
        DissectableAreaIdentity identity
            = new DissectableAreaIdentity(attributes.getInclusionPath(),
                                          attributes.getDissectingPane()
                                          .getName());
        DissectableAreaAttributes dissectableAttributes
            = new DissectableAreaAttributes();
        dissectableAttributes.setIdentity(identity);
View Full Code Here

        return new SharedContentUsagesImpl(count);
    }

    public static class DissectableAreaIdentityComparator implements Comparator {
        public int compare(Object o1, Object o2) {
            DissectableAreaIdentity i1 = (DissectableAreaIdentity) o1;
            DissectableAreaIdentity i2 = (DissectableAreaIdentity) o2;

            int result;

            if ((result = i1.getName().compareTo(i2.getName())) != 0) {
                return result;
            }

            return ObjectHelper.compare(i1.getInclusionPath(),
                                        i2.getInclusionPath());
        }
View Full Code Here

TOP

Related Classes of com.volantis.mcs.dissection.DissectableAreaIdentity

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.