Example #1
0
 void PasteIntoCell(TreeListNode node, TreeListColumn column, string value)
 {
     //account for the destination of the value to paste, i.e. to which column it should be pasted ...
     //... system column: i.e. either a parameter value or a switch of a policy or function
     if (TreeListBuilder.IsSystemColumn(column))
     {
         BaseTreeListTag treeListTag = (node.Tag as BaseTreeListTag);
         DataSets.CountryConfig.SystemRow systemRow = (column.Tag as SystemTreeListTag).GetSystemRow();
         if (!treeListTag.IsPermittedPasteValue(value, systemRow.ID))
         {
             return;                                                          // e.g. trying to paste 'grumml' into a policy-switch
         }
         treeListTag.StoreChangedValue(value, systemRow);
         TreeListManager.UpdateIntelliAndTUBoxInfo((node.Tag as BaseTreeListTag).GetFunctionName(), column);
     }
     //... comment column: i.e. a comment (to a parameter, function or policy)
     else if (TreeListBuilder.IsCommentColumn(column))
     {
         (node.Tag as BaseTreeListTag).SetComment(value);
     }
     //... policy column: ...
     else if (TreeListBuilder.IsPolicyColumn(column))
     {   //... an editable policy column belongs to a parameter and contains e.g. a component of an incomelist, the name of a constant/variable, etc.
         if ((node.Tag as BaseTreeListTag).IsPolicyColumnEditable())
         {
             foreach (CountryConfig.ParameterRow parameterRow in (node.Tag as ParameterTreeListTag).GetParameterRows())
             {
                 parameterRow.Name = value;
             }
         }
         else
         {
             return;  //no action if a policy-, function- or parameter-name
         }
     }
     //... group column:
     else if (TreeListBuilder.IsGroupColumn(column))
     {
         //... an editable group column belongs to a parameter
         if ((node.Tag as BaseTreeListTag).IsGroupColumnEditable())
         {
             foreach (CountryConfig.ParameterRow parameterRow in (node.Tag as ParameterTreeListTag).GetParameterRows())
             {
                 parameterRow.Group = value;
             }
         }
         else
         {
             return;  //group column of policies and functions is not editable
         }
     }
     else
     {
         return;                   //does not happen
     }
     node.SetValue(column, value); //update nodes here to avoid having to redraw the tree (to enhance performance)
 }