Пример #1
0
 public DisplayColumn(ViewInfo viewInfo, ColumnSpec columnSpec, ColumnDescriptor columnDescriptor)
 {
     ViewInfo         = viewInfo;
     ColumnDescriptor = columnDescriptor;
     ColumnSpec       = columnSpec;
     CollectionColumn = columnDescriptor == null ? null
         : columnDescriptor.CollectionAncestor() ?? viewInfo.ParentColumn;
 }
Пример #2
0
 public ColumnSpec(ColumnSpec that)
 {
     Name      = that.Name;
     Caption   = that.Caption;
     Format    = that.Format;
     Aggregate = that.Aggregate;
     Hidden    = that.Hidden;
 }
Пример #3
0
 public ColumnSpec(ColumnSpec that)
 {
     Name          = that.Name;
     Caption       = that.Caption;
     Format        = that.Format;
     Hidden        = that.Hidden;
     SortIndex     = that.SortIndex;
     SortDirection = that.SortDirection;
     Total         = that.Total;
 }
Пример #4
0
 public bool Equals(ColumnSpec other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(Equals(other.Name, Name) &&
            Equals(other.Caption, Caption) &&
            Equals(other.Format, Format) &&
            Equals(other.Hidden, Hidden) &&
            Equals(other.Aggregate, Aggregate));
 }
Пример #5
0
        public static ColumnSpec ReadXml(XmlReader reader)
        {
            var columnSpec = new ColumnSpec();

            columnSpec.Name    = reader.GetAttribute("name");
            columnSpec.Caption = reader.GetAttribute("caption");
            columnSpec.Format  = reader.GetAttribute("format");
            columnSpec.Hidden  = "true" == reader.GetAttribute("hidden");

            bool empty = reader.IsEmptyElement;

            reader.ReadElementString("column");
            if (!empty)
            {
                reader.ReadEndElement();
            }
            return(columnSpec);
        }
Пример #6
0
        // ReSharper restore NonLocalizedString

        public bool Equals(ColumnSpec other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }
            return(Equals(other.Name, Name) &&
                   Equals(other.Caption, Caption) &&
                   Equals(other.Format, Format) &&
                   Equals(other.Hidden, Hidden) &&
                   Equals(other.SortIndex, SortIndex) &&
                   Equals(other.SortDirection, SortDirection) &&
                   Equals(other.Total, Total));
        }
Пример #7
0
        // ReSharper disable LocalizableElement
        public static ViewSpec ReadXml(XmlReader reader)
        {
            var viewSpec = new ViewSpec
            {
                Name        = reader.GetAttribute("name"),
                RowSource   = reader.GetAttribute("rowsource"),
                SublistName = reader.GetAttribute("sublist"),
                UiMode      = reader.GetAttribute("uimode") ?? string.Empty
            };
            var columns = new List <ColumnSpec>();
            var filters = new List <FilterSpec>();

            if (reader.IsEmptyElement)
            {
                reader.ReadElementString("view");
                return(viewSpec);
            }
            reader.Read();
            while (true)
            {
                if (reader.IsStartElement("column"))
                {
                    columns.Add(ColumnSpec.ReadXml(reader));
                }
                else if (reader.IsStartElement("filter"))
                {
                    filters.Add(FilterSpec.ReadXml(reader));
                }
                else if (reader.NodeType == XmlNodeType.EndElement)
                {
                    reader.ReadEndElement();
                    break;
                }
                else
                {
                    reader.Skip();
                }
            }
            viewSpec.Columns = ImmutableList.ValueOf(columns);
            viewSpec.Filters = ImmutableList.ValueOf(filters);
            return(viewSpec);
        }
