Absolutely. It's one of wickets many strong points.

Regards,
Antony Stubbs

website: sharca.com

On 1/08/2009, at 1:39 AM, Iain Reddick <iain.redd...@beatsystems.com> wrote:

Thanks for the reply - I think I'm perhaps trying to bend the framework rather than work with it.

I suppose I'm really wondering about the following kind of thing, and whether it's worth trying to build similar re-usable components:

public class NullableLabel extends Label {
private boolean visibleWhenNull = true;
...
public boolean isVisible() {
  if ( getModelObject() != null ) {
    return true;
  } else {
    return visibleWhenNull;
  }
}

public void setVisibleWhenNull(...) {
  ...
}
}
This adds simple, configurable null-aware behaviour to a label.

Is this kind of thinking worth pursuing?


add(new Link<User>("editgroup", user) {
onclick() {
 ...
}

isvisible() {
 return user.getgroup()!=null;
}
}

?

-igor

2009/7/30 Iain Reddick <iain.redd...@beatsystems.com>:

> Hi all,
>
> One of the difficulties I am finding with wicket is the best practice when
> displaying/using data that is potentially null.
>
> Example:
>
> I have a "user" object which has a nullable "group" property. I want to show > a link to the group details page when the "group" property is not null, but
> show nothing otherwise (let's keep this simple).
>
> My issue is that either way, I have to construct the link component and add > it to the page, whether I want it is visible or not. This is tricky at the > best of times, as I must always carry out a lot of "is null" logic.
>
> The construction issue becomes multiplied if I want the same behaviour on a > stateful page (i.e. the link, etc. can be appropriate for linking to the > group, or be null and not visible and can switch between the two states).
>
> My question is - am I missing something, or do I just need to have a better
> strategy for this type of situation?
>
> If the answer is the latter, does anyone have any tips and/or components
> that would cut down on the extra coding?
>
> Thanks
>
> ---------------------------------------------------------------------
> 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