internal String DPName(ITabsObject form) { HPatternInstance instance = form.Instance; String nome = ""; if (instance.IsWebPanel) { if (instance.ParentObject != null) nome = instance.ParentObject.Name; } else { if (instance.Transaction != null && instance.Transaction.Transaction != null) { nome = instance.Transaction.TransactionName; } } return String.Format("DPDSM{0}", nome); }
private short internalSubs(StringBuilder ret, ITabsObject view, short contaNivel1) { BaseCollection<Code.ITabObject> lista = view.ListTabs; Dictionary<string, short> grupos = new Dictionary<string, short>(); GroupsElement groups = view.Groups; Boolean isGrupo = false; foreach (GroupTabElement group in groups) { add(ret, 0, "&treeNode = new()"); add(ret, 0, String.Format("&treeNode.Id = \"#{0}\"", group.Name)); add(ret, 0, String.Format("&treeNode.Name = \"{0}\"", group.Name)); add(ret, 0, "&treeNode.Link = '#'"); add(ret, 0, "&treeNode.Expanded = true"); if (group.ImageName != null) { add(ret, 0, String.Format("&treeNode.Icon = {0}.Link()", group.ImageName)); } add(ret, 0, "&treeNodeCollectionData.Add(&treeNode)"); add(ret, 0, ""); contaNivel1++; grupos.Add(group.Name, contaNivel1); } short oldNivel = 0; bool IsPrimeiro = false; foreach (Code.ITabObject tab in lista) { bool podeRodar = true; if (tab is TabElement && !IsPrimeiro) { IsPrimeiro = true; podeRodar = false; } if (podeRodar) { if (String.IsNullOrEmpty(tab.Group) || tab.Group.ToLower() == "none") { isGrupo = false; } else { isGrupo = true; short tmpNivel = grupos[tab.Group]; if (tmpNivel == null || tmpNivel <= 0) tmpNivel = 1; if (oldNivel != tmpNivel) { oldNivel = tmpNivel; add(ret, 0, String.Format("&parent = &treeNodeCollectionData.Item({0})", tmpNivel)); add(ret, 0, ""); } } int ident = 0; if (tab.IsConditional()) { ident = 1; add(ret, 0, String.Format("If ({0}) and ", tab.Condition)); } bool IsDisableImage = false; add(ret, ident, "&treeNode = new()"); if (tab is TabElement) { TabElement tabe = (TabElement)tab; add(ret, ident, String.Format("&treeNode.Id = iif(&Mode = TrnMode.Insert,'#',{0}.Link({1}))", tabe.Wcname, view.Parameters.ListViewVariablesBK())); add(ret, ident, String.Format("&treeNode.Name = \"{0}\"", tab.Name)); add(ret, ident, "&treeNode.Link = '#'"); if (sett.Template.TabDisabledName != null) { IsDisableImage = true; add(ret, ident, "If &Mode = TrnMode.Insert"); add(ret, ident + 1, String.Format("&treeNode.Icon = {0}.Link()", sett.Template.TabDisabledName)); add(ret, ident + 1, String.Format("&treeNode.IconWhenSelected = {0}.Link()", sett.Template.TabDisabledName)); if (tab.ImageName != null) { add(ret, ident, "Else"); } else { add(ret, ident, "EndIf"); } } } if (tab is TabFormElement) { add(ret, ident, String.Format("&treeNode.Id = '#{0}'", tab.Code)); add(ret, ident, String.Format("&treeNode.Name = '{0}'", tab.Description)); add(ret, ident, String.Format("&treeNode.Link = '#{0}'", tab.Code)); } if (tab.ImageName != null) { if (IsDisableImage) { ident++; } add(ret, ident, String.Format("&treeNode.Icon = {0}.Link()", tab.ImageName)); add(ret, ident, String.Format("&treeNode.IconWhenSelected = {0}.Link()", tab.ImageName)); if (IsDisableImage) { ident--; add(ret, ident, "EndIf"); } } if (isGrupo) { add(ret, ident, "&parent.Nodes.Add(&treeNode)"); } else { add(ret, ident, "&treeNodeCollectionData.Add(&treeNode)"); contaNivel1++; } if (tab.IsConditional()) { add(ret, 0, "EndIf"); } add(ret, 0, ""); } } add(ret, 0, ""); return contaNivel1; }