protected override void OnModelPropertyChanged(string propertyName)
        {
            if (propertyName == "Presentation")
            {
                if (myPresentation == Model.Presentation)
                {
                    return;
                }

                if (myPresentation != null)
                {
                    myPresentation.GetModule <INodeMaskModule>().CollectionChanged -= OnMasksChanged;
                    myPresentation.GraphVisibilityChanged -= OnGraphVisibilityChanged;
                }

                myPresentation = Model.Presentation;

                Filter = null;

                if (myPresentation != null)
                {
                    myPresentation.GetModule <INodeMaskModule>().CollectionChanged += OnMasksChanged;
                    myPresentation.GraphVisibilityChanged += OnGraphVisibilityChanged;

                    OnGraphVisibilityChanged(null, EventArgs.Empty);
                }

                myPreviewNodes = null;
                PreviewNodes.Refresh();
            }
        }
Exemple #2
0
        private void OnAddNodesToCluster()
        {
            // avoid many intermediate updates
            myTransformationsObserver.ModuleChanged -= OnTransformationsChanged;

            var nodes = PreviewNodes
                        .Cast <NodeWithCaption>()
                        .Select(n => n.Node.Id)
                        .ToList();

            var operation = new ChangeClusterAssignment(myPresentation);

            operation.Execute(t => t.AddToCluster(nodes, SelectedCluster));

            // update tree
            {
                var clusterNode = Root.Children.Single(n => n.Id == SelectedCluster);

                var captionModule = myPresentation.GetModule <ICaptionModule>();

                var newTreeNodes = nodes
                                   .Select(n => new ClusterTreeNode(myPresentation)
                {
                    Parent        = clusterNode,
                    Id            = n,
                    Caption       = captionModule.Get(n).DisplayText,
                    IsDropAllowed = false,
                    ShowId        = TreeShowId
                });
                clusterNode.Children.AddRange(newTreeNodes);

                // register for notifications after tree is built to avoid intermediate states getting notified

                foreach (var node in newTreeNodes)
                {
                    PropertyChangedEventManager.AddHandler(node, OnSelectionChanged, PropertySupport.ExtractPropertyName(() => node.IsSelected));
                    PropertyChangedEventManager.AddHandler(node, OnParentChanged, PropertySupport.ExtractPropertyName(() => node.Parent));

                    myNodeToClusterCache[node.Id] = clusterNode.Id;
                }
            }

            Filter = null;

            myTransformationsObserver.ModuleChanged += OnTransformationsChanged;
        }
Exemple #3
0
        protected override void OnModelPropertyChanged(string propertyName)
        {
            if (propertyName == "Presentation")
            {
                if (myPresentation == Model.Presentation)
                {
                    return;
                }

                if (myTransformationsObserver != null)
                {
                    myTransformationsObserver.ModuleChanged -= OnTransformationsChanged;
                    myTransformationsObserver.Dispose();
                }

                myPresentation = Model.Presentation;

                // first build tree - master for preview
                BuildTree();

                // rebuild preview
                myPreviewNodes = null;
                if (Filter == null)
                {
                    PreviewNodes.Refresh();
                }
                else
                {
                    Filter = null;
                }

                // register for updates only AFTER tree is built up completely to avoid getting notified by the built up process
                var transformationModule = Model.Presentation.GetModule <ITransformationModule>();
                myTransformationsObserver = transformationModule.CreateObserver();
                myTransformationsObserver.ModuleChanged += OnTransformationsChanged;
            }
        }
 private void OnMasksChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     PreviewNodes.Refresh();
 }
Exemple #5
0
 private void OnTransformationsChanged(object sender, EventArgs e)
 {
     BuildTree();
     PreviewNodes.Refresh();
 }