You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Xavier López <xa...@gmail.com> on 2009/12/14 16:50:48 UTC

Parameterized Component

Hi,

In my application I have a number of fields that allow validation, by means
of a validation CheckBox. In order to provide some flexibility for this kind
of validation fields, I'd like to have them implemented in a Component (i.e.
ValidationTickPanel), so that they provide their own markup and other panels
using it should not know about its contents. ValidationTickPanel extends
Panel in order to be able to provide own markup.

The problem is, I'd like to have the CheckBox's wicket:id set from the
parent panel (in order to use CompoundPropertyModel). But I'm afraid that
it's impossible to have a variable wicket_id inside
ValidationTickPanel.html...

public class ValidationTick extends Panel implements RestrictedComponent {
    public ValidationTick(String componentId, String checkId, IModel
checkModel){
        super(componentId);
        CheckBox check =  new CheckBox(checkId, checkModel);
        Label label = new Label(checkId+"Label", new
StringResourceModel(""));
        add(check);
        add(label);
    }
}

<wicket:panel>
    <input type="checkbox" wicket:id="???"></input>
    <span wicket:id="???Label"></span>
</wicket:panel>

Usually, checkModel would be null as the goal would be to use
compoundPropertyModel on the checkBox..My question is, is it possible to
achieve this ? Or should I be discarding the CPM idea and passing for
instance a PropertyModel to ValidationTickPanel ?

Thanks a lot,
Xavier

Re: Parameterized Component

Posted by Xavier López <xa...@gmail.com>.
Thanks for the replies.

CPM has been working fine for me. Although what Martin says is true, I've
been reducing that in my CPM's by means of public static final variables on
the bean's classes. Just fields with the name of fields (sort of class
meta-info). Then using those fields as wicket:id's...

However, the topic of the post is a real limitation about CPM's and I'll be
using PropertyModels instead, although the new solution looks great ;)


2009/12/15 Martin Makundi <ma...@koodaripalvelut.com>

> > so you where talking about property models in general (not the compound)
> >
> > We have a solution for that now
>
> No. Property models can use constants or "the new solution". But there
> is no solution for compound property models, yet. Unless someone knows
> how to make the compiler chew html wicket:id's too, which would be
> nice.
>
> my 2cents
>
> **
> Martin
>
> >
> > On Tue, Dec 15, 2009 at 11:25, Martin Makundi <
> > martin.makundi@koodaripalvelut.com> wrote:
> >
> >> Yes, but it ties your beans to wicket ids. More refactoring and
> >> maintenance work.
> >>
> >> Anyways, if it works for you, use it.
> >>
> >> my 2cents
> >>
> >> **
> >> Martin
> >>
> >> 2009/12/15 Johan Compagner <jc...@gmail.com>:
> >> > why not
> >> > it kills a lot of code.
> >> >
> >> >
> >> > On Mon, Dec 14, 2009 at 17:45, Martin Makundi <
> >> > martin.makundi@koodaripalvelut.com> wrote:
> >> >
> >> >> I wouldn't use CPM for anything serious anyways...
> >> >>
> >> >> my 2cents
> >> >>
> >> >> **
> >> >> Martin
> >> >>
> >> >> 2009/12/14 Xavier López <xa...@gmail.com>:
> >> >> > Hi,
> >> >> >
> >> >> > In my application I have a number of fields that allow validation,
> by
> >> >> means
> >> >> > of a validation CheckBox. In order to provide some flexibility for
> >> this
> >> >> kind
> >> >> > of validation fields, I'd like to have them implemented in a
> Component
> >> >> (i.e.
> >> >> > ValidationTickPanel), so that they provide their own markup and
> other
> >> >> panels
> >> >> > using it should not know about its contents. ValidationTickPanel
> >> extends
> >> >> > Panel in order to be able to provide own markup.
> >> >> >
> >> >> > The problem is, I'd like to have the CheckBox's wicket:id set from
> the
> >> >> > parent panel (in order to use CompoundPropertyModel). But I'm
> afraid
> >> that
> >> >> > it's impossible to have a variable wicket_id inside
> >> >> > ValidationTickPanel.html...
> >> >> >
> >> >> > public class ValidationTick extends Panel implements
> >> RestrictedComponent
> >> >> {
> >> >> >    public ValidationTick(String componentId, String checkId, IModel
> >> >> > checkModel){
> >> >> >        super(componentId);
> >> >> >        CheckBox check =  new CheckBox(checkId, checkModel);
> >> >> >        Label label = new Label(checkId+"Label", new
> >> >> > StringResourceModel(""));
> >> >> >        add(check);
> >> >> >        add(label);
> >> >> >    }
> >> >> > }
> >> >> >
> >> >> > <wicket:panel>
> >> >> >    <input type="checkbox" wicket:id="???"></input>
> >> >> >    <span wicket:id="???Label"></span>
> >> >> > </wicket:panel>
> >> >> >
> >> >> > Usually, checkModel would be null as the goal would be to use
> >> >> > compoundPropertyModel on the checkBox..My question is, is it
> possible
> >> to
> >> >> > achieve this ? Or should I be discarding the CPM idea and passing
> for
> >> >> > instance a PropertyModel to ValidationTickPanel ?
> >> >> >
> >> >> > Thanks a lot,
> >> >> > Xavier
> >> >> >
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> >> For additional commands, e-mail: users-help@wicket.apache.org
> >> >>
> >> >>
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
"Klein bottle for rent--inquire within."

