Re: enabling and disabling the components

2012-08-13 Thread wicket user
Thanks, it is working but some wierd thing is happening.
I have checked the values in the object also it is getting populated but
just one component is visible otherwise none. 

PriceVO priceVO

if(priceVO.getOnSalePrice()!=null)
 add(new Label(onSalePrice,   +
priceVO.getOnSalePrice())).setVisible(true);
else
add(new Label(onSalePrice, 
)).setVisible(false);

if(priceVO.getRegularPrice()!=null)
add(new Label(regularPrice, Reg. Price :  +
priceVO.getRegularPrice())).setVisible(true);
else
add(new Label(regularPrice, 
)).setVisible(false);

if(priceVO.getSavePrice()!=null)
add( new Label(youSave, You Save : +
priceVO.getSavePrice())).setVisible(true);
else
add( new Label(youSave, 
)).setVisible(false);

if(priceVO.getPlanPrice()!=null)
add(new Label(planPrice,   + 
priceVO.getPlanPrice()+  per
month)).setVisible(true);
else
add(new Label(planPrice, 
)).setVisible(false);





if the planPrice is getting populated then everything should be invisible
that is working fine but in some scenarios only regular price is getting
populated at that time nothing is displayed. 

Please Advise.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/enabling-and-disabling-the-components-tp4651107p4651188.html
Sent from the Users forum 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: enabling and disabling the components

2012-08-10 Thread Sebastien
Hi,

Label label = new Label(fName,  myVO.getName()); // (or better use new
PropertyModelString(user, name) )
label.setVisible(myVO.getName()!=null);
add(label );

Also, the fName markup id seems to be missing in your html (also the
message markup id in test)
div wicket:id=test1
div wicket:id=fName

/div
/div

div wicket:id=test1
div wicket:id=message

/div
/div

Hope this helps,
Sebastien.

On Fri, Aug 10, 2012 at 12:49 AM, wicket user samd...@live.com wrote:

 Hi,
  I tried this .

 public class MyContainer extends WebMarkupContainer{
 public MyContainer(String id, MyVO myVO) {
 super(id);
 if(myVO.getName()!=null)
   add( new Label(fName,  myVO.getName()));
 else
  add( new Label(fName,  )).setVisible(false);
 }
 public MyContainer(String id){
 super(id);
  add(new Label(message, Testing Label);
 }

 }


 Calling from my Class

 add( new MyContainer(test));
 add( new MyContainer(test1, VO);


 In html

 div wicket:id=test

 /div

 div wicket:id=test1

 /div




 But the problem is I am getting the first markup which is test and not
 the
 test1 even though the getName is not null.

 PLease advise



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/enabling-and-disabling-the-components-tp4651107p4651112.html
 Sent from the Users forum 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: enabling and disabling the components

2012-08-09 Thread wicket user
I was reading about setEnable(false), will that will be sufficient for my
requirement ? 



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/enabling-and-disabling-the-components-tp4651107p4651108.html
Sent from the Users forum 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: enabling and disabling the components

2012-08-09 Thread Sebastien
Hi,

Yes, you have to add the component anyway, and you can controls its
rendering by using #setEnable based on your condition. Note that if you
need to not render severals components in the same time, you can have a
look at wicket:enclosure. Finally, if you need to control its/their
rendering afterward, using ajax, you will weed to set
setOutputMarkupId(true), or even setOutputMarkupPlaceholderTag(true) if the
components starts un-rendered

Hope this helps,
Sebastien.

On Thu, Aug 9, 2012 at 10:53 PM, wicket user samd...@live.com wrote:

 I was reading about setEnable(false), will that will be sufficient for my
 requirement ?



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/enabling-and-disabling-the-components-tp4651107p4651108.html
 Sent from the Users forum 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: enabling and disabling the components

2012-08-09 Thread wicket user
Hi,
 I tried this . 

public class MyContainer extends WebMarkupContainer{
public MyContainer(String id, MyVO myVO) {
super(id);
if(myVO.getName()!=null)
  add( new Label(fName,  myVO.getName()));
else
 add( new Label(fName,  )).setVisible(false);
}
public MyContainer(String id){
super(id);
 add(new Label(message, Testing Label);
}

}


Calling from my Class 

add( new MyContainer(test));
add( new MyContainer(test1, VO);


In html

div wicket:id=test

/div

div wicket:id=test1

/div




But the problem is I am getting the first markup which is test and not the
test1 even though the getName is not null. 

PLease advise 



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/enabling-and-disabling-the-components-tp4651107p4651112.html
Sent from the Users forum 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