Esempio n. 1
0
 protected void tbClassHeader_MouseLeave(object sender, MouseEventArgs e)
 {
     if (DiagramView != null)
     {
         DiagramView.InvokeVersionedElementMouseLeave(this, PSMSchemaClass);
     }
 }
Esempio n. 2
0
 void Connector_MouseLeave(object sender, MouseEventArgs e)
 {
     if (DiagramView != null)
     {
         DiagramView.InvokeVersionedElementMouseLeave(this, PSMAssociation);
     }
 }
Esempio n. 3
0
        private void MakeHighlightsForChangeInstance(ChangeInstance change)
        {
            if (DiagramNewVersion != null)
            {
                if (change.Component.ExistsInVersion(DiagramNewVersion.Version))
                {
                    MainWindow.FocusComponent(change.Component, false);
                }
                else
                {
                    DiagramView.ClearSelection();
                }
            }

            if (DiagramViewOldVersion != null)
            {
                if (change.Component.ExistsInVersion(DiagramOldVersion.Version))
                {
                    MainWindow.FocusComponent(change.Component.GetInVersion(DiagramOldVersion.Version), false);
                }
                else
                {
                    DiagramViewOldVersion.ClearSelection();
                }
            }
        }
Esempio n. 4
0
        public override void PutInDiagram(DiagramView diagramView, ViewHelper viewHelper)
        {
            base.PutInDiagram(diagramView, viewHelper);

            Connector = new Connector();
            ////NameLabel = new Label();
            ////SourceCardinalityLabel = new Label();
            ////SourceRoleLabel = new Label();
            ////TargetCardinalityLabel = new Label();
            ////TargetRoleLabel = new Label();
            CreatedControls.Add(Connector);
            ////CreatedControls.Add(NameLabel);
            ////CreatedControls.Add(SourceCardinalityLabel);
            ////CreatedControls.Add(SourceRoleLabel);
            ////CreatedControls.Add(TargetCardinalityLabel);
            ////CreatedControls.Add(TargetRoleLabel);
            DiagramView.ExolutioCanvas.AddConnector(Connector);
            Connector.Connect(SourceClassView.MainNode, TargetClassView.MainNode);
            if (ViewHelper.Points.Count == 0)
            {
                ViewHelper.Points.AppendRange(Connector.Points.Select(p => (Point)p));
            }
            else if (ViewHelper.Points.Count >= Connector.Points.Count)
            {
                Connector.SetPoints(ViewHelper.Points);
            }
            ////DiagramView.ExolutioCanvas.AddNode(NameLabel);
            ////DiagramView.ExolutioCanvas.AddNode(SourceCardinalityLabel);
            ////DiagramView.ExolutioCanvas.AddNode(SourceRoleLabel);
            ////DiagramView.ExolutioCanvas.AddNode(TargetCardinalityLabel);
            ////DiagramView.ExolutioCanvas.AddNode(TargetRoleLabel);
            ////NameLabel.PlacementCenter = EPlacementCenter.Center;
            ////Connector.SnapNodeToConnector(NameLabel);
            ////SourceCardinalityLabel.SnapTo(Connector.StartPoint, true);
            ////SourceRoleLabel.SnapTo(Connector.StartPoint, true);
            ////TargetCardinalityLabel.SnapTo(Connector.EndPoint, true);
            ////TargetRoleLabel.SnapTo(Connector.EndPoint, true);

            CreateMenus();

            BindModelView();

            ////NameLabel.SelectedChanged += NameLabel_SelectedChanged;
            ////NameLabel.PositionChanged += NameLabel_PositionChanged;
            ////SourceCardinalityLabel.PositionChanged += SourceCardinalityLabel_PositionChanged;
            ////SourceRoleLabel.PositionChanged += SourceRoleLabel_PositionChanged;
            ////TargetCardinalityLabel.PositionChanged += TargetCardinalityLabel_PositionChanged;
            ////SourceRoleLabel.PositionChanged += TargetRoleLabel_PositionChanged;

            Connector.SelectedChanged     += Connector_SelectedChanged;
            Connector.ConnectorPointMoved += Connector_ConnectorPointMoved;
            Connector.PointsCountChanged  += Connector_PointsCountChanged;
            //Connector.MouseDown += Connector_MouseDown;
            #if SILVERLIGHT
            #else
            //Connector.MouseUp += Connector_MouseUp;
            #endif
        }
