Repository: wicket
Updated Branches:
  refs/heads/master ff5aa63dd -> b60ec64d0


WICKET-5732 Tab formatting, no functional change.

Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/b60ec64d
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/b60ec64d
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/b60ec64d

Branch: refs/heads/master
Commit: b60ec64d0b50a611a9549809c9ab216f0ffa3ae3
Parents: 7acfbff
Author: Andrea Del Bene <[email protected]>
Authored: Tue Oct 28 14:22:51 2014 +0100
Committer: Andrea Del Bene <[email protected]>
Committed: Fri Oct 31 17:40:26 2014 +0100

----------------------------------------------------------------------
 .../java/org/apache/wicket/DequeueContext.java  | 486 +++++++++----------
 1 file changed, 243 insertions(+), 243 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/b60ec64d/wicket-core/src/main/java/org/apache/wicket/DequeueContext.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/DequeueContext.java 
b/wicket-core/src/main/java/org/apache/wicket/DequeueContext.java
index b3071e9..92c66f9 100644
--- a/wicket-core/src/main/java/org/apache/wicket/DequeueContext.java
+++ b/wicket-core/src/main/java/org/apache/wicket/DequeueContext.java
@@ -29,273 +29,273 @@ import org.apache.wicket.util.collections.ArrayListStack;
  */
 public final class DequeueContext
 {
-    private final IMarkupFragment markup;
-    private int index;
-    private ComponentTag next;
-    private ArrayListStack<ComponentTag> tags = new ArrayListStack<>();
-    private final boolean skipFirst;
-    private ComponentTag first;
+       private final IMarkupFragment markup;
+       private int index;
+       private ComponentTag next;
+       private ArrayListStack<ComponentTag> tags = new ArrayListStack<>();
+       private final boolean skipFirst;
+       private ComponentTag first;
 
-    private ArrayListStack<MarkupContainer> containers = new 
ArrayListStack<>();
+       private ArrayListStack<MarkupContainer> containers = new 
ArrayListStack<>();
 
-    /** A bookmark for the DequeueContext stack */
-    public static final class Bookmark
-    {
-        private final int index;
-        private final ComponentTag next;
-        private final ArrayListStack<ComponentTag> tags;
-        private final ArrayListStack<MarkupContainer> containers;
+       /** A bookmark for the DequeueContext stack */
+       public static final class Bookmark
+       {
+               private final int index;
+               private final ComponentTag next;
+               private final ArrayListStack<ComponentTag> tags;
+               private final ArrayListStack<MarkupContainer> containers;
 
-        private Bookmark(DequeueContext parser)
-        {
-            this.index = parser.index;
-            this.next = parser.next;
-            this.tags = new ArrayListStack<>(parser.tags);
-            this.containers = new ArrayListStack<>(parser.containers);
-        }
+               private Bookmark(DequeueContext parser)
+               {
+                       this.index = parser.index;
+                       this.next = parser.next;
+                       this.tags = new ArrayListStack<>(parser.tags);
+                       this.containers = new 
ArrayListStack<>(parser.containers);
+               }
 
-        private void restore(DequeueContext parser)
-        {
-            parser.index = index;
-            parser.next = next;
-            parser.tags = new ArrayListStack<>(tags);
-            parser.containers = new ArrayListStack<>(containers);
-        }
-    }
+               private void restore(DequeueContext parser)
+               {
+                       parser.index = index;
+                       parser.next = next;
+                       parser.tags = new ArrayListStack<>(tags);
+                       parser.containers = new ArrayListStack<>(containers);
+               }
+       }
 
-    public DequeueContext(IMarkupFragment markup, MarkupContainer root, 
boolean skipFirst)
-    {
-        this.markup = markup;
-        this.skipFirst = skipFirst;
-        this.containers.push(root);
-        this.next = nextTag();
-    }
-    
-    /**
-     * Saves the state of the context into a bookmark which can later be used 
to restore it.
-     */
-    public Bookmark save()
-    {
-        return new Bookmark(this);
-    }
+       public DequeueContext(IMarkupFragment markup, MarkupContainer root, 
boolean skipFirst)
+       {
+               this.markup = markup;
+               this.skipFirst = skipFirst;
+               this.containers.push(root);
+               this.next = nextTag();
+       }
 
-    /**
-     * Restores the state of the context from the bookmark
-     * 
-     * @param bookmark
-     */
-    public void restore(Bookmark bookmark)
-    {
-        bookmark.restore(this);
-    }
+       /**
+        * Saves the state of the context into a bookmark which can later be 
used to restore it.
+        */
+       public Bookmark save()
+       {
+               return new Bookmark(this);
+       }
 
-    /**
-     * Peeks markup tag that would be retrieved by call to {@link #takeTag()}
-     * 
-     * @return
-     */
-    public ComponentTag peekTag()
-    {
-        return next;
-    }
+       /**
+        * Restores the state of the context from the bookmark
+        * 
+        * @param bookmark
+        */
+       public void restore(Bookmark bookmark)
+       {
+               bookmark.restore(this);
+       }
 
-    /**
-     * Retrieves the next markup tag
-     * 
-     * @return
-     */
-    public ComponentTag takeTag()
-    {
-        ComponentTag taken = next;
+       /**
+        * Peeks markup tag that would be retrieved by call to {@link 
#takeTag()}
+        * 
+        * @return
+        */
+       public ComponentTag peekTag()
+       {
+               return next;
+       }
 
-        if (taken == null)
-        {
-            return null;
-        }
+       /**
+        * Retrieves the next markup tag
+        * 
+        * @return
+        */
+       public ComponentTag takeTag()
+       {
+               ComponentTag taken = next;
 
-        if (taken.isOpen() && !taken.hasNoCloseTag())
-        {
-            tags.push(taken);
-        }
-        else if (tags.size() > 0 && taken.closes(tags.peek()))
-        {
-            tags.pop();
-        }
-        next = nextTag();
-        return taken;
-    }
+               if (taken == null)
+               {
+                       return null;
+               }
 
-    /**
-     * Skips to the closing tag of the tag retrieved from last call to {@link 
#takeTag()}
-     */
-    public void skipToCloseTag()
-    {
-        while (!next.closes(tags.peek()))
-        {
-            next = nextTag();
-        }
-    }
+               if (taken.isOpen() && !taken.hasNoCloseTag())
+               {
+                       tags.push(taken);
+               }
+               else if (tags.size() > 0 && taken.closes(tags.peek()))
+               {
+                       tags.pop();
+               }
+               next = nextTag();
+               return taken;
+       }
 
-    private ComponentTag nextTag()
-    {
-        if (skipFirst && first == null)
-        {
-            for (; index < markup.size(); index++)
-            {
-                MarkupElement element = markup.get(index);
-                if (element instanceof ComponentTag)
-                {
-                    first = (ComponentTag)element;
-                    index++;
-                    break;
-                }
-            }
-        }
+       /**
+        * Skips to the closing tag of the tag retrieved from last call to 
{@link #takeTag()}
+        */
+       public void skipToCloseTag()
+       {
+               while (!next.closes(tags.peek()))
+               {
+                       next = nextTag();
+               }
+       }
 
-        for (; index < markup.size(); index++)
-        {
-            MarkupElement element = markup.get(index);
-            if (element instanceof ComponentTag)
-            {
-                ComponentTag tag = (ComponentTag)element;
+       private ComponentTag nextTag()
+       {
+               if (skipFirst && first == null)
+               {
+                       for (; index < markup.size(); index++)
+                       {
+                               MarkupElement element = markup.get(index);
+                               if (element instanceof ComponentTag)
+                               {
+                                       first = (ComponentTag)element;
+                                       index++;
+                                       break;
+                               }
+                       }
+               }
 
-                if (tag.isOpen() || tag.isOpenClose())
-                {
-                    DequeueTagAction action = canDequeueTag(tag);
-                    switch (action)
-                    {
-                        case IGNORE :
-                            continue;
-                        case DEQUEUE :
-                            index++;
-                            return tag;
-                        case SKIP : // skip to close tag
-                            boolean found = false;
-                            for (; index < markup.size(); index++)
-                            {
-                                if ((markup.get(index) instanceof ComponentTag)
-                                    && markup.get(index).closes(tag))
-                                {
-                                    found = true;
-                                    break;
-                                }
-                            }
-                            if (!found)
-                            {
-                                throw new IllegalStateException(String.format(
-                                    "Could not find close tag for tag '%s' in 
markup: %s ", tag,
-                                    markup));
-                            }
+               for (; index < markup.size(); index++)
+               {
+                       MarkupElement element = markup.get(index);
+                       if (element instanceof ComponentTag)
+                       {
+                               ComponentTag tag = (ComponentTag)element;
 
-                    }
-                }
-                else
-                {
-                    // closed tag
-                    ComponentTag open = tag.isClose() ? tag.getOpenTag() : tag;
+                               if (tag.isOpen() || tag.isOpenClose())
+                               {
+                                       DequeueTagAction action = 
canDequeueTag(tag);
+                                       switch (action)
+                                       {
+                                               case IGNORE :
+                                                       continue;
+                                               case DEQUEUE :
+                                                       index++;
+                                                       return tag;
+                                               case SKIP : // skip to close tag
+                                                       boolean found = false;
+                                                       for (; index < 
markup.size(); index++)
+                                                       {
+                                                               if 
((markup.get(index) instanceof ComponentTag)
+                                                                       && 
markup.get(index).closes(tag))
+                                                               {
+                                                                       found = 
true;
+                                                                       break;
+                                                               }
+                                                       }
+                                                       if (!found)
+                                                       {
+                                                               throw new 
IllegalStateException(String.format(
+                                                                       "Could 
not find close tag for tag '%s' in markup: %s ", tag,
+                                                                       
markup));
+                                                       }
 
-                    if (skipFirst && first != null && open == first)
-                    {
-                        continue;
-                    }
+                                       }
+                               }
+                               else
+                               {
+                                       // closed tag
+                                       ComponentTag open = tag.isClose() ? 
tag.getOpenTag() : tag;
 
-                    switch (canDequeueTag(open))
-                    {
-                        case DEQUEUE :
-                            index++;
-                            return tag;
-                        case IGNORE :
-                            continue;
-                        case SKIP :
-                            throw new IllegalStateException(String.format(
-                                "Should not see closed tag of skipped open tag 
'%s' in markup:%s",
-                                tag, markup));
-                    }
-                }
-            }
-        }
-        return null;
-    }
+                                       if (skipFirst && first != null && open 
== first)
+                                       {
+                                               continue;
+                                       }
 
-    private DequeueTagAction canDequeueTag(ComponentTag open)
-    {
-        if (containers.size() < 1)
-        {
-            // TODO queueing message: called too early
-            throw new IllegalStateException();
-        }
+                                       switch (canDequeueTag(open))
+                                       {
+                                               case DEQUEUE :
+                                                       index++;
+                                                       return tag;
+                                               case IGNORE :
+                                                       continue;
+                                               case SKIP :
+                                                       throw new 
IllegalStateException(String.format(
+                                                               "Should not see 
closed tag of skipped open tag '%s' in markup:%s",
+                                                               tag, markup));
+                                       }
+                               }
+                       }
+               }
+               return null;
+       }
 
-        DequeueTagAction action;
-        for (int i = containers.size() - 1; i >= 0; i--)
-        {
-            action = containers.get(i).canDequeueTag((open));
-            if (action != null)
-            {
-                return action;
-            }
-        }
-        return DequeueTagAction.IGNORE;
-    }
+       private DequeueTagAction canDequeueTag(ComponentTag open)
+       {
+               if (containers.size() < 1)
+               {
+                       // TODO queueing message: called too early
+                       throw new IllegalStateException();
+               }
 
-    /**
-     * Checks if the tag returned by {@link #peekTag()} is either open or 
open-close.
-     * 
-     * @return
-     */
-    public boolean isAtOpenOrOpenCloseTag()
-    {
-        ComponentTag tag = peekTag();
-        return tag != null && (tag.isOpen() || tag.isOpenClose());
-    }
+               DequeueTagAction action;
+               for (int i = containers.size() - 1; i >= 0; i--)
+               {
+                       action = containers.get(i).canDequeueTag((open));
+                       if (action != null)
+                       {
+                               return action;
+                       }
+               }
+               return DequeueTagAction.IGNORE;
+       }
 
-    /**
-     * Retrieves the container on the top of the containers stack
-     * 
-     * @return
-     */
-    public MarkupContainer peekContainer()
-    {
-        return containers.peek();
-    }
+       /**
+        * Checks if the tag returned by {@link #peekTag()} is either open or 
open-close.
+        * 
+        * @return
+        */
+       public boolean isAtOpenOrOpenCloseTag()
+       {
+               ComponentTag tag = peekTag();
+               return tag != null && (tag.isOpen() || tag.isOpenClose());
+       }
 
-    /**
-     * Pushes a container onto the container stack
-     * 
-     * @param container
-     */
-    public void pushContainer(MarkupContainer container)
-    {
-        containers.push(container);
-    }
+       /**
+        * Retrieves the container on the top of the containers stack
+        * 
+        * @return
+        */
+       public MarkupContainer peekContainer()
+       {
+               return containers.peek();
+       }
 
-    /**
-     * Pops a container from the container stack
-     * 
-     * @return
-     */
-    public MarkupContainer popContainer()
-    {
-        return containers.pop();
-    }
+       /**
+        * Pushes a container onto the container stack
+        * 
+        * @param container
+        */
+       public void pushContainer(MarkupContainer container)
+       {
+               containers.push(container);
+       }
 
-    /**
+       /**
+        * Pops a container from the container stack
+        * 
+        * @return
+        */
+       public MarkupContainer popContainer()
+       {
+               return containers.pop();
+       }
+
+       /**
         * Searches the container stack for a component that can be dequeude
-     * 
-     * @param tag
-     * @return
-     */
-    public Component findComponentToDequeue(ComponentTag tag)
-    {
-        for (int j = containers.size() - 1; j >= 0; j--)
-        {
-            MarkupContainer container = containers.get(j);
-            Component child = container.findComponentToDequeue(tag);
-            if (child != null)
-            {
-                return child;
-            }
-        }
-        return null;
-    }
+        * 
+        * @param tag
+        * @return
+        */
+       public Component findComponentToDequeue(ComponentTag tag)
+       {
+               for (int j = containers.size() - 1; j >= 0; j--)
+               {
+                       MarkupContainer container = containers.get(j);
+                       Component child = container.findComponentToDequeue(tag);
+                       if (child != null)
+                       {
+                               return child;
+                       }
+               }
+               return null;
+       }
 
 }

Reply via email to