internal ListControlEntryDefinition Copy()
 {
     ListControlEntryDefinition definition = new ListControlEntryDefinition {
         appliesTo = this.appliesTo
     };
     foreach (ListControlItemDefinition definition2 in this.itemDefinitionList)
     {
         definition.itemDefinitionList.Add(definition2);
     }
     return definition;
 }
        /// <summary>
        /// Returns a Shallow Copy of the current object.
        /// </summary>
        /// <returns></returns>
        internal ListControlEntryDefinition Copy()
        {
            ListControlEntryDefinition result = new ListControlEntryDefinition();
            result.appliesTo = this.appliesTo;
            foreach (ListControlItemDefinition lcid in this.itemDefinitionList)
            {
                result.itemDefinitionList.Add(lcid);
            }

            return result;
        }
Esempio n. 3
0
 internal ListControlEntry(ListControlEntryDefinition entrydefn)
 {
     this._items = new List<ListControlEntryItem>();
     this._entrySelectedBy = new List<string>();
     if (entrydefn.appliesTo != null)
     {
         foreach (TypeOrGroupReference reference in entrydefn.appliesTo.referenceList)
         {
             this._entrySelectedBy.Add(reference.name);
         }
     }
     foreach (ListControlItemDefinition definition in entrydefn.itemDefinitionList)
     {
         this._items.Add(new ListControlEntryItem(definition));
     }
 }
Esempio n. 4
0
 private void LoadListControlItemDefinitionsFromObjectModel(ListControlEntryDefinition lved, List<ListControlEntryItem> listItems, int viewIndex, string typeName)
 {
     foreach (ListControlEntryItem item in listItems)
     {
         ListControlItemDefinition definition = new ListControlItemDefinition();
         if (item.DisplayEntry != null)
         {
             ExpressionToken token = this.LoadExpressionFromObjectModel(item.DisplayEntry, viewIndex, typeName);
             if (token == null)
             {
                 lved.itemDefinitionList = null;
                 return;
             }
             FieldPropertyToken token2 = new FieldPropertyToken {
                 expression = token
             };
             definition.formatTokenList.Add(token2);
         }
         if (!string.IsNullOrEmpty(item.Label))
         {
             TextToken token3 = new TextToken {
                 text = item.Label
             };
             definition.label = token3;
         }
         lved.itemDefinitionList.Add(definition);
     }
     if (lved.itemDefinitionList.Count == 0)
     {
         base.ReportErrorForLoadingFromObjectModel(StringUtil.Format(FormatAndOutXmlLoadingStrings.NoListViewItemInFormattingData, typeName, viewIndex), typeName);
         lved.itemDefinitionList = null;
     }
 }
Esempio n. 5
0
 private void LoadListControlItemDefinitions(ListControlEntryDefinition lved, System.Xml.XmlNode bodyNode)
 {
     using (base.StackFrame(bodyNode))
     {
         int num = 0;
         foreach (System.Xml.XmlNode node in bodyNode.ChildNodes)
         {
             if (base.MatchNodeName(node, "ListItem"))
             {
                 num++;
                 ListControlItemDefinition item = this.LoadListControlItemDefinition(node);
                 if (item == null)
                 {
                     base.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.InvalidPropertyEntry, base.ComputeCurrentXPath(), base.FilePath));
                     lved.itemDefinitionList = null;
                     return;
                 }
                 lved.itemDefinitionList.Add(item);
             }
             else
             {
                 base.ProcessUnknownNode(node);
             }
         }
         if (lved.itemDefinitionList.Count == 0)
         {
             base.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.NoListViewItem, base.ComputeCurrentXPath(), base.FilePath));
             lved.itemDefinitionList = null;
         }
     }
 }
