You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by "Brown, Berlin [GCG-PFS]" <Be...@Primerica.com> on 2010/06/15 17:07:12 UTC

Question about markup inheritance and page layouts

I was a little confused about page layouts and markup inheritance.  I
was thinking that a I could take a piece of HTML markup and reuse that
component when I need to, and use it multiple times within page without
ever having to create the content.  
 
I was not able to do this.  What I have now, it seems I can only use
parent child inheritance with one sub-component.

Pseudo Code ....
 
BasePage.java:
 
public abstract class BasePage extends WebPage {
 
    public BasePage(final PageParameters parameters) {    
    }   
}
 
BasePage.html:
 
<html> 
  <wicket:child />
</html>
 
----
 
SomePage.java
 
public class SomePage extends BasePage {
 
    public SomePage(final PageParameters parameters) {    
    }   
}
 
SomePage.html:
<wicket:extend>
<div>
  <div wicket:id="myPanel"></div>
  <div wicket:id="myPanel1"></div>
</div>
</wicket:extend>
 
----
 
BasePanel.java 
...
 
BasePanel.html
<div>
   <wicket:child />
</div>
 
MyPanel1.java extends BasePanel
...
 
MyPane1l.html
<wicket:extend>  
<div>   
</div>
</wicket:extend>
 
----
 
Basically:
 
BasePage has child page -> Some Page ... Some Page has child panels
BasePanel -> My Panel and My Panel1
...
 
I don't get the output I would expect.  It looks like the markup
inheritance stops at "SomePage" and doesn't recognize
 the "BasePanel" HTML child code.
 
My intended goal is to avoid duplicating HTML content, what is the best
way to achieve that.  Maybe I should use markup inheritance for the
panel instead of the page?
 
 

RE: Question about markup inheritance and page layouts

Posted by "Brown, Berlin [GCG-PFS]" <Be...@Primerica.com>.
 

-----Original Message-----
From: Jeremy Thomerson [mailto:jeremy@wickettraining.com] 
Sent: Tuesday, June 15, 2010 11:34 AM
To: users@wicket.apache.org
Cc: Berlin Brown
Subject: Re: Question about markup inheritance and page layouts

>
> >
> Where did you place the wicket:panel tags in your markup?
>
> --
> Jeremy Thomerson
> http://www.wickettraining.com
>
>
> They are in the SomePage:
>
> > SomePage.html:
> > <wicket:extend>
> > <div>
> >  <div wicket:id="myPanel"></div>
> >  <div wicket:id="myPanel1"></div>
> > </div>
> > </wicket:extend>
>

No, the wicket:panel tags that must appear in the panel html files -
where are they?

Ooops, I got it working now and all the inheritance works as expected:

In my base panel, I didn't include the wicket:panel (but I did put it in
the implemeting panel html)

Base Panel.html:

<wicket:panel>
...
</wicket:panel>

That change above, fixed the problem.
--
Jeremy Thomerson
http://www.wickettraining.com


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


Re: Question about markup inheritance and page layouts

Posted by Jeremy Thomerson <je...@wickettraining.com>.
>
> >
> Where did you place the wicket:panel tags in your markup?
>
> --
> Jeremy Thomerson
> http://www.wickettraining.com
>
>
> They are in the SomePage:
>
> > SomePage.html:
> > <wicket:extend>
> > <div>
> >  <div wicket:id="myPanel"></div>
> >  <div wicket:id="myPanel1"></div>
> > </div>
> > </wicket:extend>
>

No, the wicket:panel tags that must appear in the panel html files - where
are they?

-- 
Jeremy Thomerson
http://www.wickettraining.com

RE: Question about markup inheritance and page layouts

Posted by "Brown, Berlin [GCG-PFS]" <Be...@Primerica.com>.
 

-----Original Message-----
From: Jeremy Thomerson [mailto:jeremy@wickettraining.com] 
Sent: Tuesday, June 15, 2010 11:26 AM
To: users@wicket.apache.org
Cc: Berlin Brown
Subject: Re: Question about markup inheritance and page layouts

On Tue, Jun 15, 2010 at 10:07 AM, Brown, Berlin [GCG-PFS] <
Berlin.Brown@primerica.com> wrote:

> I was a little confused about page layouts and markup inheritance.  I 
> was thinking that a I could take a piece of HTML markup and reuse that

> component when I need to, and use it multiple times within page 
> without ever having to create the content.
>
> I was not able to do this.  What I have now, it seems I can only use 
> parent child inheritance with one sub-component.
>
> Pseudo Code ....
>
> BasePage.java:
>
> public abstract class BasePage extends WebPage {
>
>    public BasePage(final PageParameters parameters) {
>    }
> }
>
> BasePage.html:
>
> <html>
>  <wicket:child />
> </html>
>
> ----
>
> SomePage.java
>
> public class SomePage extends BasePage {
>
>    public SomePage(final PageParameters parameters) {
>    }
> }
>
> SomePage.html:
> <wicket:extend>
> <div>
>  <div wicket:id="myPanel"></div>
>  <div wicket:id="myPanel1"></div>
> </div>
> </wicket:extend>
>
> ----
>
> BasePanel.java
> ...
>
> BasePanel.html
> <div>
>   <wicket:child />
> </div>
>
> MyPanel1.java extends BasePanel
> ...
>
> MyPane1l.html
> <wicket:extend>
> <div>
> </div>
> </wicket:extend>
>
> ----
>
> Basically:
>
> BasePage has child page -> Some Page ... Some Page has child panels 
> BasePanel -> My Panel and My Panel1 ...
>
> I don't get the output I would expect.  It looks like the markup 
> inheritance stops at "SomePage" and doesn't recognize  the "BasePanel"

> HTML child code.
>
> My intended goal is to avoid duplicating HTML content, what is the 
> best way to achieve that.  Maybe I should use markup inheritance for 
> the panel instead of the page?
>
>
>
Where did you place the wicket:panel tags in your markup?

--
Jeremy Thomerson
http://www.wickettraining.com


They are in the SomePage:

> SomePage.html:
> <wicket:extend>
> <div>
>  <div wicket:id="myPanel"></div>
>  <div wicket:id="myPanel1"></div>
> </div>
> </wicket:extend>



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


Re: Question about markup inheritance and page layouts

Posted by Jeremy Thomerson <je...@wickettraining.com>.
On Tue, Jun 15, 2010 at 10:07 AM, Brown, Berlin [GCG-PFS] <
Berlin.Brown@primerica.com> wrote:

> I was a little confused about page layouts and markup inheritance.  I
> was thinking that a I could take a piece of HTML markup and reuse that
> component when I need to, and use it multiple times within page without
> ever having to create the content.
>
> I was not able to do this.  What I have now, it seems I can only use
> parent child inheritance with one sub-component.
>
> Pseudo Code ....
>
> BasePage.java:
>
> public abstract class BasePage extends WebPage {
>
>    public BasePage(final PageParameters parameters) {
>    }
> }
>
> BasePage.html:
>
> <html>
>  <wicket:child />
> </html>
>
> ----
>
> SomePage.java
>
> public class SomePage extends BasePage {
>
>    public SomePage(final PageParameters parameters) {
>    }
> }
>
> SomePage.html:
> <wicket:extend>
> <div>
>  <div wicket:id="myPanel"></div>
>  <div wicket:id="myPanel1"></div>
> </div>
> </wicket:extend>
>
> ----
>
> BasePanel.java
> ...
>
> BasePanel.html
> <div>
>   <wicket:child />
> </div>
>
> MyPanel1.java extends BasePanel
> ...
>
> MyPane1l.html
> <wicket:extend>
> <div>
> </div>
> </wicket:extend>
>
> ----
>
> Basically:
>
> BasePage has child page -> Some Page ... Some Page has child panels
> BasePanel -> My Panel and My Panel1
> ...
>
> I don't get the output I would expect.  It looks like the markup
> inheritance stops at "SomePage" and doesn't recognize
>  the "BasePanel" HTML child code.
>
> My intended goal is to avoid duplicating HTML content, what is the best
> way to achieve that.  Maybe I should use markup inheritance for the
> panel instead of the page?
>
>
>
Where did you place the wicket:panel tags in your markup?

-- 
Jeremy Thomerson
http://www.wickettraining.com