Example #1
0
        private void FillNewVertexAndEdgeBySchemaMenu()
        {
            IVertex baseVertex = Edge.Get(@"To:");

            IVertex r = baseVertex.GetAll(@"$Is:");

            if (r.Count() == 0)
            {
                r = Edge.GetAll(@"Meta:");
            }
            ;

            if (r.Count() == 0 || r.FirstOrDefault().To.Value == null || GeneralUtil.CompareStrings(r.FirstOrDefault().To.Value, "$Empty"))
            {
                NewVertexBySchema.IsEnabled = false;
                NewEdgeBySchema.IsEnabled   = false;
                return;
            }

            NewVertexBySchema.Items.Clear();
            NewEdgeBySchema.Items.Clear();

            foreach (IEdge e in r)
            {
                NewVertexAndEdgeBySchema_FillForMeta(baseVertex, e.To, VertexOperations.GetChildEdges(e.To));
            }

            NewVertexAndEdgeBySchema_FillForMeta(baseVertex, MinusZero.Instance.Root.Get(@"System\Meta\Base\Vertex"), MinusZero.Instance.Root.GetAll(@"System\Meta\Base\Vertex\"));

            NewVertexBySchema.IsEnabled = true;
            NewEdgeBySchema.IsEnabled   = true;
        }
Example #2
0
        protected override void CreateView()
        {
            if (GraphUtil.GetValueAndCompareStrings(Vertex.Get("AlternatingRows:"), "True"))
            {
                this.ThisDataGrid.AlternatingRowBackground = (Brush)FindResource("0AlternatingBackgroundBrush");
            }
            else
            {
                this.ThisDataGrid.AlternatingRowBackground = (Brush)FindResource("0BackgroundBrush");
            }

            ThisDataGrid.Columns.Clear();


            AddInfoTemplateButton();
            AddDeleteTemplateButton();

            AddColumn("", ""); // Vertex level column

            IVertex childs = null;

            if (ToShowEdgesMeta != null)
            {
                childs = VertexOperations.GetChildEdges(ToShowEdgesMeta);
                foreach (IEdge e in childs)
                {
                    if (e.To.Get("$Hide:") == null)
                    {
                        AddColumn((string)e.To.Value, "To[" + (string)e.To.Value + "]");
                    }
                }

                if (ExpertMode)
                {
                    foreach (IEdge e in MinusZero.Instance.Root.Get(@"System\Meta\Base\Vertex"))
                    {
                        bool contains = false;

                        foreach (IEdge ee in childs)
                        {
                            if (GeneralUtil.CompareStrings(ee.To, e.To))
                            {
                                contains = true;
                            }
                        }

                        if (contains == false && e.To.Get("$Hide:") == null)
                        {
                            AddColumn((string)e.To.Value, "To[" + (string)e.To.Value + "]");
                        }
                    }
                }
            }
        }
Example #3
0
        public static IVertex NewVertexBySchema(IVertex baseVertex, IVertex inputVertex)
        {
            IVertex Vertex     = baseVertex.Get("To:");
            IVertex MetaVertex = inputVertex;

            IVertex v = VertexOperations.AddInstance(Vertex, MetaVertex);

            if (VertexOperations.GetChildEdges(MetaVertex).Count() > 0)
            {
                MinusZero.Instance.DefaultShow.EditDialog(v, null);
            }
            else
            {
                NewVertexBySchema d = new NewVertexBySchema(v, MetaVertex);

                MinusZero.Instance.DefaultShow.ShowContentFloating(d);
            }

            return(null);
        }
Example #4
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            MinusZero.Instance.DefaultShow.CloseWindowByContent(this);

            if (GeneralUtil.CompareStrings(this.Schema.Vertex.Get(@"BaseEdge:\To:\To:").Value, "$Empty"))
            {
                Vertex.AddVertex(null, this.Content.Text);
            }
            else
            {
                //Vertex.AddVertex(this.Schema.Vertex.Get(@"BaseEdge:\To:\To:"), this.Content.Text);

                IVertex meta = this.Schema.Vertex.Get(@"BaseEdge:\To:\To:");

                IVertex v = VertexOperations.AddInstance(Vertex, meta);

                v.Value = this.Content.Text;

                if (VertexOperations.GetChildEdges(meta).Count() > 0)
                {
                    MinusZero.Instance.DefaultShow.EditDialog(v, null);
                }
            }
        }
Example #5
0
        public void UpdateBaseEdge()
        {
            DispachAllSubVisualisers();

            BaseVertexEdgeAdded_PreFill = false;
            BaseVertexEdgeAdded         = false;


            //  if (!isLoaded)
            //    return;

            IVertex basTo = Vertex.Get(@"BaseEdge:\To:");

            if (basTo != null)
            {
                if ((string)Vertex.Get(@"SectionsAsTabs:").Value == "True")
                {
                    SectionsAsTabs = true;
                }
                else
                {
                    SectionsAsTabs = false;
                }

                if ((string)Vertex.Get(@"MetaOnLeft:").Value == "True")
                {
                    MetaOnLeft = true;
                }
                else
                {
                    MetaOnLeft = false;
                }

                if ((string)Vertex.Get(@"ExpertMode:").Value == "True")
                {
                    ExpertMode = true;
                }
                else
                {
                    ExpertMode = false;
                }

                ColumnNumber = GraphUtil.GetIntegerValue(Vertex.Get(@"ColumnNumber:"));

                IVertex metaForForm = getMetaForForm();

                PreFillForm();

                InitializeControlContent();

                List <IEdge> childs = new List <IEdge>();

                if (metaForForm == null || metaForForm.Count() == 0) // if Form is not typed
                {
                    IList <IVertex> visited = new List <IVertex>();

                    foreach (IEdge e in basTo)
                    {
                        childs.Add(e);

                        if (!visited.Contains(e.Meta) && e.Meta.Get("$Hide:") == null)
                        {
                            if (basTo.GetAll(e.Meta + ":").Count() > 1)
                            {
                                AddEdge(e.Meta, true);
                                visited.Add(e.Meta);
                            }
                            else
                            {
                                AddEdge(e.Meta, false);
                            }
                        }
                    }
                }
                else // Form is typed
                {
                    foreach (IEdge e in VertexOperations.GetChildEdges(metaForForm))
                    {
                        childs.Add(e);

                        if (e.To.Get("$Hide:") == null)
                        {
                            if (GraphUtil.GetIntegerValue(e.To.Get("$MaxCardinality:")) > 1 || GraphUtil.GetIntegerValue(e.To.Get("$MaxCardinality:")) == -1)
                            {
                                AddEdge(e.To, true);
                            }
                            else
                            {
                                AddEdge(e.To, false);
                            }
                        }
                    }
                }

                if (ExpertMode)
                {
                    foreach (IEdge e in MinusZero.Instance.Root.Get(@"System\Meta\Base\Vertex"))
                    {
                        bool contains = false;

                        foreach (IEdge ee in childs)
                        {
                            if (GeneralUtil.CompareStrings(ee.To, e.To))
                            {
                                contains = true;
                            }
                        }

                        if (contains == false)
                        {
                            AddEdge(e.To, false);
                        }
                    }
                }

                if (MetaOnLeft)
                {
                    if (!HasTabs)
                    {
                        CorrectWidth(TabList[""]);
                    }
                }
            }
        }
Example #6
0
        private void PreFillForm()
        {
            TabList = new Dictionary <string, TabInfo>();

            IVertex basTo = Vertex.Get(@"BaseEdge:\To:");

            IVertex metaForForm = getMetaForForm();

            List <IEdge> childs = new List <IEdge>();

            if (metaForForm == null || metaForForm.Count() == 0) // if Form is not typed
            {
                IList <IVertex> visited = new List <IVertex>();

                foreach (IEdge e in basTo)
                {
                    childs.Add(e);
                    if (!visited.Contains(e.Meta) && e.Meta.Get("$Hide:") == null)
                    {
                        if (basTo.GetAll(e.Meta + ":").Count() > 1)
                        {
                            PreFillFormAnalyseEdge(e.Meta, true);
                            visited.Add(e.Meta);
                        }
                        else
                        {
                            PreFillFormAnalyseEdge(e.Meta, false);
                        }
                    }
                }
            }
            else // Form is typed
            {
                foreach (IEdge e in VertexOperations.GetChildEdges(metaForForm))
                {
                    childs.Add(e);

                    if (e.To.Get("$Hide:") == null)
                    {
                        if (GraphUtil.GetIntegerValue(e.To.Get("$MaxCardinality:")) > 1 || GraphUtil.GetIntegerValue(e.To.Get("$MaxCardinality:")) == -1)
                        {
                            PreFillFormAnalyseEdge(e.To, true);
                        }
                        else
                        {
                            PreFillFormAnalyseEdge(e.To, false);
                        }
                    }
                }
            }

            if (ExpertMode)
            {
                foreach (IEdge e in MinusZero.Instance.Root.Get(@"System\Meta\Base\Vertex"))
                {
                    bool contains = false;

                    foreach (IEdge ee in childs)
                    {
                        if (GeneralUtil.CompareStrings(ee.To, e.To))
                        {
                            contains = true;
                        }
                    }

                    if (contains == false)
                    {
                        PreFillFormAnalyseEdge(e.To, false);
                    }
                }
            }
        }