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()); }
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)); }
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 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; }
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)); }
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); }