/// <summary>
        ///
        /// </summary>
        /// <param name="table"></param>
        public void DisplayPeriod(Period period, bool isTableView = false, bool readOnly = false)
        {
            if (DefaultPeriodName == null)
            {
                PeriodName name = ApplicationManager.Instance.ControllerFactory.ServiceFactory.GetPeriodNameService().getRootPeriodName();
                DefaultPeriodName = name.getDefaultPeriodName();
            }

            this.Period = period;
            this.panel.Children.Clear();
            if (forAutomaticSourcing)
            {
                this.tagFormula.Visibility = System.Windows.Visibility.Collapsed;
            }
            if (readOnly)
            {
                this.NewPeriodTextBlock.Visibility = System.Windows.Visibility.Collapsed;
            }
            if ((period == null || period.itemListChangeHandler.Items.Count <= 0) && !this.IsReadOnly)
            {
                if (DefaultPeriodName != null)
                {
                    this.ActiveNamePanel = new RPeriodNamePanel(DefaultPeriodName.name);
                }
                else
                {
                    this.ActiveNamePanel = new RPeriodNamePanel();
                }
                AddNamePanel(this.ActiveNamePanel);
                return;
            }

            Dictionary <String, List <PeriodItem> > dictionary = period != null?period.AsDictionary() : new Dictionary <String, List <PeriodItem> >(0);

            int index = 0;

            foreach (String name in dictionary.Keys)
            {
                List <PeriodItem> items;
                dictionary.TryGetValue(name, out items);
                RPeriodNamePanel itemPanel = new RPeriodNamePanel(name, items);
                if (this.IsReadOnly)
                {
                    itemPanel.SetReadOnly(this.IsReadOnly);
                }
                itemPanel.Index = index;
                AddNamePanel(itemPanel);
                index++;
            }
            if (this.panel.Children.Count == 0 && !this.IsReadOnly)
            {
                this.ActiveNamePanel = new RPeriodNamePanel();
                this.ActiveNamePanel.SetReadOnly(readOnly);
                AddNamePanel(this.ActiveNamePanel);
            }
        }