You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Thorsten Scherler <th...@juntadeandalucia.es> on 2008/12/19 10:52:06 UTC

View Layer: implementing presentation logic

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: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: View Layer: implementing presentation logic

Posted by Thorsten Scherler <th...@juntadeandalucia.es>.
El vie, 19-12-2008 a las 11:29 +0100, Jérémy Bogatirsky escribió:
> Hi,
> 
> you may look at <wicket:enclosure>.
> I'm actually trying to use it.
> 

Thanks Jérémy, I am ATM trying to use it but not very successfully till
now. 

Salu2

P.S.: For more information about the different tags in wicket see
http://cwiki.apache.org/WICKET/wickets-xhtml-tags.html

> Jérémy
> 
> 2008/12/19 Thorsten Scherler <th...@juntadeandalucia.es>:
> > 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: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
-- 
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: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: View Layer: implementing presentation logic

Posted by Jérémy Bogatirsky <jb...@gmail.com>.
Hi,

you may look at <wicket:enclosure>.
I'm actually trying to use it.

Jérémy

2008/12/19 Thorsten Scherler <th...@juntadeandalucia.es>:
> 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: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: View Layer: implementing presentation logic

Posted by Ryan McKinley <ry...@gmail.com>.
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: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org