protected virtual void InitializePageViewItem(RadPageViewItem item, GridViewInfo viewInfo)
 {
     item.Tag = (object)viewInfo;
     if (this.pageViewElement is RadPageViewOutlookElement)
     {
         return;
     }
     if (viewInfo.ChildRows.Count == 0 && !viewInfo.ViewTemplate.AllowAddNewRow)
     {
         int num1 = (int)item.SetDefaultValueOverride(RadElement.VisibilityProperty, (object)ElementVisibility.Collapsed);
     }
     else
     {
         int num2 = (int)item.SetDefaultValueOverride(RadElement.VisibilityProperty, (object)ElementVisibility.Visible);
     }
 }
示例#2
0
 private IRowView GetRowView(IRowView view, GridViewInfo viewInfo)
 {
     if (view.ViewInfo == viewInfo)
     {
         return(view);
     }
     foreach (IRowView childView in view.ChildViews)
     {
         IRowView rowView = this.GetRowView(childView, viewInfo);
         if (rowView != null)
         {
             return(rowView);
         }
     }
     return((IRowView)null);
 }
        public override IList <GridViewRowInfo> GetChildRows(
            GridViewRowInfo parentRow,
            GridViewInfo view)
        {
            List <GridViewRowInfo> gridViewRowInfoList = new List <GridViewRowInfo>();
            PropertyDescriptor     descriptor          = ListBindingHelper.GetListItemProperties(parentRow.DataBoundItem).Find(this.relation.ChildColumnNames[0], true);

            if (descriptor != null)
            {
                List <GridViewRowInfo> cachedChildRows = this.GetCachedChildRows(parentRow.DataBoundItem, descriptor);
                IEnumerable            enumerable      = descriptor.GetValue(parentRow.DataBoundItem) as IEnumerable;
                if (enumerable != null)
                {
                    PropertyDescriptorCollection listItemProperties = ListBindingHelper.GetListItemProperties((object)enumerable);
                    int num = 0;
                    foreach (object obj in enumerable)
                    {
                        GridViewRowInfo childRowInfo = this.GetChildRowInfo(cachedChildRows, num++);
                        ((IDataItem)childRowInfo).DataBoundItem = obj;
                        for (int index = 0; index < this.Template.Columns.Count; ++index)
                        {
                            if (this.Template.Columns[index].IsFieldNamePath)
                            {
                                childRowInfo.Cache[(GridViewColumn)this.Template.Columns[index]] = DataUtils.GetValue(listItemProperties, this.Template.Columns[index].FieldName, obj);
                            }
                            else if (!string.IsNullOrEmpty(this.Template.Columns[index].FieldName))
                            {
                                PropertyDescriptor propertyDescriptor = listItemProperties.Find(this.Template.Columns[index].FieldName, true);
                                if (propertyDescriptor != null)
                                {
                                    childRowInfo.Cache[(GridViewColumn)this.Template.Columns[index]] = propertyDescriptor.GetValue(obj);
                                }
                            }
                        }
                        gridViewRowInfoList.Add(childRowInfo);
                    }
                }
                IBindingList index1 = enumerable as IBindingList;
                if (index1 != null)
                {
                    index1.ListChanged           -= new ListChangedEventHandler(this.bindableChildren_ListChanged);
                    index1.ListChanged           += new ListChangedEventHandler(this.bindableChildren_ListChanged);
                    this.rowsBindingLists[index1] = view;
                }
            }
            return((IList <GridViewRowInfo>)gridViewRowInfoList);
        }
示例#4
0
 public void Dispose()
 {
     this.SuspendPropertyNotifications();
     if (this.ViewInfo != null)
     {
         this.ViewTemplate.MasterTemplate.SelectedRows.BeginUpdate();
         this.ViewTemplate.MasterTemplate.SelectedRows.Remove(this);
         this.ViewTemplate.MasterTemplate.SelectedRows.EndUpdate(false);
         this.ViewInfo.PinnedRows.Remove(this);
     }
     this.ResumePropertyNotifications();
     this.parent        = (GridViewRowInfo)null;
     this.rowState      = (GridViewRowInfo.GridViewRowInfoState)null;
     this.viewInfo      = (GridViewInfo)null;
     this.dataBoundItem = (object)null;
     GC.SuppressFinalize((object)this);
 }
