Eelco,

Thanks.  I was trying to do it as an anonymous class, but your idea is
simpler.  Here's what I ended up with:

public class HidingExternalLink extends ExternalLink {

        private static final long serialVersionUID = 1L;

        public HidingExternalLink(final String id, final String href)   {
                this(id, href, null);
        }

        public HidingExternalLink(final String id, final IModel href) {
                this(id,href,null);
        }

        public HidingExternalLink(final String id, final String href, final
String label) {
                super(id, href, label);
                setModel(new Model(href));
        }

        public HidingExternalLink(final String id, final IModel href, final
IModel label) {
                super(id, href, label);
                setModel(href);
        }

         public boolean isVisible() {
                 return getModelObject() != null;
         }
        
}

Tauren




On 9/26/07, Eelco Hillenius <[EMAIL PROTECTED]> wrote:
> > In the meantime, anyone have suggestions how to create a link to an
> > external web page that is only visible if the model is not null?
>
> class MyExternalLink extends ExternalLink {
>     .... constructors ....
>
>   public boolean isVisible() {
>     return getModelObject() != null;
>   }
> }
>
> Eelco
>
> ---------------------------------------------------------------------
> 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]

Reply via email to