Re: [NEWBIE] How to do if... else... switch... in wicket html ?
You don't do it in the HTML, but in the java code. So you create a component that takes care of the if-else for you. Linda Ista Pouss wrote: Hi, What is the best technique to do some if else and so on with wicket ? I need a html with something like that (stupid and naïve approch) : wicket:if (something = toto) div do this thing/div wicket:else if (something = foo) pa href=error.htmlIt's not good/a/p wicket:else if (something = other) divrender other/div How to do that with wicket ? Thanks. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org No virus found in this incoming message. Checked by AVG - www.avg.com Version: 8.5.278 / Virus Database: 270.11.16/2005 - Release Date: 03/16/09 19:01:00 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: [NEWBIE] How to do if... else... switch... in wicket html ?
div wicket:id=text/div String text; if () { text = ... } else text = ... add(new Label(text, text)) if you need different hierarchies (i.e. not just one Label), then use Panels or Fragments instead francisco On Tue, Mar 17, 2009 at 11:21 AM, Ista Pouss ista...@gmail.com wrote: Hi, What is the best technique to do some if else and so on with wicket ? I need a html with something like that (stupid and naïve approch) : wicket:if (something = toto) div do this thing/div wicket:else if (something = foo) pa href=error.htmlIt's not good/a/p wicket:else if (something = other) divrender other/div How to do that with wicket ? 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
Re: [NEWBIE] How to do if... else... switch... in wicket html ?
wicket:if (something = toto) div do this thing/div wicket:else if (something = foo) pa href=error.htmlIt's not good/a/p wicket:else if (something = other) divrender other/div Here is one thing you can do: div wicket:id=my_first_optiondadada/div div wicket:id=my_second_optiondududu/div And in your Java code you do: boolean showDadada; add(new WebMarkupContiainer(my_first_option).setVisible(showDadada)); add(new WebMarkupContiainer(my_second_option).setVisible(!showDadada)); This is only one of the numerous possible ways to accomplish this.. but remember: no script-coding in HTML! ** Martin How to do that with wicket ? 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
Re: [NEWBIE] How to do if... else... switch... in wicket html ?
Hi, You can use in your Java code if (something.equals(error) { setResponsePage(ErrorPage.class); return; } commands in the error case to forward the user to the Error page. Peter Ista Pouss írta: Hi, What is the best technique to do some if else and so on with wicket ? I need a html with something like that (stupid and naïve approch) : wicket:if (something = toto) div do this thing/div wicket:else if (something = foo) pa href=error.htmlIt's not good/a/p wicket:else if (something = other) divrender other/div How to do that with wicket ? Thanks. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: [NEWBIE] How to do if... else... switch... in wicket html ?
Hi, Use panels, and instantiate either one type or another on the java side. Then your content will change. Cheers, Ista Pouss wrote: Hi, What is the best technique to do some if else and so on with wicket ? I need a html with something like that (stupid and naïve approch) : wicket:if (something = toto) div do this thing/div wicket:else if (something = foo) pa href=error.htmlIt's not good/a/p wicket:else if (something = other) divrender other/div How to do that with wicket ? 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
Re: [NEWBIE] How to do if... else... switch... in wicket html ?
It sounds like you want something like this: File.html: div wicket:id=labeldadada/div File.java: boolean again = false; // put your logic here if (again) { add(new Label(label, Very well!); } else { add(new Label(label, Very good!); } Ista Pouss wrote: Thanks all. Yes, I see there is planty solutions, but I am a little losted. I understand very well the WebMarkupContainer and the setVisible mecanism. But I don't undestand very well where is the markup in WebMarkupContainer... for instance, I have : div wicket:id=my_first_optiondadada/div div wicket:id=my_second_optiondududu/div and I should want in my_first_option : p Very Good ! /p and for second : div span wicket:id=again?/span Very Well ! /div NOT in java prose, but in a HTML file. Where do I put that ? In some wicket fragment ? Other ? Thanks again, I'm going to try all that. 2009/3/17 Martin Makundi martin.maku...@koodaripalvelut.com: wicket:if (something = toto) ... - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org No virus found in this incoming message. Checked by AVG - www.avg.com Version: 8.5.278 / Virus Database: 270.11.16/2005 - Release Date: 03/16/09 19:01:00 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: [NEWBIE] How to do if... else... switch... in wicket html ?
2009/3/17 Linda van der Pal lvd...@heritageagenturen.nl: It sounds like you want something like this: File.html: div wicket:id=labeldadada/div File.java: boolean again = false; // put your logic here if (again) { add(new Label(label, Very well!); } else { add(new Label(label, Very good!); } I should prefer than Very well and Very good are in a html file, or part of html file with some wicket mark inside. For instance, something like : add(new Panel(label, a reference in a wicket html file); Thanks in advance. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: [NEWBIE] How to do if... else... switch... in wicket html ?
Then you do indeed have to work with the visibility. Ista Pouss wrote: 2009/3/17 Linda van der Pal lvd...@heritageagenturen.nl: It sounds like you want something like this: File.html: div wicket:id=labeldadada/div File.java: boolean again = false; // put your logic here if (again) { add(new Label(label, Very well!); } else { add(new Label(label, Very good!); } I should prefer than Very well and Very good are in a html file, or part of html file with some wicket mark inside. For instance, something like : add(new Panel(label, a reference in a wicket html file); Thanks in advance. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org No virus found in this incoming message. Checked by AVG - www.avg.com Version: 8.5.278 / Virus Database: 270.11.16/2006 - Release Date: 03/17/09 07:23:00 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: [NEWBIE] How to do if... else... switch... in wicket html ?
Yes, I see there is planty solutions, but I am a little losted. I understand very well the WebMarkupContainer and the setVisible mecanism. But I don't undestand very well where is the markup in WebMarkupContainer... There is no difference whether the div's are visible or not. If you insert components within them, you just add normally: WebMarkupContainer dadaDiv = new WebMarkupContainer(my_first_option); page.add(dadaDiv); dadaDiv.add(new Label(my_span)); .. and so-on. If you want the WebMarkupContainer to be a panel, no problem, it can be a new Panel(my_first_option); as well. Simply try-it-out and show us your code if you cannot make it work. ** Martin - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: [NEWBIE] How to do if... else... switch... in wicket html ?
Thanks all. Yes, I see there is planty solutions, but I am a little losted. I understand very well the WebMarkupContainer and the setVisible mecanism. But I don't undestand very well where is the markup in WebMarkupContainer... for instance, I have : div wicket:id=my_first_optiondadada/div div wicket:id=my_second_optiondududu/div and I should want in my_first_option : p Very Good ! /p and for second : div span wicket:id=again?/span Very Well ! /div NOT in java prose, but in a HTML file. Where do I put that ? In some wicket fragment ? Other ? Thanks again, I'm going to try all that. 2009/3/17 Martin Makundi martin.maku...@koodaripalvelut.com: wicket:if (something = toto) ... - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: [NEWBIE] How to do if... else... switch... in wicket html ?
On Tue, Mar 17, 2009 at 7:14 AM, Ista Pouss ista...@gmail.com wrote: I should prefer than Very well and Very good are in a html file, or part of html file with some wicket mark inside. So, use Fragments. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: [NEWBIE] How to do if... else... switch... in wicket html ?
Ok, I an see where this would help if you have separate designers and programers. Try this way then: Label veryGood = new Label(my_first_option, Very Good!); Label veryWell = new Label(my_second_option, Very Well!); Label again = new Label(my_second_option, ?); add(veryGood); add(veryWell); veryWell.add(again); bool = expression[1|0]... veryGood.setVisible(bool); veryWell.setVisible(! bool); and your HTML will be simply: div wicket:id=myComponent[replaced label]/div p wicket:id=my_first_option[Very Good ! ]/div div wicket:id=my_second_optionspan wicket:id=again[?]/ span[Very Well !]/div Note: I haven't tried nesting a label inside another label, but things usually work that way in Wicket. If the label doesn't work, you can try a MarkupContainer instead, which is pretty much the same thing, just not specifically a Label (you might need to wrap both string as labels in that case). I'm not sure why you would want that again component though from the example it doesn't seem to need to be a component. - Brill Pappin On 17-Mar-09, at 7:14 AM, Ista Pouss wrote: 2009/3/17 Linda van der Pal lvd...@heritageagenturen.nl: It sounds like you want something like this: File.html: div wicket:id=labeldadada/div File.java: boolean again = false; // put your logic here if (again) { add(new Label(label, Very well!); } else { add(new Label(label, Very good!); } I should prefer than Very well and Very good are in a html file, or part of html file with some wicket mark inside. For instance, something like : add(new Panel(label, a reference in a wicket html file); Thanks in advance. - 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
Re: [NEWBIE] How to do if... else... switch... in wicket html ?
2009/3/17 James Carman jcar...@carmanconsulting.com: So, use Fragments. It's work ! (I hope). I do that : body div wicket:id=copie?/div /body wicket:fragment wicket:id=frag-diap Diapositive /wicket:fragment wicket:fragment wicket:id=frag-expo Exposé /wicket:fragment in java : add(new Fragment(copie, frag-expo, this)); // or frag-diap And I get : body div wicket:id=copie That is exp frag /div /body I lookat all your other solution ; infinitely numbers of thanks. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org