Ejemplo n.º 1
0
 virtual public void SetUp() {
     t = new Tag("root");
     sk = new StackKeeper(t);
     a = new Chunk("a");
     sk.Add(a);
     b = new Chunk("b");
     sk.Add(b);
     c = new Chunk("c");
     sk.Add(c);
 }
Ejemplo n.º 2
0
        /*
         * (non-Javadoc)
         *
         * @see com.itextpdf.tool.xml.pipeline.Pipeline#close(com.itextpdf.tool
         * .xml.Tag, com.itextpdf.tool.xml.pipeline.ProcessObject)
         */
        public override IPipeline Close(IWorkerContext context, Tag t, ProcessObject po)
        {
            SvgPipelineContext hcc = (SvgPipelineContext)GetLocalContext(context);
            ITagProcessor      tp;
            IList <IElement>   elements = null;

            try {
                tp = hcc.ResolveProcessor(t.Name, t.NameSpace);

                if (tp.IsStackOwner())
                {
                    // remove the element from the StackKeeper Queue if end tag is found
                    StackKeeper tagStack;
                    try {
                        tagStack = hcc.Poll();
                    } catch (NoStackException e) {
                        throw new PipelineException(String.Format(
                                                        LocaleMessages.GetInstance().GetMessage(LocaleMessages.STACK_404), t.ToString()), e);
                    }
                    elements = tp.EndElement(context, t, tagStack.GetElements());
                }
                else
                {
                    elements = tp.EndElement(context, t, hcc.CurrentContent());
                    hcc.CurrentContent().Clear();
                }

                if (elements != null && elements.Count > 0)
                {
                    try {
                        StackKeeper stack = hcc.Peek();
                        foreach (IElement elem in elements)
                        {
                            stack.Add(elem);
                        }
                    } catch (NoStackException) {
                        //don't write definities, part of defs
                        if (!hcc.IsDefinition())
                        {
                            foreach (IElement elem in elements)
                            {
                                po.Add((IWritable)elem);
                            }
                        }
                    }
                }
            } catch (NoTagProcessorException e) {
                if (!hcc.AcceptUnknown())
                {
                    throw e;
                }
            }
            return(GetNext());
        }
Ejemplo n.º 3
0
 virtual public void SetUp()
 {
     t  = new Tag("root");
     sk = new StackKeeper(t);
     a  = new Chunk("a");
     sk.Add(a);
     b = new Chunk("b");
     sk.Add(b);
     c = new Chunk("c");
     sk.Add(c);
 }
Ejemplo n.º 4
0
 /**
  * Retrieves and removes the top of the stack.
  * @return a StackKeeper
  * @throws NoStackException if there are no elements on the stack
  */
 protected internal StackKeeper Poll()
 {
     try
     {
         StackKeeper first = this.queue.First.Value;
         this.queue.RemoveFirst();
         return(first);
     } catch (InvalidOperationException) {
         throw new NoStackException();
     }
 }
Ejemplo n.º 5
0
        /**
         * Add a {@link StackKeeper} to the top of the stack list.
         * @param stackKeeper the {@link StackKeeper}
         */

        virtual protected internal void AddFirst(StackKeeper stackKeeper)
        {
            this.queue.AddFirst(stackKeeper);

        }
Ejemplo n.º 6
0
 /**
  * Add a {@link StackKeeper} to the top of the stack list.
  * @param stackKeeper the {@link StackKeeper}
  */
 protected internal void AddFirst(StackKeeper stackKeeper)
 {
     this.queue.AddFirst(stackKeeper);
 }