Static text and condition

2008-06-19 Thread Goran Novak

Hi,

What is the best (wicket) way to do the next:

I have one page which has to show few sentences (static text), but the
sentences are different according to the input data.

For example if input to the page constructor is:
Page(input1 = 0, input2 = 0, inpu3 = 0)
Page has to show these three sentences:
  This first 'sentence 1' variation
  This first 'sentence 2' variation
  This first 'sentence 3' variation

Second time different input parameters come:
Page(input1 = 1, input2 = 0, inpu3 = 0)
Page has to show these three sentences:
  This second 'sentence 1' variation and some other text
  This first 'sentence 2' variation
  This first 'sentence 3' variation

And so on...

Is it better to put every possiable sentence to resource file and than to
show the right one according to the input parameter.
If(input1 = 0) {
  add(new Label(getLocalizer().getString(firstVariationKey, this)));
} else if (input1 = 1){
  add(new Label(getLocalizer().getString(secondVariationKey, this)));
}


Or to put all sentences staticaly to html file and than use in code
setVisible(true/false) method on that span/'webmarkup container' in which
sentence is.

Or is there a smarter way.

Thanks :)

-- 
View this message in context: 
http://www.nabble.com/Static-text-and-condition-tp18008831p18008831.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Static text and condition

2008-06-19 Thread Igor Vaynberg
just give labels a model that can figure out which sentence to show.
if you want them stored in .properties files that is fine too.

-igor

On Thu, Jun 19, 2008 at 6:18 AM, Goran Novak [EMAIL PROTECTED] wrote:

 Hi,

 What is the best (wicket) way to do the next:

 I have one page which has to show few sentences (static text), but the
 sentences are different according to the input data.

 For example if input to the page constructor is:
 Page(input1 = 0, input2 = 0, inpu3 = 0)
 Page has to show these three sentences:
  This first 'sentence 1' variation
  This first 'sentence 2' variation
  This first 'sentence 3' variation

 Second time different input parameters come:
 Page(input1 = 1, input2 = 0, inpu3 = 0)
 Page has to show these three sentences:
  This second 'sentence 1' variation and some other text
  This first 'sentence 2' variation
  This first 'sentence 3' variation

 And so on...

 Is it better to put every possiable sentence to resource file and than to
 show the right one according to the input parameter.
 If(input1 = 0) {
  add(new Label(getLocalizer().getString(firstVariationKey, this)));
 } else if (input1 = 1){
  add(new Label(getLocalizer().getString(secondVariationKey, this)));
 }


 Or to put all sentences staticaly to html file and than use in code
 setVisible(true/false) method on that span/'webmarkup container' in which
 sentence is.

 Or is there a smarter way.

 Thanks :)

 --
 View this message in context: 
 http://www.nabble.com/Static-text-and-condition-tp18008831p18008831.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


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