Exemple #1
0
        public void TestLabelText_UsesPropertyNameWithCamelCase()
        {
            XmlUIFormFieldLoader loader = new XmlUIFormFieldLoader(new DtdLoader(), new DefClassFactory());
            UIFormField          uiProp = (UIFormField)loader.LoadUIProperty(@"<field property=""TestPropName"" />");

            Assert.AreEqual(null, uiProp.Label);
            Assert.AreEqual("Test Prop Name:", uiProp.GetLabel());
        }
Exemple #2
0
        public void TestLabelText_UsesQuestionMark_WhenCheckBoxField()
        {
            XmlUIFormFieldLoader loader = new XmlUIFormFieldLoader(new DtdLoader(), new DefClassFactory());
            UIFormField          uiProp = (UIFormField)loader.LoadUIProperty(@"<field property=""TestPropName"" type=""CheckBox"" />");

            Assert.AreEqual(null, uiProp.Label);
            Assert.AreEqual("Test Prop Name?", uiProp.GetLabel());
        }
Exemple #3
0
        public void TestFieldDefaultLabel()
        {
            UIFormField uiFormField = new UIFormField(null, "TestProperty", typeof(TextBox), null, null, true, null, null, LayoutStyle.Label);

            Assert.AreEqual("Test Property:", uiFormField.GetLabel());
            uiFormField = new UIFormField(null, "TestProperty", typeof(CheckBox), null, null, true, null, null, LayoutStyle.Label);
            Assert.AreEqual("Test Property?", uiFormField.GetLabel());
        }
Exemple #4
0
        public void TestFieldDefaultLabelFromClassDef()
        {
            ClassDef    classDef    = CreateTestClassDef("");
            UIFormField uiFormField = new UIFormField(null, "TestProperty", typeof(TextBox), null, null, true, null, null, LayoutStyle.Label);

            Assert.AreEqual("Tested Property:", uiFormField.GetLabel(classDef));
            uiFormField = new UIFormField(null, "TestProperty", typeof(CheckBox), null, null, true, null, null, LayoutStyle.Label);
            Assert.AreEqual("Tested Property?", uiFormField.GetLabel(classDef));
        }
Exemple #5
0
        private IControlHabanero CreateAndAddGroupBox(IPanelInfo panelInfo, UIFormField formField)
        {
            IControlHabanero labelControl = ControlFactory.CreateGroupBox(formField.GetLabel());

            labelControl.Width = 0; // don't affect the label column's fixed width
            labelControl.Name  = formField.PropertyName;
            SetToolTip(formField, labelControl);
            panelInfo.LayoutManager.AddControl(labelControl, formField.RowSpan, 2);
            return(labelControl);
        }
Exemple #6
0
        private ILabel CreateAndAddLabel(IPanelInfo panelInfo, UIFormField formField)
        {
//            IClassDef classDef = panelInfo.UIForm.UIDef.ClassDef;
            ILabel labelControl = ControlFactory.CreateLabel(formField.GetLabel(), formField.IsCompulsory);

            labelControl.Name    = _controlNamingStrategy.GetLabelControlName(formField);
            labelControl.Enabled = formField.Editable;
            SetToolTip(formField, labelControl);
            var containerControl = panelInfo.Panel;

            EnsureControlNameUnique(labelControl, containerControl);
            panelInfo.LayoutManager.AddControl(labelControl, formField.RowSpan, 1);
            return(labelControl);
        }
        private static void ConfigureLabel(Label label, string propName)
        {
            IUIFormField field = new UIFormField(label.Text, propName)
            {
                ClassDef = ClassDef.Get <TBo>()
            };
            var singleValueDef = GetSingleValueDef(propName);

            label.Text = field.GetLabel();
            if (IsCompulsory(singleValueDef))
            {
                SetBoldText(label);
            }
        }
Exemple #8
0
        public void Test_PropDefUnitOfMeasure_Updates_FormFieldLabel()
        {
            //---------------Set up test pack-------------------
            ClassDef     classDef         = CreateTestClassDef("");
            const string testPropertyName = "TestProperty";
            PropDef      propDefUOM       = (PropDef)classDef.PropDefcol[testPropertyName];

            propDefUOM.UnitOfMeasure = "NewUOM";
            UIFormField uiFormField = new UIFormField(null, testPropertyName, typeof(TextBox), null, null, true, null, null, LayoutStyle.Label);

            //---------------Assert Precondition----------------
            Assert.AreEqual("Tested Property", propDefUOM.DisplayName);
            //---------------Execute Test ----------------------
            string labelName = uiFormField.GetLabel(classDef);

            //---------------Test Result -----------------------
            Assert.AreEqual("Tested Property (NewUOM):", labelName);
        }
Exemple #9
0
        public void TestFieldDefaultLabelFromRelatedClassDef()
        {
            ClassDef.ClassDefs.Clear();
            ClassDef classDef  = CreateTestClassDef("");
            ClassDef classDef2 = CreateTestClassDef("2");

            ClassDef.ClassDefs.Add(classDef2);
            RelKeyDef  relKeyDef  = new RelKeyDef();
            RelPropDef relPropDef = new RelPropDef(classDef.PropDefcol["TestProperty"], "TestProperty2");

            relKeyDef.Add(relPropDef);
            SingleRelationshipDef def = new SingleRelationshipDef("TestRel", classDef2.AssemblyName, classDef2.ClassName, relKeyDef, false, DeleteParentAction.Prevent);

            classDef.RelationshipDefCol.Add(def);

            UIFormField uiFormField = new UIFormField(null, "TestRel.TestProperty2", typeof(TextBox), null, null, true, null, null, LayoutStyle.Label);

            Assert.AreEqual("Tested Property2:", uiFormField.GetLabel(classDef));
        }