AddFirst() protected method

protected AddFirst ( StackKeeper stackKeeper ) : void
stackKeeper StackKeeper
return void
コード例 #1
0
 protected virtual void AddStackKeeper(Tag t, HtmlPipelineContext hcc, ITagProcessor tp)
 {
     if (tp.IsStackOwner())
     {
         hcc.AddFirst(new StackKeeper(t));
     }
 }
コード例 #2
0
        /*
         * (non-Javadoc)
         *
         * @see
         * com.itextpdf.tool.xml.pipeline.IPipeline#open(com.itextpdf.tool.
         * xml.Tag, com.itextpdf.tool.xml.pipeline.ProcessObject)
         */
        public override IPipeline Open(IWorkerContext context, Tag t, ProcessObject po)
        {
            HtmlPipelineContext hcc = (HtmlPipelineContext)GetLocalContext(context);

            try {
                Object lastMarginBottom = null;
                if (hcc.GetMemory().TryGetValue(HtmlPipelineContext.LAST_MARGIN_BOTTOM, out lastMarginBottom))
                {
                    t.LastMarginBottom = lastMarginBottom;
                    hcc.GetMemory().Remove(HtmlPipelineContext.LAST_MARGIN_BOTTOM);
                }
                ITagProcessor tp = hcc.ResolveProcessor(t.Name, t.NameSpace);
                if (tp.IsStackOwner())
                {
                    hcc.AddFirst(new StackKeeper(t));
                }
                IList <IElement> content = tp.StartElement(context, t);
                if (content.Count > 0)
                {
                    if (tp.IsStackOwner())
                    {
                        StackKeeper peek;
                        try {
                            peek = hcc.Peek();
                            foreach (IElement elem in content)
                            {
                                peek.Add(elem);
                            }
                        } catch (NoStackException e) {
                            throw new PipelineException(String.Format(LocaleMessages.STACK_404, t.ToString()), e);
                        }
                    }
                    else
                    {
                        foreach (IElement elem in content)
                        {
                            hcc.CurrentContent().Add(elem);
                            if (elem.Type == Element.BODY)
                            {
                                WritableElement writableElement = new WritableElement();
                                writableElement.Add(elem);
                                po.Add(writableElement);
                                hcc.CurrentContent().Remove(elem);
                            }
                        }
                    }
                }
            } catch (NoTagProcessorException e) {
                if (!hcc.AcceptUnknown())
                {
                    throw e;
                }
            }
            return(GetNext());
        }
コード例 #3
0
        /*
         * (non-Javadoc)
         *
         * @see
         * com.itextpdf.tool.xml.pipeline.IPipeline#open(com.itextpdf.tool.
         * xml.Tag, com.itextpdf.tool.xml.pipeline.ProcessObject)
         */
        public override IPipeline Open(IWorkerContext context, Tag t, ProcessObject po)
        {
            HtmlPipelineContext hcc = (HtmlPipelineContext)GetLocalContext(context);

            try {
                ITagProcessor tp = hcc.ResolveProcessor(t.Name, t.NameSpace);
                if (tp.IsStackOwner())
                {
                    hcc.AddFirst(new StackKeeper(t));
                }
                IList <IElement> content = tp.StartElement(context, t);
                if (content.Count > 0)
                {
                    if (tp.IsStackOwner())
                    {
                        StackKeeper peek;
                        try {
                            peek = hcc.Peek();
                            foreach (IElement elem in content)
                            {
                                peek.Add(elem);
                            }
                        } catch (NoStackException e) {
                            throw new PipelineException(String.Format(LocaleMessages.STACK_404, t.ToString()), e);
                        }
                    }
                    else
                    {
                        foreach (IElement elem in content)
                        {
                            hcc.CurrentContent().Add(elem);
                        }
                    }
                }
            } catch (NoTagProcessorException e) {
                if (!hcc.AcceptUnknown())
                {
                    throw e;
                }
            }
            return(GetNext());
        }
コード例 #4
0
ファイル: HtmlPipeline.cs プロジェクト: newlysoft/itextsharp
 protected virtual void AddStackKeeper(Tag t, HtmlPipelineContext hcc, ITagProcessor tp)
 {
     if (tp.IsStackOwner())
         hcc.AddFirst(new StackKeeper(t));
 }