You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Patrick Davids <pa...@nuboit.de> on 2013/07/25 12:07:50 UTC

SOLVED / Re: How to make an own panel work like an e.g. TextField / joining the model hierarchy of page/form

Hi Martin,
thanx, its working, now.

I had some additional convenience constructors in my panel with empty 
model object inits, because some days ago I always ran into "try to set 
on empty model object exceptions". I kept them and I think they forced 
side-effects.

Just having one, only with an id, made it work.

kind regards
Patrick

Am 24.07.2013 09:53, schrieb Martin Grigorov:
> Hi Patrick,
>
>
> On Wed, Jul 24, 2013 at 10:36 AM, Patrick Davids
> <pa...@nuboit.de>wrote:
>
>> Hi Martin,
>> concerning the IComponentInheritedModel I did not not try anything in my
>> panel since yet, because I suppose it should work from the scratch, when
>> a manually wrap the ModelObject on form level into CompundPropertyModel.
>>
>> As I can see CompoundPropertyModel is an IComponentInheritedModel, and I
>> understand, why this works.
>>
>> Form f = new Form("anyid", new CompoundPropertyModel(PersonObject));
>> f.add(new TextField("personName"));
>>
>>
>>
>> My question focused more on, what I should implement in
>> MyOwnTextFieldPanel("personName") to act the same way like an usual
>> textfield, not what I have to do on the parent component/form.
>> An ususal TextField "joins" the Form and its inner CompundPropertyModel
>> (Handling) in a magic way, and I would like to have the same feature for
>> MyOwnTextField.
>>
>
> It should work the same way.
> Just make sure your panel "participates" in the component path.
> For example:
>
> Form f = new Form("anyid", new CompoundPropertyModel(personObject));
> f.add(new YourPanel("namesObject"));
>
> class YourPanel extends Panel {
>    public YourPanel(Sting id) {
>       super(id);
>
>       add(new TextField("first"));
>       add(new TextField("last"));
>    }
> }
>
>
> With this code the text field's model would be:
> personObject.getNamesObject().getFirst()
>
>
>> regards
>> Patrick
>>
>> Am 23.07.2013 15:21, schrieb Martin Grigorov:
>>> Hi,
>>>
>>>
>>> On Tue, Jul 23, 2013 at 4:17 PM, Patrick Davids <
>> patrick.davids@nuboit.de>wrote:
>>>
>>>> Hi all,
>>>> I implemented a "TextField-Panel".
>>>> Its kind of FormComponentPanel, but not really... do not have a
>>>> convertInput() situation.
>>>> Just additional behaviors and some own l18n stuff...
>>>>
>>>> Its already working fine, but what I always have to to is, getting the
>>>> modelobject manually and forward into my form (model object), where it
>>>> is used.
>>>>
>>>> I would like to implement it in a way, behaving like CompundProperty
>>>> modeled forms.
>>>>
>>>> I read about an IComponentInheritance marker interface, but I do not
>>>>
>>>
>>> Do you mean org.apache.wicket.model.IComponentInheritedModel ?
>>> It has a demo code in its javadoc.
>>> Show us what you tried.
>>>
>>>
>>>> know, how to use it.
>>>>
>>>> Can some one help?
>>>>
>>>> kind regards and thanx
>>>> Patrick
>>>> ---------------------------------------------------------------------
>>>> 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