public override ExporterCollection Convert(BaseReportItem parent, BaseReportItem item) { if (parent == null) { throw new ArgumentNullException("parent"); } if (item == null) { throw new ArgumentNullException("item"); } ISimpleContainer simpleContainer = item as ISimpleContainer; this.parent = parent; simpleContainer.Parent = parent; PrintHelper.AdjustParent(parent,simpleContainer.Items); if (PrintHelper.IsTextOnlyRow(simpleContainer)) { ExporterCollection myList = new ExporterCollection(); base.BaseConvert (myList,simpleContainer,parent.Location.X, new Point(base.SectionBounds.DetailStart.X,base.SectionBounds.DetailStart.Y)); return myList; } else { return this.ConvertDataRow(simpleContainer); } }
/// <summary> /// Convert a single item, Location is calculated as follows /// </summary> /// <param name="offset"> only Y value is used, gives the offset to Items location.Y </param> /// <param name="item">Item to convert</param> /// <returns></returns> private static void RenderLineItem (BaseReportItem item, Point offset,IExpressionEvaluatorFacade evaluator,ReportPageEventArgs rpea) { Point saveLocation = new Point (item.Location.X,item.Location.Y); PrintHelper.AdjustChildLocation(item,offset); IReportExpression epr = item as IReportExpression; string evaluatedValue = String.Empty; if (epr != null) { try { if (!String.IsNullOrEmpty(epr.Expression)) { evaluatedValue = evaluator.Evaluate(epr.Expression); } else { evaluatedValue = evaluator.Evaluate(epr.Text); } epr.Text = evaluatedValue; } catch (UnknownFunctionException ufe) { epr.Text = GlobalValues.UnkownFunctionMessage(ufe.Message); } } item.Render (rpea); item.Location = saveLocation; }
public static IBaseExportColumn ConvertLineItem (BaseReportItem item,Point offset) { if (item == null) { throw new ArgumentNullException("item"); } if (item.VisibleInReport == true) { var columnBuilder = item as IExportColumnBuilder; IBaseExportColumn lineItem = null; if (columnBuilder != null) { lineItem = columnBuilder.CreateExportColumn(); lineItem.StyleDecorator.Location = new Point(offset.X + lineItem.StyleDecorator.Location.X, lineItem.StyleDecorator.Location.Y + offset.Y); lineItem.StyleDecorator.DisplayRectangle = new Rectangle(lineItem.StyleDecorator.Location, lineItem.StyleDecorator.Size); } return lineItem; } else { return null; } }
public static void AdjustParent (BaseReportItem parent,ReportItemCollection items) { foreach (BaseReportItem i in items) { i.Parent = parent; ISimpleContainer ic = i as ISimpleContainer; if (ic != null) { AdjustParentInternal(ic.Items,i); } else { AdjustParentInternal(items,parent); } } }
public override ExporterCollection Convert (BaseReportItem parent,BaseReportItem item) { if (parent == null) { throw new ArgumentNullException("parent"); } if (item == null) { throw new ArgumentNullException("item"); } ExporterCollection mylist = base.Convert(parent,item); this.table = (BaseTableItem)item ; this.table.Parent = parent; return ConvertInternal(mylist); }
public void InsertOneItem () { itemCollection = this.PlainCollection(); int len = itemCollection.Count(); BaseReportItem r = new BaseReportItem(); r.Name = "Inserted"; itemCollection.Insert(1,r); Assert.AreEqual (len + 1,itemCollection.Count()); // read inserted element and check some default values BaseReportItem r1 = itemCollection.Find("Inserted"); Assert.AreEqual(GlobalValues.DefaultBackColor,r1.BackColor); Assert.AreEqual(System.Drawing.Color.Black,r1.ForeColor); }
public static IBaseConverter CreateConverter (BaseReportItem itemToConvert,IDataNavigator dataNavigator, ExporterPage singlePage,IExportItemsConverter exportItemsConverter,ILayouter layouter) { Type t = itemToConvert.GetType(); if (t.Equals(typeof(BaseTableItem))) { return new TableConverter(dataNavigator,singlePage,exportItemsConverter,layouter); } if (t.Equals(typeof(BaseRowItem))) { return new RowConverter (dataNavigator,singlePage,exportItemsConverter,layouter); } return null; }
public static IBaseConverter CreateConverter (BaseReportItem itemToConvert,IReportModel reportModel, IDataNavigator dataNavigator,ExporterPage singlePage) { Type t = itemToConvert.GetType(); if (t.Equals(typeof(BaseTableItem))) { return new GroupedTableConverter(reportModel,dataNavigator,singlePage); } if (t.Equals(typeof(BaseRowItem))) { return new GroupedRowConverter (reportModel,dataNavigator,singlePage); } return null; }
public static Rectangle DrawingAreaRelativeToParent (BaseReportItem parent,ISimpleContainer item) { if ( parent == null) { throw new ArgumentNullException("parent"); } if (item == null) { throw new ArgumentNullException ("item"); } BaseReportItem bri = (BaseReportItem) item; return new Rectangle(parent.Location.X + bri.Location.X , bri.Location.Y + bri.SectionOffset, bri.Size.Width,bri.Size.Height); }
static int CalculateGap(BaseReportItem oldItem, BaseReportItem item) { if (oldItem == item) { return 0; } else { if (oldItem.Location.Y + oldItem.Size.Height < item.Location.Y ) { return item.Location.Y - (oldItem.Location.Y + oldItem.Size.Height) ; } else { return 0; } } }
/// <summary> /// Convert a single item, Location is calculated as follows /// (X = ParentRectangle.X + Item.X Y = offset.Y + Item.Y) /// </summary> /// <param name="offset"> only Y value is used, gives the offset to Items location.Y </param> /// <param name="item">Item to convert</param> /// <returns></returns> private BaseExportColumn ConvertToLineItem (Point offset,BaseReportItem item) { if (item == null) { throw new ArgumentNullException("item"); } IExportColumnBuilder columnBuilder = item as IExportColumnBuilder; BaseExportColumn lineItem = null; if (columnBuilder != null) { lineItem = columnBuilder.CreateExportColumn(); lineItem.StyleDecorator.Location = new Point(this.ParentRectangle.Location.X + lineItem.StyleDecorator.Location.X, lineItem.StyleDecorator.Location.Y + offset.Y); } return lineItem; }
public static Rectangle RenderContainer(ISimpleContainer simpleContainer, IExpressionEvaluatorFacade evaluator, Point offset, ReportPageEventArgs rpea) { BaseReportItem item = simpleContainer as BaseReportItem; Rectangle retVal = new Rectangle(offset, item.Size); Point saveLocation = item.Location; PrintHelper.AdjustChildLocation(item, offset); item.Render(rpea); if (simpleContainer.Items != null) { retVal = StandardPrinter.RenderPlainCollection(item, simpleContainer.Items, evaluator, offset, rpea); } retVal = new Rectangle(retVal.X, retVal.Y, retVal.X + item.Size.Width, item.Size.Height + 3 * GlobalValues.GapBetweenContainer); item.Location = saveLocation; return(retVal); }
/// <summary> /// Convert a single item, Location is calculated as follows /// </summary> /// <param name="offset"> only Y value is used, gives the offset to Items location.Y </param> /// <param name="item">Item to convert</param> /// <returns></returns> public static BaseExportColumn ConvertLineItem(BaseReportItem item, Point offset) { if (item == null) { throw new ArgumentNullException("item"); } IExportColumnBuilder columnBuilder = item as IExportColumnBuilder; BaseExportColumn lineItem = null; if (columnBuilder != null) { lineItem = columnBuilder.CreateExportColumn(); lineItem.StyleDecorator.Location = new Point(offset.X + lineItem.StyleDecorator.Location.X, lineItem.StyleDecorator.Location.Y + offset.Y); lineItem.StyleDecorator.DisplayRectangle = new Rectangle(lineItem.StyleDecorator.Location, lineItem.StyleDecorator.Size); } return(lineItem); }
private static void AdjustParentInternal (ReportItemCollection items,BaseReportItem parent) { foreach(BaseReportItem item in items) { item.Parent = parent; } }
public static Rectangle CalculatePageBreakRectangle(BaseReportItem simpleContainer, Point curPos) { return(new Rectangle(new Point(simpleContainer.Location.X, curPos.Y), simpleContainer.Size)); }
public static void AdjustChildLocation (BaseReportItem item,Point offset) { item.Location = new Point(item.Location.X + offset.X, offset.Y + item.Location.Y); }
public static void AdjustSectionLocation (BaseReportItem section) { section.Location = new Point(section.Location.X,section.SectionOffset ); }
public static Rectangle CalculatePageBreakRectangle(BaseReportItem simpleContainer,Point curPos) { return new Rectangle(new Point (simpleContainer.Location.X,curPos.Y), simpleContainer.Size); }
public static void AdjustSectionLocation(BaseReportItem section) { section.Location = new Point(section.Location.X, section.SectionOffset); }
public static BaseRectangleItem CreateDebugItem (BaseReportItem item) { BaseRectangleItem debugRectangle = new BaseRectangleItem(); debugRectangle = new BaseRectangleItem(); debugRectangle.Location = new Point (0 ,0); debugRectangle.Size = new Size(item.Size.Width,item.Size.Height); debugRectangle.FrameColor = item.FrameColor; return debugRectangle; }
public void DrawBorder() { BaseReportItem bri = new BaseReportItem(); Assert.IsFalse(bri.DrawBorder,"DrawBorder should BeforePrintEventArgs false"); }
public void DefaultForeColor () { BaseReportItem bri = new BaseReportItem(); Assert.AreEqual(System.Drawing.Color.Black,bri.ForeColor,"Forecolor should be black"); }
public static void AdjustChildLocation(BaseReportItem item, Point offset) { item.Location = new Point(item.Location.X + offset.X, offset.Y + item.Location.Y); }
public void DrawBorder() { BaseReportItem bri = new BaseReportItem(); Assert.IsFalse(bri.DrawBorder, "DrawBorder should BeforePrintEventArgs false"); }
public void DefaultForeColor() { BaseReportItem bri = new BaseReportItem(); Assert.AreEqual(System.Drawing.Color.Black, bri.ForeColor, "Forecolor should be black"); }
public virtual ExporterCollection Convert(BaseReportItem parent, BaseReportItem item) { this.ParentRectangle = new Rectangle(parent.Location, parent.Size); return(new ExporterCollection());; }
public void DefaultBackColor() { BaseReportItem bri = new BaseReportItem(); Assert.AreEqual(GlobalValues.DefaultBackColor, bri.BackColor); }
private static void RenderLineItem (BaseReportItem item, Point offset,IExpressionEvaluatorFacade evaluator,ReportPageEventArgs rpea) { Point saveLocation = new Point (item.Location.X,item.Location.Y); PrintHelper.AdjustChildLocation(item,offset); BaseTextItem textItem = item as BaseTextItem; IReportExpression epr = item as IReportExpression; if (epr != null) { string sss = evaluator.Evaluate(epr.Expression); if (!String.IsNullOrEmpty(sss)) { textItem.Text = sss; } } if (textItem != null) { string str = textItem.Text; textItem.Text = evaluator.Evaluate(textItem.Text); textItem.Render(rpea); textItem.Text = str; } else { item.Render (rpea); } item.Location = saveLocation; }
public void DefaultFont() { BaseReportItem bri = new BaseReportItem(); Assert.AreEqual(GlobalValues.DefaultFont, bri.Font); }
public static Rectangle RenderPlainCollection (BaseReportItem parent, ReportItemCollection items, IExpressionEvaluatorFacade evaluator, Point offset, ReportPageEventArgs rpea) { if (items.Count > 0) { foreach (BaseReportItem child in items) { child.Parent = parent; StandardPrinter.RenderLineItem (child,offset,evaluator,rpea); } } return new Rectangle(offset,parent.Size); }
public void DefaultConstructor() { BaseReportItem bri = new BaseReportItem(); Assert.IsNotNull(bri); Assert.AreEqual(System.Drawing.Color.Black,bri.ForeColor); }
public override bool ReceiveDialogMessage(DialogMessage message) { if (customizer == null) { customizer = (Properties)base.CustomizationObject; reportStructure = (ReportStructure)customizer.Get("Generator"); } if (message == DialogMessage.Activated) { this.model = reportStructure.CreateAndFillReportModel(); this.resultDataSet = FillGrid(); if (this.resultDataSet != null) { this.grdQuery.DataSource = this.resultDataSet.Tables[0]; foreach (DataGridViewColumn dd in this.grdQuery.Columns) { DataGridViewColumnHeaderCheckBoxCell cb = new DataGridViewColumnHeaderCheckBoxCell(); cb.CheckBoxAlignment = HorizontalAlignment.Right; cb.Checked = true; dd.HeaderCell = cb; dd.SortMode = DataGridViewColumnSortMode.NotSortable; } this.grdQuery.AllowUserToOrderColumns = true; } base.EnableNext = true; base.EnableFinish = true; } else if (message == DialogMessage.Finish) { if (this.resultDataSet != null) { // check reordering of columns DataGridViewColumn[] displayCols; DataGridViewColumnCollection dc = this.grdQuery.Columns; displayCols = new DataGridViewColumn[dc.Count]; for (int i = 0; i < dc.Count; i++) { if (dc[i].Visible) { displayCols[dc[i].DisplayIndex] = dc[i]; } } // only checked columns are used in the report ReportItemCollection sourceItems = WizardHelper.DataItemsFromDataSet(this.resultDataSet); AvailableFieldsCollection abstractColumns = WizardHelper.AbstractColumnsFromDataSet(this.resultDataSet); ReportItemCollection destItems = new ReportItemCollection(); foreach (DataGridViewColumn cc in displayCols) { DataGridViewColumnHeaderCheckBoxCell hc = (DataGridViewColumnHeaderCheckBoxCell)cc.HeaderCell; if (hc.Checked) { BaseReportItem br = (BaseReportItem)sourceItems.Find(cc.HeaderText); destItems.Add(br); } } reportStructure.ReportItemCollection.AddRange(destItems); if ((this.sqlParamsCollection != null) && (this.sqlParamsCollection.Count > 0)) { reportStructure.SqlQueryParameters.AddRange(sqlParamsCollection); } if (abstractColumns != null) { reportStructure.AvailableFieldsCollection.AddRange(abstractColumns); } } base.EnableNext = true; base.EnableFinish = true; } return(true); }
public void DefaultBackColor () { BaseReportItem bri = new BaseReportItem(); Assert.AreEqual(GlobalValues.DefaultBackColor,bri.BackColor); }
public void FindWithNameIsNull() { itemCollection = this.PlainCollection(); BaseReportItem r = itemCollection.Find(null); }
public void DefaultFont () { BaseReportItem bri = new BaseReportItem(); Assert.AreEqual (GlobalValues.DefaultFont,bri.Font); }
protected static ICSharpCode.Reports.Core.BaseRowItem CreateRowWithTextColumns(BaseReportItem parent, ReportItemCollection items) { ReportItemCollection colDetail = AbstractLayout.HeaderColumnsFromReportItems(items); ICSharpCode.Reports.Core.BaseRowItem row = new ICSharpCode.Reports.Core.BaseRowItem(); AdjustContainer(parent, row); int defY = parent.Location.Y + GlobalValues.ControlMargins.Top; int defX = row.Size.Width / colDetail.Count; int startX = parent.Location.X + GlobalValues.ControlMargins.Left; foreach (ICSharpCode.Reports.Core.BaseTextItem ir in colDetail) { Point np = new Point(startX, defY); startX += defX; ir.Location = np; ir.Parent = row; row.Items.Add(ir); } return(row); }
public void FindWithNameIsEmpty() { itemCollection = this.PlainCollection(); BaseReportItem r = itemCollection.Find(String.Empty); }
public virtual ExporterCollection Convert(BaseReportItem parent, BaseReportItem item) { this.ParentRectangle = new Rectangle(parent.Location,parent.Size); return new ExporterCollection();; }