venice
Class CreateVisualizationTreeCommand

java.lang.Object
  |
  +--venice.Command
        |
        +--venice.CreateVisualizationTreeCommand

public class CreateVisualizationTreeCommand
extends Command

Class which creates the visualization tree from the GXL model stored in a ModelStorage. The contents of current Visualization are erased, which may or may not be wanted behaviour.

Author:
Petteri Kamppuri

Field Summary
private  ModelStorage mModel
          Private variable to hold the ModelStorage instance that is needed in various places in the recursive action of this object.
private  Visualization mVisualization
          Private variable to hold the Visualization instance that is needed in various places in the recursive action of this object.
 
Fields inherited from class venice.Command
stAppModule
 
Constructor Summary
CreateVisualizationTreeCommand()
           
 
Method Summary
protected  void addAllModelElements()
          Adds all MElements from ModelStorage to current mVisualization instance.
protected  void addAllRelationships()
          Adds relationships from mModel to mVisualization.
protected  void addModelObjectToVisualizationTree(VPackage inVisualizationPackage, java.lang.Object inModelObject)
          Adds a ModelStorage object and recursively its children to the visualization tree.
 void execute()
          Creates the visualization tree.
 
Methods inherited from class venice.Command
getAppModule, setAppModule
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

mModel

private ModelStorage mModel
Private variable to hold the ModelStorage instance that is needed in various places in the recursive action of this object.

mVisualization

private Visualization mVisualization
Private variable to hold the Visualization instance that is needed in various places in the recursive action of this object.
Constructor Detail

CreateVisualizationTreeCommand

public CreateVisualizationTreeCommand()
Method Detail

execute

public void execute()
Creates the visualization tree. First all MElements are added, after that all relationships are added.
Overrides:
execute in class Command

addAllModelElements

protected void addAllModelElements()
Adds all MElements from ModelStorage to current mVisualization instance. MElements include Components, Interfaces and Packages. Adding is done by iterating the list of all model nodes.

addModelObjectToVisualizationTree

protected void addModelObjectToVisualizationTree(VPackage inVisualizationPackage,
                                                 java.lang.Object inModelObject)
Adds a ModelStorage object and recursively its children to the visualization tree. Each type of object is treated differently. Possible types for inModelObject are MPackage, MComponent and MInterface.
Parameters:
inVisualizationPackage - to what visualization package inModelObject is added
inModelObject - which model object to add

addAllRelationships

protected void addAllRelationships()
Adds relationships from mModel to mVisualization. Relationships are fetched as one big linked list and the list is iterated. For each Object in the list, the method checks if it is an instanceof MRealization, MGeneralization or MDependency. If it is, then a corresponding element is added to the visualization.