Esempio n. 6
0
 private ListControlEntryDefinition LoadListControlEntryDefinitionFromObjectModel(ListControlEntry listEntry, int viewIndex, string typeName)
 {
     ListControlEntryDefinition lved = new ListControlEntryDefinition();
     if (listEntry.SelectedBy.Count > 0)
     {
         lved.appliesTo = this.LoadAppliesToSectionFromObjectModel(listEntry.SelectedBy);
     }
     this.LoadListControlItemDefinitionsFromObjectModel(lved, listEntry.Items, viewIndex, typeName);
     if (lved.itemDefinitionList == null)
     {
         return null;
     }
     return lved;
 }
Esempio n. 7
0
 private ListControlEntryDefinition LoadListControlEntryDefinition(System.Xml.XmlNode listViewEntryNode, int index)
 {
     using (base.StackFrame(listViewEntryNode, index))
     {
         bool flag = false;
         bool flag2 = false;
         ListControlEntryDefinition lved = new ListControlEntryDefinition();
         foreach (System.Xml.XmlNode node in listViewEntryNode.ChildNodes)
         {
             if (base.MatchNodeName(node, "EntrySelectedBy"))
             {
                 if (flag)
                 {
                     base.ProcessDuplicateNode(node);
                     return null;
                 }
                 flag = true;
                 lved.appliesTo = this.LoadAppliesToSection(node, true);
             }
             else if (base.MatchNodeName(node, "ListItems"))
             {
                 if (flag2)
                 {
                     base.ProcessDuplicateNode(node);
                     return null;
                 }
                 flag2 = true;
                 this.LoadListControlItemDefinitions(lved, node);
             }
             else
             {
                 base.ProcessUnknownNode(node);
             }
         }
         if (lved.itemDefinitionList == null)
         {
             base.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.NoDefinitionList, base.ComputeCurrentXPath(), base.FilePath));
             return null;
         }
         return lved;
     }
 }
Esempio n. 8
0
        /// <summary>
        /// Load ListItems into ListControlItemDefinition
        /// </summary>
        /// <param name="lved"></param>
        /// <param name="listItems"></param>
        /// <param name="viewIndex"></param>
        /// <param name="typeName"></param>
        private void LoadListControlItemDefinitionsFromObjectModel(ListControlEntryDefinition lved, List<ListControlEntryItem> listItems, int viewIndex, string typeName)
        {
            foreach (ListControlEntryItem listItem in listItems)
            {
                ListControlItemDefinition lvid = new ListControlItemDefinition();

                // Contains:
                //   DisplayEntry --- Expression  cardinality 0..1
                //   Label        --- Label       cardinality 0..1
                if (listItem.DisplayEntry != null)
                {
                    ExpressionToken expression = LoadExpressionFromObjectModel(listItem.DisplayEntry, viewIndex, typeName);
                    if (expression == null)
                    {
                        lved.itemDefinitionList = null;
                        return; // fatal
                    }
                    FieldPropertyToken fpt = new FieldPropertyToken();
                    fpt.expression = expression;
                    fpt.fieldFormattingDirective.formatString = listItem.FormatString;
                    lvid.formatTokenList.Add(fpt);
                }

                if (!String.IsNullOrEmpty(listItem.Label))
                {
                    TextToken tt = new TextToken();
                    tt.text = listItem.Label;
                    lvid.label = tt;
                }

                lved.itemDefinitionList.Add(lvid);
            }

            // we must have at least a definition in th elist
            if (lved.itemDefinitionList.Count == 0)
            {
                //Error: At least one list view item must be specified.
                this.ReportErrorForLoadingFromObjectModel(
                    StringUtil.Format(FormatAndOutXmlLoadingStrings.NoListViewItemInFormattingData, typeName, viewIndex), typeName);
                lved.itemDefinitionList = null;
                return; //fatal
            }
        }
