private void AddGridStandard(TransactionLevel subLevel, IHPatternInstanceElement nivel, Dictionary<string, int> Counters) { GridStandardElement grid = new GridStandardElement(); grid.Name = String.Format("Grid{0}", Counters["GridCounter"]); Counters["GridCounter"]++; grid.Description = subLevel.Description; IDictionary<TransactionAttribute, Artech.Genexus.Common.Objects.Attribute> descAttNames; IList<int> toExclude = DefaultFormHelper.CalculateExcluded(subLevel, out descAttNames); foreach (TransactionAttribute ta in subLevel.Attributes) { if (!toExclude.Contains(ta.Attribute.Id)) { string colTitleProperty = "ColumnTitle"; Artech.Genexus.Common.Objects.Attribute attName; if (!descAttNames.TryGetValue(ta, out attName)) { attName = ta.Attribute; if (ta.IsLocal) colTitleProperty = "ContextualTitle"; } string colTitleExpr = String.Format("={0}.{1}", attName.Name, colTitleProperty); AttributeElement att = new AttributeElement(attName); att.Description = colTitleExpr; grid.Attributes.Add(att); } } if (nivel is FormElement) { FormElement form = nivel as FormElement; ColumnElement col = new ColumnElement(); col.ColSpan = 2; col.Items.Add(grid); form.AddRow().Columns.Add(col); } if (nivel is GridFreeStyleElement) { GridFreeStyleElement gridnivel = nivel as GridFreeStyleElement; gridnivel.Items.Add(grid); } }
private static void GetRowsGridPP(IBaseCollection<RowElement> rows, IBaseCollection<AttributeElement> atts, RowElement baserow, ColumnElement basecol,IHPatternInstanceElement trni) { RowElement row = baserow.Clone(); row.Parent = trni; row.Columns.Clear(); ColumnElement col = basecol.Clone(); col.Items.Clear(); foreach (AttributeElement att in atts) { col.Items.Add(att); } row.Columns.Add(col); rows.Add(row); }
private void AddGridFreeStyle(TransactionLevel subLevel, IHPatternInstanceElement nivel, Dictionary<string, int> Counters) { GridFreeStyleElement grid = new GridFreeStyleElement(); grid.Name = String.Format("Grid{0}", Counters["GridCounter"]); Counters["GridCounter"]++; grid.Description = subLevel.Description; IDictionary<TransactionAttribute, Artech.Genexus.Common.Objects.Attribute> descAttNames; IList<int> toExclude = DefaultFormHelper.CalculateExcluded(subLevel, out descAttNames); foreach (IStructureItem structureItem in subLevel.Items) { if (structureItem is TransactionAttribute) { TransactionAttribute trnAttribute = structureItem as TransactionAttribute; if (trnAttribute.IsKey || !toExclude.Contains(trnAttribute.Attribute.Id)) { Artech.Genexus.Common.Objects.Attribute attName; if (!descAttNames.TryGetValue(trnAttribute, out attName)) attName = trnAttribute.Attribute; string captionProperty = "Title"; if (trnAttribute.IsLocal) captionProperty = "ContextualTitle"; AttributeElement att = new AttributeElement(attName); att.Description = String.Format("={0}.{1}", attName.Name, captionProperty); grid.Items.Add(att); } } else if (structureItem is TransactionLevel) { TransactionLevel subLevel2 = structureItem as TransactionLevel; bool hasMoreLevels = (subLevel2.Levels.Count > 0); if (hasMoreLevels) { AddGridFreeStyle(subLevel2, grid, Counters); } else { AddGridStandard(subLevel2, grid, Counters); } } } if (nivel is FormElement) { FormElement form = nivel as FormElement; ColumnElement col = new ColumnElement(); col.ColSpan = 2; col.Items.Add(grid); form.AddRow().Columns.Add(col); } if (nivel is GridFreeStyleElement) { GridFreeStyleElement gridnivel = nivel as GridFreeStyleElement; gridnivel.Items.Add(grid); } }
private static void GetRowsGridFreeStylePP(IBaseCollection<RowElement> rows, GridFreeStyleElement grid, RowElement baserow, ColumnElement basecol, IHPatternInstanceElement trni) { GetRowsGridPP(rows, grid.Attributes, baserow, basecol, grid); foreach (GridFreeStyleElement grid2 in grid.GridFreeStyles) { GetRowsGridFreeStylePP(rows, grid2, baserow, basecol, grid2); } foreach (GridStandardElement grid2 in grid.GridStandards) { GetRowsGridPP(rows, grid2.Attributes.Attributes, baserow, basecol, grid2); } }