internal T addOwnedElement <T>(String name) where T : class, UML.Classes.Kernel.Element { System.Type type = typeof(T); ADL.Construct newConstruct = null; if (type == typeof(UML.Classes.Kernel.Class)) { newConstruct = new TSF.UmlCanvas.Class(); } else if (type == typeof(UML.Classes.Interfaces.Interface)) { newConstruct = new TSF.UmlCanvas.Interface(); } else if (type == typeof(UML.Classes.Kernel.Generalization)) { return(((Factory)this.model.factory).createNewGeneralization(this) as T); } else if (type == typeof(UML.Classes.Interfaces.InterfaceRealization)) { return(((Factory)this.model.factory).createInterfaceRealization(this) as T); } else if (type == typeof(UML.Classes.Kernel.Parameter)) { newConstruct = new TSF.UmlCanvas.Argument(); } else if (type == typeof(UML.Classes.Kernel.Operation)) { newConstruct = new TSF.UmlCanvas.Operation(); } else if (type == typeof(UML.Classes.Kernel.Property)) { newConstruct = this.createNewProperty(); } else if (type == typeof(UML.Classes.Kernel.Association)) { newConstruct = new TSF.UmlCanvas.Association(); } else if (type == typeof(UML.Classes.Dependencies.Dependency)) { newConstruct = new TSF.UmlCanvas.Dependency(); } else if (type == typeof(UML.Classes.Kernel.Comment)) { newConstruct = new TSF.UmlCanvas.Note(); } newConstruct.setName(name); this.wrappedConstruct.addChild(newConstruct); Element returnedElement = ((Factory)this.model.factory).createElement(newConstruct, this); //set the name of the construct if (returnedElement is ConstructWrapper) { ((ConstructWrapper)returnedElement).name = name; } return(returnedElement as T); }
public Construct addChild(Construct construct) { this.children.Add(construct); return this; }
public ConstructWrapper(Model model, ADL.Construct construct) : base(model) { this.wrappedConstruct = construct; }