Esempio n. 9
0
        /// <summary>
        /// Load ListEntry into ListControlEntryDefinition
        /// </summary>
        /// <param name="listEntry"></param>
        /// <param name="viewIndex"></param>
        /// <param name="typeName"></param>
        /// <returns></returns>
        private ListControlEntryDefinition LoadListControlEntryDefinitionFromObjectModel(ListControlEntry listEntry, int viewIndex, string typeName)
        {
            ListControlEntryDefinition lved = new ListControlEntryDefinition();

            // Contains:
            //   SelectedBy ---  EntrySelectedBy(TypeName)  cardinality 0..1
            //   Items      ---  ListItems                  cardinality 1
            if (listEntry.EntrySelectedBy != null)
            {
                lved.appliesTo = LoadAppliesToSectionFromObjectModel(listEntry.EntrySelectedBy.TypeNames, listEntry.EntrySelectedBy.SelectionCondition);
            }

            LoadListControlItemDefinitionsFromObjectModel(lved, listEntry.Items, viewIndex, typeName);
            if (lved.itemDefinitionList == null)
            {
                return null;
            }

            return lved;
        }
Esempio n. 10
0
        private void LoadListControlItemDefinitions(ListControlEntryDefinition lved, XmlNode bodyNode)
        {
            using (this.StackFrame(bodyNode))
            {
                int index = 0;

                foreach (XmlNode n in bodyNode.ChildNodes)
                {
                    if (MatchNodeName(n, XmlTags.ListItemNode))
                    {
                        index++;
                        ListControlItemDefinition lvid = LoadListControlItemDefinition(n);
                        if (lvid == null)
                        {
                            //Error at XPath {0} in file {1}: Invalid property entry.
                            this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.InvalidPropertyEntry, ComputeCurrentXPath(), FilePath));
                            lved.itemDefinitionList = null;
                            return; //fatal
                        }
                        lved.itemDefinitionList.Add(lvid);
                    }
                    else
                    {
                        this.ProcessUnknownNode(n);
                    }
                }

                // we must have at least a definition in th elist
                if (lved.itemDefinitionList.Count == 0)
                {
                    //Error at XPath {0} in file {1}: At least one list view item must be specified.
                    this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.NoListViewItem, ComputeCurrentXPath(), FilePath));
                    lved.itemDefinitionList = null;
                    return; //fatal
                }
            }
        }
Esempio n. 11
0
        private ListControlEntryDefinition LoadListControlEntryDefinition(XmlNode listViewEntryNode, int index)
        {
            using (this.StackFrame(listViewEntryNode, index))
            {
                bool appliesToNodeFound = false;    // cardinality 0..1
                bool bodyNodeFound = false;         // cardinality 1

                ListControlEntryDefinition lved = new ListControlEntryDefinition();

                foreach (XmlNode n in listViewEntryNode.ChildNodes)
                {
                    if (MatchNodeName(n, XmlTags.EntrySelectedByNode))
                    {
                        if (appliesToNodeFound)
                        {
                            this.ProcessDuplicateNode(n);
                            return null; //fatal
                        }

                        appliesToNodeFound = true;

                        // optional section
                        lved.appliesTo = LoadAppliesToSection(n, true);
                    }
                    else if (MatchNodeName(n, XmlTags.ListItemsNode))
                    {
                        if (bodyNodeFound)
                        {
                            this.ProcessDuplicateNode(n);
                            return null; //fatal
                        }

                        bodyNodeFound = true;
                        LoadListControlItemDefinitions(lved, n);
                    }
                    else
                    {
                        this.ProcessUnknownNode(n);
                    }
                }

                if (lved.itemDefinitionList == null)
                {
                    //Error at XPath {0} in file {1}: Missing definition list.
                    this.ReportError(StringUtil.Format(FormatAndOutXmlLoadingStrings.NoDefinitionList, ComputeCurrentXPath(), FilePath));
                    return null;
                }

                return lved;
            }
        }
 internal ListControlEntry(ListControlEntryDefinition entrydefn)
     : this()
 {
     if (entrydefn.appliesTo != null)
     {
         EntrySelectedBy = EntrySelectedBy.Get(entrydefn.appliesTo.referenceList);
     }
     foreach (ListControlItemDefinition itemdefn in entrydefn.itemDefinitionList)
     {
         Items.Add(new ListControlEntryItem(itemdefn));
     }
 }