Exemplo n.º 1
0
        protected virtual void OnChildObjectsListChanged(object sender, ListChangedEventArgs e)
        {
            IList children = (IList)sender;

            if (e.ListChangedType == ListChangedType.ItemAdded)
            {
                FormObject formObject = (FormObject)children [e.NewIndex];
                formObject.Parent     = this;
                formObject.Selectable = selectable;
            }
            for (int i = 0; i < children.Count; i++)
            {
                FormDrawableObject child = children [i] as FormDrawableObject;
                if (child != null)
                {
                    child.ParentPosition = i;
                }
            }
        }
Exemplo n.º 2
0
        public void InitializeCell(TableCell cell, TableColumn column, Hashtable boundFields, bool?rowType, FormObject changedElement)
        {
            cell.Template.Clear();
            ObjectStyle           cellStyle;
            BindList <FormObject> template;

            switch (rowType)
            {
            case true:
                cellStyle = column.HeaderStyle;
                template  = column.HeaderTemplate;
                break;

            case false:
                cellStyle = column.ItemStyle;
                template  = column.ItemTemplate;
                break;

            case null:
                cellStyle = column.FooterStyle;
                template  = column.FooterTemplate;
                break;

            default:
                throw new ArgumentException("Invalid row type", "rowType");
            }
            cell.Style.Clear(cell.DefaultStyle);
            cell.Style.LoadFromString(cellStyle.ToString(cell.DefaultStyle));

            foreach (FormObject child in template)
            {
                FormObject newChild = changedElement != null &&
                                      (child.IsDescendantOf(changedElement) || changedElement.IsDescendantOf(child)) ?
                                      child : (FormObject)child.Clone();
                cell.Template.Add(newChild);
                newChild.RefreshBoundFields(boundFields);
            }
            cell.BindableFields = boundFields;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Creates a cell for this row by using the specified column and data.
        /// </summary>
        /// <param name="column">The column to which the cell belongs.</param>
        /// <param name="boundFields">The bound fields to use as data.</param>
        /// <param name="rowType">The type of the row: <c>true</c> for a header, <c>false</c> for a data row and <c>null</c> for a footer.</param>
        /// <param name="changedElement">The form object that was changed in a bound table; its reference must be kept.</param>
        /// <returns>The newly created cell.</returns>
        public TableCell CreateCell(TableColumn column, Hashtable boundFields, bool?rowType, FormObject changedElement)
        {
            TableCell cell = DocumentHelper.FormObjectCreator.CreateCell();

            InitializeCell(cell, column, boundFields, rowType, changedElement);
            childObjects.Add(cell);
            return(cell);
        }