Пример #1
0
        public void Display(TransformationTreeItem item)
        {
            throwEvent = false;
            this.Clear();
            this.Line = item;
            ValueListChangeHandler = new PersistentListChangeHandler <TransformationTreeLoopValue>();
            if (item == null)
            {
                return;
            }

            IList <TransformationTreeLoopValue> listeItem = item.valueListChangeHandler.getItems().Count > item.valueListChangeHandler.Items.Count ? item.valueListChangeHandler.getItems() : item.valueListChangeHandler.Items;

            ValueListChangeHandler.originalList = new List <TransformationTreeLoopValue>(listeItem);

            int index = 1;

            foreach (TransformationTreeLoopValue loopValue in ValueListChangeHandler.Items)
            {
                //loopValue.updatePeriod(Periodicity);
                AllocationValueItemField itemField = new AllocationValueItemField(loopValue);
                Add(itemField);
                index++;
            }
            throwEvent = true;
        }
Пример #2
0
        private void OnActivated(object item)
        {
            AllocationValueItemField field = (AllocationValueItemField)item;

            if (throwEvent && Activated != null)
            {
                Activated(this);
            }
        }
Пример #3
0
 public AllocationValueItemField Add(AllocationValueItemField field)
 {
     field.Deleted   += OnDeleted;
     field.Activated += OnActivated;
     Panel.Children.Add(field);
     if (throwEvent)
     {
         this.ValueListChangeHandler.AddNew(field.LoopValue);
     }
     if (throwEvent && Updated != null)
     {
         Updated(this);
     }
     onChange();
     return(field);
 }
Пример #4
0
        public void Remove(AllocationValueItemField field)
        {
            Panel.Children.Remove(field);
            this.ValueListChangeHandler.AddDeleted(field.LoopValue);
            int index = 1;

            foreach (object pan in Panel.Children)
            {
                ((AllocationValueItemField)pan).Index = index++;
            }

            if (throwEvent && Updated != null)
            {
                Updated(this);
            }
            onChange();
        }
Пример #5
0
 public void SetValue(object value)
 {
     if (this.Line == null)
     {
         if (throwEvent && Added != null)
         {
             Added(this);
         }
     }
     if (value is IList)
     {
         var liste = value as IList;
         throwEvent = false;
         for (int i = 0; i < liste.Count; i++)
         {
             TransformationTreeLoopValue item  = new TransformationTreeLoopValue(ValueListChangeHandler.Items.Count + 1, liste[i]);
             AllocationValueItemField    field = this.Add(item);
             if (field != null)
             {
                 this.ValueListChangeHandler.AddNew(field.LoopValue);
             }
         }
         throwEvent = true;
         if (liste.Count > 0 && throwEvent && Added != null)
         {
             Updated(this);
         }
         if (liste.Count > 0)
         {
             onChange();
         }
     }
     else
     {
         TransformationTreeLoopValue item = new TransformationTreeLoopValue(ValueListChangeHandler.Items.Count + 1, value);
         this.Add(item);
     }
 }
Пример #6
0
        private void OnDeleted(object item)
        {
            AllocationValueItemField field = (AllocationValueItemField)item;

            this.Remove(field);
        }
Пример #7
0
        public AllocationValueItemField Add(TransformationTreeLoopValue item)
        {
            AllocationValueItemField field = new AllocationValueItemField(item);

            return(this.Add(field));;
        }