/// <summary>
        /// Gets the connector.
        /// </summary>
        /// <param name="point">The point.</param>
        /// <param name="drawer">The drawer.</param>
        /// <returns>ConnectorDefinition.</returns>
        private ConnectorDefinition getConnector(JoinPoint point, InstanceDrawer drawer)
        {
            var instance = drawer.GetInstanceDrawing(point.Instance.Component);

            var connector = instance.GetJoinPoint(point.Point);

            return(connector);
        }
        /// <summary>
        /// Export data from represented <see cref="Instance" /> by using given drawer.
        /// <remarks>Note that only instances which are forced to display are displayed in root of <see cref="MEFEditor.Drawing.DiagramCanvas" /></remarks>.
        /// </summary>
        /// <param name="drawer">The drawer.</param>
        protected override void draw(InstanceDrawer drawer)
        {
            var slot = drawer.AddSlot();

            drawCatalog(drawer, slot);
            setCompositionInfo(drawer);

            drawer.ForceShow();
        }
예제 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DrawedInstance" /> class.
        /// </summary>
        /// <param name="definition">The definition.</param>
        /// <param name="instance">The instance.</param>
        /// <param name="pipeline">The pipeline.</param>
        internal DrawedInstance(RuntimeTypeDefinition definition, Instance instance, DrawingPipeline pipeline)
        {
            Pipeline        = pipeline;
            WrappedInstance = instance;

            Drawing        = new DiagramItemDefinition(instance.ID, instance.Info.TypeName);
            InstanceDrawer = new InstanceDrawer(this);

            addEdits();
        }
        /// <summary>
        /// Gets the connector.
        /// </summary>
        /// <param name="point">The point.</param>
        /// <param name="drawer">The drawer.</param>
        /// <returns>ConnectorDefinition.</returns>
        private ConnectorDefinition getConnector(JoinPoint point, InstanceDrawer drawer)
        {
            var instance = drawer.GetInstanceDrawing(point.Instance.Component);

            var connector = instance.GetJoinPoint(point.Point);

            connector.SetProperty("Error", point.Error);
            connector.SetProperty("Warning", point.Warning);

            return(connector);
        }
예제 #5
0
        /// <summary>
        /// Export data from represented <see cref="Instance" /> by using given drawer.
        /// <remarks>Note that only instances which are forced to display are displayed in root of <see cref="MEFEditor.Drawing.DiagramCanvas" /></remarks>
        /// </summary>
        /// <param name="drawer">The drawer.</param>
        protected override void draw(InstanceDrawer drawer)
        {
            var slot = drawer.AddSlot();

            foreach (var child in Children)
            {
                var childDrawing = drawer.GetInstanceDrawing(child);
                slot.Add(childDrawing.Reference);
            }

            drawer.ForceShow();
        }
        /// <summary>
        /// Sets the composition information.
        /// </summary>
        /// <param name="drawer">The drawer.</param>
        private void setCompositionInfo(InstanceDrawer drawer)
        {
            var compositionResult = CompositionResult.Get();

            CompositionContext context = null;

            var error = Error.Value == null ? "" : Error.Value;

            if (compositionResult != null)
            {
                if (compositionResult.Error != null)
                {
                    error = compositionResult.Error + Environment.NewLine + error;
                }
                context = compositionResult.Context;
            }

            if (error != "")
            {
                drawer.SetProperty("Error", error);
            }

            if (context != null)
            {
                foreach (var component in context.InputInstances)
                {
                    var drawing = drawer.GetInstanceDrawing(component);
                    drawing.SetProperty("Composed", "True");
                }

                foreach (var point in compositionResult.Points)
                {
                    var joinPoint = getConnector(point, drawer);
                }

                foreach (var join in compositionResult.Joins)
                {
                    if (compositionResult.Failed && !join.IsErrorJoin)
                    {
                        //on error we want to display only error joins
                        continue;
                    }

                    var fromPoint = getConnector(join.Export, drawer);
                    var toPoint   = getConnector(join.Import, drawer);

                    var joinDefinition = drawer.DrawJoin(fromPoint, toPoint);
                    //TODO set properties of joinDefinition
                }
            }
        }
