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 AddGridStandard(StringBuilder atts, GridStandardElement grid, HPatternSettings settings) { if (!grid.Instance.IsWebPanel) { atts.AppendLine("<br/>"); atts.AppendLine(WebForm.BeginTable("Table" + grid.Name, "Table95")); atts.AppendLine("<tr><td class='SubTitle'>"); atts.AppendLine(WebForm.TextBlock("Title" + grid.Name, "", grid.Description)); atts.AppendLine("</td></tr>"); atts.AppendLine(WebForm.EndTable()); atts.AppendLine("<hr class='HRDefault' />"); } Dictionary<string, Object> props = new Dictionary<string, object>(); if (!String.IsNullOrEmpty(grid.GetCustomRender)) { props[Artech.Genexus.Common.Properties.HTMLSFL.CustomRender] = grid.GetCustomRender; foreach (GridPropertieElement prop in TemplateGrid.MergeGridProperties(grid.GridProperties, settings)) { TemplateGrid.DefProperty(props, grid.GetCustomRender, prop); } } atts.AppendLine(WebForm.BeginGrid(grid.Name, null, null, null, null, Properties.HTMLSFL.BackColorStyle_Enum.Header, null, null,props)); foreach (AttributeElement att in grid.Attributes.Attributes) { string themeClass = null; if (!String.IsNullOrEmpty(att.ThemeClass)) themeClass = att.ThemeClass; Dictionary<string, object> properties = new Dictionary<string, object>(); if (att.Readonly) { properties[Properties.HTMLSFLCOL.ReadOnly] = true; } foreach (GridColumnPropertieElement prop in TemplateGrid.MergeGridColumnProperties(att.GridColumnProperties, settings)) { TemplateGrid.DefProperty(properties, grid.GetCustomRender, prop); } atts.AppendLine(WebForm.GridAttribute(att.AttributeName, themeClass, att.Description, att.Visible, null, properties)); } atts.AppendLine(WebForm.EndGrid()); }