示例#1
0
        public EAFactory setupClient(string name, string classifier, string stereotype, int classifierId, string[] states)
        {
            clientElement              = new EAElement();
            clientElement.Name         = name;
            clientElement.Type         = classifier;
            clientElement.ClassifierID = classifierId;
            clientElement.Stereotype   = stereotype;

            clientElement.PackageID = EARepository.currentPackage.PackageID;

            string state = "";

            if (states != null)
            {
                for (int i = 0; i < states.Length; i += 2)
                {
                    state = ObjectManager.addRunState(state, states[i], states[i + 1], 0);
                }
            }
            clientElement.RunState = state;

            EADiagram       d      = EARepository.currentDiagram;
            object          obj    = d.DiagramObjects.AddNew(name, "");
            EADiagramObject diaObj = (EADiagramObject)obj;

            diaObj.ElementID = clientElement.ElementID;

            EAFactory client = new EAFactory();

            client.clientElement = clientElement;

            return(client);
        }
示例#2
0
        public EAFactory addSupplier(string name, string type, int classifierId, string targetStereotype, string[] states, string supplierRoleName, string cardinality, String stereotype)
        {
            string state = "";

            if (states != null)
            {
                for (int i = 0; i < states.Length; i += 2)
                {
                    state = ObjectManager.addRunState(state, states[i], states[i + 1], 0);
                }
            }

            EAElement supplier = new EAElement();

            supplier.Name         = name;
            supplier.Type         = type;
            supplier.ClassifierID = classifierId;
            supplier.RunState     = state;
            if (targetStereotype != null)
            {
                supplier.Stereotype = targetStereotype;
            }

            addSupplier(supplier, supplierRoleName, cardinality, stereotype);
            //object obj = EARepository.currentDiagram.DiagramObjects.AddNew(name,"");
            //EADiagramObject diaObj = (EADiagramObject)obj;
            //diaObj.ElementID = supplier.ElementID;

            //object o = clientElement.Connectors.AddNew(name, APIAddInClass.EA_TYPE_ASSOCIATION);
            //EA.Connector connector = (EA.Connector)o;

            //connector.ClientID = clientElement.ElementID;
            //connector.SupplierID = supplier.ElementID;

            //connector.SupplierEnd.Cardinality = cardinality;
            //connector.SupplierEnd.Role = supplierRoleName;

            EAFactory client = new EAFactory();

            client.clientElement = supplier;
            return(client);
        }