Esempio n. 5
0
 internal void DeferredRemoveCheck()
 {
     if (CanRemoveFromDiagram())
     {
         RemoveFromDiagram();
         DiagramView.DeferredRemoveComponents.Add(this);
         DiagramView.DefferedRemoveCheck();
     }
 }
Esempio n. 6
0
 internal void DeferredAddCheck()
 {
     if (DiagramView == null && CanPutInDiagram(pendingDiagramView))
     {
         PutInDiagram(pendingDiagramView, pendingViewHelper);
         pendingDiagramView.DeferredAddComponents.Remove(this);
         pendingDiagramView.DefferedAddCheck();
         pendingDiagramView = null;
     }
 }
Esempio n. 7
0
        public override void PutInDiagram(DiagramView diagramView, ViewHelper viewHelper)
        {
            base.PutInDiagram(diagramView, viewHelper);

            MainNode = new Node();
            MainNode.PositionChanged += MainNode_PositionChanged;
            MainNode.SelectedChanged += MainNode_SelectedChanged;
            CreatedControls.Add(MainNode);
            CreateInnerControls(diagramView.ExolutioCanvas);
            diagramView.ExolutioCanvas.AddNode(MainNode);

            BindModelView();
        }
Esempio n. 8
0
        /// <summary>
        ///
        /// </summary>
        /// <remarks>
        /// This instance of <see cref="ComponentViewBase"/> is not yet in <see cref="DiagramView"/>.<see cref="View.DiagramView.RepresentantsCollection"/>,
        /// in which it is added in the method's body.
        /// </remarks>
        /// <param name="diagramView"></param>
        /// <param name="viewHelper"></param>
        public virtual void PutInDiagram(DiagramView diagramView, ViewHelper viewHelper)
        {
            if (ModelComponent == null)
            {
                throw new ExolutioViewException(string.Format("'{0}'ShowInDiagram can not be called when ModelCompoennt is null", this));
            }
            if (!CanPutInDiagram(diagramView))
            {
                throw new ExolutioViewException(string.Format("Can not put '{0}' to diagram.", this));
            }

            DiagramView = diagramView;
            DiagramView.RepresentantsCollection[ModelComponent] = this;
        }
Esempio n. 9
0
 public void RemoveFromDiagramDeferred()
 {
     if (CanRemoveFromDiagram())
     {
         DiagramView oldDiagramView = DiagramView;
         DiagramView.DeferredRemoveComponents.Remove(this);
         RemoveFromDiagram();
         oldDiagramView.DefferedRemoveCheck();
     }
     else
     {
         DiagramView.DeferredRemoveComponents.Add(this);
     }
 }
Esempio n. 10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TextBoxContainer&lt;T&gt;"/> class.
 /// </summary>
 /// <param name="container">Panel where <see cref="EditableTextBox">EditableTextBoxes</see>
 /// are created</param>
 /// <param name="xCaseCanvas"><see cref="XCaseCanvas"/> containing the control</param>
 public TextBoxContainer(Panel container, ExolutioCanvas exolutioCanvas, DiagramView diagramView)
 {
     if (container == null)
     {
         throw new ArgumentNullException("container");
     }
     if (exolutioCanvas == null)
     {
         throw new ArgumentNullException("exolutioCanvas");
     }
     this.container      = container;
     this.ExolutioCanvas = exolutioCanvas;
     this.DiagramView    = diagramView;
 }
Esempio n. 11
0
 public void PutInDiagramDeferred(DiagramView diagramView, Component component, ViewHelper viewHelper)
 {
     this.ModelComponent = component;
     if (CanPutInDiagram(diagramView))
     {
         PutInDiagram(diagramView, viewHelper);
         diagramView.DeferredAddComponents.Remove(this);
         diagramView.DefferedAddCheck();
     }
     else
     {
         pendingDiagramView = diagramView;
         pendingViewHelper  = viewHelper;
         diagramView.DeferredAddComponents.Add(this);
     }
 }
Esempio n. 12
0
        public override bool CanPutInDiagram(DiagramView diagramView)
        {
            if (!diagramView.RepresentantsCollection.ContainsKey(SpecificClass) ||
                !diagramView.RepresentantsCollection.ContainsKey(GeneralClass))
            {
                /*
                 * since parent and child may change, it is necessary
                 * to hook to this possible change
                 */
                if (!parentChildUpdateBound)
                {
                    PSMGeneralization.PropertyChanged += PSMGeneralization_PropertyChanged_ForParentChildUpdate;
                    parentChildUpdateBound             = true;
                }
            }

            return(base.CanPutInDiagram(diagramView) &&
                   diagramView.RepresentantsCollection.ContainsKey(SpecificClass) &&
                   diagramView.RepresentantsCollection.ContainsKey(GeneralClass));
        }
