Thanks for both of your replys!
I think extending WebComponent is the way I'll do it as then I don't
care about the type of model that gets used...
Thanks again!
Cheers,
-js
On 11/10/06, Eelco Hillenius <[EMAIL PROTECTED]> wrote:
> Probably the easiest thing to do is extend WebComponent instea
That's a good alternative too.
Eelco
On 11/10/06, Erik van Oosten <[EMAIL PROTECTED]> wrote:
> Something like this?
>
> class MyLabel extends Label {
>private String text;
>public MyLabel(String id, String text, final FormComponent fc) {
>super(id, new AbstractReadOnlyModel() {
>
Probably the easiest thing to do is extend WebComponent instead of
label. Label is a super simple component really. This
protected void onComponentTagBody(final MarkupStream markupStream,
final ComponentTag openTag)
{
replaceComponentTagBody(markupStream, openTag,
Something like this?
class MyLabel extends Label {
private String text;
public MyLabel(String id, String text, final FormComponent fc) {
super(id, new AbstractReadOnlyModel() {
Object getObject(Component component) {
return text + (fc.isRequired() ? " *" : "");
I have a custom label component that extends label. In the constructor
it takes a form component that I want it to check if isRequired() at
render time and append "*" to the text of the label. What would be the
easiest way to do this? The data for the label could be passed in
through various models