示例#5
0
        internal GridViewSummaryRowInfo Add(
            GridViewInfo viewInfo,
            GridViewSummaryRowItem summaryItem,
            bool top)
        {
            GridViewCreateRowInfoEventArgs e = new GridViewCreateRowInfoEventArgs((GridViewRowInfo) new GridViewSummaryRowInfo(viewInfo, (GridViewGroupRowInfo)null), viewInfo);

            viewInfo.ViewTemplate.OnCreateRowInfo(e);
            GridViewSummaryRowInfo rowInfo = e.RowInfo as GridViewSummaryRowInfo;

            if (rowInfo != null)
            {
                rowInfo.SummaryRowItem = summaryItem;
                rowInfo.RowPosition    = top ? SystemRowPosition.Top : SystemRowPosition.Bottom;
                this.Items.Add(rowInfo);
            }
            return(rowInfo);
        }
示例#6
0
        private void UpdateChildRowViewInfo(GridViewRowInfo newRow)
        {
            GridViewTemplate parent = this.owner.Parent;

            if (parent == null)
            {
                return;
            }
            GridViewRelationDataProvider hierarchyDataProvider = this.owner.HierarchyDataProvider as GridViewRelationDataProvider;

            if (hierarchyDataProvider == null)
            {
                return;
            }
            hierarchyDataProvider.Refresh();
            foreach (GridViewRowInfo childRow in parent.ChildRows)
            {
                bool flag = true;
                for (int index = 0; index < hierarchyDataProvider.Relation.ParentColumnNames.Count; ++index)
                {
                    if (!object.Equals(childRow.Cells[hierarchyDataProvider.Relation.ParentColumnNames[index]].Value, newRow.Cells[hierarchyDataProvider.Relation.ChildColumnNames[index]].Value))
                    {
                        flag = false;
                        break;
                    }
                }
                if (flag)
                {
                    using (IEnumerator <GridViewInfo> enumerator = ((GridViewHierarchyRowInfo)childRow).Views.GetEnumerator())
                    {
                        while (enumerator.MoveNext())
                        {
                            GridViewInfo current = enumerator.Current;
                            if (current.ViewTemplate == this.owner)
                            {
                                newRow.ViewInfo = current;
                                break;
                            }
                        }
                        break;
                    }
                }
            }
        }
示例#7
0
 public ViewInfoEnumeratorPosition(
     GridViewInfo viewInfo,
     ViewInfoTraverser.Stages stage,
     ITraversable collection,
     int index,
     PinnedRowPosition pinPosition,
     SystemRowPosition rowPosition,
     PinnedRowPosition filteredPinPoisition,
     bool filterByPinPosition)
 {
     this.viewInfo             = viewInfo;
     this.stage                = stage;
     this.collection           = collection;
     this.index                = index;
     this.pinPosition          = pinPosition;
     this.rowPosition          = rowPosition;
     this.filteredPinPoisition = filteredPinPoisition;
     this.filterByPinPosition  = filterByPinPosition;
 }
示例#8
0
 public IRowView GetRowView(GridViewInfo viewInfo)
 {
     foreach (RadElement child in this.Panel.Children)
     {
         IRowView view = child as IRowView;
         if (view != null)
         {
             if (view.ViewInfo == viewInfo)
             {
                 return(view);
             }
             IRowView rowView = this.GetRowView(view, viewInfo);
             if (rowView != null)
             {
                 return(rowView);
             }
         }
     }
     return((IRowView)null);
 }
示例#9
0
        public virtual void Initialize(GridViewRowInfo rowInfo)
        {
            if (rowInfo == null || this.rowInfo == rowInfo)
            {
                return;
            }
            bool flag = this.rowInfo == null;

            this.rowInfo     = rowInfo;
            this.viewInfo    = this.rowInfo.ViewInfo;
            this.HotTracking = false;
            this.WireEvents();
            this.UpdateSelectedState();
            this.UpdateCells();
            if (!flag)
            {
                return;
            }
            this.UpdateInfo();
        }
