Sven,
thank you, but it worked when using this ?

add(new Label("codProduct"));

Is there an easy way to update the default model And the
AjaxEditableLabel in the similar fasion?  Nice to have an example.
Why would the reference be outdated, since ProperyModel is considered
dynamic module ?

Thank you.

On Thu, Jul 15, 2010 at 8:35 PM, Sven Meier <s...@meiers.net> wrote:
> Hi,
>
> it's the "outdated reference" problem (as often when something goes wrong
> with models):
>
>  new PropertyModel<String>(getDefaultModel(), "codProduct"))
>
> Note that you're putting the current default model into another model.
> Later on you change the default model:
>
>  setDefaultModel(new CompoundPropertyModel<Product>(product))
>
> How should your PropertyModel be aware of this change?
>
> BTW Martijn's statement is incorrect:
>>If you look at the source code for AjaxEditableLabel you could've seen
>>that it is not suited for CompoundPropertyModel usage.
>
> AjaxEditableLabel is very well capable of working with
> CompoundPropertyModels, see AjaxEditableLabel#getParentModel().
>
> Regards
>
> Sven
>
>
> On 07/15/2010 04:29 PM, Mansour Al Akeel wrote:
>>
>> Hello Martrin, and Ernesto,
>> it's still not working. I have this ProductPanel to be updated and
>> (possibly edited). It shows the product info when an item is clicked.
>> Here's the code for the Product Panel:
>>
>> public class ProductDetails extends Panel {
>>
>>       �...@ejb
>>        private ProductServicesLocal productServices;
>>
>>        public ProductDetails(String id, final Product product) {
>>                super(id);
>>                setOutputMarkupId(true);
>>                this.setCurrentProduct(product);
>>                add(new Label("id"));
>>
>>                add(new AjaxEditableLabel<String>("codProduct",
>>                                new
>> PropertyModel<String>(getDefaultModel(), "codProduct")));
>>
>>                add(new Label("tpVat"));
>>
>>                add(new AjaxLink<String>("save") {
>>                       �...@override
>>                        public void onClick(AjaxRequestTarget target) {
>>                                System.out.println("saving product .... ");
>>                        }
>>                });
>>        }
>>
>>        public void setCurrentProduct(Product product) {
>>                setDefaultModel(new
>> CompoundPropertyModel<Product>(product));
>>        }
>> }
>>
>> And here's the code for the item to update the panel:
>>
>>
>>                                AjaxLink<String>  link = new
>> AjaxLink<String>("link") {
>>                                        {
>>                                                add(new Label("id", new
>> PropertyModel<String>(model,
>>                                                                "id")));
>>                                        }
>>                                       �...@override
>>                                        public void
>> onClick(AjaxRequestTarget target) {
>>                                                Product product =
>> item.getModelObject();
>>
>>  productDetails.setCurrentProduct(product);
>>
>>  target.addComponent(productDetails);
>>
>>  System.out.println(product.getId());
>>                                        }
>>                                };
>>                                item.add(link);
>>
>>
>> The problem with this code, is the Editable Label doesn't update with
>> the rest of the labels. I mean if I click on an item, it shows me the
>> results for the corresponding product in the Labels, but not in the
>> AjaxEditableLabel.
>>
>>
>>
>> On Thu, Jul 15, 2010 at 3:48 PM, Martin Makundi
>> <martin.maku...@koodaripalvelut.com>  wrote:
>>
>>>
>>> you need to add the updated panel into target:
>>>
>>> target.addComponent(panelToBeUpdated);
>>>
>>>
>>>
>>> 2010/7/15 Mansour Al Akeel<mansour.alak...@gmail.com>:
>>>
>>>>
>>>> I just tried it. It doesn't update the panel. Here's the full code:
>>>>
>>>> public class ProductDetails extends Panel {
>>>>
>>>>       �...@ejb
>>>>        private ProductServicesLocal productServices;
>>>>
>>>>        public ProductDetails(String id, final Product product) {
>>>>                super(id);
>>>>                setOutputMarkupId(true);
>>>>                this.setCurrentProduct(product);
>>>>                add(new Label("id"));
>>>>
>>>>                add(new AjaxEditableLabel<String>("codProduct",
>>>>                                new
>>>> PropertyModel<String>((Product)getDefaultModelObject(), "codProduct")));
>>>>
>>>>                add(new AjaxLink<String>("save") {
>>>>                       �...@override
>>>>                        public void onClick(AjaxRequestTarget target) {
>>>>                                System.out.println("saving product ....
>>>> ");
>>>>                        }
>>>>                });
>>>>        }
>>>>
>>>>        public void setCurrentProduct(Product product) {
>>>>                setDefaultModel(new
>>>> CompoundPropertyModel<Product>(product));
>>>>        }
>>>> }
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>>
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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

Reply via email to