Exemplo n.º 1
0
        public void SetLoopValue(TransformationTreeItem loop)
        {
            String           name  = loop.name;
            RPeriodNamePanel panel = GetPeriodNamePanel(loop);

            if (panel != null)
            {
                int position = Period != null ? Period.itemListChangeHandler.Items.Count : 0;
                //panel.UpdateInterval(interval, position);
            }
            else
            {
                int position            = Period != null ? Period.itemListChangeHandler.Items.Count : 0;
                List <PeriodItem> items = new List <PeriodItem>(0);
                PeriodItem        item  = new PeriodItem();
                item.name         = name;
                item.loop         = loop;
                item.position     = position++;
                item.operatorSign = DateOperator.EQUALS.sign;
                items.Add(item);

                panel = new RPeriodNamePanel(name, items);
                if (loop.IsPeriod)
                {
                    panel.ItemPanel1.OperatorCol.Width  = new GridLength(200, GridUnitType.Auto);
                    panel.ItemPanel2.OperatorCol.Width  = new GridLength(200, GridUnitType.Auto);
                    panel.ItemPanel1.SignComboBox.Width = 100;
                }
                AddNamePanel(panel);
                OnAdded(panel.ItemPanel1);
            }
        }
Exemplo n.º 2
0
        /// <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);
            }
        }
Exemplo n.º 3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="name"></param>
 /// <returns></returns>
 public RPeriodNamePanel GetPeriodNamePanel(string name)
 {
     foreach (object item in this.panel.Children)
     {
         RPeriodNamePanel panel = (RPeriodNamePanel)item;
         String           text  = panel.ItemPanel1.Label.Content.ToString();
         if (text.ToUpper().Equals(name.ToUpper()))
         {
             return(panel);
         }
     }
     return(null);
 }
Exemplo n.º 4
0
        protected void AddNamePanel(RPeriodNamePanel namePanel)
        {
            namePanel.Added           += OnAdded;
            namePanel.Updated         += OnUpdated;
            namePanel.Deleted         += OnDeleted;
            namePanel.Activated       += OnActivated;
            namePanel.ValidateFormula += OnValidateFormula;
            bool isLoop = namePanel.ItemPanel1.PeriodItem != null && namePanel.ItemPanel1.PeriodItem.loop != null && namePanel.ItemPanel1.PeriodItem.loop.IsPeriod;

            if (isLoop)
            {
                setLoopOperatorSize(namePanel);
            }
            this.panel.Children.Add(namePanel);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Définit la valeur du TargetItem en cour d'édition
        /// et affiche cette valeur dans le TextBox
        /// </summary>
        /// <param name="value">La valeur du TargetItem en cour d'édition</param>
        public void SetPeriodItemName(string name)
        {
            RPeriodNamePanel panel = GetPeriodNamePanel(name);

            if (panel != null)
            {
                panel.SetPeriodName(name);
            }
            else
            {
                panel       = new RPeriodNamePanel(name, new List <PeriodItem>(0));
                panel.Index = this.panel.Children.Count;
                AddNamePanel(panel);
            }
        }
Exemplo n.º 6
0
 public RPeriodNamePanel GetPeriodNamePanel(TransformationTreeItem loop)
 {
     foreach (object item in this.panel.Children)
     {
         RPeriodNamePanel panel = (RPeriodNamePanel)item;
         String           text  = panel.ItemPanel1.Label.Content.ToString();
         if (loop.IsPeriod)
         {
             setLoopOperatorSize(panel);
         }
         if (panel.ItemPanel1.PeriodItem != null &&
             panel.ItemPanel1.PeriodItem.loop != null &&
             (panel.ItemPanel1.PeriodItem.loop.Equals(loop) || panel.ItemPanel1.PeriodItem.loop.name.ToUpper().Equals(loop.name.ToUpper())))
         {
             return(panel);
         }
     }
     return(null);
 }
Exemplo n.º 7
0
        public void SetPeriodInterval(PeriodInterval interval)
        {
            if (interval.periodName == null)
            {
                Kernel.Util.MessageDisplayer.DisplayInfo("Unvalid Period interval", "Period name cannot be null !");
                return;
            }

            String           name  = interval.periodName.name;
            RPeriodNamePanel panel = GetPeriodNamePanel(name);

            if (panel != null)
            {
                int position = Period != null ? Period.itemListChangeHandler.Items.Count : 0;
                panel.UpdateInterval(interval, position);
            }
            else
            {
                int position            = Period != null ? Period.itemListChangeHandler.Items.Count : 0;
                List <PeriodItem> items = new List <PeriodItem>(0);
                PeriodItem        item  = new PeriodItem();
                item.name         = name;
                item.position     = position++;
                item.value        = interval.periodFromDateTime.ToShortDateString();
                item.operatorSign = DateOperator.AFTER_OR_EQUALS.sign;
                items.Add(item);

                item              = new PeriodItem();
                item.name         = name;
                item.position     = position++;
                item.value        = interval.periodToDateTime.ToShortDateString();
                item.operatorSign = DateOperator.BEFORE_OR_EQUALS.sign;
                items.Add(item);

                panel = new RPeriodNamePanel(name, items);
                AddNamePanel(panel);
                OnAdded(panel.ItemPanel1);
                OnAdded(panel.ItemPanel2);
            }
        }
Exemplo n.º 8
0
 private void setLoopOperatorSize(RPeriodNamePanel panel)
 {
     panel.ItemPanel1.OperatorCol.Width  = new GridLength(200, GridUnitType.Auto);
     panel.ItemPanel2.OperatorCol.Width  = new GridLength(200, GridUnitType.Auto);
     panel.ItemPanel1.SignComboBox.Width = 100;
 }