Package org.flexdock.perspective.persist

Examples of org.flexdock.perspective.persist.PerspectiveModel


* @version $Id: PerspectiveModelSerializer.java,v 1.8 2005-07-06 18:10:48 winnetou25 Exp $
*/
public class PerspectiveModelSerializer implements ISerializer {

    public Element serialize(Document document, Object object) {
        PerspectiveModel perspectiveModel = (PerspectiveModel) object;

        Element perspectiveModelElement = document.createElement(PersistenceConstants.PERSPECTIVE_MODEL_ELEMENT_NAME);

        perspectiveModelElement.setAttribute(PersistenceConstants.PERSPECTIVE_MODEL_ATTRIBUTE_CURRENT_PERSPECTIVE_ID, perspectiveModel.getCurrentPerspective());
        perspectiveModelElement.setAttribute(PersistenceConstants.PERSPECTIVE_MODEL_ATTRIBUTE_DEFAULT_PERSPECTIVE_ID, perspectiveModel.getDefaultPerspective());

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


                perspectives.add(perspective);
            }
        }

        Perspective[] perspectivesArray = (Perspective[]) perspectives.toArray(new Perspective[perspectives.size()]);
        PerspectiveModel perspectiveModel = new PerspectiveModel(defaultPerspectiveId, currentPerspectiveId, perspectivesArray);

        return perspectiveModel;
    }
View Full Code Here

        Perspective[] items = getPerspectives();
        for(int i=0; i<items.length; i++) {
            items[i] = (Perspective)items[i].clone();
        }

        PerspectiveModel info = new PerspectiveModel(m_defaultPerspective, getCurrentPerspectiveName(), items);
        String pKey = persistenceKey==null? m_defaultPersistenceKey: persistenceKey;
        return m_persistHandler.store(pKey, info);
    }
View Full Code Here

    public synchronized boolean load(String persistenceKey) throws IOException, PersistenceException {
        if(m_persistHandler==null)
            return false;

        String pKey = persistenceKey==null? m_defaultPersistenceKey: persistenceKey;
        PerspectiveModel info = m_persistHandler.load(pKey);
        if(info==null)
            return false;

        Perspective[] perspectives = info.getPerspectives();

        m_perspectives.clear();
        for(int i=0; i<perspectives.length; i++) {
            add(perspectives[i]);
        }
        setDefaultPerspective(info.getDefaultPerspective());
        setCurrentPerspectiveName(info.getCurrentPerspective());
        return true;
    }
View Full Code Here

TOP

Related Classes of org.flexdock.perspective.persist.PerspectiveModel

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.