using System;
using System.Collections.Generic;
using System.Text;
using FastReport.Table;
using FastReport.Utils;
namespace FastReport.CrossView
{
///
/// The base class for matrix element descriptors such as and
/// .
///
public class CrossViewDescriptor : IFRSerializable
{
#region Fields
private string expression;
private TableColumn templateColumn;
private TableRow templateRow;
private TableCell templateCell;
#endregion
#region Properties
///
/// Gets or sets an expression which value will be used to fill the matrix.
///
///
/// Expression may be any valid expression. Usually it's a data column:
/// [DataSource.Column].
///
public string Expression
{
get { return expression; }
set { expression = value; }
}
///
/// Gets or sets the template column bound to this descriptor.
///
///
/// This property is for internal use; usually you don't need to use it.
///
public TableColumn TemplateColumn
{
get { return templateColumn; }
set { templateColumn = value; }
}
///
/// Gets or sets the template row bound to this descriptor.
///
///
/// This property is for internal use; usually you don't need to use it.
///
public TableRow TemplateRow
{
get { return templateRow; }
set { templateRow = value; }
}
///
/// Gets or sets the template cell bound to this descriptor.
///
///
/// Using this property, you may access the matrix cell which is bound to
/// this descriptor. It may be useful to change the cell's appearance.
///
/// Before using this property, you must initialize the matrix descriptors by
/// calling the method.
///
///
///
///
/// CrossViewObject crossView;
/// // change the fill color of the first matrix cell
/// crossView.Data.Cells[0].TemplateCell.Fill = new SolidFill(Color.Red);
///
///
public TableCell TemplateCell
{
get { return templateCell; }
set { templateCell = value; }
}
#endregion
#region Public Methods
///
/// Assigns values from another descriptor.
///
/// Descriptor to assign values from.
public virtual void Assign(CrossViewDescriptor source)
{
Expression = source.Expression;
TemplateCell = source.TemplateCell;
}
///
public virtual void Serialize(FRWriter writer)
{
CrossViewDescriptor c = writer.DiffObject as CrossViewDescriptor;
if (Expression != c.Expression)
writer.WriteStr("Expression", Expression);
}
///
public void Deserialize(FRReader reader)
{
reader.ReadProperties(this);
}
#endregion
}
}