public PivotDataProvider(CellSetDataProvider provider)
        {
            if (provider == null)
            {
                throw new ArgumentNullException("provider");
            }

            Provider = provider;
        }
Exemplo n.º 2
0
        public PivotDataProvider(CellSetDataProvider provider)
        {
            if (provider == null)
            {
                throw new ArgumentNullException("provider");
            }

            Provider = provider;
        }
        public void Initialize(CellSetDataProvider provider)
        {
            // Ячейка с фокусом содержит элемент из предыдущего CellSetDataProvider. По таплу ныжно найти ей соответствие в новом CellSetDataProvider
            if (FocusedCellView != null)
            {
                if (provider != null)
                {
                    CellInfo info = provider.GetCellInfo(FocusedCellView.CellDescr.Axis0_Coord, FocusedCellView.CellDescr.Axis1_Coord);
                    IDictionary<String, MemberInfo> tuple = FocusedCellView.GetTuple();
                    if(info != null && info.CompareByTuple(tuple))
                    {
                        // Соответствие сразу найдено (в идеале)
                    }
                    else
                    {
                        info = provider.GetCellByTuple(tuple);
                    }
                    FocusedCellView = info;
                }
                else
                    FocusedCellView = null;
            }

            bool stick = false;
            // Пытаемся получить ячейку, которая в текущий момент верхняя левая
            // и сравнить ее с новой ячейкой с теми же координатами. Если ячейки совпадают, то позицию не обнуляем чтобы на экране осталась текущая область
            if (m_CellSetProvider != null &&
                m_CellSetProvider.CellSet_Description != null)
            {
                CellInfo cell_old = m_CellSetProvider.GetCellInfo(ColumnsArea_FirstVisible_Coordinate.Column, RowsArea_FirstVisible_Coordinate.Row);
                if (cell_old != null)
                {
                    if (provider != null &&
                        provider.CellSet_Description != null)
                    {
                        CellInfo cell_new = provider.GetCellInfo(ColumnsArea_FirstVisible_Coordinate.Column, RowsArea_FirstVisible_Coordinate.Row);
                        if (cell_new != null)
                        { 
                            // Сверяем по координатам
                            stick = cell_new.CompareByTuple(cell_old.GetTuple());
                        }
                    }
                }
            }

            //// Если в старой позиции уже находится другая ячейка, то отображаем ячейку с фокусом
            //if (!stick)
            //{
            //    GoToFocusedCell();
            //    //ColumnsArea_FirstVisible_Coordinate.Column = 0;
            //    //RowsArea_FirstVisible_Coordinate.Row = 0;
            //    //m_VerticalScroll.Value = 0;
            //    //m_HorizontalScroll.Value = 0;
            //}

            m_SelectionManager.ClearSelection();

            //m_MembersWidthes.Clear();
            //m_MembersHeightes.Clear();

            ColumnsArea_LovestMemberControls.Clear();
            RowsArea_LovestMemberControls.Clear();
            m_MemberControls_Dict.Clear();

            DateTime start = DateTime.Now;
            //System.Diagnostics.Debug.WriteLine("PivotGrid initializing start: " + start.TimeOfDay.ToString());

            bool new_OlapData = m_CellSetProvider != provider;
            m_CellSetProvider = provider;
            m_LayoutProvider = null;

            if (provider != null)
            {
                PivotDataProvider pivotProvider = new PivotDataProvider(provider);
                m_LayoutProvider = new PivotLayoutProvider(pivotProvider);
            }

            if (m_AnalyticInfo == null)
                m_AnalyticInfo = new PivotDataAnalizer(this);
            else
            {
                m_AnalyticInfo.ClearMembersAnalytic();
                if (new_OlapData)
                    m_AnalyticInfo.BuildCellsAnalytic();
            }

            Refresh(RefreshType.BuildEndRefresh);

            // Если в старой позиции уже находится другая ячейка, то отображаем ячейку с фокусом
            if (!stick)
            {
                GoToFocusedCell();
            }
            DateTime stop = DateTime.Now;
            //System.Diagnostics.Debug.WriteLine("PivotGrid initializing stop: " + stop.TimeOfDay.ToString());
            //System.Diagnostics.Debug.WriteLine("PivotGrid initializing time: " + (stop - start).ToString());
        }
		protected virtual void Initialize(CellSetData cs_descr)
		{
			try
			{
				Dictionary<String, SortDescriptor> axis1_sortInfo = null;
				Dictionary<String, SortDescriptor> axis0_sortInfo = null;
				if (m_CellSetProvider != null)
				{
					axis0_sortInfo = m_CellSetProvider.ColumnsSortInfo;
					axis1_sortInfo = m_CellSetProvider.RowsSortInfo;
				}

				ResetSettings();

				IsWaiting = true;
				DateTime start = DateTime.Now;
				//System.Diagnostics.Debug.WriteLine("UpdateablePivotGrid initializing start: " + start.ToString());

				m_CSDescr = cs_descr;
				if (cs_descr != null)
				{
					m_CellSetProvider = new CellSetDataProvider(cs_descr, DataReorganizationType);
					if (axis0_sortInfo != null)
					{
						foreach (var hierarchyUniqueName in axis0_sortInfo.Keys)
						{
							m_CellSetProvider.Sort(0, hierarchyUniqueName, axis0_sortInfo[hierarchyUniqueName]);
						}
					}

					if (axis1_sortInfo != null)
					{
						foreach (var hierarchyUniqueName in axis1_sortInfo.Keys)
						{
							m_CellSetProvider.Sort(1, hierarchyUniqueName, axis1_sortInfo[hierarchyUniqueName]);
						}
					}
					ImportSizeInfo();
				}

				PivotGrid.Initialize(m_CellSetProvider);
				UpdateButtons();

				DateTime stop = DateTime.Now;
				//System.Diagnostics.Debug.WriteLine("UpdateablePivotGrid initializing stop: " + stop.ToString());
				System.Diagnostics.Debug.WriteLine("UpdateablePivotGrid initializing time: " + (stop - start).ToString());
			}
			finally
			{
				IsWaiting = false;
			}
		}
 void InitializeTuple(CellSetData cs_descr)
 {
     if (cs_descr != null)
     {
         CellSetDataProvider  cellSetProvider = new CellSetDataProvider(cs_descr);
         CellInfo cell = cellSetProvider.GetCellInfo(0, 0);
         if (cell != null)
         {
             IDictionary<String, MemberWrap> slice = new Dictionary<String, MemberWrap>();
             IDictionary<String, MemberInfo> tuple = cell.GetTuple();
             foreach (String hierarchyUniqueName in tuple.Keys)
             {
                 slice.Add(hierarchyUniqueName, new MemberWrap(tuple[hierarchyUniqueName]));
             }
             m_CopyControl.Initialize(slice);
         }
     }
 }
        public void InitializeMembersList(CellSetDataProvider provider)
        {
            IList<MemberItem> list = new List<MemberItem>();
            if (provider != null && provider.CellSet_Description.Axes.Count > 0)
            {
                int col = 0;
                foreach (MemberInfo info in provider.Columns)
                {
                    //CellData cell = provider.CellSet_Description.GetCellDescription(col);
                    //CellView view = new CellView(cell, info, MemberInfo.Empty, provider.GetInvisibleCoords(col));
                    CellInfo view = provider.GetCellInfo(col, -1);
                    double value = 0;
                    if (view != null && 
                        view.Value != null)
                    {
                        try
                        {
                            value = Convert.ToDouble(view.Value);
                        }
                        catch (System.InvalidCastException)
                        {
                        }
                    }

                    list.Add(new MemberItem(info, value, view));
                    col++;
                }
            }

            m_MembersGrid.ItemsSource = list;
        }  
        protected virtual void Initialize(CellSetData cs_descr)
        {
            try
            {
                ResetSettings();

                IsWaiting = true;
                DateTime start = DateTime.Now;
                //System.Diagnostics.Debug.WriteLine("UpdateablePivotGrid initializing start: " + start.ToString());

                m_CSDescr = cs_descr;
                if (cs_descr != null)
                {
                    m_CellSetProvider = new CellSetDataProvider(cs_descr);
                    ImportSizeInfo();
                }
                PivotGrid.Initialize(m_CellSetProvider);
                UpdateButtons();

                DateTime stop = DateTime.Now;
                //System.Diagnostics.Debug.WriteLine("UpdateablePivotGrid initializing stop: " + stop.ToString());
                System.Diagnostics.Debug.WriteLine("UpdateablePivotGrid initializing time: " + (stop - start).ToString());
            }
            finally
            {
                IsWaiting = false;
            }
        }