:-| I do not know why but it is functions now!
Thanks Igor and Sven for the help
svenmeier wrote:
>
> Hi,
>
> WebMarkupContainer container = new WebMarkupContainer("container", new
> CompoundPropertyModel(new ProfileModel(userId)));
> add(container);
> container.add(new Label("firstName") {
>
> protected boolean isVisible() {
> return !Strings.isEmpty(getModelObjectAsString());
> }
>
> });
>
> The label will have a model inherited from the CompoundPropertyModel.
>
> Sven
>
>
> greeklinux schrieb:
>> Hello Igor,
>>
>> If I am using a PropertyModel for my Label,
>> new VisibleLabel("firstName", new PropertyModel(new ProfileModel(userId),
>> "firstName"))
>>
>> then visibleLabel.getModelObjectAsString() returns the right value for
>> the
>> "firstName"
>> property. The Model is the wrapper for the firstName value.
>>
>> But if I want to use the CompoundPropertyModel then the method returns
>> nothing.
>> There is no Model that directly wraps my firstName value, right? The
>> Model
>> is associated
>> with "all" the Labels not only with one.
>>
>> I cannot figure out how to use it with the CompountPropertyModel (if it
>> is
>> prossible).
>>
>>
>>
>> igor.vaynberg wrote:
>>
>>> the result is whatever you gave the label as the model, if i look at
>>> your code above it is the firstname property of whatever user you gave
>>> to the compound model
>>>
>>> -igor
>>>
>>> On Fri, May 23, 2008 at 11:02 AM, greeklinux <[EMAIL PROTECTED]> wrote:
>>>
>>>> Hello Igor,
>>>>
>>>> thank you for the help, but I tried it and it does not work.
>>>> I print out getModelObjectAsString() but there was "nothing".
>>>> I am confused about what getModelObjectAsString() returns.
>>>> Is the result my User that is loaded in my ProfileModel?
>>>>
>>>>
>>>>
>>>>
>>>> igor.vaynberg wrote:
>>>>
>>>>> class mylabel extends label {
>>>>> protected boolean isvisible() {
>>>>> return !Strings.isEmpty(getModelObjectAsString());
>>>>> }
>>>>> }
>>>>>
>>>>> -igor
>>>>>
>>>>> On Fri, May 23, 2008 at 8:13 AM, greeklinux <[EMAIL PROTECTED]> wrote:
>>>>>
>>>>>> Hello,
>>>>>>
>>>>>> I want to display diffent values. For this purpose I am
>>>>>> using the Label component with a CompoundPropertyModel.
>>>>>>
>>>>>> I want to show user details on a profile page.
>>>>>> But not all user values are set. So I want to display only
>>>>>> values that are not empty strings.
>>>>>>
>>>>>> I was thinking about to extend the Label class and override
>>>>>> the isVisible() method. But I do not know how to get the value for
>>>>>> the Label that will be displayed. The Label gets his value with the
>>>>>> wicket id as property expression.
>>>>>>
>>>>>> ProfileModel gets an user id and loads a user obj. from DB.
>>>>>>
>>>>>> class user extends page {
>>>>>> ...
>>>>>> CompoundPropertyModel model = new CompoundPropertyModel(new
>>>>>> ProfileModel(userId));
>>>>>> setModel(model);
>>>>>> Label firstName = new Label("firstName");
>>>>>> add(firstName);
>>>>>> ...
>>>>>> }
>>>>>>
>>>>>>
>>>>>> Thanks
>>>>>> --
>>>>>> View this message in context:
>>>>>> http://www.nabble.com/Label-visibility-dependend-on-Model-value-tp17427854p17427854.html
>>>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>>>>
>>>>>>
>>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>>>
>>>>>
>>>>>
>>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/Label-visibility-dependend-on-Model-value-tp17427854p17430846.html
>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>>
>>>>
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>>
>>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
--
View this message in context:
http://www.nabble.com/Label-visibility-dependend-on-Model-value-tp17427854p17447764.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]