On 25/04/2014 18:30, Entropy wrote:
I just tried putting some text inside the feedback panel's html like so:

<div class="errorpanel" id="errorpanel" wicket:id="feedback">This is a
test</div>

That didn't work.  "This is a test" was overwritten when the feedback panel
rendered.  Which is exactly what I expected it to do.


Hi,

The text between the tags is called the body. When a Panel is rendered, the body of the tags to which the panel was bound ("This is a test" in your example) is ignored, and the associated markup is rendered instead. Associated markup is the markup provided by the Panel, that is shipped in an HTML file with the same name as the Panel's class, or super class.

There is nothing preventing you from subclassing FeedbackPanel, and providing very similar associated markup, just including a <span wicket:id="myheading"></span>.

To override the associated markup provided by a Panel's parent (replace markup instead of extend it), you do this:

<wicket:panel>
here you must provide all the markup required by the Panel.
</wicket:panel>

ie. Use <wicket:panel> instead of <wicket:extend>.

So, to get what you want, create a subclass of FeedbackPanel, called MyFeedbackPanel. Then, in MyFeedbackPanel.html, copy all the HTML from FeedbackPanel.html, and insert the label that you want to add. Then, in MyFeedbackPanel#onInitialize(), add the label as you normally would.

Cheers,
Jesse

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

Reply via email to