public Undefined(UndefinedV undefinedV)
        {
            InitializeComponent();

            reference = undefinedV;

            // listen to events from the controller
            //ViewController.ViewEvents ...

            // let the listener controller hear me :)
            ViewController.ViewListener.Listen(this);

            System.Windows.Controls.ToolTip toolTip1 = new System.Windows.Controls.ToolTip();
            toolTip1.Content = "Click to Change";
            this.ToolTip = toolTip1;

            if ((reference.Reference.Parent as OperationD).Children.Count == 1)
            {
                // the undefined is the only item in this structure
                // do not offer chance to be removed
                rightClickMenu.Items.Remove(delete);
            }

            if ((reference.Reference.Parent.Parent as ChoiceD).Children.Count == 1)
            {
                // do not allow remove choice
                rightClickMenu.Items.Remove(removeChoice);
            }
        }
        public void visit(UndefinedD undefinedD)
        {
            UndefinedV undefinedV = new UndefinedV(undefinedD, level + 1);
            undefinedD.References.Add(undefinedV);

            current = undefinedV;
        }
 public void visit(UndefinedV undefinedV)
 {
     drawnItem = new Undefined(undefinedV);
 }
        private GrammarNodeV newVisual(int level)
        {
            if (item is UndefinedD)
            {
                UndefinedD undefinedD = item as UndefinedD;
                UndefinedV visual = new UndefinedV(undefinedD, level);

                undefinedD.References.Add(visual);
                return visual;
            }
            else
                throw new NotImplementedException();
        }
 public void visit(UndefinedV undefinedV)
 {
 }
        public void visit(ConcatenationV concatenationV)
        {
            int position = -1;

            for (int i = 0; i < concatenationV.Children.Count; i++)
            {
                GrammarNodeV child = concatenationV.Children[i];

                if (child.getReference() == target)
                    position = i;

                child.accept(this);
            }

            if (position >= 0)
            {
                int theLevel = (concatenationV.Children[position] as SymbolV).Level;

                ChoiceV choiceV = concatenationV.getParent() as ChoiceV;
                if (choiceV == null)
                    throw new Exception("The concatV parent was not of type choiceV");

                // assert that a new choice has been added to the concatD
                ChoiceD choiceD = concatenationV.Reference.Parent as ChoiceD;
                if (choiceD == null)
                    throw new Exception("The concatV.Ref.Parent is not of type choiceD");

                if (choiceD.Children.Count < 2)
                    throw new Exception("A new choice has not been added to the choiceD grammar.");

                // assuming that the last choice to be added is the new one.
                ConcatenationD concatDadded = choiceD.Children[choiceD.Children.Count - 1] as ConcatenationD;
                if (concatDadded == null)
                    throw new Exception("The choiceD children are not of type concatD");

                // assert that the new concatD has one child of type UndefinedD
                if (concatDadded.Children.Count > 1)
                    throw new Exception("ConcatD is new and does not have one child of type UndefinedD");

                UndefinedD undefinedD = concatDadded.Children[0] as UndefinedD;
                if (undefinedD == null)
                    throw new Exception("ConcatD is new and does not have one child of type UndefinedD");

                ConcatenationV newConcat = new ConcatenationV(concatDadded);
                UndefinedV newUndefinedV = new UndefinedV(undefinedD, theLevel);

                newConcat.appendChildV(newUndefinedV);
                choiceV.appendChildV(newConcat);
            }
        }
        private GrammarNodeV newVisual()
        {
            if (newItem is UndefinedD)
            {
                UndefinedD undefinedD = newItem as UndefinedD;
                UndefinedV visual = new UndefinedV(undefinedD, level);

                undefinedD.References.Add(visual);
                return visual;
            }
            else if (newItem is TerminalD)
            {
                TerminalD terminalD = newItem as TerminalD;
                TerminalV visual = new TerminalV(terminalD, level);

                terminalD.References.Add(visual);
                return visual;
            }
            else if (newItem is NonterminalTailD)
            {
                NonterminalTailD nontTailD = newItem as NonterminalTailD;
                NonterminalTailV visual = new NonterminalTailV(nontTailD, level);
                nontTailD.AddReference(visual);
                return visual;
            }
            else
                throw new NotImplementedException();
        }
 internal void setRule(UndefinedV undefinedV)
 {
     rule = undefinedV.Reference.getMyRule();
 }