Re: Parameterized Component

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
> so you where talking about property models in general (not the compound)
>
> We have a solution for that now

No. Property models can use constants or "the new solution". But there
is no solution for compound property models, yet. Unless someone knows
how to make the compiler chew html wicket:id's too, which would be
nice.

my 2cents

**
Martin

>
> On Tue, Dec 15, 2009 at 11:25, Martin Makundi <
> martin.makundi@koodaripalvelut.com> wrote:
>
>> Yes, but it ties your beans to wicket ids. More refactoring and
>> maintenance work.
>>
>> Anyways, if it works for you, use it.
>>
>> my 2cents
>>
>> **
>> Martin
>>
>> 2009/12/15 Johan Compagner <jc...@gmail.com>:
>> > why not
>> > it kills a lot of code.
>> >
>> >
>> > On Mon, Dec 14, 2009 at 17:45, Martin Makundi <
>> > martin.makundi@koodaripalvelut.com> wrote:
>> >
>> >> I wouldn't use CPM for anything serious anyways...
>> >>
>> >> my 2cents
>> >>
>> >> **
>> >> Martin
>> >>
>> >> 2009/12/14 Xavier López <xa...@gmail.com>:
>> >> > Hi,
>> >> >
>> >> > In my application I have a number of fields that allow validation, by
>> >> means
>> >> > of a validation CheckBox. In order to provide some flexibility for
>> this
>> >> kind
>> >> > of validation fields, I'd like to have them implemented in a Component
>> >> (i.e.
>> >> > ValidationTickPanel), so that they provide their own markup and other
>> >> panels
>> >> > using it should not know about its contents. ValidationTickPanel
>> extends
>> >> > Panel in order to be able to provide own markup.
>> >> >
>> >> > The problem is, I'd like to have the CheckBox's wicket:id set from the
>> >> > parent panel (in order to use CompoundPropertyModel). But I'm afraid
>> that
>> >> > it's impossible to have a variable wicket_id inside
>> >> > ValidationTickPanel.html...
>> >> >
>> >> > public class ValidationTick extends Panel implements
>> RestrictedComponent
>> >> {
>> >> >    public ValidationTick(String componentId, String checkId, IModel
>> >> > checkModel){
>> >> >        super(componentId);
>> >> >        CheckBox check =  new CheckBox(checkId, checkModel);
>> >> >        Label label = new Label(checkId+"Label", new
>> >> > StringResourceModel(""));
>> >> >        add(check);
>> >> >        add(label);
>> >> >    }
>> >> > }
>> >> >
>> >> > <wicket:panel>
>> >> >    <input type="checkbox" wicket:id="???"></input>
>> >> >    <span wicket:id="???Label"></span>
>> >> > </wicket:panel>
>> >> >
>> >> > Usually, checkModel would be null as the goal would be to use
>> >> > compoundPropertyModel on the checkBox..My question is, is it possible
>> to
>> >> > achieve this ? Or should I be discarding the CPM idea and passing for
>> >> > instance a PropertyModel to ValidationTickPanel ?
>> >> >
>> >> > Thanks a lot,
>> >> > Xavier
>> >> >
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> For additional commands, e-mail: users-help@wicket.apache.org
>> >>
>> >>
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>

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


