Пример #1
0
 public UMLBox(UMLDiagram ownerDiagram, DI.GraphNode graphNode)
     : base(ownerDiagram, graphNode)
 {
     _outerBox = new CanvasRect (ChildrensRoot);
     _outerBox.X1 = _outerBox.Y1 = 0;
     _outerBox.X2 = Width;
     _outerBox.Y2 = Height;
     _outerBox.FillColor = DEFAULT_FILL_COLOR;
     _outerBox.OutlineColor = DEFAULT_OUTLINE_COLOR;
     Width = graphNode.Size.Width;
     Height = graphNode.Size.Height;
     // gets the corresponding model element
     Uml2SemanticModelBridge bridge = (Uml2SemanticModelBridge) graphNode.SemanticModel;
     _modelElement = (UML.NamedElement) bridge.Element;
     DI.GraphElement nestedDiagElem;
     DI.SimpleSemanticModelElement nestedBridge;
     // looks for the Name compartment
     foreach (DI.DiagramElement elem in GraphNode.Contained)
     {
         nestedDiagElem = elem as DI.GraphElement;
         if (nestedDiagElem != null)
         {
             nestedBridge = nestedDiagElem.SemanticModel as DI.SimpleSemanticModelElement;
             if (nestedBridge.TypeInfo == "NameCompartment")
             {
                 // widget for the property Name
                 _name = new UMLEntry (this, (DI.GraphNode)nestedDiagElem, ChildrensRoot, false, _modelElement.Name);
                 _name.Show();
                 break;
             }
         }
     }
     Redraw ();
 }
Пример #2
0
 public UMLUseCase(UMLDiagram ownerDiagram, DI.GraphNode graphNode)
     : base(ownerDiagram, graphNode)
 {
     _circle = new CanvasEllipse (ChildrensRoot);
     _circle.X1 = _circle.Y1 = 0;
     _circle.X2 = Width;
     _circle.Y2 = Height;
     _circle.FillColor = DEFAULT_FILL_COLOR;
     _circle.OutlineColor = DEFAULT_OUTLINE_COLOR;
     //
     Width = GraphNode.Size.Width;
     Height = GraphNode.Size.Height;
     //
     Uml2SemanticModelBridge bridge = (Uml2SemanticModelBridge) GraphNode.SemanticModel;
     _modelElement = (UML.UseCase) bridge.Element;
     DI.GraphElement nestedDiagElem;
     DI.SimpleSemanticModelElement nestedBridge;
     //
     foreach (DI.DiagramElement elem in GraphNode.Contained)
     {
         nestedDiagElem = elem as DI.GraphElement;
         if (nestedDiagElem != null)
         {
             nestedBridge = nestedDiagElem.SemanticModel as DI.SimpleSemanticModelElement;
             System.Console.WriteLine ("UMLUseCase nestedBridge.TypeInfo "+nestedBridge.TypeInfo);
             if (nestedBridge.TypeInfo == "NameCompartment")
             {
                 // widget for the property Name
                 string fontModifier = (_modelElement.IsAbstract ? "italic" : "");
                 _name = new UMLEntry (this, (DI.GraphNode)nestedDiagElem, ChildrensRoot, false, _modelElement.Name, fontModifier);
                 _name.Show();
                 break;
             }
         }
     }
     _circle.X1 = _circle.Y1 = 0;
     _circle.X2 = Width;
     _circle.Y2 = Height;
     Redraw ();
 }
Пример #3
0
 public UMLAssociationEnd(UMLDiagram ownerDiagram, DI.GraphNode graphNode)
     : base(ownerDiagram, graphNode)
 {
     _circle = new CanvasEllipse (ownerDiagram.CanvasRoot);
     _circle.OutlineColorGdk = UMLEdge.HIGHLIGHTED_OUTLINE_COLOR;
     _graphNode = graphNode;
     _modelElement = (UML.Property) MonoUML.Widgets.Helper.GetSemanticElement (graphNode);
     DI.SimpleSemanticModelElement bridge;
     foreach (DI.GraphNode gn in graphNode.Contained)
     {
         bridge = gn.SemanticModel as DI.SimpleSemanticModelElement;
         switch (bridge.TypeInfo)
         {
             case "Name":
                 _name = new UMLEntry (this, gn, ownerDiagram.CanvasRoot, true, _modelElement.Name);
                 _name.TextChanged += new UMLElementNameChangedHandler (BroadcastNameChange);
                 base.AddFreeEntry (_name);
                 _name.Show ();
                 break;
             case "Visibility":
                 break;
             case "Multiplicity":
                 _multiplicity = new UMLEntry (this, gn, ownerDiagram.CanvasRoot, true, GetMultiplicity ());
                 _multiplicity.TextChanged += new UMLElementNameChangedHandler (ApplyMultiplicityChange);
                 base.AddFreeEntry (_multiplicity);
                 _multiplicity.Show ();
                 break;
         }
     }
 }
