Synchronize tables' size

From Catglobe Wiki
Revision as of 09:22, 11 February 2010 by Catglobe (talk | contribs) (Design detail)
Jump to: navigation, search

Introduction

The new report engine is designed in a loose-coupling way that Report and Diagram are 2 separate matter. It means that Report know just enough about the Diagram to get it built while the Diagram has no idea about the Report that is using it.

But, when there are more than one table diagram in a Report, the customer doesn't want these tables having different format just like the below example. Multitable-DifferentFormat.png

The customer doesn't want to see a big table whose content is cropped due to not enough width as below image either BigTableNotBreak.png

So we need to define a way to synchronize the content of tables in same document and also make sure a big table can be split into multiple sub-table with consistent content.

2 phases layout

The method is being used in WPF and Silverlight for layout objects

  • First phase: ask all child objects about its expected layout
  • Second phase: base all these layout information => proceed with customization

First phase

  • Report builder let all table diagram built without any constraint
  • Table diagram is built with its own simple constraint:
    • All data cells MUST not be wrapped and have the same width. This means that all data cells (or data columns) would have the same maximum width that is required to display the longest data value.
    • The highest level row header is 3 time the width of data cell
    • 1 level higher, down to haft size

Second phase

Base on the width of all table and the available page width, we can determine the optimum data cell's width and also the tables that need to be split.

  • Find the maximum width of all data cells among all tables
  • Rebuild the column widths and set to all tables that do not need to be split
  • Split tables that bigger than page size base on some rules
    • abs/pct MUST be group together
    • second level option texts SHOULD be group together

Example:

BigTable-Split.png

Design detail

ReportBuilder.png

  • As Diagram builder, Report build takes input as an ReportBuildInfo
  • The main entry point is the Build method of class ReportBuilder
  • There are 2 kinds of report builder: DocumentBuilder and PresentationBuilder => for now only DocumentBuilder is implemented
  • The DocumentBuilder use XmlVisitor to build report from and xml declaration, thus it need to provide a class that implement XmlVisitMethodImpl which is DocumentBuildImpl

Document revisions

Version No. Date Changed By Description Svn revision
0.1 11.02.2010 Nguyễn Trung Chính First version 60300