Re: Parameterized Component

Posted by Johan Compagner <jc...@gmail.com>.
http://wicketinaction.com/2009/11/removing-fragile-string-expressions-from-wicket-code/

On Tue, Dec 15, 2009 at 16:52, Juan Carlos Garcia M. <jc...@gmail.com>wrote:

>
> Johan, Can you elaborate more on that please? What is this new solution?
>
>
>
> Johan Compagner wrote:
> >
> > so you where talking about property models in general (not the compound)
> >
> > We have a solution for that now
> >
> > On Tue, Dec 15, 2009 at 11:25, Martin Makundi <
> > martin.makundi@koodaripalvelut.com> wrote:
> >
> >> Yes, but it ties your beans to wicket ids. More refactoring and
> >> maintenance work.
> >>
> >> Anyways, if it works for you, use it.
> >>
> >> my 2cents
> >>
> >> **
> >> Martin
> >>
> >> 2009/12/15 Johan Compagner <jc...@gmail.com>:
> >> > why not
> >> > it kills a lot of code.
> >> >
> >> >
> >> > On Mon, Dec 14, 2009 at 17:45, Martin Makundi <
> >> > martin.makundi@koodaripalvelut.com> wrote:
> >> >
> >> >> I wouldn't use CPM for anything serious anyways...
> >> >>
> >> >> my 2cents
> >> >>
> >> >> **
> >> >> Martin
> >> >>
> >> >> 2009/12/14 Xavier López <xa...@gmail.com>:
> >> >> > Hi,
> >> >> >
> >> >> > In my application I have a number of fields that allow validation,
> >> by
> >> >> means
> >> >> > of a validation CheckBox. In order to provide some flexibility for
> >> this
> >> >> kind
> >> >> > of validation fields, I'd like to have them implemented in a
> >> Component
> >> >> (i.e.
> >> >> > ValidationTickPanel), so that they provide their own markup and
> >> other
> >> >> panels
> >> >> > using it should not know about its contents. ValidationTickPanel
> >> extends
> >> >> > Panel in order to be able to provide own markup.
> >> >> >
> >> >> > The problem is, I'd like to have the CheckBox's wicket:id set from
> >> the
> >> >> > parent panel (in order to use CompoundPropertyModel). But I'm
> afraid
> >> that
> >> >> > it's impossible to have a variable wicket_id inside
> >> >> > ValidationTickPanel.html...
> >> >> >
> >> >> > public class ValidationTick extends Panel implements
> >> RestrictedComponent
> >> >> {
> >> >> >    public ValidationTick(String componentId, String checkId, IModel
> >> >> > checkModel){
> >> >> >        super(componentId);
> >> >> >        CheckBox check =  new CheckBox(checkId, checkModel);
> >> >> >        Label label = new Label(checkId+"Label", new
> >> >> > StringResourceModel(""));
> >> >> >        add(check);
> >> >> >        add(label);
> >> >> >    }
> >> >> > }
> >> >> >
> >> >> > <wicket:panel>
> >> >> >    <input type="checkbox" wicket:id="???"></input>
> >> >> >
> >> >> > </wicket:panel>
> >> >> >
> >> >> > Usually, checkModel would be null as the goal would be to use
> >> >> > compoundPropertyModel on the checkBox..My question is, is it
> >> possible
> >> to
> >> >> > achieve this ? Or should I be discarding the CPM idea and passing
> >> for
> >> >> > instance a PropertyModel to ValidationTickPanel ?
> >> >> >
> >> >> > Thanks a lot,
> >> >> > Xavier
> >> >> >
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> >> For additional commands, e-mail: users-help@wicket.apache.org
> >> >>
> >> >>
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://old.nabble.com/Parameterized-Component-tp26780051p26795873.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Parameterized Component

