Inheritance: GraphItemConfiguration
        private void AddOutput(NodeInputConfig inputConfig, GenericNode node = null)
        {
            if (!IsVisible(inputConfig.Visibility))
            {
                return;
            }
            var nodeToUse = node ?? GraphItem;
            var header    = new InputOutputViewModel();

            header.Name       = inputConfig.Name.GetValue(node);
            header.DataObject = inputConfig.IsAlias
                ? DataObject
                : inputConfig.GetDataObject(nodeToUse);
            header.OutputConnectorType = inputConfig.SourceType;
            header.IsInput             = false;
            header.IsOutput            = true;
            if (inputConfig.AttributeInfo != null)
            {
                header.IsNewLine = inputConfig.AttributeInfo.IsNewRow;
            }
            else
            {
                header.IsNewLine = true;
            }
            ContentItems.Add(header);
            ApplyOutputConfiguration(inputConfig, header.DataObject as IGraphItem, header.OutputConnector, true);
            if (header.InputConnector != null)
            {
                header.OutputConnector.Configuration = inputConfig;
            }
        }
Exemple #2
0
 public NodeConfig<TNode> InputAlias(string inputName)
 {
     var config = new NodeInputConfig()
     {
         Name = new ConfigProperty<IDiagramNodeItem, string>(inputName),
         IsInput = true,
         IsOutput = false,
         SourceType = typeof(TNode),
         ReferenceType = typeof(TNode),
         IsAlias = true
     };
     GraphItemConfigurations.Add(config);
     return this;
 }
Exemple #3
0
 public NodeConfig<TNode> Input<TSourceType, TReferenceType>(string inputName, bool allowMultiple, Func<IDiagramNodeItem, IDiagramNodeItem, bool> validator = null)
     where TSourceType : class, IConnectable
     where TReferenceType : GenericSlot, new()
 {
     var config = new NodeInputConfig()
     {
         Name = new ConfigProperty<IDiagramNodeItem, string>(inputName),
         IsInput = true,
         IsOutput = false,
         ReferenceType = typeof(TReferenceType),
         SourceType = typeof(TSourceType),
         Validator = validator
     };
     GraphItemConfigurations.Add(config);
     return this;
 }
Exemple #4
0
        private GraphItemConfiguration CreateSlotConfiguration(PropertyInfo property, Slot slot)
        {
            var config = new NodeInputConfig()
            {
                Name          = new ConfigProperty <IDiagramNodeItem, string>(slot.Name),
                IsInput       = slot is InputSlot,
                IsOutput      = slot is OutputSlot,
                Visibility    = slot.Visibility,
                ReferenceType = property.PropertyType,
                SourceType    = slot.SourceType ?? property.PropertyType.GetGenericParameter(),
                PropertyInfo  = property,
                AttributeInfo = slot,
                Tint          = slot.Tint,
                Style         = slot.Style
            };

            return(config);
        }
        private GraphItemConfiguration CreateSlotConfiguration(PropertyInfo property, Slot slot)
        {
            var config = new NodeInputConfig()
            {
                Name = new ConfigProperty<IDiagramNodeItem, string>(slot.Name),
                IsInput = slot is InputSlot,
                IsOutput = slot is OutputSlot,
                Visibility = slot.Visibility,
                ReferenceType = property.PropertyType,
                SourceType = slot.SourceType ?? property.PropertyType.GetGenericParameter(),
                PropertyInfo = property,
                AttributeInfo = slot,
                Tint = slot.Tint,
                Style = slot.Style
            };

            return config;
        }