Exemple #1
0
 public override void Create(Control container, IConfigurationType config, ITemplatable templatable, IEnumerable registry, WebPartManager manager)
 {
     if (null == container)
     {
         throw new ArgumentNullException("container");
     }
     if (null == config)
     {
         throw new ArgumentNullException("config");
     }
     if (!(config is IConfigurationSection))
     {
         throw new ArgumentException("config must be an IConfigurationSection");
     }
     if (!(registry is Dictionary<string, Control>))
     {
         throw new ArgumentException("registry must be a Dictionary<string,Control>");
     }
     Dictionary<string, Control> commanders = registry as Dictionary<string, Control>;
     commanders.Clear();
     IDictionary<string, IConfigurationElement> itemElements = (config as IConfigurationSection).Elements;
     if (itemElements.ContainsKey("commanders"))
     {
         Table table;
         if (container is Table)
         {
             table = (container as Table);
         }
         else
         {
             table = new Table();
         }
         if (string.IsNullOrEmpty(table.ID))
         {
             table.ID = container.ID + "commanders";
         }
         table.ApplyStyle(templatable.CommandersStyle);
         foreach (IConfigurationElement element in itemElements["commanders"].Elements.Values)
         {
             this.DisplayItem(table, element, element.ConfigKey, null, null, templatable.CommandersRowStyle, templatable.InvalidItemStyle, commanders, manager);
         }
         if (!(container is Table))
         {
             container.Controls.Add(table);
         }
     }
 }
Exemple #2
0
 public override void Create(Control container, IConfigurationType config, ITemplatable templatable, IEnumerable registry, IBinder binder, WebPartManager manager)
 {
     if (null == container)
     {
         throw new ArgumentNullException("container");
     }
     if (null == config)
     {
         throw new ArgumentNullException("config");
     }
     if (!(config is IConfigurationSection))
     {
         throw new ArgumentException("config must be an IConfigurationSection");
     }
     if (!(registry is ITemplatingItemsCollection))
     {
         throw new ArgumentException("registry must be an ITemplatingItemsCollection");
     }
     ITemplatingItemsCollection filters = registry as ITemplatingItemsCollection;
     IDictionary<string, IConfigurationElement> itemElements = (config as IConfigurationSection).Elements;
     if (itemElements.ContainsKey("filter"))
     {
         Table table;
         if (container is Table)
         {
             table = (container as Table);
         }
         else
         {
             table = new Table();
             table.ID = container.ID + "filter";
         }
         table.ApplyStyle(templatable.FilterStyle);
         for (int i = 0; i < filters.Count; i++)
         {
             foreach (IConfigurationElement element in itemElements["filter"].Elements.Values)
             {
                 string prefix = "filter" + element.ConfigKey + i.ToString();
                 this.DisplayItem(table, element, prefix, binder, filters[i], templatable.FilterRowStyle, templatable.InvalidItemStyle, manager);
             }
         }
         if (!(container is Table))
         {
             container.Controls.Add(table);
         }
     }
 }
Exemple #3
0
 public override void Create(Control container, IConfigurationType config, ITemplatable templatable, WebPartManager manager)
 {
     if (null == container)
     {
         throw new ArgumentNullException("container");
     }
     if (null == config)
     {
         throw new ArgumentNullException("config");
     }
     if (!(config is IConfigurationSection))
     {
         throw new ArgumentException("config must be an IConfigurationSection");
     }
     IDictionary<string, IConfigurationElement> itemElements = (config as IConfigurationSection).Elements;
     if (itemElements.ContainsKey("header"))
     {
         Table table;
         if (container is Table)
         {
             table = (container as Table);
         }
         else
         {
             table = new Table();
             table.ID = container.ID + "header";
         }
         table.ApplyStyle(templatable.HeaderStyle);
         foreach (IConfigurationElement element in itemElements["header"].Elements.Values)
         {
             this.DisplayItem(table, element, "header-" + element.ConfigKey, null, null, templatable.HeaderRowStyle, templatable.InvalidItemStyle, manager);
         }
         if (!(container is Table))
         {
             container.Controls.Add(table);
         }
     }
 }
