Re: Is it the best way to code a Link depending on a condition

2009-09-25 Thread cmoulliard
ulliard.blogspot.com/ >> http://cmoulliard.blogspot.com/ >> -- >> View this message in context: >> http://www.nabble.com/Is-it-the-best-way-to-code-a-Link-depending-on-a-condition-tp25488603p25530206.html >> Sent from the Wicket - User

Re: Is it the best way to code a Link depending on a condition

2009-09-23 Thread josephpachod
tract >> class ContentHoldingPage extend TheBasePage. >> >> ++ >> >> ----------------------------- >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >> For additional command

Re: Is it the best way to code a Link depending on a condition

2009-09-23 Thread Nicolas Melendez
I would define > it > > > > in my base page and make an abstract String getTitle() method in the > > > > base page so I'm sure everyone set it up later on. I would do the > same > > > > if it's a specific kind of structured page, f

Re: Is it the best way to code a Link depending on a condition

2009-09-22 Thread Jeremy Thomerson
ing of a page title, then I would define it > > > in my base page and make an abstract String getTitle() method in the > > > base page so I'm sure everyone set it up later on. I would do the same > > > if it's a specific kind of structured page, for example an ab

Re: Is it the best way to code a Link depending on a condition

2009-09-22 Thread Nicolas Melendez
t's a specific kind of structured page, for example an abstract > > class ContentHoldingPage extend TheBasePage. > > > > ++ > > > > ------------- > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.or

Re: Is it the best way to code a Link depending on a condition

2009-09-21 Thread cmoulliard
Page. > > ++ > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > > - Charles Moulliard SOA Architect My Blog :

Re: Is it the best way to code a Link depending on a condition

2009-09-19 Thread Jeremy Thomerson
link.add(new > >>>> Label("linkRequestTxt",String.valueOf(audit.getRequest().getId(; > >>>> item.add(link); > >>>> > >>>> } else { > >>>> link =

Re: Is it the best way to code a Link depending on a condition

2009-09-18 Thread Joseph Pachod
cmoulliard wrote: What I have done to avoid to repeat the creation of the labels is to define and use static method private Label labelTitle; public static Label getLabelTitle(String title) { return new Label("title",new Model( title )); } I personall

Re: Is it the best way to code a Link depending on a condition

2009-09-18 Thread cmoulliard
itional commands, e-mail: users-h...@wicket.apache.org > > > - Charles Moulliard SOA Architect My Blog : http://cmoulliard.blogspot.com/ http://cmoulliard.blogspot.com/ -- View this message in context: http://www.nabble.com/Is-it-the-best-way-to-code-a-Link-depending-on-a-conditi

Re: Is it the best way to code a Link depending on a condition

2009-09-18 Thread Joseph Pachod
cmoulliard wrote: (...) I think that this is a general remark that some users make about Wicket. It is very difficult to reuse part of the code. Here is another example : I have a label called id which is used in different page. The way proposes by Wicket to code it is Page Request item.add

Re: Is it the best way to code a Link depending on a condition

2009-09-17 Thread cmoulliard
gt;>>> audit.getRequest().getId() ); >> >>>> >> >>>> link = new Link("linkRequest") { >> >>>> >> >>>> @Ove

Re: Is it the best way to code a Link depending on a condition

2009-09-17 Thread Pedro Santos
tring.valueOf(audit.getRequest().getId()))); > >>>> item.add(link); > >>>> > >>>> } else { > >>>> link = new Link("linkRequest") { > >>>> > >>

Re: Is it the best way to code a Link depending on a condition

2009-09-17 Thread Matthias Keller
Hi Yes there'll always be some repetition. Depending on your logic you might also stuff the first block in the onClick event to generate the model if it's not used anywhere else. That could eliminate the first block. The problem about reusable components in wicket is that probably you might

Re: Is it the best way to code a Link depending on a condition

2009-09-17 Thread cmoulliard
this.setEnabled(false); >>>> } >>>> >>>> }; >>>> Label label = new Label("linkRequestTxt",""); >>>> link.add(label); >>>&

Re: Is it the best way to code a Link depending on a condition

2009-09-17 Thread Matthias Keller
Hi As I said in my previous mail, just initialize the link once using the upper variant. Use an if before to create the requestFormModel, in case 2, the requestFormModel can be null - as the onClick is never executed this will not matter. Have something like: final Model requestFormModel; if

Re: Is it the best way to code a Link depending on a condition

2009-09-17 Thread cmoulliard
er >> >> * >> blog : http://cmoulliard.blogspot.com >> >> - >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >> For additional commands, e-mail: u

Re: Is it the best way to code a Link depending on a condition

2009-09-17 Thread Matthias Keller
Sure, just create it (including the onClick which might be invalid), but afterwards set the setEnabled() as needed. As long as the link is disabled, it can never be clicked thus the onClick() will never be executed anyway, so it's irrelevant if the requestFormModel is valid or not... I dont th

Is it the best way to code a Link depending on a condition

2009-09-17 Thread Charles Moulliard
Hi, I would like to know if there is a better way to code this case : What I would like to do is to enable/disable a link depending on a condition. If the condition is true, than we create the link otherwise we disable it. In both case, a label must be defined for the Link. I mean, is it possible