Posted by "Juan Carlos Garcia M." <jc...@gmail.com>.
Johan, Can you elaborate more on that please? What is this new solution?



Johan Compagner wrote:
> 
> so you where talking about property models in general (not the compound)
> 
> We have a solution for that now
> 
> On Tue, Dec 15, 2009 at 11:25, Martin Makundi <
> martin.makundi@koodaripalvelut.com> wrote:
> 
>> Yes, but it ties your beans to wicket ids. More refactoring and
>> maintenance work.
>>
>> Anyways, if it works for you, use it.
>>
>> my 2cents
>>
>> **
>> Martin
>>
>> 2009/12/15 Johan Compagner <jc...@gmail.com>:
>> > why not
>> > it kills a lot of code.
>> >
>> >
>> > On Mon, Dec 14, 2009 at 17:45, Martin Makundi <
>> > martin.makundi@koodaripalvelut.com> wrote:
>> >
>> >> I wouldn't use CPM for anything serious anyways...
>> >>
>> >> my 2cents
>> >>
>> >> **
>> >> Martin
>> >>
>> >> 2009/12/14 Xavier López <xa...@gmail.com>:
>> >> > Hi,
>> >> >
>> >> > In my application I have a number of fields that allow validation,
>> by
>> >> means
>> >> > of a validation CheckBox. In order to provide some flexibility for
>> this
>> >> kind
>> >> > of validation fields, I'd like to have them implemented in a
>> Component
>> >> (i.e.
>> >> > ValidationTickPanel), so that they provide their own markup and
>> other
>> >> panels
>> >> > using it should not know about its contents. ValidationTickPanel
>> extends
>> >> > Panel in order to be able to provide own markup.
>> >> >
>> >> > The problem is, I'd like to have the CheckBox's wicket:id set from
>> the
>> >> > parent panel (in order to use CompoundPropertyModel). But I'm afraid
>> that
>> >> > it's impossible to have a variable wicket_id inside
>> >> > ValidationTickPanel.html...
>> >> >
>> >> > public class ValidationTick extends Panel implements
>> RestrictedComponent
>> >> {
>> >> >    public ValidationTick(String componentId, String checkId, IModel
>> >> > checkModel){
>> >> >        super(componentId);
>> >> >        CheckBox check =  new CheckBox(checkId, checkModel);
>> >> >        Label label = new Label(checkId+"Label", new
>> >> > StringResourceModel(""));
>> >> >        add(check);
>> >> >        add(label);
>> >> >    }
>> >> > }
>> >> >
>> >> > <wicket:panel>
>> >> >    <input type="checkbox" wicket:id="???"></input>
>> >> >    
>> >> > </wicket:panel>
>> >> >
>> >> > Usually, checkModel would be null as the goal would be to use
>> >> > compoundPropertyModel on the checkBox..My question is, is it
>> possible
>> to
>> >> > achieve this ? Or should I be discarding the CPM idea and passing
>> for
>> >> > instance a PropertyModel to ValidationTickPanel ?
>> >> >
>> >> > Thanks a lot,
>> >> > Xavier
>> >> >
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> For additional commands, e-mail: users-help@wicket.apache.org
>> >>
>> >>
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> 
> 

-- 
View this message in context: http://old.nabble.com/Parameterized-Component-tp26780051p26795873.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: Parameterized Component

Posted by Johan Compagner <jc...@gmail.com>.
so you where talking about property models in general (not the compound)

We have a solution for that now

On Tue, Dec 15, 2009 at 11:25, Martin Makundi <
martin.makundi@koodaripalvelut.com> wrote:

