FastReport

Форк
0
/
CrossViewDescriptor.cs 
112 строк · 3.5 Кб
1
using System;
2
using System.Collections.Generic;
3
using System.Text;
4
using FastReport.Table;
5
using FastReport.Utils;
6

7
namespace FastReport.CrossView
8
{
9
    /// <summary>
10
    /// The base class for matrix element descriptors such as <see cref="CrossViewHeaderDescriptor"/> and
11
    /// <see cref="CrossViewCellDescriptor"/>.
12
    /// </summary>
13
    public class CrossViewDescriptor : IFRSerializable
14
    {
15
        #region Fields
16
        private string expression;
17
        private TableColumn templateColumn;
18
        private TableRow templateRow;
19
        private TableCell templateCell;
20
        #endregion
21

22
        #region Properties
23
        /// <summary>
24
        /// Gets or sets an expression which value will be used to fill the matrix.
25
        /// </summary>
26
        /// <remarks>
27
        /// <b>Expression</b> may be any valid expression. Usually it's a data column:
28
        /// <c>[DataSource.Column]</c>.
29
        /// </remarks>
30
        public string Expression
31
        {
32
            get { return expression; }
33
            set { expression = value; }
34
        }
35

36
        /// <summary>
37
        /// Gets or sets the template column bound to this descriptor.
38
        /// </summary>
39
        /// <remarks>
40
        /// This property is for internal use; usually you don't need to use it.
41
        /// </remarks>
42
        public TableColumn TemplateColumn
43
        {
44
            get { return templateColumn; }
45
            set { templateColumn = value; }
46
        }
47

48
        /// <summary>
49
        /// Gets or sets the template row bound to this descriptor.
50
        /// </summary>
51
        /// <remarks>
52
        /// This property is for internal use; usually you don't need to use it.
53
        /// </remarks>
54
        public TableRow TemplateRow
55
        {
56
            get { return templateRow; }
57
            set { templateRow = value; }
58
        }
59

60
        /// <summary>
61
        /// Gets or sets the template cell bound to this descriptor.
62
        /// </summary>
63
        /// <remarks>
64
        /// Using this property, you may access the matrix cell which is bound to
65
        /// this descriptor. It may be useful to change the cell's appearance. 
66
        /// <note>
67
        /// Before using this property, you must initialize the matrix descriptors by
68
        /// calling the <see cref="CrossViewObject.BuildTemplate"/> method.
69
        /// </note>
70
        /// </remarks>
71
        /// <example>
72
        /// <code>
73
        /// CrossViewObject crossView;
74
        /// // change the fill color of the first matrix cell
75
        /// crossView.Data.Cells[0].TemplateCell.Fill = new SolidFill(Color.Red);
76
        /// </code>
77
        /// </example>
78
        public TableCell TemplateCell
79
        {
80
            get { return templateCell; }
81
            set { templateCell = value; }
82
        }
83
        #endregion
84

85
        #region Public Methods
86
        /// <summary>
87
        /// Assigns values from another descriptor.
88
        /// </summary>
89
        /// <param name="source">Descriptor to assign values from.</param>
90
        public virtual void Assign(CrossViewDescriptor source)
91
        {
92
            Expression = source.Expression;
93
            TemplateCell = source.TemplateCell;
94
        }
95

96
        /// <inheritdoc/>
97
        public virtual void Serialize(FRWriter writer)
98
        {
99
            CrossViewDescriptor c = writer.DiffObject as CrossViewDescriptor;
100

101
            if (Expression != c.Expression)
102
                writer.WriteStr("Expression", Expression);
103
        }
104

105
        /// <inheritdoc/>
106
        public void Deserialize(FRReader reader)
107
        {
108
            reader.ReadProperties(this);
109
        }
110
        #endregion
111
    }
112
}
113

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.