示例#10
0
        private bool StepOutOfHierarchy()
        {
            GridViewHierarchyRowInfo hierarchyRow1 = this.hierarchyRow as GridViewHierarchyRowInfo;

            if (this.hierarchyRow is GridViewGroupRowInfo || this.hierarchyRow.HasChildViews || this.processHierarchy && (this.hierarchyRow.Parent != null || this.hierarchyRow is GridViewHierarchyRowInfo))
            {
                IHierarchicalRow hierarchyRow2 = this.hierarchyRow;
                this.oldRowIsGroupRow = hierarchyRow2 is GridViewGroupRowInfo;
                this.hierarchyRow     = this.hierarchyRow.Parent;
                GridViewInfo gridViewInfo = this.Current != null ? this.Current.ViewInfo : (GridViewInfo)null;
                bool         flag         = this.Current is GridViewHierarchyRowInfo;
                if (this.hierarchyRow == null)
                {
                    this.hierarchyRow = this.rootRow;
                }
                if (this.hierarchyTraversers.Count > 0)
                {
                    ITraverser <GridViewRowInfo> traverser = this.hierarchyTraversers.Pop();
                    traverser.MovePrevious();
                    traverser.MovePrevious();
                    for (int index = 0; index < 5; ++index)
                    {
                        traverser.MoveNext();
                        if (traverser.Current == hierarchyRow2)
                        {
                            this.traverser = traverser;
                            return(this.ProcessHierarchy || hierarchyRow1 == null || (hierarchyRow1.ViewTemplate.Templates.Count <= 0 || !hierarchyRow1.ViewTemplate.IsSelfReference) || (gridViewInfo == null || hierarchyRow1.ViewTemplate == gridViewInfo.ViewTemplate) && (flag || hierarchyRow1 != this.rootRow));
                        }
                    }
                }
                this.CreateTraverser();
                while (this.traverser.MoveNext())
                {
                    if (this.traverser.Current == hierarchyRow2)
                    {
                        return(this.ProcessHierarchy || hierarchyRow1 == null || (hierarchyRow1.ViewTemplate.Templates.Count <= 0 || !hierarchyRow1.ViewTemplate.IsSelfReference) || (gridViewInfo == null || hierarchyRow1.ViewTemplate == gridViewInfo.ViewTemplate) && (flag || hierarchyRow1 != this.rootRow));
                    }
                }
            }
            return(false);
        }
示例#11
0
        public IEnumerable <IRowView> GetRowViews(GridViewInfo viewInfo)
        {
            List <IRowView> results = new List <IRowView>();

            foreach (RadElement child in this.Panel.Children)
            {
                IRowView view = child as IRowView;
                if (view != null)
                {
                    if (view.ViewInfo == viewInfo)
                    {
                        results.Add(view);
                    }
                    else
                    {
                        this.GetRowViews(view, viewInfo, results);
                    }
                }
            }
            return((IEnumerable <IRowView>)results);
        }
示例#12
0
 public ParentDataRow(
     GridViewSelfReferenceDataProvider provider,
     GridViewInfo viewInfo,
     GridViewRowInfo parent)
     : base(viewInfo)
 {
     this.IsAttached = false;
     this.provider   = provider;
     GridViewColumn[] gridViewColumnArray1 = new GridViewColumn[this.provider.Relation.ParentColumnNames.Count];
     GridViewColumn[] gridViewColumnArray2 = new GridViewColumn[this.provider.Relation.ParentColumnNames.Count];
     for (int index = 0; index < this.provider.Relation.ParentColumnNames.Count; ++index)
     {
         gridViewColumnArray1[index] = (GridViewColumn)this.provider.Relation.ParentTemplate.Columns[this.provider.Relation.ParentColumnNames[index]];
     }
     for (int index = 0; index < this.provider.Relation.ChildColumnNames.Count; ++index)
     {
         gridViewColumnArray2[index] = (GridViewColumn)this.provider.Relation.ChildTemplate.Columns[this.provider.Relation.ChildColumnNames[index]];
     }
     for (int index = 0; index < this.provider.Relation.ChildColumnNames.Count; ++index)
     {
         this[gridViewColumnArray2[index]] = parent[gridViewColumnArray1[index]];
     }
 }
