public void Visit(QuestionUnit node)
        {
            ReferenceTables.SetReference(node.Identifier, node.DataType);

            if (!ReferenceTables.ContainsReference(node.DataType))
            {
                var wrapper = _terminalWrapperFactory.CreateWrapper(node.DataType);
                node.Value = wrapper;
                ReferenceTables.SetValue(node.DataType, wrapper);
            }
        }
 public void Visit(QuestionUnit node)
 {
     DeclareNewVariable(node.Identifier, node.DataType);
 }
        public void Visit(QuestionUnit node)
        {
            WidgetBase unitWrapper = _widgetFactory.GetWidget(node, ReferenceTables.GetValue(node.Identifier));
            unitWrapper.Visibility = _parentExpressionDidNotEvaluate ? Visibility.Collapsed : Visibility.Visible;

            int index = _elementsToDisplay.ToList().FindIndex(elem => elem.Unit.Identifier == unitWrapper.Unit.Identifier);
            if (index < 0)
            {
                INotifyPropertyChanged nodeValue = node.Value as INotifyPropertyChanged;
                if (nodeValue != null)
                {
                    nodeValue.PropertyChanged += (sender, args) => _rebuildMethod();
                }

                _elementsToDisplay.Add(unitWrapper);
            }
            else
            {
                _elementsToDisplay[index].Visibility = unitWrapper.Visibility;
            }
        }
Exemple #4
0
 private WidgetBase GetWidget(QuestionUnit unit, Text type)
 {
     unit.InitialiseValue(GetTypeWrapper(type));
     return new TextWidget(unit);
 }
Exemple #5
0
 public WidgetBase GetWidget(QuestionUnit unit, TextWrapper typeWrapper)
 {
     unit.InitialiseValue(typeWrapper);
     return new TextWidget(unit);
 }
Exemple #6
0
 public WidgetBase GetWidget(QuestionUnit unit, ITerminalWrapper typeWrapper)
 {
     return GetWidget(unit, typeWrapper as dynamic);
 }
Exemple #7
0
 public WidgetBase GetWidget(QuestionUnit unit)
 {
     return GetWidget(unit, unit.DataType as dynamic);
 }
 public void Visit(QuestionUnit node)
 {
     _unitsToAnswers.Add(node.Text, node.Value);
 }
Exemple #9
0
        public override void ExitQuestionUnit(QLParser.QuestionUnitContext context)
        {
            IList<ElementBase> children = GetChildren();

            ThrowExceptionIfAny();
            if (children.Count() != 1)
            {
                _astBuilderExceptions.Add(new ParserError("A question should have only identifier as a child."));
            }

            QuestionUnit question = new QuestionUnit(
                (Identifier)children[0],
                _terminalTypeFactory.GetTypeInstance(context.type()),
                context.TEXT().GetText(),
                SourceLocation.CreateFor(context)
                );
            AppendToAST(question);
        }