Esempio n. 13
0
        public static void FoldChildrenRecursive(PSMComponent parent, DiagramView activeDiagramView, EFoldingAction foldingAction)
        {
            IEnumerable <PSMComponent> childComponents = ModelIterator.GetPSMChildren(parent, false, true);

            foreach (PSMComponent childComponent in childComponents)
            {
                if (!activeDiagramView.RepresentantsCollection.IsElementPresent(childComponent))
                {
                    continue;
                }
                ComponentViewBase childView = activeDiagramView.RepresentantsCollection[childComponent];
                bool proceed = true;
                if (childView.DownCastSatisfies <IComponentViewBaseVH>(c => c.ViewHelper.DownCastSatisfies <IFoldableComponentViewHelper>(
                                                                           fvh => (fvh.IsFolded && foldingAction == EFoldingAction.Fold) || fvh.IsFolded && foldingAction == EFoldingAction.Unfold)))
                {
                    proceed = false;
                }
                FoldRecursive(childComponent, activeDiagramView, proceed, foldingAction);
            }
        }
Esempio n. 14
0
        public Rect GetCanvasBoundingRectangle(DiagramView diagramView)
        {
            double canvasWidth;
            double canvasHeight;

            if (diagramView.ExolutioCanvas.Children.OfType <Node>().Count() > 0)
            {
                canvasWidth  = diagramView.ExolutioCanvas.Children.OfType <Node>().Max(thumb => thumb.Right) + 20;
                canvasHeight = diagramView.ExolutioCanvas.Children.OfType <Node>().Max(thumb => thumb.Bottom) + 20;
            }
            else
            {
                canvasWidth  = 40;
                canvasHeight = 40;
            }
            Rect r           = new Rect(0, 0, canvasWidth, canvasHeight);
            Rect transformed = diagramView.LayoutTransform.TransformBounds(r);

            return(transformed);
        }
Esempio n. 15
0
        public static void FoldRecursive(PSMComponent psmComponent, DiagramView activeDiagramView, bool proceed, EFoldingAction foldingAction)
        {
            if (!activeDiagramView.RepresentantsCollection.IsElementPresent(psmComponent))
            {
                return;
            }

            ComponentViewBase componentView = activeDiagramView.RepresentantsCollection[psmComponent];

            if (foldingAction == EFoldingAction.Fold)
            {
                componentView.HideAllControls();
            }
            else
            {
                componentView.UnHideAllControls();
            }
            if (proceed)
            {
                FoldChildrenRecursive(psmComponent, activeDiagramView, foldingAction);
            }
        }
Esempio n. 16
0
        public override void PutInDiagram(DiagramView diagramView, ViewHelper viewHelper)
        {
            base.PutInDiagram(diagramView, viewHelper);

            Connector             = new Connector();
            Connector.EndCapStyle = EConnectorCapStyle.Triangle;
            CreatedControls.Add(Connector);
            DiagramView.ExolutioCanvas.AddConnector(Connector);
            Connector.Connect(SpecificClassView.MainNode, GemeralClassView.MainNode);
            if (ViewHelper.Points.Count == 0)
            {
                ViewHelper.Points.AppendRange(Connector.Points.Select(p => (Point)p));
            }
            else if (ViewHelper.Points.Count >= Connector.Points.Count)
            {
                Connector.SetPoints(ViewHelper.Points);
            }

            CreateMenus();

#if SILVERLIGHT
            //ContextMenuService.SetContextMenu(Connector, associationMenu);
            //ContextMenuService.SetContextMenu(NameLabel, associationMenu);
            //ContextMenuService.SetContextMenu(Connector.StartPoint, startPointMenu);
            //ContextMenuService.SetContextMenu(Connector.EndPoint, endPointMenu);
#endif
            BindModelView();

            Connector.SelectedChanged     += Connector_SelectedChanged;
            Connector.ConnectorPointMoved += Connector_ConnectorPointMoved;
            Connector.PointsCountChanged  += Connector_PointsCountChanged;
            //Connector.MouseDown += Connector_MouseDown;
            #if SILVERLIGHT
            #else
            //Connector.MouseUp += Connector_MouseUp;
            #endif
        }