示例#13
0
        public override IList <GridViewRowInfo> GetChildRows(
            GridViewRowInfo parentRow,
            GridViewInfo view)
        {
            if (this.Relation == null || this.indexer.Count == 0)
            {
                return((IList <GridViewRowInfo>) new List <GridViewRowInfo>());
            }
            bool flag = true;

            if (parentRow == null)
            {
                parentRow = this.indexer[0];
                flag      = false;
            }
            else
            {
                parentRow = (GridViewRowInfo) new GridViewSelfReferenceDataProvider.ParentDataRow(this, ((GridViewHierarchyRowInfo)parentRow).ActiveView, parentRow);
            }
            List <GridViewRowInfo> gridViewRowInfoList = new List <GridViewRowInfo>();
            int lo  = this.indexer.Index(parentRow);
            int num = this.indexer.LastIndex(parentRow);

            if (lo >= 0)
            {
                IEnumerator <GridViewRowInfo> forwardEnumerator = this.indexer.GetForwardEnumerator(lo, num + 1);
                while (forwardEnumerator.MoveNext())
                {
                    if (flag)
                    {
                        forwardEnumerator.Current.SetParent(parentRow);
                    }
                    gridViewRowInfoList.Add(forwardEnumerator.Current);
                }
            }
            return((IList <GridViewRowInfo>)gridViewRowInfoList);
        }
示例#14
0
 public abstract IList <GridViewRowInfo> GetChildRows(
     GridViewRowInfo parentRow,
     GridViewInfo view);
示例#15
0
 public GridViewCurrentViewChangedEventArgs(GridViewInfo oldView, GridViewInfo newView)
 {
     this.oldView = oldView;
     this.newView = newView;
 }
示例#16
0
 public GridViewCreateRowInfoEventArgs(GridViewRowInfo row, GridViewInfo view)
 {
     this.rowInfo  = row;
     this.viewInfo = view;
 }
 public override void SetContent()
 {
     if (this.pageViewElement is RadPageViewExplorerBarElement)
     {
         RadPageViewItem radPageViewItem = (RadPageViewItem)null;
         for (int index = this.pageViewElement.Items.Count - 1; index >= 0; --index)
         {
             if (this.HierarchyRow.Views[index].ViewTemplate != this.ViewTemplate)
             {
                 RadPageViewExplorerBarItem viewExplorerBarItem = (RadPageViewExplorerBarItem)this.pageViewElement.Items[index];
                 GridViewInfo     view  = this.HierarchyRow.Views[this.HierarchyRow.Views.Count - index - 1];
                 GridTableElement child = (GridTableElement)viewExplorerBarItem.AssociatedContentAreaElement.Children[0];
                 if (viewExplorerBarItem.Tag != view || child.ViewTemplate == null)
                 {
                     this.InitializePageViewItem((RadPageViewItem)viewExplorerBarItem, view);
                     child.Detach();
                     child.Initialize(this.GridViewElement, view);
                     if (view == this.HierarchyRow.ActiveView)
                     {
                         radPageViewItem = (RadPageViewItem)viewExplorerBarItem;
                         this.rowView    = child;
                     }
                 }
             }
         }
         if (radPageViewItem == null)
         {
             return;
         }
         this.pageViewElement.SelectedItem = radPageViewItem;
     }
     else
     {
         if (this.pageViewElement != null)
         {
             RadPageViewItem radPageViewItem1 = (RadPageViewItem)null;
             if (this.pageViewElement is RadPageViewStripElement || this.pageViewElement is RadPageViewOutlookElement)
             {
                 int index1 = this.ViewTemplate.IsSelfReference ? 1 : 0;
                 int index2 = 0;
                 while (index2 < this.pageViewElement.Items.Count)
                 {
                     if (this.HierarchyRow.Views[index1].ViewTemplate != this.ViewTemplate)
                     {
                         RadPageViewItem radPageViewItem2 = this.pageViewElement.Items[index2];
                         GridViewInfo    view             = this.HierarchyRow.Views[index1];
                         this.InitializePageViewItem(radPageViewItem2, view);
                         if (view == this.HierarchyRow.ActiveView)
                         {
                             radPageViewItem1 = radPageViewItem2;
                         }
                     }
                     ++index2;
                     ++index1;
                 }
             }
             else
             {
                 for (int index = this.pageViewElement.Items.Count - 1; index >= 0; --index)
                 {
                     if (this.HierarchyRow.Views[this.HierarchyRow.Views.Count - index - 1].ViewTemplate != this.ViewTemplate)
                     {
                         RadPageViewItem radPageViewItem2 = this.pageViewElement.Items[index];
                         GridViewInfo    view             = this.HierarchyRow.Views[this.HierarchyRow.Views.Count - index - 1];
                         this.InitializePageViewItem(radPageViewItem2, view);
                         if (view == this.HierarchyRow.ActiveView)
                         {
                             radPageViewItem1 = radPageViewItem2;
                         }
                     }
                 }
             }
             if (radPageViewItem1 != null)
             {
                 this.suspendTabChanging           = true;
                 this.pageViewElement.SelectedItem = radPageViewItem1;
                 this.suspendTabChanging           = false;
             }
         }
         if (this.rowView.ViewInfo != this.HierarchyRow.ActiveView)
         {
             bool flag = this.rowView.ViewTemplate != this.HierarchyRow.ActiveView.ViewTemplate;
             this.rowView.Detach();
             this.rowView.Initialize(this.GridViewElement, this.HierarchyRow.ActiveView);
             if (!flag)
             {
                 return;
             }
             this.UpdateRowViewLayout();
         }
         else
         {
             this.rowView.ViewElement.UpdateRows();
         }
     }
 }