예제 #7
0
        /// <summary>
        /// Draws the specified services.
        /// </summary>
        /// <param name="services">The services.</param>
        protected override void draw(InstanceDrawer services)
        {
            var importedValues = Import.Get();

            var i = 0;

            foreach (var value in importedValues)
            {
                services.SetProperty("Import[" + i + "]", value);
                ++i;
            }

            services.ForceShow();
        }
        /// <summary>
        /// Export data from represented <see cref="Instance" /> by using given drawer.
        /// <remarks>Note that only instances which are forced to display are displayed in root of <see cref="MEFEditor.Drawing.DiagramCanvas" /></remarks>
        /// </summary>
        /// <param name="drawer">The drawer.</param>
        protected override void draw(InstanceDrawer drawer)
        {
            var importedValues = Import.Get();

            if (importedValues != null)
            {
                var i = 0;
                foreach (var value in importedValues)
                {
                    drawer.SetProperty("Import[" + i + "]", value);
                    ++i;
                }
            }

            drawer.ForceShow();
        }
        /// <summary>
        /// Draws the catalog.
        /// </summary>
        /// <param name="drawer">The drawer.</param>
        /// <param name="slot">The slot.</param>
        private void drawCatalog(InstanceDrawer drawer, SlotDefinition slot)
        {
            var composableCatalog = ComposableCatalog.Get();

            if (composableCatalog != null)
            {
                var catalogDrawing = drawer.GetInstanceDrawing(composableCatalog);
                slot.Add(catalogDrawing.Reference);
            }

            foreach (var composedPart in DirectChildren.Value)
            {
                var partDrawing = drawer.GetInstanceDrawing(composedPart);
                slot.Add(partDrawing.Reference);
            }
        }
예제 #10
0
        /// <summary>
        /// Export data from represented <see cref="Instance" /> by using given drawer.
        /// <remarks>Note that only instances which are forced to display are displayed in root of <see cref="MEFEditor.Drawing.DiagramCanvas" /></remarks>.
        /// </summary>
        /// <param name="drawer">The drawer.</param>
        protected override void draw(InstanceDrawer drawer)
        {
            var slot = drawer.AddSlot();

            var parts = Parts.Get();

            if (parts != null)
            {
                foreach (var part in parts)
                {
                    var partDrawing = drawer.GetInstanceDrawing(part);
                    slot.Add(partDrawing.Reference);
                }
            }

            drawer.ForceShow();
        }
