Example #1
0
        internal void WriteGroupHeaderTo(
            IGroupHeader header, PluginFileOutput output
            )
        {
            var method = groupHeaderType.GetMethod("WriteTo");
            var args   = new object[] { output };

            method.Invoke(header, args);
        }
Example #2
0
        private void insert(int index, IGroupHeader header, object item)
        {
            _collection.Insert(index, header);
            _collection.Insert(index + 1, item);

            if (GroupFooterTemplate != null)
            {
                _collection.Insert(index + 2, new DefaultGroupFooter());
            }
        }
        public void PaintGroupHeader()
        {
            IGroupHeader header = Item as IGroupHeader;
            Graphics     g      = Graphics;
            Rectangle    r      = ClientBounds;

            PaintHeaderBackground();
            Text = header.Title;
            PaintTemplateContent();
            BorderColor = BackColor;
            r.Height--;
            ClientBounds = r;
            PaintDefaultBorder();
        }
Example #4
0
 internal virtual GroupDef GetGroupDef(IGroupHeader header)
 {
     foreach (var childDef in childDefs)
     {
         if (!(childDef is GroupDef groupDef))
         {
             continue;
         }
         if (groupDef.groupType == header.groupType)
         {
             return(groupDef);
         }
     }
     throw new Exception("Valid group def not found.");
 }
Example #5
0
        internal override GroupDef GetGroupDef(IGroupHeader header)
        {
            if (header.groupType > 0)
            {
                throw new Exception("Expected top group.");
            }
            var signature = new Signature(header.label);
            var sig       = signature.ToString();

            if (!topGroups.ContainsKey(sig))
            {
                throw new Exception($"Unknown top group {sig}");
            }
            return(topGroups[sig]);
        }
 protected void IGroupHeaderFrom(XmlElement xe, IGroupHeader receiver)
 {
     if (xe.HasAttribute("bShowNullGroup"))
     {
         receiver.bShowNullGroup = Boolean.Parse(xe.GetAttribute("bShowNullGroup"));
     }
     if (xe.HasAttribute("bHiddenGroup"))
     {
         receiver.bHiddenGroup = Boolean.Parse(xe.GetAttribute("bHiddenGroup"));
     }
     if (xe.HasAttribute("bAloneLine"))
     {
         receiver.bAloneLine = Boolean.Parse(xe.GetAttribute("bAloneLine"));
     }
 }
Example #7
0
        private ContentControl CreateGroupHeader(IGroupHeader group)
        {
            ContentControl groupheader = new ContentControl();
            Binding        binding     = new Binding();

            binding.Source = this;
            binding.Mode   = BindingMode.OneWay;
            binding.Path   = new PropertyPath("GroupHeaderTemplate");
            groupheader.SetBinding(ContentControl.ContentTemplateProperty, binding);
            groupheader.DataContext                = group;
            groupheader.HorizontalAlignment        = HorizontalAlignment.Stretch;
            groupheader.HorizontalContentAlignment = HorizontalAlignment.Stretch;
            groupheader.VerticalAlignment          = VerticalAlignment.Top;
            groupheader.VerticalContentAlignment   = VerticalAlignment.Stretch;
            return(groupheader);
        }
Example #8
0
        private void addItem(object item)
        {
            if (GroupAdapter == null)
            {
                return;
            }

            IGroupHeader correctHeader = GroupAdapter.GenerateHeader(item);

            for (int i = 0; i < _collection.Count; i++)
            {
                if (_collection[i] is IGroupHeader)
                {
                    IGroupHeader header = _collection[i] as IGroupHeader;

                    int comp = correctHeader.CompareTo(header);

                    //if goes inside this header
                    if (comp == 0)
                    {
                        //binary search insert would have to walk to the end of the items anyways, so might as well do linear insert

                        //move to the first item
                        i++;

                        for (; i < _collection.Count; i++)
                        {
                            //if we're at the next header, insert at here
                            if (_collection[i] is IGroupFooter || _collection[i] is IGroupHeader)
                            {
                                _collection.Insert(i, item);
                                return;
                            }

                            //or if the item goes before the item in the list
                            else if (header.CompareInsideHeader(item, _collection[i]) < 0)
                            {
                                _collection.Insert(i, item);
                                return;
                            }

                            //otherwise keep looking through the list
                        }

                        //if it wasn't added, must be at the end of the list
                        _collection.Add(item);
                        return;
                    }

                    //if goes before this header
                    else if (comp < 0)
                    {
                        insert(i, correctHeader, item);
                        return;
                    }
                }
            }

            //item didn't find a matching header, needs a new header
            insert(_collection.Count, correctHeader, item);
            return;
        }
Example #9
0
 private ContentControl CreateGroupHeader(IGroupHeader group)
 {
     ContentControl groupheader = new ContentControl();
     Binding binding = new Binding();
     binding.Source = this;
     binding.Mode = BindingMode.OneWay;
     binding.Path = new PropertyPath("GroupHeaderTemplate");
     groupheader.SetBinding(ContentControl.ContentTemplateProperty, binding);
     groupheader.DataContext = group;
     groupheader.HorizontalAlignment = HorizontalAlignment.Stretch;
     groupheader.HorizontalContentAlignment = HorizontalAlignment.Stretch;
     groupheader.VerticalAlignment = VerticalAlignment.Top;
     groupheader.VerticalContentAlignment = VerticalAlignment.Stretch;
     return groupheader;
 }