示例#18
0
 public PrintGridTraverser(GridViewInfo viewInfo)
     : base(viewInfo)
 {
 }
示例#19
0
 public GridTraverser(GridViewInfo viewInfo)
     : this(viewInfo, GridTraverser.TraversalModes.AllRows)
 {
 }
示例#20
0
 public GridViewPinnedRowCollection(GridViewInfo viewInfo)
 {
     this.viewInfo = viewInfo;
 }
 public GridViewSummaryRowInfo(GridViewInfo gridViewInfo, GridViewGroupRowInfo group)
     : base(gridViewInfo)
 {
     this.groupRow = group;
 }
示例#22
0
 public ViewInfoTraverser(GridViewInfo viewInfo)
 {
     this.viewInfo = viewInfo;
     this.Reset();
 }
示例#23
0
 public void Initialize(RadGridViewElement rootElement, GridViewInfo viewInfo)
 {
     this.gridViewElement = rootElement;
     this.viewInfo        = viewInfo;
     this.viewInfo.ViewTemplate.MasterTemplate.SynchronizationService.AddListener((IGridViewEventListener)this);
 }
示例#24
0
 public GridViewDataRowInfo(GridViewInfo viewInfo)
     : base(viewInfo)
 {
 }
示例#25
0
        private void ListSource_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            if (e.Action == NotifyCollectionChangedAction.Add)
            {
                this.AttachRows(e.NewItems);
                if (!this.suspendNotifications)
                {
                    if (this.Count <= 1)
                    {
                        this.owner.DataView.EnsureDescriptors();
                    }
                    this.UpdateChildRowViewInfo((GridViewRowInfo)e.NewItems[0]);
                    if (((GridViewRowInfo)e.NewItems[0]).Parent is MasterGridViewTemplate)
                    {
                        ++((GridViewRowInfo)e.NewItems[0]).ViewInfo.Version;
                    }
                    this.DispatchDataViewChangedEvent(new DataViewChangedEventArgs(ViewChangedAction.Add, e.NewItems));
                    if (this.owner.SelectLastAddedRow && e.NewItems.Count > 0)
                    {
                        GridViewSynchronizationService.RaiseCurrentChanged(this.owner, this.owner.DataView.CurrentItem, this.owner.CurrentColumn, this.owner.DataView == null);
                        if (!this.addingThroughUI)
                        {
                            if (this.prevSelectedRow != null)
                            {
                                GridViewSynchronizationService.SuspendEvent(this.owner, KnownEvents.CurrentChanged);
                                this.prevSelectedRow.IsCurrent  = false;
                                this.prevSelectedRow.IsSelected = false;
                                GridViewSynchronizationService.ResumeEvent(this.owner, KnownEvents.CurrentChanged);
                            }
                            GridViewRowInfo newItem = (GridViewRowInfo)e.NewItems[0];
                            newItem.IsCurrent    = true;
                            newItem.IsSelected   = true;
                            this.prevSelectedRow = newItem;
                            newItem.EnsureVisible();
                        }
                    }
                    if (this.owner.IsSelfReference)
                    {
                        this.DispatchDataViewChangedEvent(new DataViewChangedEventArgs(ViewChangedAction.SortingChanged));
                    }
                }
            }
            GridViewInfo    gridViewInfo    = (GridViewInfo)null;
            GridViewRowInfo gridViewRowInfo = (GridViewRowInfo)null;
            bool            flag1           = false;

            if (e.Action == NotifyCollectionChangedAction.Remove)
            {
                GridViewRowInfo newItem = e.NewItems[0] as GridViewRowInfo;
                flag1 = newItem.IsPinned;
                if (newItem != null && newItem.ViewTemplate != null && newItem.ViewTemplate.HierarchyDataProvider != null)
                {
                    int val1 = this.owner.MasterTemplate.Owner.TableElement.RowScroller.Scrollbar.Value;
                    newItem.ViewTemplate.HierarchyDataProvider.Refresh();
                    newItem.ViewTemplate.Refresh();
                    RadScrollBarElement scrollbar = this.owner.MasterTemplate.Owner.TableElement.RowScroller.Scrollbar;
                    scrollbar.Value = Math.Min(val1, scrollbar.Maximum - scrollbar.LargeChange + 1);
                }
                if (newItem != null && newItem.IsCurrent && (this.owner.Parent != null && !this.suspendNotifications))
                {
                    gridViewInfo    = newItem.ViewInfo;
                    gridViewRowInfo = GridViewRowCollection.NavigateAfterRemove(newItem, (List <GridViewRowInfo>)null);
                }
                if (!this.suspendNotifications)
                {
                    this.DispatchDataViewChangedEvent(new DataViewChangedEventArgs(ViewChangedAction.Remove, e.NewItems));
                }
            }
            this.OnCollectionChanged(e);
            if (gridViewInfo != null)
            {
                GridViewRelationDataProvider hierarchyDataProvider = gridViewInfo.ViewTemplate.HierarchyDataProvider as GridViewRelationDataProvider;
                if (hierarchyDataProvider != null && this.owner.MasterTemplate.SynchronizationService.IsDispatchSuspended)
                {
                    hierarchyDataProvider.Refresh();
                }
                gridViewInfo.Refresh();
            }
            GridViewCollectionChangedEventArgs args = new GridViewCollectionChangedEventArgs(this.owner, e.Action, e.NewItems, e.OldItems, e.NewStartingIndex, e.OldStartingIndex, e.PropertyName);
            bool flag2 = true;

            if (e.Action == NotifyCollectionChangedAction.ItemChanging || e.Action == NotifyCollectionChangedAction.ItemChanged)
            {
                flag2 = !this.owner.ListSource.IsDataBound || e.Action == NotifyCollectionChangedAction.ItemChanged && !string.IsNullOrEmpty(e.PropertyName);
            }
            if (flag2)
            {
                this.owner.EventDispatcher.RaiseEvent <GridViewCollectionChangedEventArgs>(EventDispatcher.RowsChanged, (object)this, args);
                this.UpdateHierarchyView(e.NewItems, e.PropertyName);
            }
            if (flag1)
            {
                this.DispatchDataViewChangedEvent(new DataViewChangedEventArgs(ViewChangedAction.Remove), GridEventType.UI);
            }
            if (gridViewInfo == null || this.owner.MasterTemplate == null)
            {
                return;
            }
            if (this.owner.MasterTemplate.SynchronizationService.IsDispatchSuspended)
            {
                if (gridViewRowInfo == null)
                {
                    return;
                }
                this.owner.MasterTemplate.CurrentRowToSetOnEndUpdate = gridViewRowInfo;
            }
            else
            {
                if (!flag1)
                {
                    this.DispatchDataViewChangedEvent(new DataViewChangedEventArgs(ViewChangedAction.Remove), GridEventType.UI);
                }
                if (gridViewRowInfo == null)
                {
                    return;
                }
                this.owner.MasterTemplate.CurrentRow = gridViewRowInfo;
            }
        }
 public GridViewSystemRowCollection(GridViewInfo viewInfo)
 {
     this.viewInfo = viewInfo;
     this.list     = new List <GridViewSystemRowInfo>();
 }