예제 #1
0
        protected PageElement(
            PageElementDependencies dependencies,
            PageElement parent,
            IElement element,
            IPageData pageData)
        {
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }
            if (pageData == null)
            {
                throw new ArgumentNullException("pageData");
            }

            Dependencies = dependencies;
            Element      = element;
            Parent       = parent;

            foreach (var pageArea in element.GetPageAreas())
            {
                if (pageArea >= 0 && pageArea < PageArea.MaxValue)
                {
                    _hasPageArea[(int)pageArea] = true;
                }
            }
        }
예제 #2
0
        public PageZone(
            PageElementDependencies dependencies,
            PageElement parent,
            IRegion region,
            IElement content,
            IPageData pageData)
            : base(dependencies, parent, region, pageData)
        {
            _dataContextBuilder = pageData.BeginAddElement(Element, this);

            content = content ?? region.Content;
            var layout    = content as ILayout;
            var component = content as IComponent;

            if (layout != null)
            {
                var pageLayout = new PageLayout(dependencies, this, layout, null, pageData);
                _writeContent = pageLayout.WritePageArea;
                Children      = new PageElement[] { pageLayout };
            }
            else if (component != null)
            {
                var pageComponent = new PageComponent(dependencies, this, component, pageData);
                _writeContent = pageComponent.WritePageArea;
                Children      = new PageElement[] { pageComponent };
            }
            else
            {
                Children      = null;
                _writeContent = (rc, pa) => WriteResult.Continue();
            }

            pageData.EndAddElement(Element);
        }
예제 #3
0
        public PageLayout(
            PageElementDependencies dependencies,
            PageElement parent,
            ILayout layout,
            IEnumerable <Tuple <string, IRegion, IElement> > regionElements,
            IPageData pageData)
            : base(dependencies, parent, layout, pageData)
        {
            pageData.BeginAddElement(Element);

            _regions = dependencies.DictionaryFactory.Create <string, PageRegion>();

            var regionElementList = regionElements == null
                ? new List <Tuple <string, IRegion, IElement> >()
                : regionElements.ToList();

            foreach (var regionName in layout.GetRegionNames())
            {
                var name          = regionName;
                var regionElement = regionElementList.FirstOrDefault(
                    re => string.Equals(re.Item1, name, StringComparison.OrdinalIgnoreCase));

                var region = regionElement == null?layout.GetRegion(name) : regionElement.Item2;

                var element = regionElement == null?layout.GetElement(name) : regionElement.Item3;

                var pageRegion = new PageRegion(dependencies, this, region, element, pageData);
                _regions[regionName] = pageRegion;
            }

            Children = _regions.Values.ToArray();

            pageData.EndAddElement(Element);
        }
예제 #4
0
 public PageComponent(
     PageElementDependencies dependencies,
     PageElement parent,
     IComponent component,
     IPageData pageData)
     : base(dependencies, parent, component, pageData)
 {
 }
예제 #5
0
 public PageComponent(
     PageElementDependencies dependencies,
     PageElement parent,
     IComponent component,
     IPageData pageData)
     : base(dependencies, parent, component, pageData)
 {
     pageData.BeginAddElement(Element);
     pageData.EndAddElement(Element);
 }