protected virtual void UpdateLinkTypes(bool isLastChildRow) { ElementVisibility elementVisibility = ElementVisibility.Hidden; if (this.rowElement.TableElement.ShowSelfReferenceLines) { elementVisibility = ElementVisibility.Visible; } int index1 = this.LinkCount - 1; GridLinkItem hierarchyLink1 = this.hierarchyLinks[index1]; hierarchyLink1.Visibility = elementVisibility; hierarchyLink1.Type = !isLastChildRow ? GridLinkItem.LinkType.TShape : GridLinkItem.LinkType.RightBottomAngleShape; GridViewHierarchyRowInfo parent = this.RowInfo.Parent as GridViewHierarchyRowInfo; for (int index2 = index1 - 1; index2 >= 0; --index2) { GridLinkItem hierarchyLink2 = this.hierarchyLinks[index2]; hierarchyLink2.Visibility = elementVisibility; hierarchyLink2.Type = GridLinkItem.LinkType.VerticalLine; if (parent != null) { if (this.IsLastChildRow(parent.Parent, (GridViewRowInfo)parent)) { hierarchyLink2.Visibility = ElementVisibility.Hidden; } parent = parent.Parent as GridViewHierarchyRowInfo; } else { hierarchyLink2.Visibility = ElementVisibility.Hidden; } } }
public virtual object Evaluate(IHierarchicalRow row) { string summaryExpression = this.GetSummaryExpression(); if (string.IsNullOrEmpty(summaryExpression)) { return((object)null); } object obj = (object)null; GridViewGroupRowInfo viewGroupRowInfo = row as GridViewGroupRowInfo; if (viewGroupRowInfo != null) { return(viewGroupRowInfo.Group.Evaluate(summaryExpression)); } GridViewHierarchyRowInfo hierarchyRowInfo = row as GridViewHierarchyRowInfo; if (hierarchyRowInfo != null) { return(hierarchyRowInfo.ActiveView.Evaluate(summaryExpression, (IEnumerable <GridViewRowInfo>)hierarchyRowInfo.ActiveView.ChildRows)); } GridViewTemplate gridViewTemplate = row as GridViewTemplate; if (gridViewTemplate != null) { return(gridViewTemplate.DataView.Evaluate(summaryExpression, 0, gridViewTemplate.DataView.Count)); } return(obj); }
public GridViewDetailsRowInfo(GridViewHierarchyRowInfo ownerRowInfo) : base(ownerRowInfo.ViewInfo) { this.ownerRowInfo = ownerRowInfo; this.SuspendPropertyNotifications(); this.MaxHeight = 500; this.ResumePropertyNotifications(); }
protected virtual GridViewDetailsRowInfo CreateGridViewDetailsRowInfo( GridViewHierarchyRowInfo hierarchyRow) { GridViewCreateRowInfoEventArgs e = new GridViewCreateRowInfoEventArgs((GridViewRowInfo) new GridViewDetailsRowInfo(this), hierarchyRow.ViewInfo); this.ViewTemplate.OnCreateRowInfo(e); return(e.RowInfo as GridViewDetailsRowInfo); }
private bool IsSelfReference(GridViewHierarchyRowInfo hierarchyRow) { if (hierarchyRow == null || hierarchyRow.ChildRows == null || hierarchyRow.ChildRows.Count > 0 && hierarchyRow.ChildRows[0].ViewTemplate != hierarchyRow.ViewTemplate || hierarchyRow.ChildRows.Count == 0 && hierarchyRow.ViewTemplate.Templates.Count > 0) { return(false); } return(hierarchyRow.ViewTemplate.IsSelfReference); }
protected internal ICollectionView <GridViewRowInfo> LoadHierarchicalData( GridViewHierarchyRowInfo parent, ICollectionView <GridViewRowInfo> sourceView) { if (this.ViewTemplate.HierarchyDataProvider == null) { this.childRows = GridViewChildRowCollection.Empty; this.version = this.ownerTemplate.DataView.Version; return((ICollectionView <GridViewRowInfo>)null); } IList <GridViewRowInfo> childRows = this.ViewTemplate.HierarchyDataProvider.GetChildRows((GridViewRowInfo)parent, this); for (int index = 0; index < childRows.Count; ++index) { childRows[index].ViewInfo = this; childRows[index].SetParent((GridViewRowInfo)parent); } if (sourceView == null || this.ViewTemplate.IsSelfReference) { Dictionary <string, bool> dictionary = new Dictionary <string, bool>(); if (sourceView != null) { for (int index = 0; index < sourceView.Groups.Count; ++index) { DataGroup group = sourceView.Groups[index] as DataGroup; string header = group.Header; if (string.IsNullOrEmpty(header)) { header = index.ToString(); } dictionary.Add(header, group.IsExpanded); } } sourceView = (ICollectionView <GridViewRowInfo>) new SnapshotCollectionView <GridViewRowInfo>((IEnumerable <GridViewRowInfo>)childRows, this.ownerTemplate.DataView); if (this.ownerTemplate.GroupPredicate != null) { ((SnapshotCollectionView <GridViewRowInfo>)sourceView).GroupPredicate = this.ownerTemplate.GroupPredicate; } for (int index = 0; index < sourceView.Groups.Count; ++index) { DataGroup group = sourceView.Groups[index] as DataGroup; string header = group.Header; if (string.IsNullOrEmpty(header)) { header = index.ToString(); } if (dictionary.ContainsKey(header)) { group.GroupRow.IsExpanded = dictionary[header]; } } } else { ((SnapshotCollectionView <GridViewRowInfo>)sourceView).Load((IEnumerable <GridViewRowInfo>)childRows); } return(sourceView); }
protected virtual bool OnRowVisible() { if (this.current == null) { return(false); } bool flag = (this.processHiddenRows || this.current.IsVisible) && this.pinPosition == this.current.PinPosition; if (this.pinPosition == PinnedRowPosition.None) { GridViewSystemRowInfo current = this.current as GridViewSystemRowInfo; if (current != null && current.RowPosition != this.rowPosition) { flag = false; } } if (this.viewInfo.ViewTemplate.GroupDescriptors.Count > 0 && this.current is GridViewSummaryRowInfo && !this.viewInfo.ViewTemplate.ShowTotals) { flag = false; } if (this.current is GridViewTableHeaderRowInfo) { flag = flag && this.viewInfo.ViewTemplate.ShowColumnHeaders; } else if (this.current is GridViewNewRowInfo) { flag = flag && GridTraverser.IsNewRowVisible(this.current as GridViewNewRowInfo); } else if (this.current is GridViewSearchRowInfo) { flag = flag && this.viewInfo.ViewTemplate.AllowSearchRow; } else if (this.current is GridViewFilteringRowInfo) { flag = flag && this.viewInfo.ViewTemplate.EnableFiltering && this.viewInfo.ViewTemplate.ShowFilteringRow; } else if (this.current is GridViewDetailsRowInfo) { GridViewHierarchyRowInfo owner = ((GridViewDetailsRowInfo)this.current).Owner as GridViewHierarchyRowInfo; if (owner != null) { flag = flag && owner.IsExpanded; } } if (this.RowVisible == null) { return(flag); } RowEnumeratorEventArgs e = new RowEnumeratorEventArgs(this.current); e.ProcessRow = flag; this.RowVisible((object)this, e); return(e.ProcessRow); }
public DeleteRowDataViewChangedEventArgs( GridViewInfo viewInfo, GridViewHierarchyRowInfo hierarchyRow, int hierarchyRowIndex, GridViewRowInfo[] rows) : base(ViewChangedAction.Remove, (IList)rows) { this.viewInfo = viewInfo; this.hierarchyRow = hierarchyRow; this.hierarchyRowIndex = hierarchyRowIndex; }
protected virtual void CreateTraverser(GridViewInfo viewInfo) { GridViewHierarchyRowInfo hierarchyRow = this.hierarchyRow as GridViewHierarchyRowInfo; if (this.hierarchyRow.HasChildViews) { if (hierarchyRow != null && !this.IsSelfReference(hierarchyRow)) { this.oldRowIsGroupRow = false; this.traverser = (ITraverser <GridViewRowInfo>) new ViewInfoTraverser(viewInfo != null ? viewInfo : hierarchyRow.ActiveView); } else { this.traverser = (ITraverser <GridViewRowInfo>) new HierarchyRowTraverser((GridViewRowInfo)this.hierarchyRow); } } else if (hierarchyRow != null && (this.processHierarchy || this.hierarchyRow == this.rootRow || this.oldRowIsGroupRow)) { this.oldRowIsGroupRow = false; this.traverser = (ITraverser <GridViewRowInfo>) new ViewInfoTraverser(viewInfo != null ? viewInfo : hierarchyRow.ActiveView); } else if (this.hierarchyRow is GridViewTemplate) { this.traverser = (ITraverser <GridViewRowInfo>) new ViewInfoTraverser(((GridViewTemplate)this.hierarchyRow).MasterViewInfo); } else if (this.hierarchyRow is GridViewGroupRowInfo) { this.traverser = (ITraverser <GridViewRowInfo>) new GroupRowTraverser((GridViewGroupRowInfo)this.hierarchyRow); } ViewInfoTraverser traverser = this.traverser as ViewInfoTraverser; if (traverser != null) { if (this.mode == GridTraverser.TraversalModes.TopPinnedRows) { traverser.FilterByPinPosition = true; traverser.FilteredPinPosition = PinnedRowPosition.Top; } else if (this.mode == GridTraverser.TraversalModes.BottomPinnedRows) { traverser.FilterByPinPosition = true; traverser.FilteredPinPosition = PinnedRowPosition.Bottom; } else if (this.mode == GridTraverser.TraversalModes.ScrollableRows) { traverser.FilterByPinPosition = true; traverser.FilteredPinPosition = PinnedRowPosition.None; } } this.traverser.Reset(); }
private void UpdateHierarchyView(IList list, string propertyName) { if (list == null || list.Count <= 0) { return; } GridViewHierarchyRowInfo hierarchyRowInfo = list[0] as GridViewHierarchyRowInfo; if (hierarchyRowInfo == null || hierarchyRowInfo.ViewTemplate == null || hierarchyRowInfo.ViewTemplate.HierarchyDataProvider == null || !hierarchyRowInfo.ViewTemplate.HierarchyDataProvider.Relation.ChildColumnNames.Contains(propertyName) && !hierarchyRowInfo.ViewTemplate.HierarchyDataProvider.Relation.ParentColumnNames.Contains(propertyName)) { return; } hierarchyRowInfo.ViewTemplate.HierarchyDataProvider.Refresh(); hierarchyRowInfo.ViewTemplate.Refresh(); }
protected override bool OnMouseDownLeft(MouseEventArgs e) { GridRowElement rowAtPoint = this.GetRowAtPoint(e.Location); if (rowAtPoint != null && rowAtPoint.GridViewElement.TableElement.PageViewMode == PageViewMode.ExplorerBar) { GridViewHierarchyRowInfo parent = rowAtPoint.RowInfo.Parent as GridViewHierarchyRowInfo; if (parent != null) { this.GridViewElement.CurrentRow.IsSelected = false; parent.ActiveView = rowAtPoint.RowInfo.ViewInfo; } } return(base.OnMouseDownLeft(e)); }
private void StepInHierarchyBackward() { while (this.CanStepInHierarchy()) { GridViewHierarchyRowInfo current = this.traverser.Current as GridViewHierarchyRowInfo; if (current != null && !this.processHierarchy && !this.IsSelfReference(current)) { this.overDetailsRow = true; break; } this.hierarchyRow = (IHierarchicalRow)this.traverser.Current; this.hierarchyTraversers.Push(this.traverser); this.CreateTraverser(); this.traverser.MoveToEnd(); } }
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); }
protected override bool CanStepInHierarchy() { GridViewHierarchyRowInfo current = this.Traverser.Current as GridViewHierarchyRowInfo; if (current != null) { foreach (GridViewInfo view in (IEnumerable <GridViewInfo>)current.Views) { if (view.ChildRows.Count > 0) { return(true); } } return(false); } if (this.Traverser.Current != null) { return(this.Traverser.Current.HasChildRows()); } return(false); }
private bool StepInHierarchy() { if (this.overDetailsRow) { this.overDetailsRow = false; } else if (this.CanStepInHierarchy()) { GridViewHierarchyRowInfo current = this.traverser.Current as GridViewHierarchyRowInfo; if (current != null && !this.processHierarchy && !this.IsSelfReference(current)) { this.overDetailsRow = true; return(true); } if (this.traverser.Current != null) { this.hierarchyRow = (IHierarchicalRow)this.traverser.Current; this.hierarchyTraversers.Push(this.traverser); this.CreateTraverser(); } } return(false); }
private void FillParentData() { GridViewHierarchyRowInfo parent = this.Parent as GridViewHierarchyRowInfo; if (parent == null) { return; } GridViewRelation relation = this.ViewTemplate.HierarchyDataProvider.Relation; if (relation == null) { return; } for (int index = 0; index < relation.ChildColumnNames.Count; ++index) { GridViewColumn column = (GridViewColumn)this.ViewTemplate.Columns[relation.ChildColumnNames[index]]; if (column != null) { this[column] = parent[(GridViewColumn)parent.ViewTemplate.Columns[relation.ParentColumnNames[index]]]; } } this.InvalidateRow(); }
public GridViewInfo(GridViewTemplate ownerTemplate, GridViewHierarchyRowInfo parentRow) : this(ownerTemplate) { this.parentRow = parentRow; }
public virtual int GetNumberOfPages(Rectangle drawArea) { TableViewRowLayoutBase rowLayout = (this.grid.ViewDefinition as TableViewDefinition).CreateRowLayout() as TableViewRowLayoutBase; rowLayout.Context = GridLayoutContext.Printer; rowLayout.Initialize(this.grid.TableElement); if (this.GridView.PrintStyle.FitWidthMode == PrintFitWidthMode.FitPageWidth) { rowLayout.MeasureRow(new SizeF((float)drawArea.Width, (float)drawArea.Height)); } else { rowLayout.MeasureRow((SizeF)this.GridView.Size); } int height = drawArea.Height; if (this.PrintHeaderOnEachPage && !this.PrintHierarchy) { height -= rowLayout.GetRowHeight((GridViewRowInfo)this.GridView.MasterView.TableHeaderRow); } int num1 = 0; int num2 = 1; this.traverser.Reset(); this.traverser.ProcessHiddenRows = this.PrintHiddenRows; this.traverser.ProcessHierarchy = this.PrintHierarchy; while (this.traverser.MoveNext()) { if (this.traverser.Current is GridViewDataRowInfo || this.traverser.Current is GridViewTableHeaderRowInfo && (this.PrintHierarchy || !this.PrintHeaderOnEachPage) || (this.traverser.Current is GridViewGroupRowInfo && this.PrintGrouping || this.traverser.Current is GridViewSummaryRowInfo && this.PrintSummaries)) { GridViewHierarchyRowInfo current = this.traverser.Current as GridViewHierarchyRowInfo; if (current != null && current.Views.Count > 0) { switch (this.printSettings.ChildViewPrintMode) { case ChildViewPrintMode.PrintFirstView: current.ActiveView = current.Views[0]; break; case ChildViewPrintMode.SelectViewToPrint: ChildViewPrintingEventArgs e = new ChildViewPrintingEventArgs(current.Views.IndexOf(current.ActiveView), current); this.OnChildViewPrinting((object)this, e); current.ActiveView = current.Views[e.ActiveViewIndex]; break; } } int num3 = !this.GridView.AutoSizeRows ? rowLayout.GetRowHeight(this.traverser.Current) + this.grid.TableElement.RowSpacing : this.PrintRenderer.GetDataRowHeight(this.traverser.Current, rowLayout); if (num1 + num3 < height) { num1 += num3; } else { ++num2; num1 = num3; } } } this.traverser.Reset(); TableViewDefinitionPrintRenderer printRenderer = this.PrintRenderer as TableViewDefinitionPrintRenderer; if (printRenderer != null && printRenderer.PrintPages.Count > 0 && !this.PrintHierarchy) { return(num2 * printRenderer.PrintPages.Count); } return(num2); }
public override void DrawPage( PrintGridTraverser traverser, Rectangle drawArea, Graphics graphics, GridPrintSettings settings, int pageNumber) { bool flag1 = this.currentPage != pageNumber; int height = drawArea.Height; int x = drawArea.X; int y = drawArea.Y; TableViewRowLayout rowLayout = this.GetRowLayout((GridViewRowInfo)this.GridView.MasterView.TableHeaderRow, settings.FitWidthMode, settings.HierarchyIndent, drawArea); rowLayout.IgnoreColumnVisibility = settings.PrintHiddenColumns; int num1 = 0; foreach (GridViewColumn renderColumn in (IEnumerable <GridViewColumn>)rowLayout.RenderColumns) { if (renderColumn is GridViewRowHeaderColumn || renderColumn is GridViewIndentColumn) { num1 += rowLayout.GetColumnWidth(renderColumn); } } int num2 = (int)rowLayout.DesiredSize.Width - num1; if (settings.FitWidthMode == PrintFitWidthMode.NoFitCentered) { x += (drawArea.Width - num2) / 2; } if ((this.GridView.ShowColumnHeaders && this.firstPage && pageNumber == 1 || settings.PrintHeaderOnEachPage) && !settings.PrintHierarchy) { this.PrintRow((GridViewRowInfo)this.GridView.MasterView.TableHeaderRow, rowLayout, settings, x, y, graphics, drawArea); int num3 = this.GetDataRowHeight((GridViewRowInfo)this.GridView.MasterView.TableHeaderRow, (TableViewRowLayoutBase)rowLayout) + this.GridView.TableElement.RowSpacing; y += num3; height -= num3; } this.firstPage = false; int num4 = y; GridViewRowInfo row = (GridViewRowInfo)null; if (this.PrintPages.Count > 0 && !settings.PrintHierarchy) { row = traverser.Current; } bool flag2 = true; while (traverser.MoveNext()) { if (traverser.Current is GridViewDataRowInfo || traverser.Current is GridViewGroupRowInfo || traverser.Current is GridViewSummaryRowInfo || traverser.Current is GridViewTableHeaderRowInfo && settings.PrintHierarchy) { GridViewHierarchyRowInfo current = traverser.Current as GridViewHierarchyRowInfo; if (current != null && current.Views.Count > 0) { switch (settings.ChildViewPrintMode) { case ChildViewPrintMode.PrintFirstView: current.ActiveView = current.Views[0]; break; case ChildViewPrintMode.SelectViewToPrint: ChildViewPrintingEventArgs e = new ChildViewPrintingEventArgs(current.Views.IndexOf(current.ActiveView), current); this.OnChildViewPrinting(e); current.ActiveView = current.Views[e.ActiveViewIndex]; break; } } rowLayout = this.GetRowLayout(traverser.Current, settings.FitWidthMode, settings.HierarchyIndent, drawArea); int num3 = !(traverser.Current is GridViewGroupRowInfo) ? this.GetDataRowHeight(traverser.Current, (TableViewRowLayoutBase)rowLayout) : this.GetRowSize(traverser.Current, rowLayout).Height; if ((y + num3 >= drawArea.Bottom || num4 + num3 >= drawArea.Bottom) && !flag2) { traverser.MovePrevious(); num4 = y; bool flag3 = this.currentPage != pageNumber; ++this.currentPage; if (!flag3) { break; } } else { if (traverser.Current is GridViewGroupRowInfo) { if (settings.PrintGrouping) { if (this.currentPage == pageNumber) { this.PrintRowWideCell(traverser.Current, rowLayout, settings, x, y, graphics); y += num3 + this.GridView.TableElement.RowSpacing; } else { num4 += num3 + this.GridView.TableElement.RowSpacing; } } } else if (!(traverser.Current is GridViewSummaryRowInfo) || settings.PrintSummaries) { if (this.currentPage == pageNumber) { this.PrintRow(traverser.Current, rowLayout, settings, x, y, graphics, drawArea); y += num3 + this.GridView.TableElement.RowSpacing; } else { num4 += num3 + this.GridView.TableElement.RowSpacing; } } else { continue; } if (height < num3 && flag2) { ++this.currentPage; break; } flag2 = false; } } } if (this.PrintPages.Count <= 0 || settings.PrintHierarchy) { return; } if (y + this.GetDataRowHeight(traverser.Current, (TableViewRowLayoutBase)rowLayout) < drawArea.Bottom || num4 + this.GetDataRowHeight(traverser.Current, (TableViewRowLayoutBase)rowLayout) < drawArea.Bottom) { ++this.currentPage; } ++this.CurrentPrintPage; this.CurrentPrintPage %= this.PrintPages.Count; if (this.CurrentPrintPage <= 0) { return; } if (row == null) { traverser.Reset(); } else { traverser.GoToRow(row); } }
public ChildViewExpandedEventArgs(GridViewHierarchyRowInfo parentRow) { this.parentRow = parentRow; }
public ChildViewPrintingEventArgs(int activeViewIndex, GridViewHierarchyRowInfo row) { this.activeViewIndex = activeViewIndex; this.row = row; }