Package org.flexdock.perspective

Examples of org.flexdock.perspective.Perspective


    /**
     * {@inheritDoc}
     */
    public Element serialize(Document document, Object object) {
        Perspective perspective = (Perspective) object;

        Element perspectiveElement = document.createElement(PersistenceConstants.PERSPECTIVE_ELEMENT_NAME);
        perspectiveElement.setAttribute(PersistenceConstants.PERSPECTIVE_ATTRIBUTE_ID, perspective.getPersistentId());
        perspectiveElement.setAttribute(PersistenceConstants.PERSPECTIVE_ATTRIBUTE_NAME, perspective.getName());

        ISerializer layoutSerializer = SerializerRegistry.getSerializer(Layout.class);
        Element layoutElement = layoutSerializer.serialize(document, perspective.getLayout());

        perspectiveElement.appendChild(layoutElement);

        ISerializer layoutSequenceSerializer = SerializerRegistry.getSerializer(LayoutSequence.class);
        if (perspective.getInitialSequence() != null) {
            Element layoutSequenceElement = layoutSequenceSerializer.serialize(document, perspective.getInitialSequence());
            perspectiveElement.appendChild(layoutSequenceElement);
        }

        return perspectiveElement;
    }
View Full Code Here


     */
    public Object deserialize(Element element) {
        String perspectiveId = element.getAttribute(PersistenceConstants.PERSPECTIVE_ATTRIBUTE_ID);
        String perspectiveName = element.getAttribute(PersistenceConstants.PERSPECTIVE_ATTRIBUTE_NAME);

        Perspective perspective = new Perspective(perspectiveId, perspectiveName);

        NodeList layoutNodeList = element.getElementsByTagName(PersistenceConstants.LAYOUT_ELEMENT_NAME);
        ISerializer layoutSerializer = SerializerRegistry.getSerializer(Layout.class);
        if (layoutNodeList.getLength() > 0 && layoutNodeList.item(0) instanceof Element) {
            Element layoutElement = (Element) layoutNodeList.item(0);
            Layout layout = (Layout) layoutSerializer.deserialize(layoutElement);
            perspective.setLayout(layout);
        }

        NodeList layoutSequenceNodeList = element.getElementsByTagName(PersistenceConstants.LAYOUT_SEQUENCE_ELEMENT_NAME);
        ISerializer layoutSequenceSerializer = SerializerRegistry.getSerializer(LayoutSequence.class);
        if (layoutSequenceNodeList.getLength() > 0 && layoutSequenceNodeList.item(0) instanceof Element) {
            Element layoutSequenceElement = (Element) layoutSequenceNodeList.item(0);
            LayoutSequence layoutSequence = (LayoutSequence) layoutSequenceSerializer.deserialize(layoutSequenceElement);
            perspective.setInitialSequence(layoutSequence);
        }

        return perspective;
    }
View Full Code Here

        ISerializer perspectiveSerializer = SerializerRegistry.getSerializer(Perspective.class);

        Perspective[] perspectives = perspectiveModel.getPerspectives();
        for (int i = 0; i < perspectives.length; i++) {
            Perspective perspective = perspectives[i];
            Element perspectiveElement = perspectiveSerializer.serialize(document, perspective);
            perspectiveModelElement.appendChild(perspectiveElement);
        }

        return perspectiveModelElement;
View Full Code Here

        ArrayList perspectives = new ArrayList();
        for (int i=0; i<perspectivesList.getLength(); i++) {
            Node node = perspectivesList.item(i);
            if (node instanceof Element) {
                Element perspectiveElement = (Element) node;
                Perspective perspective = (Perspective) perspectiveSerializer.deserialize(perspectiveElement);
                perspectives.add(perspective);
            }
        }

        Perspective[] perspectivesArray = (Perspective[]) perspectives.toArray(new Perspective[perspectives.size()]);
View Full Code Here

                return createPerspective3();
            return null;
        }

        private Perspective createPerspective1() {
            Perspective perspective = new Perspective(P1, "Perspective1");
            LayoutSequence sequence = perspective.getInitialSequence(true);

            sequence.add(MAIN_VIEW);
            sequence.add(BIRD_VIEW, MAIN_VIEW, EAST_REGION, .3f);
            sequence.add(MESSAGE_VIEW, MAIN_VIEW, WEST_REGION, .3f);
            sequence.add(PROBLEM_VIEW, MESSAGE_VIEW);
View Full Code Here

            return perspective;
        }

        private Perspective createPerspective2() {
            Perspective perspective = new Perspective(P2, "Perspective2");
            LayoutSequence sequence = perspective.getInitialSequence(true);

            sequence.add(MAIN_VIEW);
            sequence.add(BIRD_VIEW, MAIN_VIEW, WEST_REGION, .3f);
            sequence.add(MESSAGE_VIEW, BIRD_VIEW, SOUTH_REGION, .5f);
            sequence.add(PROBLEM_VIEW, MESSAGE_VIEW);
View Full Code Here

            return perspective;
        }

        private Perspective createPerspective3() {
            Perspective perspective = new Perspective(P3, "Perspective3");
            LayoutSequence sequence = perspective.getInitialSequence(true);
            sequence.add(MAIN_VIEW);

            return perspective;
        }
View Full Code Here

                return createPerspective3();
            return null;
        }

        private Perspective createPerspective1() {
            Perspective perspective = new Perspective(P1, "Perspective1");
            LayoutSequence sequence = perspective.getInitialSequence(true);

            sequence.add(MAIN_VIEW);
            sequence.add(BIRD_VIEW, MAIN_VIEW, EAST_REGION, .3f);
            sequence.add(MESSAGE_VIEW, MAIN_VIEW, WEST_REGION, .3f);
            sequence.add(PROBLEM_VIEW, MESSAGE_VIEW);
View Full Code Here

            return perspective;
        }

        private Perspective createPerspective2() {
            Perspective perspective = new Perspective(P2, "Perspective2");
            LayoutSequence sequence = perspective.getInitialSequence(true);

            sequence.add(MAIN_VIEW);
            sequence.add(BIRD_VIEW, MAIN_VIEW, WEST_REGION, .3f);
            sequence.add(MESSAGE_VIEW, BIRD_VIEW, SOUTH_REGION, .5f);
            sequence.add(PROBLEM_VIEW, MESSAGE_VIEW);
View Full Code Here

            return perspective;
        }

        private Perspective createPerspective3() {
            Perspective perspective = new Perspective(P3, "Perspective3");
            LayoutSequence sequence = perspective.getInitialSequence(true);
            sequence.add(MAIN_VIEW);

            return perspective;
        }
View Full Code Here

TOP

Related Classes of org.flexdock.perspective.Perspective

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.