InteractionModel.java :  » Testing » jacareto » jacareto » interactionmodel » Java Open Source

Java Open Source » Testing » jacareto 
jacareto » jacareto » interactionmodel » InteractionModel.java
/*
 * Jacareto Copyright (c) 2002-2005
 * Applied Computer Science Research Group, Darmstadt University of
 * Technology, Institute of Mathematics & Computer Science,
 * Ludwigsburg University of Education, and Computer Based
 * Learning Research Group, Aachen University. All rights reserved.
 *
 * Jacareto is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * Jacareto is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with Jacareto; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 */

package jacareto.interactionmodel;


import jacareto.system.Environment;
import jacareto.system.EnvironmentMember;

/**
 * This is a structure that visualize a interaction-model.
 *
 * @author <a href="mailto:markus.bois@web.de">Markus Bois</a>
 * @version 1.02
 */
public class InteractionModel extends EnvironmentMember {
    /** The root element of the interaction-model. */
    private InteractionModelElement rootElement;

    /** The interaction-model tree model. */
    private InteractionModelTreeModel interactionModelTreeModel;

    /**
     * Creates a new interaction-model of the given model.
     *
     * @param env the environment
     * @param rootElement the root of a interaction-model
     */
    public InteractionModel (Environment env, InteractionModelElement rootElement) {
        super(env);
        this.rootElement = rootElement;

        // Vielleicht ein StructerListener mal schauen
        // create the tree model
        interactionModelTreeModel = new InteractionModelTreeModel(env, this);
    }

    /**
     * Returns the root element of the interaction-model.
     *
     * @return DOCUMENT ME!
     */
    public InteractionModelElement getRootElement () {
        return rootElement;
    }

    /**
     * Returns a tree model of the interaction-model.
     *
     * @return DOCUMENT ME!
     */
    public InteractionModelTreeModel getTreeModel () {
        return interactionModelTreeModel;
    }

    /**
     * Clears the interaction-model.
     */
    public void clear () {
        interactionModelTreeModel.clear ();
        rootElement.removeAllChildren ();
    }

    /**
     * Rebuilds the interaction-model.
     *
     * @param rootElement the root element of another interaction-model
     */
    public void rebuild (InteractionModelElement rootElement) {
        clear ();
        this.rootElement = rootElement;
        interactionModelTreeModel.rebuild ();
    }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.