Exemplo n.º 1
0
        protected override void OnInitialize()
        {
            this.TitleDynamicValuesHelper = new DynamicValuesHelper(this.Title);
            this.TitleDynamicValuesHelper.Initialize(this.OwnerNode);

            this.MessageDynamicValuesHelper = new DynamicValuesHelper(this.Message);
            this.MessageDynamicValuesHelper.Initialize(this.OwnerNode);
        }
Exemplo n.º 2
0
        protected override void OnInitialize()
        {
            this.LabelDynamicValuesHelper = new DynamicValuesHelper(this.Label);
            this.LabelDynamicValuesHelper.Initialize(this);

            this.ToolTipDynamicValuesHelper = new DynamicValuesHelper(this.ToolTip);
            this.ToolTipDynamicValuesHelper.Initialize(this);
        }
Exemplo n.º 3
0
        protected override void OnInitialize()
        {
            this.TitleDynamicValuesHelper = new DynamicValuesHelper(this.Title);
            this.TitleDynamicValuesHelper.Initialize(this.OwnerNode);

            this.MessageDynamicValuesHelper = new DynamicValuesHelper(this.Message);
            this.MessageDynamicValuesHelper.Initialize(this.OwnerNode);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Use this method to do initializing and validation
        /// </summary>
        internal void Initialize()
        {
            this.LabelDynamicValuesHelper = new DynamicValuesHelper(this.Label);
            this.LabelDynamicValuesHelper.Initialize(this);

            this.ToolTipDynamicValuesHelper = new DynamicValuesHelper(this.ToolTip);
            this.ToolTipDynamicValuesHelper.Initialize(this);

            OnInitialize();
        }
Exemplo n.º 5
0
        /// <summary>
        /// Use this method to do initializing and validation
        /// </summary>
        internal void Initialize() 
        {
            this.LabelDynamicValuesHelper = new DynamicValuesHelper(this.Label);
            this.LabelDynamicValuesHelper.Initialize(this);

            this.ToolTipDynamicValuesHelper = new DynamicValuesHelper(this.ToolTip);
            this.ToolTipDynamicValuesHelper.Initialize(this);

            OnInitialize();
        }
Exemplo n.º 6
0
        protected override void OnInitialize()
        {
            this.UrlDynamicValuesHelper = new DynamicValuesHelper(this.Url);
            this.UrlDynamicValuesHelper.Initialize(this.OwnerNode);
            this.UrlDynamicValuesHelper.UseUrlEncode = true;

            this.ViewLabelDynamicValuesHelper = new DynamicValuesHelper(this.ViewLabel);
            this.ViewLabelDynamicValuesHelper.Initialize(this.OwnerNode);

            this.ViewToolTipDynamicValuesHelper = new DynamicValuesHelper(this.ViewToolTip);
            this.ViewToolTipDynamicValuesHelper.Initialize(this.OwnerNode);
        }
Exemplo n.º 7
0
        protected override void OnInitialize()
        {
            this.UrlDynamicValuesHelper = new DynamicValuesHelper(this.Url);
            this.UrlDynamicValuesHelper.Initialize(this.OwnerNode);
            this.UrlDynamicValuesHelper.UseUrlEncode = true;

            this.ViewLabelDynamicValuesHelper = new DynamicValuesHelper(this.ViewLabel);
            this.ViewLabelDynamicValuesHelper.Initialize(this.OwnerNode);

            this.ViewToolTipDynamicValuesHelper = new DynamicValuesHelper(this.ViewToolTip);
            this.ViewToolTipDynamicValuesHelper.Initialize(this.OwnerNode);
        }
        /// <exclude />
        public XElement ReplaceValues(DynamicValuesHelperReplaceContext context)
        {
            XElement result = new XElement(this.Element);

            foreach (XAttribute attribute in GetAttributes(result))
            {
                DynamicValuesHelper dynamicValuesHelper = _dynamicValuesHelpers[GetKeyValue(attribute)];

                string newValue = dynamicValuesHelper.ReplaceValues(context);

                attribute.SetValue(newValue);
            }

            return(result);
        }
        /// <exclude />
        public void Initialize(TreeNode ownerTreeNode)
        {
            foreach (XAttribute attribute in GetAttributes(this.Element))
            {
                string key = GetKeyValue(attribute);
                if (_dynamicValuesHelpers.ContainsKey(key))
                {
                    continue;
                }

                DynamicValuesHelper dynamicValuesHelper = new DynamicValuesHelper(attribute.Value);
                dynamicValuesHelper.Initialize(ownerTreeNode);

                _dynamicValuesHelpers.Add(key, dynamicValuesHelper);
            }
        }
        /// <exclude />
        protected override void OnInitialize()
        {
            try
            {
                FunctionTreeBuilder.Build(this.FunctionMarkup);
            }
            catch
            {
                AddValidationError("TreeValidationError.Common.WrongFunctionMarkup");
                return;
            }

            this.FunctionMarkupDynamicValuesHelper = new AttributeDynamicValuesHelper(this.FunctionMarkup);
            this.FunctionMarkupDynamicValuesHelper.Initialize(this.OwnerNode);

            this.DocumentLabelDynamicValueHelper = new DynamicValuesHelper(this.DocumentLabel);
            this.DocumentLabelDynamicValueHelper.Initialize(this.OwnerNode);
        }
Exemplo n.º 11
0
        /// <exclude />
        protected override void OnInitialize()
        {
            try
            {
                FunctionTreeBuilder.Build(this.FunctionMarkup);
            }
            catch
            {
                AddValidationError("TreeValidationError.Common.WrongFunctionMarkup");
                return;
            }            

            this.FunctionMarkupDynamicValuesHelper = new AttributeDynamicValuesHelper(this.FunctionMarkup);
            this.FunctionMarkupDynamicValuesHelper.Initialize(this.OwnerNode);

            this.DocumentLabelDynamicValueHelper = new DynamicValuesHelper(this.DocumentLabel);
            this.DocumentLabelDynamicValueHelper.Initialize(this.OwnerNode);
        }
Exemplo n.º 12
0
        /// <exclude />
        protected override void OnInitialize()
        {
            if (!typeof(IData).IsAssignableFrom(this.InterfaceType))
            {
                AddValidationError("TreeValidationError.Common.NotImplementingIData", this.InterfaceType, typeof(IData));
                return;
            }

            IEnumerable <Type> siblingInterfaceTypes = this.ParentNode.ChildNodes.Where(f => f.GetType() == typeof(DataElementsTreeNode)).Select(f => ((DataElementsTreeNode)f).InterfaceType).ToList();

            if (siblingInterfaceTypes.Count() != siblingInterfaceTypes.Distinct().Count())
            {
                AddValidationError("TreeValidationError.DataElementsTreeNode.SameInterfaceUsedTwice", this.InterfaceType);
                return;
            }


            this.KeyPropertyInfo = this.CurrentDataInterfaceType.GetKeyProperties()[0];


            foreach (ParentIdFilterNode parentIdFilterNode in this.FilterNodes.OfType <ParentIdFilterNode>())
            {
                if (this.ParentFilteringHelpers == null)
                {
                    this.ParentFilteringHelpers = new Dictionary <Type, ParentFilterHelper>();
                }

                if (this.ParentFilteringHelpers.ContainsKey(parentIdFilterNode.ParentFilterType))
                {
                    AddValidationError("TreeValidationError.DataElementsTreeNode.SameParentFilterInterfaceUsedTwice", parentIdFilterNode.ParentFilterType);
                    return;
                }

                var helper = new ParentFilterHelper
                {
                    ParentIdFilterNode           = parentIdFilterNode,
                    ParentReferencedPropertyInfo = this.InterfaceType.GetPropertiesRecursively().Single(f => f.Name == parentIdFilterNode.ReferenceFieldName),
                    ParentRefereePropertyName    = parentIdFilterNode.ParentFilterType.GetKeyProperties()[0].Name
                };

                this.ParentFilteringHelpers.Add(parentIdFilterNode.ParentFilterType, helper);
            }



            this.JoinParentIdFilterNode   = null;
            this.JoinDataElementsTreeNode = null;
            foreach (TreeNode descendantTreeNode in this.DescendantsBreadthFirst())
            {
                var dataElementTreeNode = descendantTreeNode as DataElementsTreeNode;
                if (dataElementTreeNode == null)
                {
                    continue;
                }

                ParentIdFilterNode parentIdFilterNode = dataElementTreeNode.FilterNodes.OfType <ParentIdFilterNode>()
                                                        .FirstOrDefault(f => f.ParentFilterType == this.InterfaceType);

                if (parentIdFilterNode != null)
                {
                    if (this.JoinParentIdFilterNode == null)
                    {
                        this.JoinParentIdFilterNode            = parentIdFilterNode;
                        this.JoinDataElementsTreeNode          = dataElementTreeNode;
                        this.JoinInnerKeyReferencePropertyInfo = this.JoinDataElementsTreeNode.CurrentDataInterfaceType.GetAllProperties().Single(f => f.Name == this.JoinParentIdFilterNode.ReferenceFieldName);
                    }
                    else if (this.Display != LeafDisplayMode.Lazy)
                    {
                        AddValidationError("TreeValidationError.DataElementsTreeNode.MoreThanOnParentFilterIsPointingToMe", this.InterfaceType);
                        return;
                    }
                }
            }

            if (this.Label != null)
            {
                this.LabelDynamicValuesHelper = new DynamicValuesHelper(this.Label);
                this.LabelDynamicValuesHelper.Initialize(this);
            }

            if (this.ToolTip != null)
            {
                this.ToolTipDynamicValuesHelper = new DynamicValuesHelper(this.ToolTip);
                this.ToolTipDynamicValuesHelper.Initialize(this);
            }

            if (!typeof(ILocalizedControlled).IsAssignableFrom(this.InterfaceType))
            {
                this.ShowForeignItems = false;
            }
        }
Exemplo n.º 13
0
        protected override void OnInitialize()
        {
            this.LabelDynamicValuesHelper = new DynamicValuesHelper(this.Label);
            this.LabelDynamicValuesHelper.Initialize(this);

            this.ToolTipDynamicValuesHelper = new DynamicValuesHelper(this.ToolTip);
            this.ToolTipDynamicValuesHelper.Initialize(this);
        }
Exemplo n.º 14
0
        /// <exclude />
        protected override void OnInitialize()
        {
            if (!typeof(IData).IsAssignableFrom(this.InterfaceType))
            {
                AddValidationError("TreeValidationError.Common.NotImplementingIData", this.InterfaceType, typeof(IData));
                return;
            }

            IEnumerable<Type> siblingInterfaceTypes = this.ParentNode.ChildNodes.Where(f => f.GetType() == typeof(DataElementsTreeNode)).Select(f => ((DataElementsTreeNode)f).InterfaceType).ToList();
            if (siblingInterfaceTypes.Count() != siblingInterfaceTypes.Distinct().Count())
            {
                AddValidationError("TreeValidationError.DataElementsTreeNode.SameInterfaceUsedTwice", this.InterfaceType);
                return;
            }


            this.KeyPropertyInfo = this.CurrentDataInterfaceType.GetKeyProperties()[0];


            foreach (ParentIdFilterNode parentIdFilterNode in this.FilterNodes.OfType<ParentIdFilterNode>())
            {
                if (this.ParentFilteringHelpers == null) this.ParentFilteringHelpers = new Dictionary<Type, ParentFilterHelper>();

                if (this.ParentFilteringHelpers.ContainsKey(parentIdFilterNode.ParentFilterType))
                {
                    AddValidationError("TreeValidationError.DataElementsTreeNode.SameParentFilterInterfaceUsedTwice", parentIdFilterNode.ParentFilterType);
                    return;
                }

                var helper = new ParentFilterHelper
                {
                    ParentIdFilterNode = parentIdFilterNode,
                    ParentReferencedPropertyInfo = this.InterfaceType.GetPropertiesRecursively().Single(f => f.Name == parentIdFilterNode.ReferenceFieldName),
                    ParentRefereePropertyName = parentIdFilterNode.ParentFilterType.GetKeyProperties()[0].Name
                };

                this.ParentFilteringHelpers.Add(parentIdFilterNode.ParentFilterType, helper);
            }



            this.JoinParentIdFilterNode = null;
            this.JoinDataElementsTreeNode = null;
            foreach (TreeNode descendantTreeNode in this.DescendantsBreadthFirst())
            {
                var dataElementTreeNode = descendantTreeNode as DataElementsTreeNode;
                if (dataElementTreeNode == null) continue;

                ParentIdFilterNode parentIdFilterNode = dataElementTreeNode.FilterNodes.OfType<ParentIdFilterNode>()
                                                        .FirstOrDefault(f => f.ParentFilterType == this.InterfaceType);

                if (parentIdFilterNode != null)
                {
                    if (this.JoinParentIdFilterNode == null)
                    {
                        this.JoinParentIdFilterNode = parentIdFilterNode;
                        this.JoinDataElementsTreeNode = dataElementTreeNode;
                        this.JoinInnerKeyReferencePropertyInfo = this.JoinDataElementsTreeNode.CurrentDataInterfaceType.GetAllProperties().Single(f => f.Name == this.JoinParentIdFilterNode.ReferenceFieldName);
                    }
                    else if (this.Display != LeafDisplayMode.Lazy)
                    {
                        AddValidationError("TreeValidationError.DataElementsTreeNode.MoreThanOnParentFilterIsPointingToMe", this.InterfaceType);
                        return;
                    }
                }
            }

            if (this.Label != null)
            {
                this.LabelDynamicValuesHelper = new DynamicValuesHelper(this.Label);
                this.LabelDynamicValuesHelper.Initialize(this);
            }

            if (this.ToolTip != null)
            {
                this.ToolTipDynamicValuesHelper = new DynamicValuesHelper(this.ToolTip);
                this.ToolTipDynamicValuesHelper.Initialize(this);
            }

            if (!typeof(ILocalizedControlled).IsAssignableFrom(this.InterfaceType))
            {
                this.ShowForeignItems = false;
            }
        }