Ejemplo n.º 1
0
        /// <inheritdoc/>
        public override void Serialize(FRWriter writer)
        {
            MatrixCellDescriptor c = writer.DiffObject as MatrixCellDescriptor;

            base.Serialize(writer);

            writer.ItemName = "Cell";
            if (Function != c.Function)
            {
                writer.WriteValue("Function", Function);
            }
            if (Percent != c.Percent)
            {
                writer.WriteValue("Percent", Percent);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Returns the zero-based index of the first occurrence of a descriptor.
 /// </summary>
 /// <param name="value">The descriptor to locate in the collection.</param>
 /// <returns>The zero-based index of the first occurrence of descriptor within
 /// the entire collection, if found; otherwise, -1.</returns>
 public int IndexOf(MatrixCellDescriptor value)
 {
     return(List.IndexOf(value));
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Inserts a descriptor into this collection at the specified index.
 /// </summary>
 /// <param name="index">The zero-based index at which value should be inserted.</param>
 /// <param name="value">The descriptor to insert.</param>
 public void Insert(int index, MatrixCellDescriptor value)
 {
     List.Insert(index, value);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Adds a descriptor to the end of this collection.
 /// </summary>
 /// <param name="value">Descriptor to add.</param>
 /// <returns>Index of the added descriptor.</returns>
 public int Add(MatrixCellDescriptor value)
 {
     return(List.Add(value));
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Determines whether a descriptor is in the collection.
 /// </summary>
 /// <param name="value">The descriptor to locate in the collection.</param>
 /// <returns><b>true</b> if descriptor is found in the collection; otherwise, <b>false</b>.</returns>
 public bool Contains(MatrixCellDescriptor value)
 {
     return(List.Contains(value));
 }
Ejemplo n.º 6
0
        private void PrintData()
        {
            // use two passes to calc cell values. This is necessary because this calculation
            // replaces an array of cell values by the single (aggregated) value.
            // At the first pass we calc total values only (so they include all cell values, not aggregated ones);
            // at the second pass we calc other values except total.
            PrintData_CalcTotals(1);
            PrintData_CalcTotals(2);
            // calc percents
            PrintData_CalcPercents();

            // fire AfterTotals event
            Matrix.OnAfterTotals(EventArgs.Empty);

            List <MatrixHeaderItem> columnTerminalItems = Matrix.Data.Columns.RootItem.GetTerminalItems();
            List <MatrixHeaderItem> rowTerminalItems    = Matrix.Data.Rows.RootItem.GetTerminalItems();
            int   dataCount             = Matrix.Data.Cells.Count;
            int   top                   = HeaderHeight;
            Point bodyLocation          = GetBodyLocation();
            bool  firstTimePrintingData = true;

            cellValues      = new object[dataCount];
            Matrix.RowIndex = 0;

            foreach (MatrixHeaderItem rowItem in rowTerminalItems)
            {
                int left = HeaderWidth;
                Matrix.RowValues   = rowItem.Values;
                Matrix.ColumnIndex = 0;

                foreach (MatrixHeaderItem columnItem in columnTerminalItems)
                {
                    Matrix.ColumnValues = columnItem.Values;

                    for (int cellIndex = 0; cellIndex < dataCount; cellIndex++)
                    {
                        TableCell            templateCell = null;
                        TableCellData        resultCell   = null;
                        MatrixCellDescriptor descr        = Matrix.Data.Cells[cellIndex];

                        if (Matrix.CellsSideBySide)
                        {
                            if (columnItem.TemplateColumn != null && rowItem.TemplateRow != null && descr.TemplateColumn != null)
                            {
                                templateCell = Matrix[
                                    columnItem.TemplateColumn.Index + (descr.TemplateColumn.Index - bodyLocation.X),
                                    rowItem.TemplateRow.Index];
                            }
                            else
                            {
                                templateCell = CreateDataCell();
                            }

                            resultCell = ResultTable.GetCellData(left + cellIndex, top);
                        }
                        else
                        {
                            if (columnItem.TemplateColumn != null && rowItem.TemplateRow != null && descr.TemplateColumn != null)
                            {
                                templateCell = Matrix[columnItem.TemplateColumn.Index,
                                                      rowItem.TemplateRow.Index + (descr.TemplateRow.Index - bodyLocation.Y)];
                            }
                            else
                            {
                                templateCell = CreateDataCell();
                            }

                            resultCell = ResultTable.GetCellData(left, top + cellIndex);
                        }

                        if (designTime)
                        {
                            if (firstTimePrintingData)
                            {
                                templateCell.Text = "[" + ExtractColumnName(descr.Expression) + "]";
                            }
                            else
                            {
                                templateCell.Text = "";
                            }
                            resultCell.RunTimeAssign(templateCell, true);
                        }
                        else
                        {
                            object value = Matrix.Data.GetValue(columnItem.Index, rowItem.Index, cellIndex);
                            cellValues[cellIndex] = value;
                            templateCell.Text     = templateCell.FormatValue(value);
                            templateCell.SaveState();
                            if (String.IsNullOrEmpty(templateCell.Hyperlink.Expression) &&
                                (templateCell.Hyperlink.Kind == HyperlinkKind.DetailReport ||
                                 templateCell.Hyperlink.Kind == HyperlinkKind.DetailPage ||
                                 templateCell.Hyperlink.Kind == HyperlinkKind.Custom))
                            {
                                string hyperlinkValue = "";
                                string separator      = templateCell.Hyperlink.ValuesSeparator;
                                foreach (object obj in Matrix.ColumnValues)
                                {
                                    hyperlinkValue += obj.ToString() + separator;
                                }
                                foreach (object obj in Matrix.RowValues)
                                {
                                    hyperlinkValue += obj.ToString() + separator;
                                }
                                templateCell.Hyperlink.Value = hyperlinkValue.Substring(0, hyperlinkValue.Length - separator.Length);
                            }

                            int evenStyleIndex = Matrix.MatrixEvenStylePriority == MatrixEvenStylePriority.Rows ?
                                                 Matrix.RowIndex : Matrix.ColumnIndex;
                            if ((evenStyleIndex + 1) % 2 == 0)
                            {
                                templateCell.ApplyEvenStyle();
                            }
                            templateCell.GetData();
                            resultCell.RunTimeAssign(templateCell, true);
                            templateCell.RestoreState();
                        }
                    }

                    firstTimePrintingData = false;
                    Matrix.ColumnIndex++;
                    if (Matrix.CellsSideBySide)
                    {
                        if (Matrix.KeepCellsSideBySide)
                        {
                            ResultTable.Columns[left].KeepColumns = dataCount;
                        }
                        left += dataCount;
                    }
                    else
                    {
                        left++;
                    }
                }

                Matrix.RowIndex++;
                if (Matrix.CellsSideBySide)
                {
                    top++;
                }
                else
                {
                    top += dataCount;
                }
            }
        }