Manages property definitions for a column in a user interface grid, usually as specified in the class definitions xml file. The UIGridColumn can be for
  • A Reflective Property e.g. an Order BO may have a property "CustomerName" that is declared on the Order BO class directly but is derived from the Customer class and therefore does not have a PropDef associated with it.
  • A Defined Property i.e. a normal property of the BO that is mapped to a column in the database e.g. for Order BO an OrderNumber. This property will have a PropDef.
  • A Related Property Habanero has the ability to define a property for a grid etc. via its relationships e.g. for a grid showing order details we may want to show the CustomerName and CustomerCode. We could define these as properties on the Order BO and use Reflective Properties (as above) or we could declare the Related Properties i.e. Customer.CustomerName and Customer.CustomerCode. Habanero will then find the PropDef for the Related Property via its defined relationships. A Related Property can be defined via any of the Business Objects single Relationships.
  • Наследование: IUIGridColumn
    Пример #1
    0
            public void TestParameters_Null()
            {
    
                IUIGridColumn column = new UIGridColumn("heading", null, null, null, true, 100,
                                                       PropAlignment.left, null);
    
                Assert.IsNull(column.GetParameterValue("somename"));
            }
    Пример #2
    0
            public void TestFieldDefaultLabelFromClassDef()
            {
                ClassDef classDef = CreateTestClassDef("");
                IUIGridColumn uiGridColumn = new UIGridColumn(null, "TestProperty", typeof(DataGridViewTextBoxColumn), false, 100, PropAlignment.left , null);
    
    #pragma warning disable 612,618
                Assert.AreEqual("Tested Property", uiGridColumn.GetHeading(classDef));
    #pragma warning restore 612,618
            }
    Пример #3
    0
            public void TestRemove()
            {
                UIGridColumn column = new UIGridColumn("heading", null, null, null, false,
                    100, PropAlignment.left, null);
                UIGrid uiGrid = new UIGrid();
                uiGrid.Add(column);
    
                Assert.IsTrue(uiGrid.Contains(column));
                uiGrid.Remove(column);
                Assert.IsFalse(uiGrid.Contains(column));
            }
    Пример #4
    0
            public void TestParameters()
            {
                Hashtable parameters = new Hashtable();
    
    
                IUIGridColumn column = new UIGridColumn("heading", null, null, null, true, 100,
                                                       PropAlignment.left, parameters);
    
                Assert.AreEqual(0, column.Parameters.Count);
                column.Parameters.Add("name", "value");
                Assert.IsNull(column.GetParameterValue("somename"));
                Assert.AreEqual("value", column.GetParameterValue("name"));
            }
    Пример #5
    0
            public void TestCopyTo()
            {
                UIGridColumn column1 = new UIGridColumn("heading", null, null, null, false,
                    100, PropAlignment.left, null);
                UIGridColumn column2 = new UIGridColumn("heading", null, null, null, false,
                    100, PropAlignment.left, null);
                UIGrid uiGrid = new UIGrid();
                uiGrid.Add(column1);
                uiGrid.Add(column2);
    
                UIGridColumn[] target = new UIGridColumn[2];
                uiGrid.CopyTo(target, 0);
                Assert.AreEqual(column1, target[0]);
                Assert.AreEqual(column2, target[1]);
            }
    Пример #6
    0
            public void TestCloneUIGrid()
            {
                UIGridColumn uiGridCol = new UIGridColumn("Head", "Prop", "control", "Assembly",true,100, PropAlignment.centre, null);
                UIGrid uiGrid = new UIGrid();
                uiGrid.SortColumn = "Prop";
                uiGrid.Add(uiGridCol);
    
                //---------------Execute Test ----------------------
                IUIGrid clonedGrid = uiGrid.Clone();
    
                //---------------Test Result -----------------------
                Assert.IsTrue(uiGrid.Equals(clonedGrid));
                Assert.IsTrue(uiGrid == (UIGrid) clonedGrid);
                Assert.IsFalse(uiGrid != (UIGrid) clonedGrid);
                Assert.AreEqual(uiGrid[0], clonedGrid[0],
                                  "Should be a deep copy and the columns should be equal but copied");
                Assert.AreNotSame(uiGrid[0], clonedGrid[0], "Should be a deep copy and the columns should be equal but copied (not same)");
            }
    Пример #7
    0
            ///<summary>
            ///Determines whether the specified <see cref="T:System.Object"></see> is equal to the current <see cref="T:System.Object"></see>.
            ///</summary>
            ///
            ///<returns>
            ///true if the specified <see cref="T:System.Object"></see> is equal to the current <see cref="T:System.Object"></see>; otherwise, false.
            ///</returns>
            ///
            ///<param name="obj">The <see cref="T:System.Object"></see> to compare with the current <see cref="T:System.Object"></see>. </param><filterpriority>2</filterpriority>
            public override bool Equals(object obj)
            {
                if (obj == null)
                {
                    return(false);
                }
    
                UIGridColumn otherGridColumn = obj as UIGridColumn;
    
                if (otherGridColumn == null)
                {
                    return(false);
                }
                if ((otherGridColumn.PropertyName != this.PropertyName) ||
                    (otherGridColumn.Heading != this.Heading) ||
                    (otherGridColumn.GridControlTypeName != this.GridControlTypeName) ||
                    (otherGridColumn.Editable != this.Editable))
                {
                    return(false);
                }
                return(true);
            }
    Пример #8
    0
     private IUIGridColumn GetGridColumn()
     {
         ClassDef classDef = CreateTestClassDef("");
         UIGridColumn gridColumn = new UIGridColumn("T P", "TestProperty",  null, null, true, 100, PropAlignment.left, null)
                                       {
                                           Editable = true,
                                           UIGrid = classDef.UIDefCol["UIDef1"].UIGrid
                                       };
         return gridColumn;
     }
    Пример #9
    0
            public void TestCloneGridColumn()
            {
                //---------------Set up test pack-------------------
                UIGridColumn gridColumn = new UIGridColumn("pp", "pp", "", "", false, 0, PropAlignment.centre, null);
    
                //---------------Execute Test ----------------------
                IUIGridColumn clonedGridColumn = gridColumn.Clone();
    
                //---------------Test Result -----------------------
                Assert.IsTrue(gridColumn.Equals(clonedGridColumn));
                Assert.IsTrue(gridColumn == (UIGridColumn) clonedGridColumn);
                Assert.IsFalse(gridColumn != (UIGridColumn) clonedGridColumn);
            }
    Пример #10
    0
     private static UIGrid GetUiGrid()
     {
         UIGridColumn uiGridCol =
             new UIGridColumn
                 ("Head", "Prop", "control", "Assembly", true, 100, PropAlignment.centre, null);
         UIGrid uiGrid = new UIGrid();
         uiGrid.SortColumn = "Prop";
         uiGrid.Add(uiGridCol);
         return uiGrid;
     }
    Пример #11
    0
            public void Test_HashCodeEquals()
            {
                //---------------Set up test pack-------------------
                UIGridColumn gridColumn = new UIGridColumn("pp", "pp", "", "", false, 0, PropAlignment.centre, null);
                IUIGridColumn clonedGridColumn = gridColumn.Clone();
    
                //---------------Assert preconditions----------------
                Assert.IsTrue(gridColumn.Equals(clonedGridColumn));
                //---------------Execute Test ----------------------
                //---------------Test Result -----------------------
                Assert.AreEqual(gridColumn.GetHashCode(), clonedGridColumn.GetHashCode());
            }
    Пример #12
    0
     public void TestFieldDefaultLabel()
     {
         IUIGridColumn uiGridColumn = new UIGridColumn(null, "TestProperty", typeof(DataGridViewTextBoxColumn), false, 100, PropAlignment.left, null);
         Assert.AreEqual("Test Property", uiGridColumn.GetHeading());
     }
    Пример #13
    0
            public void Test_HashCodeNotEquals()
            {
                //---------------Set up test pack-------------------
                UIGridColumn gridColumn = new UIGridColumn("pp", "pp", "", "", false, 0, PropAlignment.centre, null);
                UIGridColumn otherColumn = new UIGridColumn("pp", "qq", "", "", false, 0, PropAlignment.centre, null);
    
                //---------------Assert preconditions----------------
                Assert.IsFalse(gridColumn.Equals(otherColumn));
                //---------------Execute Test ----------------------
                //---------------Test Result -----------------------
                Assert.AreNotEqual(gridColumn.GetHashCode(), otherColumn.GetHashCode());
            }
    Пример #14
    0
            public void TestSettingControlTypeSetsTypeNames()
            {
                UIGridColumn uiGridColumn = new UIGridColumn(null, "TestProperty",
                    "DataGridViewTextBoxColumn", "System.Windows.Forms", false, 100, PropAlignment.left, null);
                Assert.AreEqual("DataGridViewTextBoxColumn", uiGridColumn.GridControlTypeName);
                Assert.IsNull(uiGridColumn.GridControlType);
    
                uiGridColumn.GridControlType = typeof (MyBO);
                Assert.AreEqual("MyBO", uiGridColumn.GridControlTypeName);
                Assert.AreEqual("Habanero.Test", uiGridColumn.GridControlAssemblyName);
            }
    Пример #15
    0
            public void Test_NotEqual_Heading()
            {
                //---------------Set up test pack-------------------
                UIGridColumn gridColumn1 = new UIGridColumn("pp", "pp", "", "", false, 0, PropAlignment.centre, null);
                UIGridColumn gridColumn2 = new UIGridColumn("pp1", "pp", "", "", false, 0, PropAlignment.centre, null);
    
                //--------------Assert PreConditions----------------            
    
                //---------------Execute Test ----------------------
                bool operatorEquals = gridColumn1 == gridColumn2;
                bool operatorNotEquals = gridColumn1 != gridColumn2;
                bool methodEquals = gridColumn1.Equals(gridColumn2);
    
                //---------------Test Result -----------------------
                Assert.IsFalse(methodEquals);
                Assert.IsFalse(operatorEquals);
                Assert.IsTrue(operatorNotEquals);
                //---------------Tear Down -------------------------          
            }
    Пример #16
    0
            public void Test_NotSameType()
            {
                //---------------Set up test pack-------------------
                UIGridColumn gridColumn = new UIGridColumn("", "", "", "", false, 0, PropAlignment.centre, null);
                //--------------Assert PreConditions----------------            
    
                //---------------Execute Test ----------------------
                bool methodEquals = gridColumn.Equals("fedafds");
    
                //---------------Test Result -----------------------
                Assert.IsFalse(methodEquals);
                //---------------Tear Down -------------------------          
            }
    Пример #17
    0
     public void Test_NotEqualsNull()
     {
         UIGridColumn uiGridColumn1 = new UIGridColumn("", "", "", "",false,0,PropAlignment.centre, null);
         UIGridColumn uiGridColumn2 = null;
         Assert.IsFalse(uiGridColumn1 == uiGridColumn2);
         Assert.IsTrue(uiGridColumn1 != uiGridColumn2);
         Assert.IsFalse(uiGridColumn1.Equals(uiGridColumn2));
         Assert.AreNotEqual(uiGridColumn1, uiGridColumn2);
     }
     private void ApplyRowCellValueToBOProperty(DataRow row, UIGridColumn uiProperty, IBusinessObject changedBo)
     {
         string columnName = uiProperty.PropertyName;
         if (!uiProperty.Editable) return;
         IBOPropertyMapper boPropertyMapper = BOPropMapperFactory.CreateMapper(changedBo, columnName);
         boPropertyMapper.SetPropertyValue(row[columnName]);
         row.SetColumnError(columnName, boPropertyMapper.InvalidReason);
     }
    Пример #19
    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);
    
                UIGridColumn uiGridColumn;
                uiGridColumn = new UIGridColumn(null, "TestRel.TestProperty2", typeof(DataGridViewTextBoxColumn), false, 100, PropAlignment.left, null);
    #pragma warning disable 612,618
                Assert.AreEqual("Tested Property2", uiGridColumn.GetHeading(classDef));
    #pragma warning restore 612,618
            }