public override void Make(IConfigurationType config, IExpressionsManager manager) { if (null == config) throw new ArgumentNullException("config"); IConfigurationElement element = config as IConfigurationElement; if (null == element) throw new ArgumentException("config must be an IConfigurationElement"); if (element.Elements.ContainsKey("source")) { IConfigurationElement sourceElement = element.GetElementReference("source"); if (sourceElement.Attributes.ContainsKey("id")) { if (null == manager) throw new ArgumentNullException("manager"); this.Source = manager.FindControl(sourceElement.GetAttributeReference("id").Value.ToString()); if (null == this.Source) this.Source = sourceElement.GetAttributeReference("id").Value; if (sourceElement.Attributes.ContainsKey("member")) this.Member = sourceElement.GetAttributeReference("member").Value.ToString(); } else { if (sourceElement.Attributes.ContainsKey("value")) this.Source = sourceElement.GetAttributeReference("value").Value; } } }
public override void Make(IConfigurationType config, IExpressionsManager manager) { if (null == manager) { throw new ArgumentNullException("manager"); } if (null == config) { throw new ArgumentNullException("config"); } IConfigurationElement element = config as IConfigurationElement; if (null == element) { throw new ArgumentException("config must be an IConfigurationElement"); } if (element.Elements.ContainsKey("operands")) { foreach (IConfigurationElement operandElement in element.GetElementReference("operands").Elements.Values) { string type = operandElement.GetAttributeReference("type").Value.ToString(); IToken token = manager.Token(type); if (null == token) { throw new InvalidOperationException(string.Format("Cannot make the type '{0}'", type)); } token.Make(operandElement, manager); this.Operands.Add(token); } } }
public override void Make(IConfigurationType config, IExpressionsManager manager) { if (null == config) { throw new ArgumentNullException("config"); } if (null == manager) { throw new ArgumentNullException("manager"); } IConfigurationElement tokenElement = config as IConfigurationElement; if (null == tokenElement) { throw new ArgumentException("config is not an IConfigurationElement"); } if (!tokenElement.Elements.ContainsKey("source")) { throw new ConfigurationException("Bad views token configuration: 'source' element not found"); } IConfigurationElement sourceElement = tokenElement.GetElementReference("source"); if (!sourceElement.Attributes.ContainsKey("parameter")) { throw new ConfigurationException("Bad views token configuration: 'source' element has no 'parameter' attribute"); } this.ParameterName = sourceElement.GetAttributeReference("parameter").Value.ToString(); }
public override void Make(IConfigurationType config, IExpressionsManager manager) { if (null == config) { throw new ArgumentNullException("config"); } if (null == manager) { throw new ArgumentNullException("manager"); } IConfigurationElement tokenElement = config as IConfigurationElement; if (null == tokenElement) { throw new ArgumentException("config is not an IConfigurationElement"); } if (!tokenElement.Elements.ContainsKey("source")) { throw new ConfigurationException("Bad views field token configuration: 'source' element not found"); } IConfigurationElement sourceElement = tokenElement.GetElementReference("source"); Make(sourceElement, manager); }
public ConfigurationElementsCollection(IConfigurationType parent) { if (!(parent is IConfigurationSection) && !(parent is IConfigurationElement)) { throw new InvalidOperationException("Parent must be a section or an element"); } this._parent = parent; }
public ConfigurationElementsCollection(IConfigurationType parent, IConfigurationElementsCollection copy) : base(copy as Dictionary <string, IConfigurationElement>) { if (!(parent is IConfigurationSection) && !(parent is IConfigurationElement)) { throw new InvalidOperationException("Parent must be a section or an element"); } this._parent = parent; }
public MissingConfigurationException(IConfigurationType configElementAttribute, IConfigurationType configElement, IConfigurationType configSection, IConfigurationType configSource) { this._message = string.Format("Missing attribute {0} of element {1} in section {2} in configuration source {3}", new object[] { configElementAttribute.ConfigKey, configElement.ConfigKey, configSection.ConfigKey, configSource.ConfigKey }); }
public IConfigurationElementsCollection Clone(IConfigurationType parent) { ConfigurationElementsCollection clone = new ConfigurationElementsCollection(parent); foreach (IConfigurationElement element in this.Values) { clone.Add(element.ConfigKey, element.Clone()); } return(clone); }
public override void Make(IConfigurationType config, IExpressionsManager manager) { if (null == config) throw new ArgumentNullException("config"); if (null == manager) throw new ArgumentNullException("manager"); IConfigurationElement tokenElement = config as IConfigurationElement; if (null == tokenElement) throw new ArgumentException("config is not an IConfigurationElement"); if (!tokenElement.Elements.ContainsKey("source")) throw new ConfigurationException("Bad views field token configuration: 'source' element not found"); IConfigurationElement sourceElement = tokenElement.GetElementReference("source"); Make(sourceElement, manager); }
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); } } }
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); } } }
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); } } }
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); } } }
public override void Make(IConfigurationType config, IExpressionsManager manager) { if (null == config) { throw new ArgumentNullException("config"); } IConfigurationElement element = config as IConfigurationElement; if (null == element) { throw new ArgumentException("config must be an IConfigurationElement"); } if (element.Elements.ContainsKey("source")) { IConfigurationElement sourceElement = element.GetElementReference("source"); if (sourceElement.Attributes.ContainsKey("id")) { if (null == manager) { throw new ArgumentNullException("manager"); } this.Source = manager.FindControl(sourceElement.GetAttributeReference("id").Value.ToString()); if (null == this.Source) { this.Source = sourceElement.GetAttributeReference("id").Value; } if (sourceElement.Attributes.ContainsKey("member")) { this.Member = sourceElement.GetAttributeReference("member").Value.ToString(); } } else { if (sourceElement.Attributes.ContainsKey("value")) { this.Source = sourceElement.GetAttributeReference("value").Value; } } } }
public override void Make(IConfigurationType config, IExpressionsManager manager) { if (null == manager) throw new ArgumentNullException("manager"); if (null == config)throw new ArgumentNullException("config"); IConfigurationElement element = config as IConfigurationElement; if (null == element) throw new ArgumentException("config must be an IConfigurationElement"); if (element.Elements.ContainsKey("operands")) { foreach (IConfigurationElement operandElement in element.GetElementReference("operands").Elements.Values) { string type = operandElement.GetAttributeReference("type").Value.ToString(); IToken token = manager.Token(type); if (null == token) throw new InvalidOperationException(string.Format("Cannot make the type '{0}'", type)); token.Make(operandElement, manager); this.Operands.Add(token); } } }
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("footer")) { Table table; if (container is Table) { table = (container as Table); } else { table = new Table(); table.ID = container.ID + "footer"; } table.ApplyStyle(templatable.FooterStyle); foreach (IConfigurationElement element in itemElements["footer"].Elements.Values) { this.DisplayItem(table, element, "footer-" + element.ConfigKey, null, null, templatable.FooterRowStyle, templatable.InvalidItemStyle, manager); } if (!(container is Table)) { container.Controls.Add(table); } } }
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); } } }
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); } } }
public virtual void Create(Control container, IConfigurationType config, ITemplatable templatable, WebPartManager manager) { throw new NotImplementedException(); }
public ConfigurationType(IConfigurationType anotherConfigurationType) { this.ConfigKey = anotherConfigurationType.ConfigKey; }
public override void Extract(Control container, IConfigurationType config, 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 ITemplatingItemsCollection)) { throw new ArgumentException("registry must be an ITemplatingItemsCollection"); } ITemplatingItemsCollection filters = registry as ITemplatingItemsCollection; if (filters.Count != 0) { IDictionary<string, IConfigurationElement> itemElements = (config as IConfigurationSection).Elements; if (itemElements.ContainsKey("filter")) { for (int i = 0; i < filters.Count; i++) { Dictionary<string, object> data = filters[i].Data as Dictionary<string, object>; foreach (IConfigurationElement element in itemElements["filter"].Elements.Values) { string prefix = "filter" + element.ConfigKey + i.ToString(); foreach (IConfigurationElement fieldElement in element.Elements.Values) { foreach (IConfigurationElement propertyElement in fieldElement.Elements.Values) { if (propertyElement.Attributes.ContainsKey("push")) { string propertyName = propertyElement.GetAttributeReference("member").Value.ToString(); string sourcePropertyName = propertyElement.GetAttributeReference("push").Value.ToString(); if (!data.ContainsKey(sourcePropertyName)) { data.Add(sourcePropertyName, null); } string id = string.Concat(new string[] { container.ID, "-", element.ConfigKey, "-", prefix, "-", fieldElement.ConfigKey, "-ctrl" }); Control fieldControl = ReflectionServices.FindControlEx(id, container); if (null != fieldControl) { data[sourcePropertyName] = ReflectionServices.ExtractValue(fieldControl, propertyName); } } } } } } } } }
public virtual void Create(Control container, IConfigurationType config, ITemplatable templatable, IEnumerable registry, IBinder binder, WebPartManager manager) { throw new NotImplementedException(); }
public virtual void PopulateItem(Control container, IConfigurationType config, ITemplatingItem item, string index) { 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"); } item.Data = new Dictionary <string, object>(); Dictionary <string, object> data = item.Data as Dictionary <string, object>; IDictionary <string, IConfigurationElement> itemElements = (config as IConfigurationSection).Elements; foreach (IConfigurationElement element in itemElements.Values) { if (!("selectors" == element.ConfigKey) && !("commanders" == element.ConfigKey) && !("filter" == element.ConfigKey) && !("header" == element.ConfigKey) && !("footer" == element.ConfigKey)) { foreach (IConfigurationElement fieldElement in element.Elements.Values) { foreach (IConfigurationElement propertyElement in fieldElement.Elements.Values) { if (propertyElement.Attributes.ContainsKey("push")) { string propertyName = propertyElement.GetAttributeReference("member").Value.ToString(); string sourcePropertyName = propertyElement.GetAttributeReference("push").Value.ToString(); if (!data.ContainsKey(sourcePropertyName)) { data.Add(sourcePropertyName, null); } if (!string.IsNullOrEmpty(index)) { string id = string.Concat(new string[] { container.ID, "-", element.ConfigKey, "-", index, "-", fieldElement.ConfigKey, "-ctrl" }); Control fieldControl = ReflectionServices.FindControlEx(id, container); if (null != fieldControl) { object val = ReflectionServices.ExtractValue(fieldControl, propertyName); if (fieldControl is DateTextBox && val == null && propertyName == "Date") { val = ((DateTextBox)fieldControl).Text; } data[sourcePropertyName] = val; } } } } } } } }
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); } }
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); } }
public virtual void CreateFilter(IConfigurationType config, ITemplatingItemsCollection filters, IBinder binder, ITemplatable templatable) { FiltersTemplate.Instance.Create(_container, config, templatable, filters, binder, this.manager); }
public virtual void CreateCommanders(IConfigurationType config, ITemplatable templatable, Dictionary<string, Control> commanders) { CommandersTemplate.Instance.Create(_commandersHolder, config, templatable, commanders, this.manager); }
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); }
public virtual void ExtractItems(IConfigurationType config, int itemsCount, ITemplatingItemsCollection items) { ItemTemplate.Instance.Extract(_container, config, null, null, items, null, -1, itemsCount, this.manager); }
public virtual void Make(IConfigurationType config, IExpressionsManager manager) { }
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); } }
public virtual void Extract(Control container, IConfigurationType config, IEnumerable registry, WebPartManager manager) { throw new NotImplementedException(); }
public virtual void PopulateItem(Control container, IConfigurationType config, ITemplatingItem item, string index) { 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"); } item.Data = new Dictionary<string, object>(); Dictionary<string, object> data = item.Data as Dictionary<string, object>; IDictionary<string, IConfigurationElement> itemElements = (config as IConfigurationSection).Elements; foreach (IConfigurationElement element in itemElements.Values) { if (!("selectors" == element.ConfigKey) && !("commanders" == element.ConfigKey) && !("filter" == element.ConfigKey) && !("header" == element.ConfigKey) && !("footer" == element.ConfigKey)) { foreach (IConfigurationElement fieldElement in element.Elements.Values) { foreach (IConfigurationElement propertyElement in fieldElement.Elements.Values) { if (propertyElement.Attributes.ContainsKey("push")) { string propertyName = propertyElement.GetAttributeReference("member").Value.ToString(); string sourcePropertyName = propertyElement.GetAttributeReference("push").Value.ToString(); if (!data.ContainsKey(sourcePropertyName)) { data.Add(sourcePropertyName, null); } if (!string.IsNullOrEmpty(index)) { string id = string.Concat(new string[] { container.ID, "-", element.ConfigKey, "-", index, "-", fieldElement.ConfigKey, "-ctrl" }); Control fieldControl = ReflectionServices.FindControlEx(id, container); if (null != fieldControl) { object val = ReflectionServices.ExtractValue(fieldControl, propertyName); if (fieldControl is DateTextBox && val == null && propertyName == "Date") { val = ((DateTextBox)fieldControl).Text; } data[sourcePropertyName] = val; } } } } } } } }
public void PopulateItem(IConfigurationType config, ITemplatingItem item, string prefix) { ItemTemplate.Instance.PopulateItem(_container, config, item, prefix); }
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); } }
public override void Extract(Control container, IConfigurationType config, 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 ITemplatingItemsCollection)) { throw new ArgumentException("registry must be an ITemplatingItemsCollection"); } ITemplatingItemsCollection filters = registry as ITemplatingItemsCollection; if (filters.Count != 0) { IDictionary <string, IConfigurationElement> itemElements = (config as IConfigurationSection).Elements; if (itemElements.ContainsKey("filter")) { for (int i = 0; i < filters.Count; i++) { Dictionary <string, object> data = filters[i].Data as Dictionary <string, object>; foreach (IConfigurationElement element in itemElements["filter"].Elements.Values) { string prefix = "filter" + element.ConfigKey + i.ToString(); foreach (IConfigurationElement fieldElement in element.Elements.Values) { foreach (IConfigurationElement propertyElement in fieldElement.Elements.Values) { if (propertyElement.Attributes.ContainsKey("push")) { string propertyName = propertyElement.GetAttributeReference("member").Value.ToString(); string sourcePropertyName = propertyElement.GetAttributeReference("push").Value.ToString(); if (!data.ContainsKey(sourcePropertyName)) { data.Add(sourcePropertyName, null); } string id = string.Concat(new string[] { container.ID, "-", element.ConfigKey, "-", prefix, "-", fieldElement.ConfigKey, "-ctrl" }); Control fieldControl = ReflectionServices.FindControlEx(id, container); if (null != fieldControl) { data[sourcePropertyName] = ReflectionServices.ExtractValue(fieldControl, propertyName); } } } } } } } } }
public virtual void ExtractFilter(IConfigurationType config, ITemplatingItemsCollection filters) { FiltersTemplate.Instance.Extract(_container, config, filters, this.manager); }
public abstract void Make(IConfigurationType config, IExpressionsManager manager);
public virtual void CreateSelectors(IConfigurationType config, ITemplatable templatable, Dictionary<string, Control> selectors) { SelectorsTemplate.Instance.Create(_selectorsHolder, config, templatable, selectors, this.manager); }
public virtual void Create(Control container, IConfigurationType config, ITemplatable templatable, IEnumerable registry, IBinder binder, ITemplatingItem item, int itemIndex, WebPartManager manager) { throw new NotImplementedException(); }
public override void Make(IConfigurationType config, IExpressionsManager manager) { if (null == config) throw new ArgumentNullException("config"); if (null == manager) throw new ArgumentNullException("manager"); IConfigurationElement tokenElement = config as IConfigurationElement; if (null == tokenElement) throw new ArgumentException("config is not an IConfigurationElement"); if (!tokenElement.Elements.ContainsKey("source")) throw new ConfigurationException("Bad views token configuration: 'source' element not found"); IConfigurationElement sourceElement = tokenElement.GetElementReference("source"); if (!sourceElement.Attributes.ContainsKey("parameter")) throw new ConfigurationException("Bad views token configuration: 'source' element has no 'parameter' attribute"); this.ParameterName = sourceElement.GetAttributeReference("parameter").Value.ToString(); }
public MissingConfigurationException(string missing, IConfigurationType configSource) { this._message = string.Format("Missing {0} in configuration source {1}", missing, configSource.ConfigKey); }
public MissingConfigurationException(IConfigurationType configChild, IConfigurationType configParent, IConfigurationType configSource) { this._message = string.Format("Missing element {0} in {1} in {2}", configChild.ConfigKey, configParent.ConfigKey, configSource.ConfigKey); }
public MissingConfigurationException(IConfigurationType configSection) { this._message = string.Format("Missing section {0}", configSection.ConfigKey); }
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); } }
public MissingConfigurationException(IConfigurationType configChild, IConfigurationType configParent) { this._message = string.Format("Missing section {0} in {1}", configChild.ConfigKey, configParent.ConfigKey); }
public virtual void Create(Control container, IConfigurationType config, ITemplatable templatable, IBinder binder, ITemplatingItem item, int itemIndex, WebPartManager manager) { throw new NotImplementedException(); }
public virtual void CreateHeader(IConfigurationType config, ITemplatable templatable) { HeaderTemplate.Instance.Create(_container, config, templatable, this.manager); }
public virtual void Extract(Control container, IConfigurationType config, ITemplatable templatable, IBinder binder, IEnumerable registry, ITemplatingItem item, int itemIndex, int itemsCount, WebPartManager manager) { throw new NotImplementedException(); }
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); }
public void Build(DataTable table, IConfigurationType config) { if (null == table) { throw new ArgumentNullException("table"); } if (null == config) { throw new ArgumentNullException("config"); } IDictionary<string, IConfigurationElement> elements = null; if (config is IConfigurationSection) { elements = ((IConfigurationSection)config).Elements; } else { if (config is IConfigurationElement) { elements = ((IConfigurationElement)config).Elements; } } if (null == elements) { throw new ArgumentException("config has no Elements"); } Dictionary<string, object> values = new Dictionary<string, object>(); if (!table.Columns.Contains("PK")) { DataColumn pk = table.Columns.Add("PK", typeof(int)); pk.AutoIncrement = true; pk.AutoIncrementSeed = 1L; pk.AutoIncrementStep = 1L; table.Constraints.Add("PK", pk, true); } values.Add("PK", null); List<DataColumn> columnsToRemove = new List<DataColumn>(); foreach (DataColumn column in table.Columns) { columnsToRemove.Add(column); } foreach (IConfigurationElement rowElement in elements.Values) { foreach (IConfigurationElement controlElement in rowElement.Elements.Values) { foreach (IConfigurationElement propertyElement in controlElement.Elements.Values) { if (propertyElement.Attributes.ContainsKey("pull")) { string pull = propertyElement.GetAttributeReference("pull").Value.ToString(); if (!table.Columns.Contains(pull)) { table.Columns.Add(pull); columnsToRemove.Remove(table.Columns[pull]); } } if (propertyElement.Attributes.ContainsKey("push")) { string push = propertyElement.GetAttributeReference("push").Value.ToString(); if (!table.Columns.Contains(push)) { table.Columns.Add(push); columnsToRemove.Remove(table.Columns[push]); } } } } } foreach (DataColumn column in columnsToRemove) { if (column.ColumnName != "PK") { table.Columns.Remove(column); } } }
public void Build(DataTable table, IConfigurationType config) { if (null == table) { throw new ArgumentNullException("table"); } if (null == config) { throw new ArgumentNullException("config"); } IDictionary <string, IConfigurationElement> elements = null; if (config is IConfigurationSection) { elements = ((IConfigurationSection)config).Elements; } else { if (config is IConfigurationElement) { elements = ((IConfigurationElement)config).Elements; } } if (null == elements) { throw new ArgumentException("config has no Elements"); } Dictionary <string, object> values = new Dictionary <string, object>(); if (!table.Columns.Contains("PK")) { DataColumn pk = table.Columns.Add("PK", typeof(int)); pk.AutoIncrement = true; pk.AutoIncrementSeed = 1L; pk.AutoIncrementStep = 1L; table.Constraints.Add("PK", pk, true); } values.Add("PK", null); List <DataColumn> columnsToRemove = new List <DataColumn>(); foreach (DataColumn column in table.Columns) { columnsToRemove.Add(column); } foreach (IConfigurationElement rowElement in elements.Values) { foreach (IConfigurationElement controlElement in rowElement.Elements.Values) { foreach (IConfigurationElement propertyElement in controlElement.Elements.Values) { if (propertyElement.Attributes.ContainsKey("pull")) { string pull = propertyElement.GetAttributeReference("pull").Value.ToString(); if (!table.Columns.Contains(pull)) { table.Columns.Add(pull); columnsToRemove.Remove(table.Columns[pull]); } } if (propertyElement.Attributes.ContainsKey("push")) { string push = propertyElement.GetAttributeReference("push").Value.ToString(); if (!table.Columns.Contains(push)) { table.Columns.Add(push); columnsToRemove.Remove(table.Columns[push]); } } } } } foreach (DataColumn column in columnsToRemove) { if (column.ColumnName != "PK") { table.Columns.Remove(column); } } }