void setPartitionSizes(TSF_EA.ElementWrapper eaElement, MDDiagramObject mdDiagramObject) { var orderedSplits = mdDiagramObject.ownedSplits.OrderBy(x => x.y).ToList(); int i = 0; int previousY = mdDiagramObject.y; foreach (global::EA.Partition partition in eaElement.WrappedElement.Partitions) { //get the corresponding split int partitionSize = 0; if (orderedSplits.Count > i) { var currentSplit = orderedSplits[i]; //calculate the size of this partition partitionSize = currentSplit.y - previousY; } else { //set the size to the bottom of the fragment partitionSize = mdDiagramObject.bottom - previousY; } if (partitionSize > 0) { partition.Size = partitionSize; eaElement.isDirty = true; } //up the counter i++; } //save the changes to the partitions by saving the EAElement eaElement.save(); }
/// <summary> /// add the given diagram to this diagram /// </summary> /// <param name="diagram">the diagram to add</param> /// <returns>the diagramElement representing the diagram</returns> public UML.Diagrams.DiagramElement addToDiagram(UML.Diagrams.Diagram diagram) { if (this.owner is ElementWrapper) { ElementWrapper elementDiagram = ((ElementWrapper)this.owner).addOwnedElement <ElementWrapper>(diagram.name, "UMLDiagram"); elementDiagram.save(); //to make the elementDiagram actuall link to the diagram we need to set PDATA1 to the diagramID // and NType = 0 for Frame or 1 for Reference this.model.executeSQL("update t_object set Ntype = 0, PDATA1 = " + ((Diagram)diagram).DiagramID.ToString() + " where ea_guid = '" + elementDiagram.WrappedElement.ElementGUID + "'"); return(this.addToDiagram(elementDiagram)); } else { return(null); } }