> Yes, but it ties your beans to wicket ids. More refactoring and
> maintenance work.
>
> Anyways, if it works for you, use it.
>
> my 2cents
>
> **
> Martin
>
> 2009/12/15 Johan Compagner <jc...@gmail.com>:
> > why not
> > it kills a lot of code.
> >
> >
> > On Mon, Dec 14, 2009 at 17:45, Martin Makundi <
> > martin.makundi@koodaripalvelut.com> wrote:
> >
> >> I wouldn't use CPM for anything serious anyways...
> >>
> >> my 2cents
> >>
> >> **
> >> Martin
> >>
> >> 2009/12/14 Xavier López <xa...@gmail.com>:
> >> > Hi,
> >> >
> >> > In my application I have a number of fields that allow validation, by
> >> means
> >> > of a validation CheckBox. In order to provide some flexibility for
> this
> >> kind
> >> > of validation fields, I'd like to have them implemented in a Component
> >> (i.e.
> >> > ValidationTickPanel), so that they provide their own markup and other
> >> panels
> >> > using it should not know about its contents. ValidationTickPanel
> extends
> >> > Panel in order to be able to provide own markup.
> >> >
> >> > The problem is, I'd like to have the CheckBox's wicket:id set from the
> >> > parent panel (in order to use CompoundPropertyModel). But I'm afraid
> that
> >> > it's impossible to have a variable wicket_id inside
> >> > ValidationTickPanel.html...
> >> >
> >> > public class ValidationTick extends Panel implements
> RestrictedComponent
> >> {
> >> >    public ValidationTick(String componentId, String checkId, IModel
> >> > checkModel){
> >> >        super(componentId);
> >> >        CheckBox check =  new CheckBox(checkId, checkModel);
> >> >        Label label = new Label(checkId+"Label", new
> >> > StringResourceModel(""));
> >> >        add(check);
> >> >        add(label);
> >> >    }
> >> > }
> >> >
> >> > <wicket:panel>
> >> >    <input type="checkbox" wicket:id="???"></input>
> >> >    <span wicket:id="???Label"></span>
> >> > </wicket:panel>
> >> >
> >> > Usually, checkModel would be null as the goal would be to use
> >> > compoundPropertyModel on the checkBox..My question is, is it possible
> to
> >> > achieve this ? Or should I be discarding the CPM idea and passing for
> >> > instance a PropertyModel to ValidationTickPanel ?
> >> >
> >> > Thanks a lot,
> >> > Xavier
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Parameterized Component

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
Yes, but it ties your beans to wicket ids. More refactoring and
maintenance work.

Anyways, if it works for you, use it.

my 2cents

**
Martin

2009/12/15 Johan Compagner <jc...@gmail.com>:
> why not
> it kills a lot of code.
>
>
> On Mon, Dec 14, 2009 at 17:45, Martin Makundi <
> martin.makundi@koodaripalvelut.com> wrote:
>
>> I wouldn't use CPM for anything serious anyways...
>>
>> my 2cents
>>
>> **
>> Martin
>>
>> 2009/12/14 Xavier López <xa...@gmail.com>:
>> > Hi,
>> >
>> > In my application I have a number of fields that allow validation, by
>> means
>> > of a validation CheckBox. In order to provide some flexibility for this
>> kind
>> > of validation fields, I'd like to have them implemented in a Component
>> (i.e.
>> > ValidationTickPanel), so that they provide their own markup and other
>> panels
>> > using it should not know about its contents. ValidationTickPanel extends
>> > Panel in order to be able to provide own markup.
>> >
>> > The problem is, I'd like to have the CheckBox's wicket:id set from the
>> > parent panel (in order to use CompoundPropertyModel). But I'm afraid that
>> > it's impossible to have a variable wicket_id inside
>> > ValidationTickPanel.html...
>> >
>> > public class ValidationTick extends Panel implements RestrictedComponent
>> {
>> >    public ValidationTick(String componentId, String checkId, IModel
>> > checkModel){
>> >        super(componentId);
>> >        CheckBox check =  new CheckBox(checkId, checkModel);
>> >        Label label = new Label(checkId+"Label", new
>> > StringResourceModel(""));
>> >        add(check);
>> >        add(label);
>> >    }
>> > }
>> >
>> > <wicket:panel>
>> >    <input type="checkbox" wicket:id="???"></input>
>> >    <span wicket:id="???Label"></span>
>> > </wicket:panel>
>> >
>> > Usually, checkModel would be null as the goal would be to use
>> > compoundPropertyModel on the checkBox..My question is, is it possible to
>> > achieve this ? Or should I be discarding the CPM idea and passing for
>> > instance a PropertyModel to ValidationTickPanel ?
>> >
>> > Thanks a lot,
>> > Xavier
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>

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


