예제 #1
0
파일: Template.cs 프로젝트: rmsphd/HPattern
        private static void AddGridFreeStyle(StringBuilder atts, GridFreeStyleElement 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' />");
            }
            atts.AppendLine("<gxFreeStyle border='1' freestyle='1' gxProp='ControlName=" + grid.Name + ";class=FreeStyleGrid'>");

            //atts.AppendLine(Heurys.Patterns.HPattern.Helpers.Template.InnerLevel(subLevel, Counters));
            atts.AppendLine("<tr>");
                atts.AppendLine("<td>");
                    atts.AppendLine(WebForm.BeginTable("Table2" + grid.Name, "Table"));

                    foreach (IHPatternInstanceElement item in grid.Items)
                    {
                        if (item is GridFreeStyleElement)
                        {
                            atts.AppendLine("<tr>");
                                atts.AppendLine("<td colspan=\"2\">");
                                    GridFreeStyleElement grid2 = item as GridFreeStyleElement;
                                    AddGridFreeStyle(atts, grid2, settings);
                                atts.AppendLine("</td>");
                            atts.AppendLine("</tr>");
                        }
                        if (item is GridStandardElement)
                        {
                            atts.AppendLine("<tr>");
                                atts.AppendLine("<td colspan=\"2\">");
                                    GridStandardElement grid2 = item as GridStandardElement;
                                    AddGridStandard(atts, grid2, settings);
                                atts.AppendLine("</td>");
                            atts.AppendLine("</tr>");
                        }
                        if (item is AttributeElement)
                        {
                            AttributeElement att = item as AttributeElement;

                            string themeClass = null;
                            if (!String.IsNullOrEmpty(att.ThemeClass))
                                themeClass = att.ThemeClass;
                            Dictionary<string, object> properties = new Dictionary<string, object>();
                            if (att.Readonly)
                            {
                                properties[Properties.HTMLATT.ReadOnly] = true;
                            }

                            atts.AppendLine("<tr>");
                                atts.AppendLine("<td class=\"td5\" valign=\"top\" nowrap=\"nowrap\">");
                                    atts.AppendLine(WebForm.TextBlock("TextBlock" + att.AttributeName, null, att.Description));
                                atts.AppendLine("</td>");
                                atts.AppendLine("<td nowrap=\"nowrap\">");
                                    atts.AppendLine(WebForm.Attribute(att.AttributeName, themeClass, null, properties));
                                atts.AppendLine("</td>");
                            atts.AppendLine("</tr>");
                        }
                    }

                    atts.AppendLine(WebForm.EndTable());
                atts.AppendLine("</td>");
            atts.AppendLine("</tr>");

            atts.AppendLine("</gxFreeStyle>");
        }
예제 #2
0
        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);
            }
        }
예제 #3
0
파일: Template.cs 프로젝트: rmsphd/HPattern
 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);
     }
 }