Exemplo n.º 1
0
        public void NewRelation(UmlRelation rel)
        {
            GuiClass c1 = FindClass(rel.src), c2 = FindClass(rel.dest);

            if (c1 != null && c2 != null)
            {
                int   ux1 = 1, ux2 = 3;
                float uy1 = .5f, uy2 = .5f;

                if (rel.type == UmlRelationType.Association)
                {
                    ux1 = 0;
                    uy1 = c1.get_empty_point_on_edge(ux1);
                    ux2 = 2;
                    uy2 = c2.get_empty_point_on_edge(ux2);
                }
                else if (rel.type == UmlRelationType.Realization || rel.type == UmlRelationType.Inheritance)
                {
                    uy2 = c2.get_empty_point_on_edge(ux2);
                }

                GuiConnection c = new GuiConnection(new GuiConnectionPoint(c1, ux1, uy1, 0), new GuiConnectionPoint(c2, ux2, uy2, 1), rel.type, this, rel.type == UmlRelationType.Attachment ? GuiConnectionStyle.Line : MouseAgent.conn_style);
                if (rel.type == UmlRelationType.Association)
                {
                    c.nav = GuiConnectionNavigation.Left;
                }
                c.relation_id = rel.ID;
                c.first.UpdatePosition(true);
                c.second.UpdatePosition(true);
                c.DoCreationFixup();
                c.ConnectionCreated(this, rel.src_role, rel.dest_role, rel.name, rel.stereo);
                Undo.Push(new CreateOperation(c), false);
            }
        }
Exemplo n.º 2
0
        public void AddObject(GuiItem item, string name_base)
        {
            item.parent = this;
            if (item is INeedRefresh)
            {
                RefreshObject((INeedRefresh)item);
            }
            item.id = RegisterItemID(name_base, item);
            item.Invalidate();
            Undo.Push(new CreateOperation((IRemoveable)item), false);

            // add relations
            if (item is GuiClass)
            {
                GuiClass cl = (GuiClass)item;
                for (int i = 0; i < active_objects.Count; i++)
                {
                    GuiObject obj = (GuiObject)active_objects[i];
                    if (obj is GuiClass)
                    {
                        foreach (UmlRelation rel in RelationsHelper.GetRelations(((GuiClass)obj).st, proj.model))
                        {
                            if (rel.dest == cl.st || rel.src == cl.st)
                            {
                                NewRelation(rel);
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
        public override void Drop( )
        {
            if (dropitem == null)
            {
                throw new ArgumentException("have nothing to drop");
            }

            parent.AddObject(dropitem, UmlModel.GetUniversal(dropobj));
            action = MouseAction.None;

            // insert Inheritance
            ArrayList l = new ArrayList(parent.active_objects);

            foreach (GuiObject a in l)
            {
                if (a is GuiClass)
                {
                    GuiClass c = a as GuiClass;

                    // TODO ?????????

                    /*if( c.st.bases != null && c.st.bases.Contains( dropitem.st.fullname ) ) {
                     *      NewRelation( dropitem, c, UmlRelationType.Inheritance );
                     * } else if( dropitem.st.bases != null && dropitem.st.bases.Contains( c.st.fullname ) ) {
                     *      NewRelation( c, dropitem, UmlRelationType.Inheritance );
                     * }*/
                }
            }
            dropitem = null;
        }
Exemplo n.º 4
0
 public void ImportClass(UmlClass cl)
 {
     if (parent.FindClass(cl) == null)
     {
         GuiClass gc = GuiElementFactory.CreateClass(parent, x_coord_counter, ancest ? Y - 100 : Y + Height + 100, cl);
         x_coord_counter += 20 + gc.Width;
     }
 }
Exemplo n.º 5
0
        public static GuiClass CreateClass(StaticView parent, int x, int y, UmlClass cl)
        {
            GuiClass c = GuiClass.fromUML(cl);

            c.X = x;
            c.Y = y;
            parent.AddObject(c, UmlModel.GetUniversal(cl));
            return(c);
        }
Exemplo n.º 6
0
        public static GuiClass fromUML(UmlClass st)
        {
            GuiClass s = new GuiClass();

            s.name = st.UniqueName;
            s.st   = st;
            s.Created();
            return(s);
        }
Exemplo n.º 7
0
        public GuiClass FindClass(UmlClass cl)
        {
            foreach (GuiObject obj in active_objects)
            {
                GuiClass gcl = obj as GuiClass;
                if (gcl != null && gcl.st == cl)
                {
                    return(gcl);
                }
            }

            return(null);
        }
Exemplo n.º 8
0
 public static GuiItem CreateElement(UmlObject obj)
 {
     if (obj is UmlClass)
     {
         return(GuiClass.fromUML(obj as UmlClass));
     }
     else if (obj is UmlEnum)
     {
         return(GuiEnum.fromUML(obj as UmlEnum));
     }
     else if (obj is UmlNamespace)
     {
         return(GuiPackage.fromUML(obj as UmlNamespace));
     }
     else
     {
         return(null);
     }
 }
Exemplo n.º 9
0
 public static GuiClass fromUML( UmlClass st )
 {
     GuiClass s = new GuiClass();
     s.name = st.UniqueName;
     s.st = st;
     s.Created();
     return s;
 }
Exemplo n.º 10
0
 public WrappedMember( GuiClass cl, UmlMember memb )
 {
     this.cl = cl;
     this.memb = memb;
 }
Exemplo n.º 11
0
 public WrappedMember(GuiClass cl, UmlMember memb)
 {
     this.cl   = cl;
     this.memb = memb;
 }