Re: Adding components to Pages based on conditionals

2009-04-18 Thread Craig Tataryn


On 17-Apr-09, at 1:00 AM, Subramanian Murali wrote:


Hi,
I am a new wicket user.
How do we include / exclude content or components in pages based on
conditions.
What is the equivalent in Wicket to the if tag in the JSTL tag  
library?


The reason i ask this question is because irrespective of whether i  
add the
component in the page, i need to have the markup for the component  
in the

HTML.

Thanks in advance for the answers.

Thanks,
Subbu.


Take a look at Component#setOutputMarkupPlaceholderTag(boolean) as  
well, very useful in situations where you want to have something  
invisible, then add a bunch of stuff to it through an ajax call and  
have that stuff show up.


Craig.

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



Adding components to Pages based on conditionals

2009-04-17 Thread Subramanian Murali
Hi,
I am a new wicket user.
How do we include / exclude content or components in pages based on
conditions.
What is the equivalent in Wicket to the if tag in the JSTL tag library?

The reason i ask this question is because irrespective of whether i add the
component in the page, i need to have the markup for the component in the
HTML.

Thanks in advance for the answers.

Thanks,
Subbu.


Re: Adding components to Pages based on conditionals

2009-04-17 Thread Vladimir K

Try EmptyPanel component which is shipped with Wicket.

if (condition)
  add(new YourVisibleComponent(componentId));
else
  add(new EmptyPanel(componentId));

Do not forget about OOD. You can introduce createYourVisibleComponent()
method which creates empty panel in base class and some certain component in
derived classes.


subbu_tce wrote:
 
 Hi,
 I am a new wicket user.
 How do we include / exclude content or components in pages based on
 conditions.
 What is the equivalent in Wicket to the if tag in the JSTL tag library?
 
 The reason i ask this question is because irrespective of whether i add
 the
 component in the page, i need to have the markup for the component in the
 HTML.
 
 Thanks in advance for the answers.
 
 Thanks,
 Subbu.
 
 

-- 
View this message in context: 
http://www.nabble.com/Adding-components-to-Pages-based-on-conditionals-tp23091567p23092032.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Adding components to Pages based on conditionals

2009-04-17 Thread Emond Papegaaij
Personally, I think, it is much more elegant to call setVisible on the 
component you want to display or hide, or, when the outcome of the condition 
can change on each render, override isVisible to return the outcome of the 
condition.

Emond Papegaaij

On Friday 17 April 2009 08:50:21 Vladimir K wrote:
 Try EmptyPanel component which is shipped with Wicket.

 if (condition)
   add(new YourVisibleComponent(componentId));
 else
   add(new EmptyPanel(componentId));

 Do not forget about OOD. You can introduce createYourVisibleComponent()
 method which creates empty panel in base class and some certain component
 in derived classes.

 subbu_tce wrote:
  Hi,
  I am a new wicket user.
  How do we include / exclude content or components in pages based on
  conditions.
  What is the equivalent in Wicket to the if tag in the JSTL tag library?
 
  The reason i ask this question is because irrespective of whether i add
  the
  component in the page, i need to have the markup for the component in the
  HTML.
 
  Thanks in advance for the answers.
 
  Thanks,
  Subbu.


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