Exemple #4
0
 public override void Create(Control container, IConfigurationType config, ITemplatable templatable, IBinder binder, ITemplatingItem item, int itemIndex, WebPartManager manager)
 {
     if (null == container)
     {
         throw new ArgumentNullException("container");
     }
     if (null == config)
     {
         throw new ArgumentNullException("config");
     }
     if (!(config is IConfigurationSection))
     {
         throw new ArgumentException("config must be an IConfigurationSection");
     }
     if ((config as IConfigurationSection).Elements.ContainsKey("totals"))
     {
         Table table;
         if (container is Table)
         {
             table = (container as Table);
         }
         else
         {
             table = new Table();
             table.ApplyStyle(templatable.TotalsStyle);
         }
         IConfigurationElement element = (config as IConfigurationSection).GetElementReference("totals");
         foreach (IConfigurationElement rowElement in element.Elements.Values)
         {
             this.DisplayItem(table, rowElement, "totals" + itemIndex.ToString(), binder, item, templatable.TotalsRowStyle, templatable.InvalidItemStyle, manager);
         }
         if (!(container is Table))
         {
             container.Controls.Add(table);
         }
     }
 }
Exemple #5
0
 public void InitProviders(IBinder binder, IValidationManager validationManager, IReporter reporter, ITemplatable templatable, ITranslator translator)
 {
     this.Binder = binder;
     this.ValidationManager = validationManager;
     this.Reporter = reporter;
     this.Templatable = templatable;
     this.Translator = translator;
 }
Exemple #6
0
        public override void Create(Control container, IConfigurationType config, ITemplatable templatable, IBinder binder, ITemplatingItem item, int itemIndex, WebPartManager manager)
        {
            if (null == container)
            {
                throw new ArgumentNullException("container");
            }
            if (null == config)
            {
                throw new ArgumentNullException("config");
            }
            if (!(config is IConfigurationSection))
            {
                throw new ArgumentException("config must be an IConfigurationSection");
            }
            IDictionary<string, IConfigurationElement> itemElements = (config as IConfigurationSection).Elements;
            Table table;
            if (container is Table)
            {
                table = (container as Table);
            }
            else
            {
                table = new Table();
            }
            table.ApplyStyle(templatable.DetailsStyle);

            Panel statusPanel = new Panel();
            HiddenField hiddenReadOnly = new HiddenField();
            hiddenReadOnly.ID = itemIndex.ToString() + "-readOnly";
            hiddenReadOnly.Value = item.IsReadOnly.ToString();
            statusPanel.Controls.Add(hiddenReadOnly);
            HiddenField hiddenNew = new HiddenField();
            hiddenNew.ID = itemIndex.ToString() + "-new";
            hiddenNew.Value = item.IsNew.ToString();
            statusPanel.Controls.Add(hiddenNew);
            HiddenField hiddenCurrent = new HiddenField();
            hiddenCurrent.ID = itemIndex.ToString() + "-current";
            hiddenCurrent.Value = item.IsCurrent.ToString();
            statusPanel.Controls.Add(hiddenCurrent);
            HiddenField hiddenHasChanges = new HiddenField();
            hiddenHasChanges.ID = itemIndex.ToString() + "-hasChanges";
            hiddenHasChanges.Value = item.HasChanges.ToString();
            statusPanel.Controls.Add(hiddenHasChanges);
            HiddenField hiddenIsValid = new HiddenField();
            hiddenIsValid.ID = itemIndex.ToString() + "-isValid";
            hiddenIsValid.Value = item.IsValid.ToString();
            statusPanel.Controls.Add(hiddenIsValid);
            HiddenField hiddenInvalidMember = new HiddenField();
            hiddenInvalidMember.ID = itemIndex.ToString() + "-invalidMember";
            hiddenInvalidMember.Value = item.InvalidMember;
            statusPanel.Controls.Add(hiddenInvalidMember);

            if (null != item)
            {
                item.BoundControls.Clear();
            }
            foreach (IConfigurationElement element in itemElements.Values)
            {
                if (!("selectors" == element.ConfigKey) && !("commanders" == element.ConfigKey) && !("filter" == element.ConfigKey) && !("header" == element.ConfigKey) && !("footer" == element.ConfigKey) && !("grouping" == element.ConfigKey) && !("totals" == element.ConfigKey))
                {
                    if (item.IsCurrent && !item.IsReadOnly)
                    {
                        this.DisplayItem(table, element, itemIndex.ToString(), binder, item, templatable.EditRowStyle, templatable.InvalidItemStyle, manager);
                    }
                    else
                    {
                        if (item.IsCurrent)
                        {
                            this.DisplayItem(table, element, itemIndex.ToString(), binder, item, templatable.SelectedRowStyle, templatable.InvalidItemStyle, manager);
                        }
                        else
                        {
                            if (itemIndex % 2 == 0)
                            {
                                this.DisplayItem(table, element, itemIndex.ToString(), binder, item, templatable.RowStyle, templatable.InvalidItemStyle, manager);
                            }
                            else
                            {
                                this.DisplayItem(table, element, itemIndex.ToString(), binder, item, templatable.AlternatingRowStyle, templatable.InvalidItemStyle, manager);
                            }
                        }
                    }
                }
            }
            if (table.Rows.Count > 0)
            {
                if (!(table.Rows[0].Cells.Count > 0))
                {
                    TableCell firstcell = new TableCell();
                    firstcell.ID = table.Rows[0].ID + "firstcell";
                    table.Rows[0].Cells.Add(firstcell);
                }

                table.Rows[0].Cells[0].Controls.Add(statusPanel);
            }
        }
