I may be missing something but what about just setting the visible property?

for( section : sections ) {
  Label label = new Label( ...
  label.setVisible( section.id != 0 );
  add( label )
}


On Dec 19, 2008, at 4:52 AM, Thorsten Scherler wrote:

Hi all,

I am looking into implementing some presentation logic and wonder what
the best approach is.

In my usecase I have a form and after the user submitted it I present
the values back in a page. There is an optional option that I want to
display if the user had given feedback to the option.

ATM I have implemented the "display back" page in a panel:
<html xmlns:wicket="http://wicket.apache.org/";>
 <wicket:panel>
  ...
   <div wicket:id="subSection">subSection</div>
...

And in my java class I do:
...
StringResourceModel ssectionResult = new StringResourceModel(
 "subSection.add", this, new Model(model));
add(new Label("subSection", ssectionResult));

And in my properties files I have:
subSection.add=Subseccion: $\{subSection\}

However that leads to the problem that
if (subSection ==null)
 it will be displayed as "Subseccion: ${subSection}"
else
it will be displayed as "Subseccion: 2.1. NOMBRAMIENTOS, SITUACIONES E
INCIDENCIAS"

What I am now looking for is a kind of if test for <div
wicket:id="subSection">subSection</div>.

something like
<wicket:if test="subSection!=0">
<div wicket:id="subSection">subSection</div>
</wicket:if test="subSection!=0">

How can I implement this test with wicket?

salu2
--
Thorsten Scherler <thorsten.at.apache.org>
Open Source Java <consulting, training and solutions>

Sociedad Andaluza para el Desarrollo de la Sociedad
de la Información, S.A.U. (SADESI)





---------------------------------------------------------------------
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