Ejemplo n.º 1
0
        /// <summary>
        /// NB here is now a misleading name... what we really mean is "is ready to be filled in".
        /// </summary>
        private bool IsMissingCustomField(PalasoDataObject palasoData)
        {
            var content = palasoData.GetProperty <IPalasoDataObjectProperty>(Field.FieldName);

            if (content == null)
            {
                if (IsSkipped(palasoData, Field.FieldName))
                {
                    return(false);
                }

                //	WS-33978 situation: when some writing system is required don't flag it if the entire field is missing
                if (_writingSystemsWhichAreRequired.Length > 0)
                {
                    return(false);
                }
                return(true);
            }
            if (Field.FieldName == "POS")
            {
                if (IsPosUnknown(palasoData))
                {
                    return(true);
                }
            }
            return(IsMissingData(content));
        }
Ejemplo n.º 2
0
        private static void AssertPropertyHasExpectedMultiText(PalasoDataObject dataObject,
                                                               string name)
        {
            //must match what is created by MakeBasicLiftMultiText()
            MultiText mt = dataObject.GetProperty <MultiText>(name);

            Assert.AreEqual(2, mt.Forms.Length);
            Assert.AreEqual("dos", mt["ws-two"]);
        }
Ejemplo n.º 3
0
 private void WriteWellKnownCustomMultiText(PalasoDataObject item,
                                            string property,
                                            ICollection <string> propertiesAlreadyOutput)
 {
     if (ShouldOutputProperty(property))
     {
         MultiText m = item.GetProperty <MultiText>(property);
         if (WriteMultiWithWrapperIfNonEmpty(property, property, m))
         {
             propertiesAlreadyOutput.Add(property);
         }
     }
 }
		private static void AssertPropertyHasExpectedMultiText(PalasoDataObject dataObject,
															   string name)
		{
			//must match what is created by MakeBasicLiftMultiText()
			MultiText mt = dataObject.GetProperty<MultiText>(name);
			Assert.AreEqual(2, mt.Forms.Length);
			Assert.AreEqual("dos", mt["ws-two"]);
		}
Ejemplo n.º 5
0
        private int AddOneCustomField(PalasoDataObject target,
                                      Field customField,
                                      int insertAtRow,
                                      int rowCount)
        {
            IReportEmptiness data = target.GetProperty <IReportEmptiness>(customField.FieldName);

            if (!customField.GetDoShow(data, ShowNormallyHiddenFields))
            {
                return(rowCount);
            }
            Control box;

            switch (customField.DataTypeName)
            {
            case "Picture":
                box = MakePictureWidget(target, customField, _detailList);
                if (box == null)
                {
                    return(rowCount);                            // other code does the user notification
                }
                break;

            case "Flag":
                box = MakeCheckBoxWidget(target, customField);
                break;

            case "Option":
                box = MakeOptionWidget(target, customField);
                break;

            case "OptionCollection":
                box = MakeOptionCollectionWidget(target, customField);
                break;

            case "MultiText":
                box =
                    MakeBoundControl(
                        target.GetOrCreateProperty <MultiText>(customField.FieldName),
                        customField);
                break;

            default:
                LexRelationType lexRelType = GetRelationType(customField.DataTypeName);
                if (lexRelType != null)
                {
                    box = MakeRelationWidget(target, lexRelType, customField);
                }
                else
                {
                    throw new ApplicationException(
                              string.Format("WeSay doesn't understand how to layout a {0}",
                                            customField.DataTypeName));
                }
                break;
            }

            string label = StringCatalog.Get(customField.DisplayName);

            //for checkboxes, the label is part of the control
            if (customField.DataTypeName == "Flag")
            {
                label = string.Empty;
            }

            Control c = DetailList.AddWidgetRow(StringCatalog.Get(label),
                                                false,
                                                box,
                                                insertAtRow,
                                                false);

            DetailList.GetRow(c);
            ++rowCount;
            return(rowCount);
        }