Example #1
0
        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);
                }
            }
        }
Example #2
0
        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);
        }
Example #3
0
        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();
        }
Example #4
0
        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;
                    }
                }
            }
        }
Example #5
0
        private TransitPoint CreateTransitPoint(WebPartManager manager, IConfigurationElement element, IExpressionsManager expressionsManager)
        {
            bool         valid        = false;
            TransitPoint transitPoint = new TransitPoint();

            if (element.Attributes.ContainsKey("id"))
            {
                valid = true;
                transitPoint.Chronicler = (ReflectionServices.FindControlEx(element.GetAttributeReference("id").Value.ToString(), manager) as IChronicler);
            }
            if (element.Attributes.ContainsKey("member"))
            {
                transitPoint.Member = element.GetAttributeReference("member").Value.ToString();
            }
            if (element.Attributes.ContainsKey("value"))
            {
                valid = true;
                transitPoint.Value = element.GetAttributeReference("value").Value;
            }
            if (element.Elements.ContainsKey("expression"))
            {
                valid = true;

                IConfigurationElement expressionElement = element.GetElementReference("expression");
                IExpression           expression        = expressionsManager.Token(expressionElement.GetAttributeReference("type").Value.ToString()) as IExpression;
                if (null == expression)
                {
                    throw new InvalidOperationException("Token is not an IExpression");
                }
                expression.Make(expressionElement, expressionsManager);
                transitPoint.Expression = expression;
            }

            if (!valid)
            {
                transitPoint = null;
            }

            return(transitPoint);
        }
        private TransitPoint CreateTransitPoint(WebPartManager manager, IConfigurationElement element, IExpressionsManager expressionsManager)
        {
            bool valid = false;
            TransitPoint transitPoint = new TransitPoint();
            if (element.Attributes.ContainsKey("id"))
            {
                valid = true;
                transitPoint.Chronicler = (ReflectionServices.FindControlEx(element.GetAttributeReference("id").Value.ToString(), manager) as IChronicler);
            }
            if (element.Attributes.ContainsKey("member"))
            {
                transitPoint.Member = element.GetAttributeReference("member").Value.ToString();
            }
            if (element.Attributes.ContainsKey("value"))
            {
                valid = true;
                transitPoint.Value = element.GetAttributeReference("value").Value;
            }
            if (element.Elements.ContainsKey("expression"))
            {
                valid = true;

                IConfigurationElement expressionElement = element.GetElementReference("expression");
                IExpression expression = expressionsManager.Token(expressionElement.GetAttributeReference("type").Value.ToString()) as IExpression;
                if (null == expression) throw new InvalidOperationException("Token is not an IExpression");
                expression.Make(expressionElement, expressionsManager);
                transitPoint.Expression = expression;
            }

            if (!valid)
                transitPoint = null;

            return transitPoint;
        }