Re: Parameterized Component

Posted by Johan Compagner <jc...@gmail.com>.
why not
it kills a lot of code.


On Mon, Dec 14, 2009 at 17:45, Martin Makundi <
martin.makundi@koodaripalvelut.com> wrote:

> I wouldn't use CPM for anything serious anyways...
>
> my 2cents
>
> **
> Martin
>
> 2009/12/14 Xavier López <xa...@gmail.com>:
> > Hi,
> >
> > In my application I have a number of fields that allow validation, by
> means
> > of a validation CheckBox. In order to provide some flexibility for this
> kind
> > of validation fields, I'd like to have them implemented in a Component
> (i.e.
> > ValidationTickPanel), so that they provide their own markup and other
> panels
> > using it should not know about its contents. ValidationTickPanel extends
> > Panel in order to be able to provide own markup.
> >
> > The problem is, I'd like to have the CheckBox's wicket:id set from the
> > parent panel (in order to use CompoundPropertyModel). But I'm afraid that
> > it's impossible to have a variable wicket_id inside
> > ValidationTickPanel.html...
> >
> > public class ValidationTick extends Panel implements RestrictedComponent
> {
> >    public ValidationTick(String componentId, String checkId, IModel
> > checkModel){
> >        super(componentId);
> >        CheckBox check =  new CheckBox(checkId, checkModel);
> >        Label label = new Label(checkId+"Label", new
> > StringResourceModel(""));
> >        add(check);
> >        add(label);
> >    }
> > }
> >
> > <wicket:panel>
> >    <input type="checkbox" wicket:id="???"></input>
> >    <span wicket:id="???Label"></span>
> > </wicket:panel>
> >
> > Usually, checkModel would be null as the goal would be to use
> > compoundPropertyModel on the checkBox..My question is, is it possible to
> > achieve this ? Or should I be discarding the CPM idea and passing for
> > instance a PropertyModel to ValidationTickPanel ?
> >
> > Thanks a lot,
> > Xavier
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Parameterized Component

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
I wouldn't use CPM for anything serious anyways...

my 2cents

**
Martin

2009/12/14 Xavier López <xa...@gmail.com>:
> Hi,
>
> In my application I have a number of fields that allow validation, by means
> of a validation CheckBox. In order to provide some flexibility for this kind
> of validation fields, I'd like to have them implemented in a Component (i.e.
> ValidationTickPanel), so that they provide their own markup and other panels
> using it should not know about its contents. ValidationTickPanel extends
> Panel in order to be able to provide own markup.
>
> The problem is, I'd like to have the CheckBox's wicket:id set from the
> parent panel (in order to use CompoundPropertyModel). But I'm afraid that
> it's impossible to have a variable wicket_id inside
> ValidationTickPanel.html...
>
> public class ValidationTick extends Panel implements RestrictedComponent {
>    public ValidationTick(String componentId, String checkId, IModel
> checkModel){
>        super(componentId);
>        CheckBox check =  new CheckBox(checkId, checkModel);
>        Label label = new Label(checkId+"Label", new
> StringResourceModel(""));
>        add(check);
>        add(label);
>    }
> }
>
> <wicket:panel>
>    <input type="checkbox" wicket:id="???"></input>
>    <span wicket:id="???Label"></span>
> </wicket:panel>
>
> Usually, checkModel would be null as the goal would be to use
> compoundPropertyModel on the checkBox..My question is, is it possible to
> achieve this ? Or should I be discarding the CPM idea and passing for
> instance a PropertyModel to ValidationTickPanel ?
>
> Thanks a lot,
> Xavier
>

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