Esempio n. 17
0
        public override void PutInDiagram(DiagramView diagramView, ViewHelper viewHelper)
        {
            base.PutInDiagram(diagramView, viewHelper);
            if (parentChildUpdateBound)
            {
                PSMAssociation.PropertyChanged -= PSMAssociation_PropertyChanged_ForParentChildUpdate;
                parentChildUpdateBound          = false;
            }
#if SILVERLIGHT
            Connector = new Connector();
#else
            Connector = new Connector()
            {
                EndCapStyle = EConnectorCapStyle.Arrow
            };
#endif
            NameLabel        = new Label();
            CardinalityLabel = new Label();
            CreatedControls.Add(Connector);
            CreatedControls.Add(NameLabel);
            CreatedControls.Add(CardinalityLabel);
            DiagramView.ExolutioCanvas.AddConnector(Connector);
            Connector.Connect(SourceClassView.MainNode, TargetClassView.MainNode);
            DiagramView.ExolutioCanvas.AddNode(NameLabel);
            DiagramView.ExolutioCanvas.AddNode(CardinalityLabel);
            NameLabel.PlacementCenter = EPlacementCenter.Center;
            Connector.SnapNodeToConnector(NameLabel);
            CardinalityLabel.SnapTo(Connector.EndPoint, true);
            BindModelView();

            NameLabel.SelectedChanged        += NameLabel_SelectedChanged;
            NameLabel.PositionChanged        += NameLabel_PositionChanged;
            CardinalityLabel.PositionChanged += CardinalityLabel_PositionChanged;
            Connector.SelectedChanged        += Connector_SelectedChanged;
            Connector.MouseEnter             += Connector_MouseEnter;
            Connector.MouseLeave             += Connector_MouseLeave;
        }
Esempio n. 18
0
 public virtual bool CanPutInDiagram(DiagramView diagramView)
 {
     return(true);
 }
Esempio n. 19
0
 private void Connector_MouseEnter(object sender, MouseEventArgs e)
 {
     DiagramView.InvokeVersionedElementMouseEnter(this, PSMAssociation);
 }
Esempio n. 20
0
 public override void PutInDiagram(DiagramView diagramView, ViewHelper viewHelper)
 {
     ViewHelper = (TViewHelper)viewHelper;
     base.PutInDiagram(diagramView, viewHelper);
 }
Esempio n. 21
0
 /// <summary>
 /// Creates new instance of <see cref="PIMAttributesContainer" />.
 /// </summary>
 /// <param name="container">Panel used to display the items</param>
 /// <param name="exolutioCanvas">canvas owning the control</param>
 public PSMAttributesContainer(Panel container, ExolutioCanvas exolutioCanvas, DiagramView diagramView)
     : base(container, exolutioCanvas, diagramView)
 {
 }
Esempio n. 22
0
 /// <summary>
 /// Creates new instance of <see cref="PIMOperationsContainer" />.
 /// </summary>
 /// <param name="container">Panel used to display the items</param>
 /// <param name="exolutioCanvas">canvas owning the control</param>
 public PIMOperationsContainer(Panel container, ExolutioCanvas exolutioCanvas, DiagramView diagram)
     : base(container, exolutioCanvas, diagram)
 {
 }
Esempio n. 23
0
 public override bool CanPutInDiagram(DiagramView diagramView)
 {
     return(true);
 }
Esempio n. 24
0
 protected void tbClassHeader_MouseEnter(object sender, MouseEventArgs e)
 {
     DiagramView.InvokeVersionedElementMouseEnter(this, PSMSchemaClass);
 }
Esempio n. 25
0
 /// <summary>
 /// Exports the diagram to an image, uses interactive dialogs to select filename.
 /// </summary>
 /// <param name="diagramView">exported diagram</param>
 /// <param name="method">image format</param>
 /// <param name="useFrameAndCaption">if set to <c>true</c> frame and caption is added to the image</param>
 public void ExportToImage(DiagramView diagramView, EExportToImageMethod method, bool useFrameAndCaption)
 {
     diagramView.ExolutioCanvas.EnterScreenshotView();
     base.ExportToImage(diagramView.ExolutioCanvas, method, useFrameAndCaption, diagramView.Diagram.Caption, GetCanvasBoundingRectangle(diagramView));
     diagramView.ExolutioCanvas.ExitScreenshotView();
 }