Ejemplo n.º 1
0
        private ConfidenceControl InitializeConfidenceControl()
        {
            int ptX, ptY, tabIndex;
            var lastControl = LastControl;

            Debug.Assert(lastControl != null, "Failed to locate previous control");
            if (lastControl == null)
            {
                ptX      = 3;
                ptY      = Margin.Top;
                tabIndex = 0;
            }
            else
            {
                ptX      = _lblName.Location.X;
                ptY      = lastControl.Location.Y + lastControl.Height;
                tabIndex = lastControl.TabIndex + 1;
            }

            var confidenceControl = new ConfidenceControl();

            confidenceControl.Anchor             = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
            confidenceControl.Location           = new System.Drawing.Point(ptX, ptY);
            confidenceControl.TabIndex           = tabIndex;
            confidenceControl.Size               = new System.Drawing.Size(Width - Margin.Horizontal - ptX, confidenceControl.Height);
            confidenceControl.ConfidenceChanged += OnConfidenceChanged;
            return(confidenceControl);
        }
        private ConfidenceControl InitializeConfidenceControl()
        {
            var previousCtrl      = _questionControl ?? _lblEntity;
            var ptX               = previousCtrl.Location.X;
            var ptY               = previousCtrl.Location.Y + previousCtrl.Height + 3;
            var confidenceControl = new ConfidenceControl();

            confidenceControl.Anchor             = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
            confidenceControl.Location           = new System.Drawing.Point(ptX, ptY);
            confidenceControl.TabIndex           = previousCtrl.TabIndex + 1;
            confidenceControl.Size               = new System.Drawing.Size(Width - ptX, confidenceControl.Height);
            confidenceControl.ConfidenceChanged += OnConfidenceChanged;

            return(confidenceControl);
        }
