Пример #1
0
 // Constructor
 private UMLDiagram(DI.Diagram diagram)
 {
     _diagram = diagram;
     _canvas = new UMLCanvas (this);
     _canvas.ElementNameChanged += ChangeElementNameHub;
     Refresh ();
 }
Пример #2
0
 // Constructor
 private NoteBookLabel(DI.Diagram diagram)
     : base(1, 3, false)
 {
     _parent = null;
     _diagram = diagram;
     //this must change depending of the diagram's type
     string diagramType = ((DI.SimpleSemanticModelElement)diagram.SemanticModel).TypeInfo;
     _icon = GetIcon(diagramType);
     //_icon = new Gdk.Pixbuf (new Gdk.Colorspace(), false, 8, 15, 15);
     //_icon.Fill (0xffff0000);
     //
     Attach(new Gtk.Image(_icon), 0, 1, 0, 1);
     //
     _label = new Label(_diagram.Name);
     Attach(_label, 1, 2, 0, 1);
     //
     Image image = new Image();
     image.Stock = Gtk.Stock.Close;
     _close_button = new Button();
     _close_button.Add(image);
     _close_button.HeightRequest = 20;
     _close_button.WidthRequest = 20;
     _close_button.Relief = Gtk.ReliefStyle.None;
     _close_button.Clicked += OnCloseButtonClicked;
     Tooltips ttips = new Tooltips ();
     ttips.SetTip (_close_button, GettextCatalog.GetString ("Close diagram"), GettextCatalog.GetString ("Close diagram"));
     //_close_button.
     Attach(_close_button, 2, 3, 0, 1);
     ShowAll();
 }
Пример #3
0
 public void NewUMLDiagram()
 {
     if(_elementsList == null || _elementsList.Count == 0)
     {
         Gtk.MessageDialog md = new Gtk.MessageDialog (
             null,
             Gtk.DialogFlags.DestroyWithParent,
             Gtk.MessageType.Info,
             Gtk.ButtonsType.Close,
             GettextCatalog.GetString ("There are no elements in the model; you should create some elements first."));
         md.Run ();
         md.Destroy();
         return;
     }
     // pick a diagram type
     DiagramTypeChooserDialog dialog = new DiagramTypeChooserDialog();
     int rtn = dialog.Run();
     if (rtn != Gtk.ResponseType.Accept.value__ && rtn != Gtk.ResponseType.Ok.value__)
     {
         return;
     }
     string diagramType = dialog.Selection;
     // pick a namespace
     ElementChooserDialog chooser = new ElementChooserDialog(
         typeof(UML.Namespace), GettextCatalog.GetString ("Choose a namespace"));
     if (_eventQueue.LastSelectedElement is UML.Namespace)
     {
         chooser.SelectedObject = _eventQueue.LastSelectedElement;
     }
     if(chooser.Run() != Gtk.ResponseType.Accept.value__) return;
     UML.Namespace ns = (UML.Namespace)chooser.SelectedObject;
     // create a new diagram
     DI.Diagram newDiagram = new DI.Diagram();
     DI.SimpleSemanticModelElement bridge = new DI.SimpleSemanticModelElement();
     bridge.TypeInfo = diagramType.Replace(" ", "") + "Diagram";
     newDiagram.SemanticModel = bridge;
     Uml2SemanticModelBridge nsbridge = new Uml2SemanticModelBridge();
     nsbridge.Element = ns;
     newDiagram.Namespace =  nsbridge;
     _elementsList.Add (newDiagram);
     // broadcast the change
     _broadcaster.BroadcastNewModel(_elementsList);
     ElementChooserDialog.SetProjectElements(_elementsList);
 }
Пример #4
0
 private object Deserialize_Diagram()
 {
     string attrNs, prop;
     DI.Diagram deserialized = new DI.Diagram();
     if(base.MoveToFirstChild())
     {
         do
         {
             attrNs = base.XmlReader.NamespaceURI;
             prop = base.XmlReader.NameTable.Get(base.XmlReader.LocalName);
             if(object.ReferenceEquals(attrNs, String.Empty)
                 || object.ReferenceEquals(attrNs, _diNs))
             {
                 if(!DeserCompElemsIn_Diagram(deserialized, prop))
                 if(!DeserCompElemsIn_GraphNode(deserialized, prop))
                 if(!DeserCompElemsIn_GraphElement(deserialized, prop))
                 if(!DeserCompElemsIn_DiagramElement(deserialized, prop))
                 base.WarnUnknownElement(prop);
             }
         } while(base.MoveToNextSibling());
     }
     return deserialized;
 }