Beispiel #1
0
 /// <summary>
 /// Removes a dependency between a model and a UI.
 /// </summary>
 /// <param name="model">The model side of the dependency.</param>
 /// <param name="ui">The UI side of the dependency.</param>
 public static void RemoveDependency(this IGraphElementModel model, IModelUI ui)
 {
     if (s_ModelDependencies.TryGetValue(model.Guid, out var uiList))
     {
         uiList.Remove(ui);
     }
 }
Beispiel #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BaseModelUIPart"/> class.
 /// </summary>
 /// <param name="name">The name of the part.</param>
 /// <param name="model">The model displayed in this part.</param>
 /// <param name="ownerElement">The owner of the part.</param>
 /// <param name="parentClassName">The class name of the parent.</param>
 protected BaseModelUIPart(string name, IGraphElementModel model, IModelUI ownerElement, string parentClassName)
 {
     PartName          = name;
     m_Model           = model;
     m_OwnerElement    = ownerElement;
     m_ParentClassName = parentClassName;
 }
Beispiel #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IconTitleProgressPart"/> class.
 /// </summary>
 /// <param name="name">The name of the part.</param>
 /// <param name="model">The model displayed in this part.</param>
 /// <param name="ownerElement">The owner of the part.</param>
 /// <param name="parentClassName">The class name of the parent.</param>
 protected IconTitleProgressPart(string name, IGraphElementModel model, IModelUI ownerElement, string parentClassName)
     : base(name, model, ownerElement, parentClassName, multiline: false)
 {
     if (model.IsCollapsible())
     {
         var collapseButtonPart = NodeCollapseButtonPart.Create(collapseButtonPartName, model, ownerElement, ussClassName);
         PartList.AppendPart(collapseButtonPart);
     }
 }
        /// <summary>
        /// Creates a new instance of the <see cref="EdgeControlPart"/> class.
        /// </summary>
        /// <param name="name">The name of the part.</param>
        /// <param name="model">The model displayed in this part.</param>
        /// <param name="ownerElement">The owner of the part.</param>
        /// <param name="parentClassName">The class name of the parent.</param>
        /// <returns>A new instance of <see cref="EdgeControlPart"/>.</returns>
        public static EdgeControlPart Create(string name, IGraphElementModel model, IModelUI ownerElement, string parentClassName)
        {
            if (model is IEdgeModel)
            {
                return(new EdgeControlPart(name, model, ownerElement, parentClassName));
            }

            return(null);
        }
        public static PrintResultPart Create(string name, IGraphElementModel model, IModelUI modelUI, string parentClassName)
        {
            if (model is MathResult)
            {
                return(new PrintResultPart(name, model, modelUI, parentClassName));
            }

            return(null);
        }
Beispiel #6
0
        /// <summary>
        /// Adds a dependency between a model and a UI.
        /// </summary>
        /// <param name="model">The model side of the dependency.</param>
        /// <param name="ui">The UI side of the dependency.</param>
        public static void AddDependency(this IGraphElementModel model, IModelUI ui)
        {
            if (!s_ModelDependencies.TryGetValue(model.Guid, out var uiList))
            {
                uiList = new HashSet <IModelUI>();
                s_ModelDependencies[model.Guid] = uiList;
            }

            uiList.Add(ui);
        }
        /// <summary>
        /// Creates a new instance of the <see cref="ConstantNodeEditorPart"/> class.
        /// </summary>
        /// <param name="name">The name of the part.</param>
        /// <param name="model">The model displayed in this part.</param>
        /// <param name="ownerElement">The owner of the part.</param>
        /// <param name="parentClassName">The class name of the parent.</param>
        /// <returns>A new instance of <see cref="ConstantNodeEditorPart"/>.</returns>
        public static ConstantNodeEditorPart Create(string name, IGraphElementModel model,
                                                    IModelUI ownerElement, string parentClassName)
        {
            if (model is IConstantNodeModel)
            {
                return(new ConstantNodeEditorPart(name, model, ownerElement, parentClassName));
            }

            return(null);
        }
        public void RemoveGraphElement(IModelUI modelUI)
        {
            if (modelUI.Model == null)
            {
                return;
            }

            var contextualizedGraphElements = m_ContextualizedGraphElements.FirstOrDefault(cge => cge.View == modelUI.View && cge.Context == modelUI.Context);

            contextualizedGraphElements?.GraphElements.Remove(modelUI.Model.Guid);
        }
