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?