예제 #11
0
        /// <summary>
        /// Export data from represented <see cref="Instance" /> by using given drawer.
        /// <remarks>Note that only instances which are forced to display are displayed in root of <see cref="MEFEditor.Drawing.DiagramCanvas" /></remarks>.
        /// </summary>
        /// <param name="drawer">The drawer.</param>
        protected override void draw(InstanceDrawer drawer)
        {
            var slot = drawer.AddSlot();

            foreach (var toAdd in PartsToAdd.Value)
            {
                var drawing = drawer.GetInstanceDrawing(toAdd);
                slot.Add(drawing.Reference);
            }

            foreach (var toRemove in PartsToRemove.Value)
            {
                var drawing = drawer.GetInstanceDrawing(toRemove);
                drawing.SetProperty("Removed", "by CompositionBatch");
                slot.Add(drawing.Reference);
            }

            drawer.ForceShow();
        }
        /// <summary>
        /// Export data from represented <see cref="Instance" /> by using given drawer.
        /// <remarks>Note that only instances which are forced to display are displayed in root of editors workspace.</remarks>.
        /// </summary>
        /// <param name="drawer">The drawer.</param>
        protected override void draw(InstanceDrawer drawer)
        {
            drawer.SetProperty("Path", Path.Value);
            drawer.SetProperty("FullPath", FullPath.Value);
            drawer.SetProperty("Error", Error.Value);
            drawer.SetProperty("AssemblyName", AssemblyName.Value);

            var slot = drawer.AddSlot();

            if (Components.Value != null)
            {
                foreach (var component in Components.Value)
                {
                    var componentDrawing = drawer.GetInstanceDrawing(component);
                    slot.Add(componentDrawing.Reference);
                }
            }

            drawer.ForceShow();
        }
        /// <summary>
        /// Export data from represented <see cref="Instance" /> by using given drawer.
        /// <remarks>Note that only instances which are forced to display are displayed in root of <see cref="MEFEditor.Drawing.DiagramCanvas" /></remarks>.
        /// </summary>
        /// <param name="drawer">The drawer.</param>
        protected override void draw(InstanceDrawer drawer)
        {
            var isComposed = Composed.Get();

            drawer.PublishField("AssemblyPath", AssemblyPath);
            drawer.PublishField("Composed", Composed);

            var slot = drawer.AddSlot();

            var context = CompositionContext.Get();

            if (context != null)
            {
                foreach (var component in CompositionContext.Get().InputInstances)
                {
                    var drawing = drawer.GetInstanceDrawing(component);
                    drawing.SetProperty("Composed", isComposed.ToString());
                    slot.Add(drawing.Reference);
                }

                var compositionResult = CompositionResult.Get();

                foreach (var point in compositionResult.Points)
                {
                    var joinPoint = getConnector(point, drawer);
                }

                foreach (var join in compositionResult.Joins)
                {
                    var fromPoint = getConnector(join.Export, drawer);
                    var toPoint   = getConnector(join.Import, drawer);

                    var joinDefinition = drawer.DrawJoin(fromPoint, toPoint);
                    //TODO set properties of joinDefinition
                }
            }

            drawer.ForceShow();
        }
예제 #14
0
        protected override void draw(InstanceDrawer drawer)
        {
            //přidáme definici slotu, ve kterém se budou
            //zobrazovat uložené instance
            var instanceSlot = drawer.AddSlot();

            //vytvořený slot naplníme instancemi
            foreach (var instance in Instances.Value)
            {
                //pro každou instanci musíme získat reprezentaci
                //jejího zobrazení
                var instanceDrawing = drawer.GetInstanceDrawing(instance);
                //do slotu patří pouze reference na vytvořené zobrazení
                instanceSlot.Add(instanceDrawing.Reference);
            }

            //předáme informace které vypíšeme uživateli
            drawer.PublishField("message", Message);
            drawer.SetProperty("time", Watch.Value.ElapsedMilliseconds + "ms");

            //vynutíme zobrazení této instance
            //ve schématu kompozice
            drawer.ForceShow();
        }
예제 #15
0
 /// <summary>
 /// Draws the specified services.
 /// </summary>
 /// <param name="services">The services.</param>
 protected override void draw(InstanceDrawer services)
 {
     services.PublishField("Import", Import);
     services.PublishField("PreImport", PreImport);
     services.ForceShow();
 }
예제 #16
0
 /// <summary>
 /// Draws the specified services.
 /// </summary>
 /// <param name="services">The services.</param>
 protected override void draw(InstanceDrawer services)
 {
     services.PublishField("Import", Import);
     services.SetProperty("ImportValue", Import.Value.Value.Wrapped.ToString());
     services.ForceShow();
 }
예제 #17
0
 /// <summary>
 /// Draws the specified services.
 /// </summary>
 /// <param name="services">The services.</param>
 protected override void draw(InstanceDrawer services)
 {
     services.PublishField("TestProperty", TestProperty);
     services.ForceShow();
 }
예제 #18
0
 /// <summary>
 /// Export data from represented <see cref="Instance"/> by using given drawer.
 /// <remarks>Note that only instances which are forced to display are displayed in root of <see cref="DiagramCanvas"/></remarks>
 /// </summary>
 /// <param name="drawer">The drawer.</param>
 protected virtual void draw(InstanceDrawer drawer)
 {
     //by default there is nothing to do
 }