Beispiel #9
0
 private void mainTabControl_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (mainTabControl.SelectedIndex == 0)
     {
         this.model = this.brg;
         //MessageBox.Show("brg");
     }
     else
     {
         this.model = this.grn;
         //MessageBox.Show("grn");
     }
 }
        public IModelUI FirstOrDefault(IModelView view, string context, IGraphElementModel model)
        {
            if (model == null)
            {
                return(null);
            }

            var contextualizedGraphElement = m_ContextualizedGraphElements.FirstOrDefault(gel => gel.View == view && gel.Context == context);

            IModelUI modelUI = null;

            contextualizedGraphElement?.GraphElements.TryGetValue(model.Guid, out modelUI);
            return(modelUI);
        }
        public void AddOrReplaceUIForModel(IModelUI modelUI)
        {
            if (modelUI.Model == null)
            {
                return;
            }

            var view    = modelUI.View;
            var context = modelUI.Context;

            var contextualizedGraphElement = m_ContextualizedGraphElements.FirstOrDefault(cge
                                                                                          => cge.View == view && cge.Context == context);

            if (contextualizedGraphElement == null)
            {
                contextualizedGraphElement = new ContextualizedGraphElements(view, context);
                m_ContextualizedGraphElements.Add(contextualizedGraphElement);
            }

            contextualizedGraphElement.GraphElements[modelUI.Model.Guid] = modelUI;
        }
        /// <summary>
        /// Creates a new instance of the <see cref="PortContainerPart"/> class.
        /// </summary>
        /// <param name="name">The name of the part.</param>
        /// <param name="model">The model displayed in this part.</param>
        /// <param name="ownerElement">The owner of the part.</param>
        /// <param name="parentClassName">The class name of the parent.</param>
        /// <returns>A new instance of <see cref="PortContainerPart"/>.</returns>
        public static PortContainerPart Create(string name, IGraphElementModel model, IModelUI ownerElement, string parentClassName)
        {
            if (model is IPortNodeModel)
            {
                return(new PortContainerPart(name, model, ownerElement, parentClassName));
            }

            return(null);
        }
        public static MathOperatorInspector Create(string name, IGraphElementModel model, IModelUI ownerElement, string parentClassName)
        {
            if (model is MathOperator)
            {
                return(new MathOperatorInspector(name, model, ownerElement, parentClassName));
            }

            return(null);
        }
 protected PrintResultPart(string name, IGraphElementModel model, IModelUI ownerElement, string parentClassName)
     : base(name, model, ownerElement, parentClassName)
 {
 }
 internal static void RemoveGraphElement(IModelUI modelUI)
 {
     s_UIForModel.RemoveGraphElement(modelUI);
 }
 internal static void AddOrReplaceGraphElement(IModelUI modelUI)
 {
     s_UIForModel.AddOrReplaceUIForModel(modelUI);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="BlackboardVariablePart"/> class.
 /// </summary>
 /// <param name="name">The name of the part.</param>
 /// <param name="model">The model displayed in this part.</param>
 /// <param name="ownerElement">The owner of the part.</param>
 /// <param name="parentClassName">The class name of the parent.</param>
 protected BlackboardVariablePart(string name, IGraphElementModel model, IModelUI ownerElement, string parentClassName)
     : base(name, model, ownerElement, parentClassName)
 {
 }
        /// <summary>
        /// Creates a new instance of the <see cref="PortConnectorWithIconPart"/> class.
        /// </summary>
        /// <param name="name">The name of the part.</param>
        /// <param name="model">The model displayed in this part.</param>
        /// <param name="ownerElement">The owner of the part.</param>
        /// <param name="parentClassName">The class name of the parent.</param>
        /// <returns>A new instance of <see cref="PortConnectorWithIconPart"/>.</returns>
        public new static PortConnectorWithIconPart Create(string name, IGraphElementModel model, IModelUI ownerElement, string parentClassName)
        {
            if (model is IPortModel && ownerElement is Port)
            {
                return(new PortConnectorWithIconPart(name, model, ownerElement, parentClassName));
            }

            return(null);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="FieldsInspector"/> class.
 /// </summary>
 protected FieldsInspector(string name, IGraphElementModel model, IModelUI ownerElement, string parentClassName)
     : base(name, model, ownerElement, parentClassName)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CollapseButtonPart"/> class.
 /// </summary>
 /// <param name="name">The name of the part.</param>
 /// <param name="model">The model displayed in this part.</param>
 /// <param name="ownerElement">The owner of the part.</param>
 /// <param name="parentClassName">The class name of the parent.</param>
 protected CollapseButtonPart(string name, IGraphElementModel model, IModelUI ownerElement, string parentClassName)
     : base(name, model, ownerElement, parentClassName)
 {
 }
Beispiel #21
0
        public static TemperatureAndTimePart Create(string name, IGraphElementModel model, IModelUI modelUI, string parentClassName)
        {
            if (model is INodeModel)
            {
                return(new TemperatureAndTimePart(name, model, modelUI, parentClassName));
            }

            return(null);
        }
 /// <summary>
 /// Creates a new ContextBlocksPart.
 /// </summary>
 /// <param name="name">The name of the part to create.</param>
 /// <param name="nodeModel">The model which the part represents.</param>
 /// <param name="ownerElement">The owner of the part to create.</param>
 /// <param name="parentClassName">The class name of the parent UI.</param>
 /// <returns>A newly created ContextBlocksPart.</returns>
 protected ContextBlocksPart(string name, IContextNodeModel nodeModel, IModelUI ownerElement, string parentClassName)
     : base(name, nodeModel, ownerElement, parentClassName)
 {
 }
        /// <summary>
        /// Creates a new <see cref="ContextBlocksPart"/>.
        /// </summary>
        /// <param name="name">The name of the part to create.</param>
        /// <param name="model">The model which the part represents.</param>
        /// <param name="ownerElement">The owner of the part to create.</param>
        /// <param name="parentClassName">The class name of the parent UI.</param>
        /// <returns>A new instance of <see cref="ContextBlocksPart"/>.</returns>
        public static ContextBlocksPart Create(string name, IGraphElementModel model, IModelUI ownerElement, string parentClassName)
        {
            if (model is IContextNodeModel contextModel)
            {
                return(new ContextBlocksPart(name, contextModel, ownerElement, parentClassName));
            }

            return(null);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="PortContainerPart"/> class.
 /// </summary>
 /// <param name="name">The name of the part.</param>
 /// <param name="model">The model displayed in this part.</param>
 /// <param name="ownerElement">The owner of the part.</param>
 /// <param name="parentClassName">The class name of the parent.</param>
 protected PortContainerPart(string name, IGraphElementModel model, IModelUI ownerElement, string parentClassName)
     : base(name, model, ownerElement, parentClassName)
 {
 }
 /// <inheritdoc />
 public MathOperatorInspector(string name, IGraphElementModel model, IModelUI ownerElement, string parentClassName)
     : base(name, model, ownerElement, parentClassName)
 {
 }
        /// <summary>
        /// Creates a new instance of the <see cref="BlackboardVariablePart"/> class.
        /// </summary>
        /// <param name="name">The name of the part.</param>
        /// <param name="model">The model displayed in this part.</param>
        /// <param name="ownerElement">The owner of the part.</param>
        /// <param name="parentClassName">The class name of the parent.</param>
        /// <returns>A new instance of <see cref="BlackboardVariablePart"/>.</returns>
        public static BlackboardVariablePart Create(string name, IGraphElementModel model, IModelUI ownerElement, string parentClassName)
        {
            if (model is IVariableDeclarationModel)
            {
                return(new BlackboardVariablePart(name, model, ownerElement, parentClassName));
            }

            return(null);
        }
        /// <summary>
        /// Creates a new instance of the <see cref="CollapseButtonPart"/> class.
        /// </summary>
        /// <param name="name">The name of the part.</param>
        /// <param name="model">The model displayed in this part.</param>
        /// <param name="ownerElement">The owner of the part.</param>
        /// <param name="parentClassName">The class name of the parent.</param>
        /// <returns>A new instance of <see cref="CollapseButtonPart"/>.</returns>
        public static CollapseButtonPart Create(string name, IGraphElementModel model, IModelUI ownerElement, string parentClassName)
        {
            if (model is ICollapsible)
            {
                return(new CollapseButtonPart(name, model, ownerElement, parentClassName));
            }

            return(null);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="EdgeControlPart"/> class.
 /// </summary>
 /// <param name="name">The name of the part.</param>
 /// <param name="model">The model displayed in this part.</param>
 /// <param name="ownerElement">The owner of the part.</param>
 /// <param name="parentClassName">The class name of the parent.</param>
 protected EdgeControlPart(string name, IGraphElementModel model, IModelUI ownerElement, string parentClassName)
     : base(name, model, ownerElement, parentClassName)
 {
 }
Beispiel #29
0
 TemperatureAndTimePart(string name, IGraphElementModel model, IModelUI ownerElement, string parentClassName)
     : base(name, model, ownerElement, parentClassName)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ConstantNodeEditorPart"/> class.
 /// </summary>
 /// <param name="name">The name of the part.</param>
 /// <param name="model">The model displayed in this part.</param>
 /// <param name="ownerElement">The owner of the part.</param>
 /// <param name="parentClassName">The class name of the parent.</param>
 protected ConstantNodeEditorPart(string name, IGraphElementModel model, IModelUI ownerElement,
                                  string parentClassName)
     : base(name, model, ownerElement, parentClassName)
 {
 }