Exemple #7
0
 public override void Extract(Control container, IConfigurationType config, ITemplatable templatable, IBinder binder, IEnumerable registry, ITemplatingItem item, int itemIndex, int itemsCount, WebPartManager manager)
 {
     if (null == container)
     {
         throw new ArgumentNullException("container");
     }
     if (null == config)
     {
         throw new ArgumentNullException("config");
     }
     if (!(config is IConfigurationSection))
     {
         throw new ArgumentException("config must be an IConfigurationSection");
     }
     if (!(registry is ITemplatingItemsCollection))
     {
         throw new ArgumentException("registry must be ITemplatingItemsCollection");
     }
     ITemplatingItemsCollection items = registry as ITemplatingItemsCollection;
     items.Clear();
     IDictionary<string, IConfigurationElement> itemElements = (config as IConfigurationSection).Elements;
     for (int i = 0; i < itemsCount; i++)
     {
         item = new TemplatingItem();
         Control hiddenReadOnly = ReflectionServices.FindControlEx(i.ToString() + "-readOnly", container);
         if (null != hiddenReadOnly)
         {
             bool isReadOnly = false;
             bool.TryParse(((HiddenField)hiddenReadOnly).Value, out isReadOnly);
             item.IsReadOnly = isReadOnly;
         }
         Control hiddenNew = ReflectionServices.FindControlEx(i.ToString() + "-new", container);
         if (null != hiddenNew)
         {
             bool isNew = false;
             bool.TryParse(((HiddenField)hiddenNew).Value, out isNew);
             item.IsNew = isNew;
         }
         Control hiddenCurrent = ReflectionServices.FindControlEx(i.ToString() + "-current", container);
         if (null != hiddenCurrent)
         {
             bool isCurrent = false;
             bool.TryParse(((HiddenField)hiddenCurrent).Value, out isCurrent);
             item.IsCurrent = isCurrent;
         }
         Control hiddenHasChanges = ReflectionServices.FindControlEx(i.ToString() + "-hasChanges", container);
         if (null != hiddenHasChanges)
         {
             bool hasChanges = false;
             bool.TryParse(((HiddenField)hiddenHasChanges).Value, out hasChanges);
             item.HasChanges = hasChanges;
         }
         Control hiddenIsValid = ReflectionServices.FindControlEx(i.ToString() + "-isValid", container);
         if (null != hiddenIsValid)
         {
             bool isValid = false;
             bool.TryParse(((HiddenField)hiddenIsValid).Value, out isValid);
             item.IsValid = isValid;
         }
         Control hiddenInvalidMember = ReflectionServices.FindControlEx(i.ToString() + "-invalidMember", container);
         if (null != hiddenInvalidMember)
         {
             item.InvalidMember = ((HiddenField)hiddenInvalidMember).Value;
         }
         this.PopulateItem(container, config, item, i.ToString());
         items.Add(item);
     }
 }
