Ejemplo n.º 1
0
        public void OfferAllNodes(GlGraph working_graph)
        {
            List<NodeWrapper> valid_targets = new List<NodeWrapper>();
            foreach (GlGraphNode loop_node in working_graph.AllNodes)
            {
                valid_targets.Add(new NodeWrapper(loop_node));
            }

            comboTargetNodes.DisplayMember = "NodeName";
            comboTargetNodes.DataSource = new BindingList<NodeWrapper>(valid_targets);
            comboTargetNodes.Refresh();
        }
Ejemplo n.º 2
0
        // constructor is INTERNAL because client code should generate edges by using the graph node class's "ConnectTo" method
        internal GlGraphEdge(GlGraph parent_graph, GlGraphNode _source, GlGraphNode _target, bool create_in_db)
        {
            _ParentGraph = parent_graph;

            if (create_in_db)
            {
                parent_graph.GlNodeRef.Set(GlobalsGraphAdmin.GL_EDGE_FLAG, GlobalsGraphAdmin.GL_EDGES_SUBSCRIPT, _source.NodeUID.ToString(), _target.NodeUID.ToString());
            }

            source_node = _source;
            target_node = _target;
            Attach();
        }
Ejemplo n.º 3
0
        public void InitForNewEdge(GlGraph working_graph, GlGraphNode start_node)
        {
            List<NodeWrapper> valid_targets = new List<NodeWrapper>();
            foreach (GlGraphNode loop_node in working_graph.AllNodes)
            {
                if (start_node.FindConnectionTo(loop_node) == null)
                {
                    valid_targets.Add(new NodeWrapper(loop_node));
                }
            }

            comboTargetNodes.DisplayMember = "NodeName";
            comboTargetNodes.DataSource = new BindingList<NodeWrapper>(valid_targets);
            comboTargetNodes.Refresh();
        }
Ejemplo n.º 4
0
 public static void AddGraphNode(GlGraph parent_graph, string new_node_name)
 {
     // biz rule
     parent_graph.CreateNewNode().SetCustomString(NODE_NAME_PROPERTY, new_node_name);
 }
Ejemplo n.º 5
0
 // build a graphnode class around an existing graph node in the DB; used during initialization
 internal GlGraphNode(GlGraph parent_graph, Guid node_guid)
 {
     _NodeUID = node_guid;
     _ParentGraph = parent_graph;
 }
Ejemplo n.º 6
0
 // create a new node on a graph
 internal GlGraphNode(GlGraph parent_graph)
 {
     _NodeUID = Guid.NewGuid();
     _ParentGraph = parent_graph;
     _ParentGraph.GlNodeRef.Set(GlobalsGraphAdmin.GL_NODE_FLAG, GlobalsGraphAdmin.GL_NODES_SUBSCRIPT, _NodeUID.ToString());
 }
Ejemplo n.º 7
0
 // build a graphnode class around an existing graph node in the DB; used during initialization
 internal GlGraphNode(GlGraph parent_graph, Guid node_guid)
 {
     _NodeUID     = node_guid;
     _ParentGraph = parent_graph;
 }
Ejemplo n.º 8
0
 // create a new node on a graph
 internal GlGraphNode(GlGraph parent_graph)
 {
     _NodeUID     = Guid.NewGuid();
     _ParentGraph = parent_graph;
     _ParentGraph.GlNodeRef.Set(GlobalsGraphAdmin.GL_NODE_FLAG, GlobalsGraphAdmin.GL_NODES_SUBSCRIPT, _NodeUID.ToString());
 }
Ejemplo n.º 9
0
        private void comboGraphs_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (BuildingGraphList) return;

            if (comboGraphs.SelectedItem.ToString() == GRAPH_CHOOSE_ENTRY)
            {
                // it's the "choose ..." entry
                CurrentGraph = null;
                RebuildNodeList();
                buttonNewNode.Enabled = false;
            }
            else
            {
                string err_msg = "";
                CurrentGraph = GlobalsGraphAdmin.OpenGraph(comboGraphs.SelectedItem.ToString(), out err_msg);
                if (CurrentGraph == null)
                    MessageBox.Show(err_msg);
                else
                    RebuildNodeList();

                buttonNewNode.Enabled = true;
            }

            buttonDeleteGraph.Enabled = (CurrentGraph != null);
        }