public static String getCustomRender(IHPatternInstanceElement element) { String ret = ""; if (element is IGridObject) { ret = ((IGridObject)element).GetCustomRender; } else if (element.Parent != null && element.Parent != element) { ret = getCustomRender(element.Parent); } return ret; }
public static void DefProperty(Dictionary<string, Object> props, String customRender, IHPatternInstanceElement element) { String nome = ""; String valor = ""; if (element is GridPropertieElement) { GridPropertieElement grid = (GridPropertieElement)element; nome = grid.Name; valor = grid.Valor; } if (element is GridColumnPropertieElement) { GridColumnPropertieElement grid = (GridColumnPropertieElement)element; nome = grid.Name; valor = grid.Valor; } props[customRender + "_" + nome] = valor; }
internal IGridObject getGridObject(IHPatternInstanceElement element) { if (element != null) { if (element is IGridObject) { return (IGridObject)element; } else { return getGridObject(element.Parent); } } return null; }
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 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); } }
internal static HPatternSettings getSettings(IHPatternInstanceElement att) { HPatternSettings settings = sett; if (settings == null) { if (att != null) { if (att.Instance != null) { if (att.Instance.Settings != null) { settings = att.Instance.Settings; } } } } return settings; }
internal static void AddCustomRenderColProperties(Dictionary<string, object> properties, IHPatternInstanceElement att) { HPatternSettings settings = getSettings(att); GridColumnPropertiesElement props = null; String CustomRender = TemplateGrid.getCustomRender(att); if (att is AttributeElement) { props = ((AttributeElement)att).GridColumnProperties; } else if (att is VariableElement) { props = ((VariableElement)att).GridColumnProperties; } foreach (GridColumnPropertieElement prop in TemplateGrid.MergeGridColumnProperties(props, settings)) { TemplateGrid.DefProperty(properties, CustomRender, prop); } }
public static string PromptRules(IHPatternInstanceElement objele, HPatternSettings settings, string prefix) { StringBuilder ret = new StringBuilder(); if (settings.Template.TemPrompt) { if (objele is FormElement) { FormElement form = (FormElement)objele; foreach (IHPatternInstanceElement ele in form.Items) { if (ele is TabFormElement) { TabFormElement tab = (TabFormElement)ele; foreach (RowElement row in tab.Rows) { PromptRulesRow(ret, row, settings,prefix); } } if (ele is RowElement) { RowElement row = (RowElement)ele; PromptRulesRow(ret, row, settings,prefix); } } } if (objele is TabFormElement) { TabFormElement tab = (TabFormElement)objele; foreach (RowElement row in tab.Rows) { PromptRulesRow(ret, row, settings,prefix); } } } return ret.ToString(); }
public static string PromptRules(IHPatternInstanceElement objele, HPatternSettings settings) { return PromptRules(objele, settings, ""); }
private static void PromptRulesElement(StringBuilder ret, IHPatternInstanceElement ele, HPatternSettings settings, string prefix) { if (ele is AttributeElement) { AttributeElement att = (AttributeElement)ele; if (att.Links != null) { foreach (LinkElement link in att.Links) { RulePrompt(ret, link, att.AttributeName, settings, prefix); } } } if (ele is VariableElement) { VariableElement att = (VariableElement)ele; if (att.Links != null) { foreach (LinkElement link in att.Links) { RulePrompt(ret, link, att.Name, settings, prefix); } } } }
private static void LinkBuild(StringBuilder atts, IHPatternInstanceElement ele,HPatternSettings settings) { if (settings.Template.TemPrompt) { if (ele is AttributeElement) { AttributeElement att = (AttributeElement)ele; if (att.Links != null) { foreach (LinkElement link in att.Links) { LinkImage(atts, link, att.AttributeName, settings); } } } if (ele is VariableElement) { VariableElement att = (VariableElement)ele; if (att.Links != null) { foreach (LinkElement link in att.Links) { LinkImage(atts, link, att.Name, settings); } } } } }
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 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); } }
private static void GetRowsAllTabsPP(IBaseCollection<RowElement> rows, RowElement row, bool GridFreeStyle, bool GridStandard, IHPatternInstanceElement trni) { // GetRowsAllTabs++ a revolta das Rows, a continuação :D rows.Add(row); foreach (ColumnElement col in row.Columns) { foreach (GroupElement grp in col.Groups) { foreach (RowElement row2 in grp.Rows) { GetRowsAllTabsPP(rows, row2,GridFreeStyle, GridStandard,trni); } } if (GridFreeStyle) { foreach (GridFreeStyleElement grid in col.GridFreeStyles) { GetRowsGridFreeStylePP(rows, grid, row, col, grid); } } if (GridStandard) { foreach (GridStandardElement grid in col.GridStandards) { GetRowsGridPP(rows, grid.Attributes.Attributes, row, col, grid); } } } }