Пример #1
0
        // TODO: Ontology stuff
        public static void rebindFrames(KnowledgeAdapter data,
                                        KnowledgeControl control)
        {
            // LEVEL #I - FILE LEVEL
            TreeNode root = KnowledgeTreeView.makeNode("Frame", 0, null, null);

            // LEVEL #II - CATEFORY OF FRAME LEVEL
            TreeNode classes   = KnowledgeTreeView.makeNode("Class frames", 1, null, root);
            TreeNode instances = KnowledgeTreeView.makeNode("Instance frames", 1, null, root);
            TreeNode rules     = KnowledgeTreeView.makeNode("Ruleset frames", 1, null, root);

            // LEVEL #III - CONCRETE FRAME LEVEL
            TreeNode node;

            log.Debug(" data.getFrames.Count=" + data.getFrames().Values.Count);
            foreach (object obj in data.getFrames().Values)
            {
                string name = KnowledgeAdapter.getFrameName(obj);
                log.Debug(" frame - " + name);

                if (KnowledgeAdapter.isClassFrame(obj))
                {
                    node = KnowledgeTreeView.makeNode(name, 2, obj, classes);
                }
                else if (KnowledgeAdapter.isInstanceFrame(obj))
                {
                    node = KnowledgeTreeView.makeNode(name, 2, obj, instances);
                }
                else
                {
                    log.Debug(" warning - the frame is nobody's");
                    continue;
                }

                KnowledgeTreeView.rebindSlots(obj, node);
            }

            // TODO: include this cycle into previous somehow
            log.Debug(" data.getRules.Count=" + data.getRules().Values.Count);
            foreach (object obj in data.getRules().Values)
            {
                string name = KnowledgeAdapter.getFrameName(obj);
                log.Debug(" frame - " + name);

                if (KnowledgeAdapter.isRuleFrame(obj))
                {
                    node = KnowledgeTreeView.makeNode(name, 2, obj, rules);
                }
                else
                {
                    log.Debug(" warning - the frame is nobody's");
                }

                // TODO: need to implement
                // buildSlotsForFrame(frame, curNode);
            }

            // ooh!
            control.rebindFrames(root);
        }
Пример #2
0
        public KnowledgeTreeView(KnowledgeController controller,
                                 KnowledgeModel model,
                                 KnowledgeControl control)
        {
            log.Debug(" tree view ctor ... ");

            this.controller = controller;
            this.model      = model;
            this.control    = control;

            // TODO: disable all tabs initially
            this.control.Enabled = false;
        }