Exemple #8
0
 public virtual void CreateFilter(IConfigurationType config, ITemplatingItemsCollection filters, IBinder binder, ITemplatable templatable)
 {
     FiltersTemplate.Instance.Create(_container, config, templatable, filters, binder, this.manager);
 }
Exemple #9
0
 public virtual void CreateCommanders(IConfigurationType config, ITemplatable templatable, Dictionary<string, Control> commanders)
 {
     CommandersTemplate.Instance.Create(_commandersHolder, config, templatable, commanders, this.manager);
 }
Exemple #10
0
 public virtual void InstantiateTotalsIn(IConfigurationType config, IBinder binder, int itemIndex, ITemplatingItem item, ITemplatable templatable)
 {
     TotalsTemplate.Instance.Create(_container, config, templatable, binder, item, itemIndex, this.manager);
 }
Exemple #11
0
 public virtual void CreateSelectors(IConfigurationType config, ITemplatable templatable, Dictionary<string, Control> selectors)
 {
     SelectorsTemplate.Instance.Create(_selectorsHolder, config, templatable, selectors, this.manager);
 }
Exemple #12
0
 public virtual void CreateHeader(IConfigurationType config, ITemplatable templatable)
 {
     HeaderTemplate.Instance.Create(_container, config, templatable, this.manager);
 }
Exemple #13
0
 public virtual void Create(Control container, IConfigurationType config, ITemplatable templatable, IEnumerable registry, IBinder binder, ITemplatingItem item, int itemIndex, WebPartManager manager)
 {
     throw new NotImplementedException();
 }
Exemple #14
0
 public virtual void Create(Control container, IConfigurationType config, ITemplatable templatable, WebPartManager manager)
 {
     throw new NotImplementedException();
 }
Exemple #15
0
 public virtual void Create(Control container, IConfigurationType config, ITemplatable templatable, IBinder binder, ITemplatingItem item, int itemIndex, WebPartManager manager, bool keepTable)
 {
     if (null == container)
     {
         throw new ArgumentNullException("container");
     }
     if (null == config)
     {
         throw new ArgumentNullException("config");
     }
     if (!(config is IConfigurationSection))
     {
         throw new ArgumentException("config must be an IConfigurationSection");
     }
     Table containerTable;
     if (container is Table)
     {
         containerTable = (container as Table);
     }
     else
     {
         containerTable = new Table();
         containerTable.ID = container.ID + "grouping";
     }
     IConfigurationElement element = (config as IConfigurationSection).GetElementReference("grouping");
     Table table;
     if (keepTable)
     {
         table = containerTable;
     }
     else
     {
         TableRow tr = new TableRow();
         TableCell tc = new TableCell();
         table = new Table();
         tr.ID = "groupingTable" + itemIndex.ToString() + "row";
         tc.ID = "groupingTable" + itemIndex.ToString() + "cell";
         table.ID = "groupingTable" + itemIndex.ToString();
         tc.Controls.Add(table);
         tr.Cells.Add(tc);
         containerTable.Rows.Add(tr);
         if (element.Attributes.ContainsKey("span"))
         {
             int columnSpan = 1;
             int.TryParse(element.GetAttributeReference("span").Value.ToString(), out columnSpan);
             tc.ColumnSpan = columnSpan;
         }
         if (element.Attributes.ContainsKey("rowspan"))
         {
             int rowSpan = 1;
             int.TryParse(element.GetAttributeReference("rowspan").Value.ToString(), out rowSpan);
             tc.RowSpan = rowSpan;
         }
     }
     table.ApplyStyle(templatable.GroupingStyle);
     foreach (IConfigurationElement rowElement in element.Elements.Values)
     {
         this.DisplayItem(table, rowElement, "grouping" + itemIndex.ToString(), binder, item, templatable.GroupRowStyle, templatable.InvalidItemStyle, manager);
     }
     if (!(container is Table))
     {
         container.Controls.Add(containerTable);
     }
 }
Exemple #16
0
 public override void Create(Control container, IConfigurationType config, ITemplatable templatable, IBinder binder, ITemplatingItem item, int itemIndex, WebPartManager manager)
 {
     this.Create(container, config, templatable, binder, item, itemIndex, manager, false);
 }