Пример #4
0
 public UMLActor(UMLDiagram ownerDiagram, DI.GraphNode actorGraphNode)
     : base(ownerDiagram, actorGraphNode)
 {
     // old ctor
     _head = new CanvasEllipse (ChildrensRoot);
     _head.OutlineColor = DEFAULT_OUTLINE_COLOR;
     _head.FillColor = DEFAULT_FILL_COLOR;
     //
     _arms = new CanvasLine (ChildrensRoot);
     _arms.WidthUnits = 1.0;
     _arms.FillColor = DEFAULT_OUTLINE_COLOR;
     //
     _body = new CanvasLine (ChildrensRoot);
     _body.WidthUnits = 1.0;
     _body.FillColor = DEFAULT_OUTLINE_COLOR;
     //
     _legs = new CanvasLine (ChildrensRoot);
     _legs.WidthUnits= 1.0;
     _legs.FillColor = DEFAULT_OUTLINE_COLOR;
     // /old ctor
     _modelElement = (UML.Actor) MonoUML.Widgets.Helper.GetSemanticElement (actorGraphNode);
     DI.GraphElement nestedDiagElem;
     DI.SimpleSemanticModelElement nestedBridge;
     //
     DI.DiagramElement elem = (DI.DiagramElement) actorGraphNode.Contained[0];
     nestedDiagElem = elem as DI.GraphElement;
     if (nestedDiagElem != null)
     {
         nestedBridge = nestedDiagElem.SemanticModel as DI.SimpleSemanticModelElement;
         if (nestedBridge.TypeInfo == "Name")
         {
             string fontModifier = (_modelElement.IsAbstract ? "italic" : "");
             _nameUMLEntry = new UMLEntry (this, (DI.GraphNode)nestedDiagElem, ownerDiagram.CanvasRoot, true, _modelElement.Name, fontModifier);
             base.AddFreeEntry (_nameUMLEntry);
             _nameUMLEntry.Show ();
             _nameDIGraphNode = nestedDiagElem;
         }
     }
     else
     {
         //TODO: Create both, entry and DI nested element
     }
     _nameUMLEntry.TextChanged += CallHub;
     Redraw ();
 }
Пример #5
0
 // Looks for the contained graph node that represents the stereotype,
 // then creates a UMLEntry and shows it.
 // The name of the edge is represented as two graph nodes: one for the
 // point where the name is located (typeInfo DirectedName) and another one
 // (contained within the former) which represents the label itself.
 // As always, every position is relative to its owner's position.
 // Note that edges are always placed at (0, 0).
 private void SearchAndDrawStereotype(DI.GraphEdge graphEdge, UMLDiagram ownerDiagram)
 {
     // looks for the contained graph node that represents the edge name
     DI.GraphNode stereotypeCompartmentGN = null;
     int i = 0;
     DI.SimpleSemanticModelElement bridge;
     while (_stereotypeCompartmentGN == null && i < graphEdge.Contained.Count)
     {
         stereotypeCompartmentGN = graphEdge.Contained [i++] as DI.GraphNode;
         if (stereotypeCompartmentGN != null)
         {
             bridge = stereotypeCompartmentGN.SemanticModel as DI.SimpleSemanticModelElement;
             if (bridge != null && bridge.TypeInfo == "StereotypeCompartment")
             {
                 _stereotypeCompartmentGN = stereotypeCompartmentGN;
             }
         }
     }
     // if the corresponding graph node was found, draw it
     if (_stereotypeCompartmentGN != null)
     {
         // first, find the corresponding Graph Node
         i = 0;
         DI.GraphNode keywordMetaclassGN = null;
         bridge = null;
         do
         {
             keywordMetaclassGN = _stereotypeCompartmentGN.Contained [i++] as DI.GraphNode;
             if (keywordMetaclassGN != null)
             {
                 bridge = keywordMetaclassGN.SemanticModel as DI.SimpleSemanticModelElement;
             }
         } while (bridge==null || bridge.TypeInfo != "KeywordMetaclass");
         // now we're able to draw it
         string text = "<<" + _modelElement.GetType().Name.Substring(6).ToLower() + ">>";
         _keywordMetaclassUMLEntry = new UMLEntry (this, keywordMetaclassGN, ownerDiagram.CanvasRoot, true, text);
         _keywordMetaclassUMLEntry.Editable = false;
         base.AddFreeEntry (_keywordMetaclassUMLEntry);
         _keywordMetaclassUMLEntry.Show ();
     }
 }