Пример #8
0
        // ReSharper disable NonLocalizedString
        public static ViewSpec ReadXml(XmlReader reader)
        {
            var viewSpec = new ViewSpec
            {
                Name        = reader.GetAttribute("name"),
                RowSource   = reader.GetAttribute("rowsource"),
                SublistName = reader.GetAttribute("sublist")
            };
            var columns = new List <ColumnSpec>();
            var filters = new List <FilterSpec>();

            if (reader.IsEmptyElement)
            {
                reader.ReadElementString("view");
                return(viewSpec);
            }
            reader.Read();
            while (true)
            {
                if (reader.IsStartElement("column"))
                {
                    columns.Add(ColumnSpec.ReadXml(reader));
                }
                else if (reader.IsStartElement("filter"))
                {
                    filters.Add(FilterSpec.ReadXml(reader));
                }
                else if (reader.NodeType == XmlNodeType.EndElement)
                {
                    reader.ReadEndElement();
                    break;
                }
                else
                {
                    reader.Read();
                }
            }
            viewSpec.Columns = Array.AsReadOnly(columns.ToArray());
            viewSpec.Filters = Array.AsReadOnly(filters.ToArray());
            return(viewSpec);
        }
Пример #9
0
        // ReSharper disable NonLocalizedString
        public static ColumnSpec ReadXml(XmlReader reader)
        {
            TotalOperation total    = TotalOperation.GroupBy;
            string         strTotal = reader.GetAttribute("total");

            if (strTotal != null)
            {
                total = (TotalOperation)Enum.Parse(typeof(TotalOperation), strTotal);
            }
            var columnSpec = new ColumnSpec
            {
                Name    = reader.GetAttribute("name"),
                Caption = reader.GetAttribute("caption"),
                Format  = reader.GetAttribute("format"),
                Hidden  = "true" == reader.GetAttribute("hidden"),
                Total   = total,
            };
            string sortIndex = reader.GetAttribute("sortindex");

            if (sortIndex != null)
            {
                columnSpec.SortIndex = Convert.ToInt32(sortIndex);
            }
            string sortDirection = reader.GetAttribute("sortdirection");

            if (sortDirection != null)
            {
                columnSpec.SortDirection = (ListSortDirection)Enum.Parse(typeof(ListSortDirection), sortDirection);
            }


            bool empty = reader.IsEmptyElement;

            reader.ReadElementString("column");
            if (!empty)
            {
                reader.ReadEndElement();
            }
            return(columnSpec);
        }
Пример #10
0
        public static ViewSpec ReadXml(XmlReader reader)
        {
            var viewSpec = new ViewSpec();

            viewSpec.Name        = reader.GetAttribute("name");
            viewSpec.SublistName = reader.GetAttribute("sublist");
            var columns = new List <ColumnSpec>();
            var sorts   = new List <SortSpec>();

            if (reader.IsEmptyElement)
            {
                reader.ReadElementString("view");
                return(viewSpec);
            }
            reader.Read();
            while (true)
            {
                if (reader.IsStartElement("column"))
                {
                    columns.Add(ColumnSpec.ReadXml(reader));
                }
                else if (reader.IsStartElement("sort"))
                {
                    sorts.Add(SortSpec.ReadXml(reader));
                }
                else if (reader.NodeType == XmlNodeType.EndElement)
                {
                    reader.ReadEndElement();
                    break;
                }
                else
                {
                    reader.Read();
                }
            }
            viewSpec.Sorts   = new ReadOnlyCollection <SortSpec>(sorts.ToArray());
            viewSpec.Columns = new ReadOnlyCollection <ColumnSpec>(columns.ToArray());
            return(viewSpec);
        }
Пример #11
0
 public ViewSpec()
 {
     Columns = new ColumnSpec[0];
     Sorts   = new SortSpec[0];
 }
Пример #12
0
 public ColumnDescriptor SetColumnSpec(ColumnSpec columnSpec)
 {
     return(SetCaption(columnSpec.Caption)
            .SetHidden(columnSpec.Hidden));
 }
Пример #13
0
 public ViewSpec()
 {
     Columns = new ColumnSpec[0];
     Filters = new FilterSpec[0];
 }