Ejemplo n.º 3
0
        public CharacteristicQuantificationDetailsControl(StandardValidTerm characteristicCode, CharacteristicQuantification characteristicQuantification)
        {
            InitializeComponent();

            _characteristicCode = characteristicCode;
            _txtName.Text       = string.IsNullOrEmpty(characteristicQuantification.Name) ? @"Name is missing" : characteristicQuantification.Name;
            _quantificationType = IdentifyCharQuantificationType(characteristicQuantification);

            SuspendLayout();

            InitializeCharQuantificationControls(characteristicQuantification);

            if (characteristicQuantification.AnnotatorConfidence)
            {
                _confidenceControl = InitializeConfidenceControl();
                Controls.Add(_confidenceControl);
                Height += _confidenceControl.Height;
            }

            ResumeLayout(false);
            PerformLayout();
        }
        public CharacteristicQuantificationDetailsControl(StandardValidTerm characteristicCode, CharacteristicQuantification characteristicQuantification)
        {
            InitializeComponent();

            _characteristicCode = characteristicCode;
            _txtName.Text = string.IsNullOrEmpty(characteristicQuantification.Name) ? @"Name is missing" : characteristicQuantification.Name;
            _quantificationType = IdentifyCharQuantificationType(characteristicQuantification);

            SuspendLayout();

            InitializeCharQuantificationControls(characteristicQuantification);

            if (characteristicQuantification.AnnotatorConfidence)
            {
                _confidenceControl = InitializeConfidenceControl();
                Controls.Add(_confidenceControl);
                Height += _confidenceControl.Height;
            }

            ResumeLayout(false);
            PerformLayout();
        }
        private ConfidenceControl InitializeConfidenceControl()
        {
            var previousCtrl = _questionControl ?? _lblEntity;
            var ptX = previousCtrl.Location.X;
            var ptY = previousCtrl.Location.Y + previousCtrl.Height + 3;
            var confidenceControl = new ConfidenceControl();
            confidenceControl.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
            confidenceControl.Location = new System.Drawing.Point(ptX, ptY);
            confidenceControl.TabIndex = previousCtrl.TabIndex + 1;
            confidenceControl.Size = new System.Drawing.Size(Width - ptX, confidenceControl.Height);
            confidenceControl.ConfidenceChanged += OnConfidenceChanged;

            return confidenceControl;
        }
        public SimpleQuestionControl(
            string label,
            StandardValidTerm questionType,
            string description,
            List<StandardValidTerm> answers,
            List<StandardCodeSequence> nonQuantifableAnswers,
            List<StandardValidTerm> initialSelection,
            int minCardinality, int maxCardinality,
            int questionNumber, bool hasConfidence,
            bool addFirstDefaultItem,
            bool shouldDisplay,
            List<string> staticDisplayItems)
        {
            Platform.CheckForNullReference(answers, "answers");

            InitializeComponent();

            _questionType = questionType;
            _lblEntity.Text = _questionType == null
                                ? label
                                : CodeUtils.ToStringBuilder(_questionType, new StringBuilder()).ToString();
            _lblEntity.ToolTipText = SplitIntoLines(description);
            _lblEntity.ShowToolTipChanged += OnLabelShowToolTipChanged;
            _lblEntity.TabStop = false;

            _questionNumber = questionNumber;

            Debug.Assert(maxCardinality - minCardinality >= 0, "MinCardinality must be less or equal to MaxCardinality in a question");
            _maxNumberOfAnswers = Math.Max(1, Math.Min(answers.Count, maxCardinality));

            var availableAnswers = new List<StandardValidTerm>(answers);
            if (nonQuantifableAnswers != null)
            {
                Debug.Assert(false, "Non-quantifieables should not really be here");
                availableAnswers.InsertRange(0, ComponentUtilities.ToStandardValidTermList(nonQuantifableAnswers));
            }

            _selectedAnswers = initialSelection;
            _staticDisplayItems = staticDisplayItems;

            if (shouldDisplay)
            {
                SuspendLayout();

                _questionControl = InitializeResponseControl(availableAnswers, initialSelection, addFirstDefaultItem);
                Controls.Add(_questionControl);
                Height += _questionControl.Height + 3;

                if (hasConfidence)
                {
                    _confidenceControl = InitializeConfidenceControl();
                    Controls.Add(_confidenceControl);
                    Height += _confidenceControl.Height + 3;
                }

                ResumeLayout(false);
                PerformLayout();
            }
            else
            {
                if (initialSelection == null || initialSelection.Count == 0)
                    Platform.Log(LogLevel.Error,
                                 "Template data error: no default values are provided for questions that are not going to be displayed. Template answers are never going to be valid");
            }
        }
        public SimpleQuestionControl(
            string label,
            StandardValidTerm questionType,
            string description,
            List <StandardValidTerm> answers,
            List <StandardCodeSequence> nonQuantifableAnswers,
            List <StandardValidTerm> initialSelection,
            int minCardinality, int maxCardinality,
            int questionNumber, bool hasConfidence,
            bool addFirstDefaultItem,
            bool shouldDisplay,
            List <string> staticDisplayItems)
        {
            Platform.CheckForNullReference(answers, "answers");

            InitializeComponent();

            _questionType   = questionType;
            _lblEntity.Text = _questionType == null
                                                                ? label
                                                                : CodeUtils.ToStringBuilder(_questionType, new StringBuilder()).ToString();
            _lblEntity.ToolTipText         = SplitIntoLines(description);
            _lblEntity.ShowToolTipChanged += OnLabelShowToolTipChanged;
            _lblEntity.TabStop             = false;

            _questionNumber = questionNumber;

            Debug.Assert(maxCardinality - minCardinality >= 0, "MinCardinality must be less or equal to MaxCardinality in a question");
            _maxNumberOfAnswers = Math.Max(1, Math.Min(answers.Count, maxCardinality));

            var availableAnswers = new List <StandardValidTerm>(answers);

            if (nonQuantifableAnswers != null)
            {
                Debug.Assert(false, "Non-quantifieables should not really be here");
                availableAnswers.InsertRange(0, ComponentUtilities.ToStandardValidTermList(nonQuantifableAnswers));
            }

            _selectedAnswers    = initialSelection;
            _staticDisplayItems = staticDisplayItems;

            if (shouldDisplay)
            {
                SuspendLayout();

                _questionControl = InitializeResponseControl(availableAnswers, initialSelection, addFirstDefaultItem);
                Controls.Add(_questionControl);
                Height += _questionControl.Height + 3;

                if (hasConfidence)
                {
                    _confidenceControl = InitializeConfidenceControl();
                    Controls.Add(_confidenceControl);
                    Height += _confidenceControl.Height + 3;
                }

                ResumeLayout(false);
                PerformLayout();
            }
            else
            {
                if (initialSelection == null || initialSelection.Count == 0)
                {
                    Platform.Log(LogLevel.Error,
                                 "Template data error: no default values are provided for questions that are not going to be displayed. Template answers are never going to be valid");
                }
            }
        }
        private ConfidenceControl InitializeConfidenceControl()
        {
            int ptX, ptY, tabIndex;
            var lastControl = LastControl;
            Debug.Assert(lastControl != null, "Failed to locate previous control");
            if (lastControl == null)
            {
                ptX = 3;
                ptY = Margin.Top;
                tabIndex = 0;
            }
            else
            {
                ptX = _lblName.Location.X;
                ptY = lastControl.Location.Y + lastControl.Height;
                tabIndex = lastControl.TabIndex + 1;
            }

            var confidenceControl = new ConfidenceControl();
            confidenceControl.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
            confidenceControl.Location = new System.Drawing.Point(ptX, ptY);
            confidenceControl.TabIndex = tabIndex;
            confidenceControl.Size = new System.Drawing.Size(Width - Margin.Horizontal - ptX, confidenceControl.Height);
            confidenceControl.ConfidenceChanged += OnConfidenceChanged;
            return confidenceControl;
        }