You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Martin Grigorov <mg...@apache.org> on 2014/02/25 12:56:03 UTC

Re: [1/2] git commit: WICKET-3335 fragment and wicket:container support

On Mon, Feb 24, 2014 at 9:09 PM, <iv...@apache.org> wrote:

> Repository: wicket
> Updated Branches:
>   refs/heads/master a79ed51e9 -> cc5d56a50
>
>
> WICKET-3335 fragment and wicket:container support
>
>
> Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
> Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/61b01295
> Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/61b01295
> Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/61b01295
>
> Branch: refs/heads/master
> Commit: 61b01295d0d52929178d058d48456cae4acbc3e7
> Parents: a79ed51
> Author: Igor Vaynberg <ig...@gmail.com>
> Authored: Mon Feb 24 11:09:12 2014 -0800
> Committer: Igor Vaynberg <ig...@gmail.com>
> Committed: Mon Feb 24 11:09:12 2014 -0800
>
> ----------------------------------------------------------------------
>  .../java/org/apache/wicket/MarkupContainer.java |  4 ++
>  .../wicket/markup/html/panel/Fragment.java      | 10 +++-
>  .../wicket/queueing/ComponentQueueingTest.java  | 53 ++++++++++++++++----
>  3 files changed, 56 insertions(+), 11 deletions(-)
> ----------------------------------------------------------------------
>
>
>
> http://git-wip-us.apache.org/repos/asf/wicket/blob/61b01295/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java
> ----------------------------------------------------------------------
> diff --git
> a/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java
> b/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java
> index 087d655..1aba865 100644
> --- a/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java
> +++ b/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java
> @@ -2169,6 +2169,10 @@ public abstract class MarkupContainer extends
> Component implements Iterable<Comp
>                 if (tag instanceof WicketTag)
>                 {
>                         WicketTag wicketTag = (WicketTag)tag;
> +                       if (wicketTag.isContainerTag())
> +                       {
> +                               return true;
> +                       }
>                         if (wicketTag.getAutoComponentFactory() != null)
>                         {
>                                 return true;
>
>
> http://git-wip-us.apache.org/repos/asf/wicket/blob/61b01295/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/Fragment.java
> ----------------------------------------------------------------------
> diff --git
> a/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/Fragment.java
> b/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/Fragment.java
> index 078aa44..676cca5 100644
> ---
> a/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/Fragment.java
> +++
> b/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/Fragment.java
> @@ -17,8 +17,12 @@
>  package org.apache.wicket.markup.html.panel;
>
>  import org.apache.wicket.Component;
> +import org.apache.wicket.IQueueRegion;
>  import org.apache.wicket.MarkupContainer;
>  import org.apache.wicket.markup.IMarkupFragment;
> +import org.apache.wicket.markup.MarkupElement;
> +import org.apache.wicket.markup.MarkupFragment;
> +import org.apache.wicket.markup.WicketTag;
>  import org.apache.wicket.markup.html.WebMarkupContainer;
>  import org.apache.wicket.model.IModel;
>  import org.apache.wicket.util.lang.Args;
> @@ -46,7 +50,7 @@ import org.apache.wicket.util.lang.Args;
>   *
>   * @author Juergen Donnerstag
>   */
> -public class Fragment extends WebMarkupContainer
> +public class Fragment extends WebMarkupContainer implements IQueueRegion
>  {
>         private static final long serialVersionUID = 1L;
>
> @@ -130,4 +134,8 @@ public class Fragment extends WebMarkupContainer
>                 return associatedMarkupId;
>         }
>
>


> +       @Override
> +       public IMarkupFragment getDequeueMarkup() {
> +               return newMarkupSourcingStrategy().getMarkup(this, null);
>

Is it important to use "newMarkupSourcingStrategy()" here ?
Can we use org.apache.wicket.Component#getMarkupSourcingStrategy() ?



> +       }
>  }
>
>
> http://git-wip-us.apache.org/repos/asf/wicket/blob/61b01295/wicket-core/src/test/java/org/apache/wicket/queueing/ComponentQueueingTest.java
> ----------------------------------------------------------------------
> diff --git
> a/wicket-core/src/test/java/org/apache/wicket/queueing/ComponentQueueingTest.java
> b/wicket-core/src/test/java/org/apache/wicket/queueing/ComponentQueueingTest.java
> index 34f1317..96f0c77 100644
> ---
> a/wicket-core/src/test/java/org/apache/wicket/queueing/ComponentQueueingTest.java
> +++
> b/wicket-core/src/test/java/org/apache/wicket/queueing/ComponentQueueingTest.java
> @@ -33,6 +33,7 @@ import org.apache.wicket.markup.html.internal.Enclosure;
>  import org.apache.wicket.markup.html.link.Link;
>  import org.apache.wicket.markup.html.list.ListItem;
>  import org.apache.wicket.markup.html.list.ListView;
> +import org.apache.wicket.markup.html.panel.Fragment;
>  import org.apache.wicket.markup.html.panel.Panel;
>  import org.apache.wicket.model.Model;
>  import org.apache.wicket.queueing.nestedborders.InnerBorder;
> @@ -205,7 +206,7 @@ public class ComponentQueueingTest extends
> WicketTestCase
>
>         /** {@code [a,q[r,s]] - > [a[q[r[s]]]] } */
>         @Test
> -       public void dequeueWithPanel1()
> +       public void panel1()
>         {
>                 MarkupContainer a = new A(), r = new R(), s = new S();
>
> @@ -225,7 +226,7 @@ public class ComponentQueueingTest extends
> WicketTestCase
>
>         /** panel has leading markup */
>         @Test
> -       public void dequeueWithPanel2()
> +       public void panel2()
>         {
>                 MarkupContainer r = new R();
>
> @@ -244,7 +245,7 @@ public class ComponentQueueingTest extends
> WicketTestCase
>
>         /** panel with a static header section */
>         @Test
> -       public void dequeueWithPanel3()
> +       public void panel3()
>         {
>                 MarkupContainer r = new R();
>
> @@ -267,7 +268,7 @@ public class ComponentQueueingTest extends
> WicketTestCase
>          * test with inner panels
>          */
>         @Test
> -       public void dequeueWithNestedPanels()
> +       public void nestedPanels()
>         {
>                 MarkupContainer r = new R(), s = new S();
>
> @@ -291,7 +292,7 @@ public class ComponentQueueingTest extends
> WicketTestCase
>         }
>
>         @Test
> -       public void dequeueWithRepeater1()
> +       public void repeater1()
>         {
>                 TestPage p = new TestPage();
>                 p.setPageMarkup("<p wicket:id='lv'><p wicket:id='b'><p
> wicket:id='c'></p></p></p>");
> @@ -318,7 +319,7 @@ public class ComponentQueueingTest extends
> WicketTestCase
>
>         /** repeater */
>         @Test
> -       public void dequeueWithRepeater2()
> +       public void repeater2()
>         {
>                 TestPage p = new TestPage();
>                 p.setPageMarkup("<p wicket:id='a'><p wicket:id='lv'><p
> wicket:id='b'><p wicket:id='c'></p></p></p></p>");
> @@ -346,7 +347,7 @@ public class ComponentQueueingTest extends
> WicketTestCase
>
>         /** repeater with a panel inside */
>         @Test
> -       public void dequeueWithRepeater3()
> +       public void repeater3()
>         {
>                 TestPage p = new TestPage();
>                 p.setPageMarkup("<p wicket:id='a'><p wicket:id='lv'><p
> wicket:id='b'><p wicket:id='q'></p></p></p></p>");
> @@ -378,7 +379,7 @@ public class ComponentQueueingTest extends
> WicketTestCase
>
>         /** dequeue, then rerender the page instance after a callback is
> executed */
>         @Test
> -       public void dequeueWithCallback()
> +       public void callback()
>         {
>                 TestPage p = new TestPage();
>                 p.setPageMarkup("<p wicket:id='a'><a wicket:id='l'><p
> wicket:id='b'></p></a></p>");
> @@ -578,7 +579,7 @@ public class ComponentQueueingTest extends
> WicketTestCase
>         }
>
>         @Test
> -       public void dequeueWithBorder1()
> +       public void border1()
>         {
>                 MarkupContainer a = new A(), b = new B(), r = new R(), s =
> new S();
>
> @@ -599,7 +600,7 @@ public class ComponentQueueingTest extends
> WicketTestCase
>
>
>         @Test
> -       public void dequeueWithNestedBorders()
> +       public void nestedBorders()
>         {
>                 MarkupContainer a = new A(), b = new B(), c= new C(), d =
> new D(), r = new R(), s = new S();
>
> @@ -625,6 +626,38 @@ public class ComponentQueueingTest extends
> WicketTestCase
>                 assertThat(p, hasPath(new Path(a, outerBorder, r,
> outerBorder.getBodyContainer(), b)));
>         }
>
> +       @Test
> +       public void fragment1() {
> +               MarkupContainer a = new A(), b = new B(), r = new R(), s =
> new S();
> +
> +               TestPage page = new TestPage();
> +               page.setPageMarkup("<a wicket:id='a'></a><f
> wicket:id='fragment'></f><b wicket:id='b'></b>"
> +                       + "<wicket:fragment wicket:id='f'><r
> wicket:id='r'></r><s wicket:id='s'></s></wicket:fragment>");
> +
> +               Fragment fragment = new Fragment("fragment", "f", page);
> +
> +               fragment.queue(r, s);
> +               page.queue(a, b, fragment);
> +
> +               assertThat(page, hasPath(new Path(a)));
> +               assertThat(page, hasPath(new Path(b)));
> +               assertThat(page, hasPath(new Path(fragment, r)));
> +               assertThat(page, hasPath(new Path(fragment, s)));
> +       }
> +
> +       @Test
> +       public void containerTag1()
> +       {
> +               MarkupContainer a = new A(), b = new B();
> +
> +               TestPage page = new TestPage();
> +               page.setPageMarkup("<wicket:container wicket:id='a'><b
> wicket:id='b'></b></wicket:container>");
> +
> +               page.queue(a, b);
> +
> +               assertThat(page, hasPath(new Path(a, b)));
> +       }
> +
>         private static class A extends WebMarkupContainer
>         {
>                 public A()
>
>

Re: [1/2] git commit: WICKET-3335 fragment and wicket:container support

Posted by Igor Vaynberg <ig...@gmail.com>.
no, its not. will fix...thanks for catching

-igor


On Tue, Feb 25, 2014 at 3:56 AM, Martin Grigorov <mg...@apache.org> wrote:
>
>
>
> On Mon, Feb 24, 2014 at 9:09 PM, <iv...@apache.org> wrote:
>>
>> Repository: wicket
>> Updated Branches:
>>   refs/heads/master a79ed51e9 -> cc5d56a50
>>
>>
>> WICKET-3335 fragment and wicket:container support
>>
>>
>> Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
>> Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/61b01295
>> Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/61b01295
>> Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/61b01295
>>
>> Branch: refs/heads/master
>> Commit: 61b01295d0d52929178d058d48456cae4acbc3e7
>> Parents: a79ed51
>> Author: Igor Vaynberg <ig...@gmail.com>
>> Authored: Mon Feb 24 11:09:12 2014 -0800
>> Committer: Igor Vaynberg <ig...@gmail.com>
>> Committed: Mon Feb 24 11:09:12 2014 -0800
>>
>> ----------------------------------------------------------------------
>>  .../java/org/apache/wicket/MarkupContainer.java |  4 ++
>>  .../wicket/markup/html/panel/Fragment.java      | 10 +++-
>>  .../wicket/queueing/ComponentQueueingTest.java  | 53 ++++++++++++++++----
>>  3 files changed, 56 insertions(+), 11 deletions(-)
>> ----------------------------------------------------------------------
>>
>>
>>
>> http://git-wip-us.apache.org/repos/asf/wicket/blob/61b01295/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java
>> ----------------------------------------------------------------------
>> diff --git
>> a/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java
>> b/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java
>> index 087d655..1aba865 100644
>> --- a/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java
>> +++ b/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java
>> @@ -2169,6 +2169,10 @@ public abstract class MarkupContainer extends
>> Component implements Iterable<Comp
>>                 if (tag instanceof WicketTag)
>>                 {
>>                         WicketTag wicketTag = (WicketTag)tag;
>> +                       if (wicketTag.isContainerTag())
>> +                       {
>> +                               return true;
>> +                       }
>>                         if (wicketTag.getAutoComponentFactory() != null)
>>                         {
>>                                 return true;
>>
>>
>> http://git-wip-us.apache.org/repos/asf/wicket/blob/61b01295/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/Fragment.java
>> ----------------------------------------------------------------------
>> diff --git
>> a/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/Fragment.java
>> b/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/Fragment.java
>> index 078aa44..676cca5 100644
>> ---
>> a/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/Fragment.java
>> +++
>> b/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/Fragment.java
>> @@ -17,8 +17,12 @@
>>  package org.apache.wicket.markup.html.panel;
>>
>>  import org.apache.wicket.Component;
>> +import org.apache.wicket.IQueueRegion;
>>  import org.apache.wicket.MarkupContainer;
>>  import org.apache.wicket.markup.IMarkupFragment;
>> +import org.apache.wicket.markup.MarkupElement;
>> +import org.apache.wicket.markup.MarkupFragment;
>> +import org.apache.wicket.markup.WicketTag;
>>  import org.apache.wicket.markup.html.WebMarkupContainer;
>>  import org.apache.wicket.model.IModel;
>>  import org.apache.wicket.util.lang.Args;
>> @@ -46,7 +50,7 @@ import org.apache.wicket.util.lang.Args;
>>   *
>>   * @author Juergen Donnerstag
>>   */
>> -public class Fragment extends WebMarkupContainer
>> +public class Fragment extends WebMarkupContainer implements IQueueRegion
>>  {
>>         private static final long serialVersionUID = 1L;
>>
>> @@ -130,4 +134,8 @@ public class Fragment extends WebMarkupContainer
>>                 return associatedMarkupId;
>>         }
>>
>
>
>>
>> +       @Override
>> +       public IMarkupFragment getDequeueMarkup() {
>> +               return newMarkupSourcingStrategy().getMarkup(this, null);
>
>
> Is it important to use "newMarkupSourcingStrategy()" here ?
> Can we use org.apache.wicket.Component#getMarkupSourcingStrategy() ?
>
>
>>
>> +       }
>>  }
>>
>>
>> http://git-wip-us.apache.org/repos/asf/wicket/blob/61b01295/wicket-core/src/test/java/org/apache/wicket/queueing/ComponentQueueingTest.java
>> ----------------------------------------------------------------------
>> diff --git
>> a/wicket-core/src/test/java/org/apache/wicket/queueing/ComponentQueueingTest.java
>> b/wicket-core/src/test/java/org/apache/wicket/queueing/ComponentQueueingTest.java
>> index 34f1317..96f0c77 100644
>> ---
>> a/wicket-core/src/test/java/org/apache/wicket/queueing/ComponentQueueingTest.java
>> +++
>> b/wicket-core/src/test/java/org/apache/wicket/queueing/ComponentQueueingTest.java
>> @@ -33,6 +33,7 @@ import org.apache.wicket.markup.html.internal.Enclosure;
>>  import org.apache.wicket.markup.html.link.Link;
>>  import org.apache.wicket.markup.html.list.ListItem;
>>  import org.apache.wicket.markup.html.list.ListView;
>> +import org.apache.wicket.markup.html.panel.Fragment;
>>  import org.apache.wicket.markup.html.panel.Panel;
>>  import org.apache.wicket.model.Model;
>>  import org.apache.wicket.queueing.nestedborders.InnerBorder;
>> @@ -205,7 +206,7 @@ public class ComponentQueueingTest extends
>> WicketTestCase
>>
>>         /** {@code [a,q[r,s]] - > [a[q[r[s]]]] } */
>>         @Test
>> -       public void dequeueWithPanel1()
>> +       public void panel1()
>>         {
>>                 MarkupContainer a = new A(), r = new R(), s = new S();
>>
>> @@ -225,7 +226,7 @@ public class ComponentQueueingTest extends
>> WicketTestCase
>>
>>         /** panel has leading markup */
>>         @Test
>> -       public void dequeueWithPanel2()
>> +       public void panel2()
>>         {
>>                 MarkupContainer r = new R();
>>
>> @@ -244,7 +245,7 @@ public class ComponentQueueingTest extends
>> WicketTestCase
>>
>>         /** panel with a static header section */
>>         @Test
>> -       public void dequeueWithPanel3()
>> +       public void panel3()
>>         {
>>                 MarkupContainer r = new R();
>>
>> @@ -267,7 +268,7 @@ public class ComponentQueueingTest extends
>> WicketTestCase
>>          * test with inner panels
>>          */
>>         @Test
>> -       public void dequeueWithNestedPanels()
>> +       public void nestedPanels()
>>         {
>>                 MarkupContainer r = new R(), s = new S();
>>
>> @@ -291,7 +292,7 @@ public class ComponentQueueingTest extends
>> WicketTestCase
>>         }
>>
>>         @Test
>> -       public void dequeueWithRepeater1()
>> +       public void repeater1()
>>         {
>>                 TestPage p = new TestPage();
>>                 p.setPageMarkup("<p wicket:id='lv'><p wicket:id='b'><p
>> wicket:id='c'></p></p></p>");
>> @@ -318,7 +319,7 @@ public class ComponentQueueingTest extends
>> WicketTestCase
>>
>>         /** repeater */
>>         @Test
>> -       public void dequeueWithRepeater2()
>> +       public void repeater2()
>>         {
>>                 TestPage p = new TestPage();
>>                 p.setPageMarkup("<p wicket:id='a'><p wicket:id='lv'><p
>> wicket:id='b'><p wicket:id='c'></p></p></p></p>");
>> @@ -346,7 +347,7 @@ public class ComponentQueueingTest extends
>> WicketTestCase
>>
>>         /** repeater with a panel inside */
>>         @Test
>> -       public void dequeueWithRepeater3()
>> +       public void repeater3()
>>         {
>>                 TestPage p = new TestPage();
>>                 p.setPageMarkup("<p wicket:id='a'><p wicket:id='lv'><p
>> wicket:id='b'><p wicket:id='q'></p></p></p></p>");
>> @@ -378,7 +379,7 @@ public class ComponentQueueingTest extends
>> WicketTestCase
>>
>>         /** dequeue, then rerender the page instance after a callback is
>> executed */
>>         @Test
>> -       public void dequeueWithCallback()
>> +       public void callback()
>>         {
>>                 TestPage p = new TestPage();
>>                 p.setPageMarkup("<p wicket:id='a'><a wicket:id='l'><p
>> wicket:id='b'></p></a></p>");
>> @@ -578,7 +579,7 @@ public class ComponentQueueingTest extends
>> WicketTestCase
>>         }
>>
>>         @Test
>> -       public void dequeueWithBorder1()
>> +       public void border1()
>>         {
>>                 MarkupContainer a = new A(), b = new B(), r = new R(), s =
>> new S();
>>
>> @@ -599,7 +600,7 @@ public class ComponentQueueingTest extends
>> WicketTestCase
>>
>>
>>         @Test
>> -       public void dequeueWithNestedBorders()
>> +       public void nestedBorders()
>>         {
>>                 MarkupContainer a = new A(), b = new B(), c= new C(), d =
>> new D(), r = new R(), s = new S();
>>
>> @@ -625,6 +626,38 @@ public class ComponentQueueingTest extends
>> WicketTestCase
>>                 assertThat(p, hasPath(new Path(a, outerBorder, r,
>> outerBorder.getBodyContainer(), b)));
>>         }
>>
>> +       @Test
>> +       public void fragment1() {
>> +               MarkupContainer a = new A(), b = new B(), r = new R(), s =
>> new S();
>> +
>> +               TestPage page = new TestPage();
>> +               page.setPageMarkup("<a wicket:id='a'></a><f
>> wicket:id='fragment'></f><b wicket:id='b'></b>"
>> +                       + "<wicket:fragment wicket:id='f'><r
>> wicket:id='r'></r><s wicket:id='s'></s></wicket:fragment>");
>> +
>> +               Fragment fragment = new Fragment("fragment", "f", page);
>> +
>> +               fragment.queue(r, s);
>> +               page.queue(a, b, fragment);
>> +
>> +               assertThat(page, hasPath(new Path(a)));
>> +               assertThat(page, hasPath(new Path(b)));
>> +               assertThat(page, hasPath(new Path(fragment, r)));
>> +               assertThat(page, hasPath(new Path(fragment, s)));
>> +       }
>> +
>> +       @Test
>> +       public void containerTag1()
>> +       {
>> +               MarkupContainer a = new A(), b = new B();
>> +
>> +               TestPage page = new TestPage();
>> +               page.setPageMarkup("<wicket:container wicket:id='a'><b
>> wicket:id='b'></b></wicket:container>");
>> +
>> +               page.queue(a, b);
>> +
>> +               assertThat(page, hasPath(new Path(a, b)));
>> +       }
>> +
>>         private static class A extends WebMarkupContainer
>>         {
>>                 public A()
>>
>