Ejemplo n.º 1
0
        public object Render(AdfPanel adfPanel)
        {
            if (adfPanel.Rows.Count == 0) return null;

            Panel panel = new Panel { CssClass = "adfj-form"};
            foreach (var panelrow in adfPanel.Rows)
            {
                Panel line = null;
                for (int i = 0; i < panelrow.Items.Count(); i++)
                {
                    var item = panelrow.Items[i];
                    var items = RenderItem(item);
                    var label = RenderLabel(item, items.FirstOrDefault());

                    if (!item.AttachToPrevious)
                    {
                        line = new Panel { CssClass = "adfj-record" };
                        panel.Controls.Add(line);
                        if (!item.Label.IsNullOrEmpty())
                        {
                            line.Controls.Add(label);
                        }
                    }

                    if (line == null) throw new RenderException("The first item in a panel cannot attach to the previous item.");
                    item.Control = line;

                    foreach (Control control in items)
                    {
                        line.Controls.Add(control);
                    }
                }
            }
            return panel;
        }
Ejemplo n.º 2
0
        public object Render(AdfPanel panel)
        {
            short index = 0;
            var table = new Table { CssClass = PanelStyle};

            int cellsperrow = panel.GetMaxItemsPerRow() * 2;

            foreach (var panelrow in panel.Rows)
            {
                var row = new TableRow { CssClass = RowStyle };
                var itemcell = new TableCell();

                for (int i = 0; i < panelrow.Items.Count(); i++)
                {
                    var item = panelrow.Items[i];

                    var labels = RenderLabel(item);
                    var items = RenderItem(item);

                    item.SetTabIndex(index += 3);

                    if (!item.AttachToPrevious)
                    {
                        if (!item.Label.IsNullOrEmpty())
                        {
                            var labelcell = new TableCell();

                            labelcell.Controls.AddRange(labels);
                            row.Controls.Add(labelcell);
                        }

                        itemcell = new TableCell();
                    }

                    itemcell.Controls.AddRange(items);
                    if (i == panelrow.Items.Count() - 1) itemcell.ColumnSpan = cellsperrow - i;

                    row.Controls.Add(itemcell);
                }

                table.Rows.Add(row);
            }

            return table;
        }
Ejemplo n.º 3
0
        public object Render(AdfPanel panel)
        {
            if (panel.Rows.Count == 0) return null;

            var table = new Table { CssClass = PanelStyle};

            int cellsperrow = panel.GetMaxItemsPerRow() * 2;

            foreach (var panelrow in panel.Rows)
            {
                var row = new TableRow { CssClass = RowStyle };
                var itemcell = new TableCell { CssClass = ItemCellStyle };

                for (int i = 0; i < panelrow.Items.Count(); i++)
                {
                    var item = panelrow.Items[i];
                    var labels = RenderLabel(item);
                    var items = RenderItem(item);

                    if (!item.AttachToPrevious)
                    {
                        if (!item.Label.IsNullOrEmpty())
                        {
                            var labelcell = new TableCell { ID = "panelLabelItem_" + item.GetPropertyName(), CssClass = LabelCellStyle };

                            labelcell.Controls.AddRange(labels);
                            row.Controls.Add(labelcell);
                        }

                        itemcell = new TableCell { ID = "panelControlItem_" + item.GetPropertyName(), CssClass = ItemCellStyle };
                    }

                    itemcell.Controls.AddRange(items);
                    if (i == panelrow.Items.Count() - 1) itemcell.ColumnSpan = cellsperrow - i;

                    row.Controls.Add(itemcell);
                }

                table.Rows.Add(row);
            }

            return table;
        }
Ejemplo n.º 4
0
 public PanelRow(AdfPanel panel)
 {
     Panel = panel;
 }
Ejemplo n.º 5
0
 public static object Render(AdfPanel panel)
 {
     return Renderer.Render(panel);
 }