Re: Parent page container required in child page?

2021-06-26 Thread Prag Progger
Works perfectly, thanks!

Op za 26 jun. 2021 om 22:58 schreef Bas Gooren :
>
> Hi,
>
> Have a look at TransparentWebMarkupContainer, it was specifically made
> for this. This does involve some (internal) magic in wicket but allows
> you to simply say this.add() in child pages instead of
> rootContainer.add().
>
> // Bas
>
> Verstuurd vanaf mijn iPhone
>
> > Op 26 jun. 2021 om 18:09 heeft Prag Progger  het 
> > volgende geschreven:
> >
> > Hi,
> >
> > I have a ParentPage and many sub class child pages that extend it. I
> > decided to add a root container element to the parent page, but this
> > breaks all ChildPage.add() method calls in the child pages. A solution
> > is to pass the root container to every child, but that is a lot of
> > work. Is there a cleaner way to solve this problem without breaking
> > all the child pages?
> >
> > // ParentPage.java
> > public class ParentPage extends WebPage {
> >// Shared with sub classes
> >protected MarkupContainer rootContainer;
> >
> >public ParentPage() {
> >rootContainer = new WebMarkupContainer("rootContainer");
> >add(rootContainer);
> >
> >rootContainer.add(new Label("parentLabel", "Parent component"));
> >}
> > }
> >
> > // ParentPage.html
> > 
> >ParentPage
> >
> >
> >
> >
> >
> >
> >
> >
> > 
> >
> >
> > // ChildPage.java
> > public class ChildPage extends ParentPage {
> >public ChildPage() {
> >// This should preferably be add() instead of rootContainer.add()
> >// So that I don't have such dependency on the parentPage.
> >rootContainer.add(new Label("childComponent", "Child component"));
> >}
> > }
> >
> > // ChildPage.html
> > 
> >
> >Child page
> >
> >
> >
> > 
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> >
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Parent page container required in child page?

2021-06-26 Thread Bas Gooren
Hi,

Have a look at TransparentWebMarkupContainer, it was specifically made
for this. This does involve some (internal) magic in wicket but allows
you to simply say this.add() in child pages instead of
rootContainer.add().

// Bas

Verstuurd vanaf mijn iPhone

> Op 26 jun. 2021 om 18:09 heeft Prag Progger  het 
> volgende geschreven:
>
> Hi,
>
> I have a ParentPage and many sub class child pages that extend it. I
> decided to add a root container element to the parent page, but this
> breaks all ChildPage.add() method calls in the child pages. A solution
> is to pass the root container to every child, but that is a lot of
> work. Is there a cleaner way to solve this problem without breaking
> all the child pages?
>
> // ParentPage.java
> public class ParentPage extends WebPage {
>// Shared with sub classes
>protected MarkupContainer rootContainer;
>
>public ParentPage() {
>rootContainer = new WebMarkupContainer("rootContainer");
>add(rootContainer);
>
>rootContainer.add(new Label("parentLabel", "Parent component"));
>}
> }
>
> // ParentPage.html
> 
>ParentPage
>
>
>
>
>
>
>
>
> 
>
>
> // ChildPage.java
> public class ChildPage extends ParentPage {
>public ChildPage() {
>// This should preferably be add() instead of rootContainer.add()
>// So that I don't have such dependency on the parentPage.
>rootContainer.add(new Label("childComponent", "Child component"));
>}
> }
>
> // ChildPage.html
> 
>
>Child page
>
>
>
> 
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Parent page container required in child page?

2021-06-26 Thread Prag Progger
Hi,

I have a ParentPage and many sub class child pages that extend it. I
decided to add a root container element to the parent page, but this
breaks all ChildPage.add() method calls in the child pages. A solution
is to pass the root container to every child, but that is a lot of
work. Is there a cleaner way to solve this problem without breaking
all the child pages?

// ParentPage.java
public class ParentPage extends WebPage {
// Shared with sub classes
protected MarkupContainer rootContainer;

public ParentPage() {
rootContainer = new WebMarkupContainer("rootContainer");
add(rootContainer);

rootContainer.add(new Label("parentLabel", "Parent component"));
}
}

// ParentPage.html

ParentPage











// ChildPage.java
public class ChildPage extends ParentPage {
public ChildPage() {
// This should preferably be add() instead of rootContainer.add()
// So that I don't have such dependency on the parentPage.
rootContainer.add(new Label("childComponent", "Child component"));
}
}

// ChildPage.html


Child page





-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org