Use a border -----Mensagem original----- De: kan [mailto:[EMAIL PROTECTED] Enviada em: segunda-feira, 1 de dezembro de 2008 09:03 Para: users@wicket.apache.org Assunto: make invisible if model object is null
I use the next construction very often: [markup] <wicket:enclosure child="something"> <p>Something here, description, comments etc: <span wicket:id="somethinig"></span></p> </wicket:enclosure> [java] add(new Label("something") { @Override public boolean isVisible() { return super.isVisible() && getDefaultModelObject() != null; } }); And there are a lot different components which should be hidden with some arounding text if they have null value of model object. How to make this more elegant? First obvious way - inherit from Label, and make something LabelInvisibleNull, but it is very bad, because a lot different components (not only Label, but Image, WebMarkupContainer, some my custom components, etc) require this behavior. Second - more meaningful - make a IBehavior. But it doesn't work. In "bind" is to early to check model, but in "beforeRender" is too late to change visibility. Is there any other option? -- WBR, kan. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] *************************************************************************************************** "Atenção: Esta mensagem foi enviada para uso exclusivo do(s) destinatários(s) acima identificado(s), podendo conter informações e/ou documentos confidencias/privilegiados e seu sigilo é protegido por lei. Caso você tenha recebido por engano, por favor, informe o remetente e apague-a de seu sistema. Notificamos que é proibido por lei a sua retenção, disseminação, distribuição, cópia ou uso sem expressa autorização do remetente. Opiniões pessoais do remetente não refletem, necessariamente, o ponto de vista da CETIP, o qual é divulgado somente por pessoas autorizadas." "Warning: This message was sent for exclusive use of the addressees above identified, possibly containing information and or privileged/confidential documents whose content is protected by law. In case you have mistakenly received it, please notify the sender and delete it from your system. Be noticed that the law forbids the retention, dissemination, distribution, copy or use without express authorization from the sender. Personal opinions of the sender do not necessarily reflect CETIP's point of view, which is only divulged by authorized personnel." ***************************************************************************************************