Re: Best way to hide a component

2010-07-25 Thread mgoodson

I've done what you all recommended and the code is way tidier now! Thanks
everyone!
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Best-way-to-hide-a-component-tp2299412p2301736.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: Best way to hide a component

2010-07-23 Thread Ian Marshall

My HTML code did not come out correctly. I wanted it displayed as:

  
<a wicket:id="lnk1" href="#" tabindex="2001">One</a>
|
<a wicket:id="lnk2" href="#" tabindex="2002">Two</a>
  
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Best-way-to-hide-a-component-tp2299412p2299938.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: Best way to hide a component

2010-07-23 Thread Ian Marshall

Don't forget using the "wicket:enclosure" tag. For example:

  
 # One 
|
 # Two 
  


  Link lnk1 = new Link("lnk1")
  {
private static final long serialVersionUID = 1L;

@Override
public void onClick()
{
  //
  // ...
  //
}
  };
  lnk1.setVisible(...);
  add(lnk1);


  Link lnk2 = new Link("lnk2")
  {
private static final long serialVersionUID = 1L;

@Override
public void onClick()
{
  //
  // ...
  //
}
  };
  // I want lnk1 and lnk2 to have the same visibility.
  // I do not need to set lnk2's visibility if I use the "wicket:enclosure"
tag instead.
  add(lnk2);


ensures that both links are visible if lnk1 is visible and neither link is
visible if lnk1 is invisible (whilst leaving the visibility of lnk2 to the
default of true).
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Best-way-to-hide-a-component-tp2299412p2299932.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: Best way to hide a component

2010-07-23 Thread Mark Doyle
Yeah, I do something similar.

You can override the isVisible method in your components, possibly
adding some logic that ties the visibility to a variable.  You only
have to manage the one variable then and all the components will know
when to display or not.

On Fri, Jul 23, 2010 at 9:02 AM, Nivedan Nadaraj  wrote:
> I have done the setVisible too for hiding components. Sometimes if there
> were a group of them, placing them in a container(WebMarkupContainer)
> and setting the visibility to t/f on the container works too.
>
> Cheers
> Niv
>
>
> On Fri, Jul 23, 2010 at 2:36 PM, Andrea Selva  wrote:
>
>> Hi,
>> Instead of switching between components, i think that using the setVisible
>> method of component class could be a better solution. This is the principle
>> i read in the in Wicket in Action book when the want to hide a container of
>> other thing.
>> I hope this could help you
>>  Andrea
>>
>> On Thu, Jul 22, 2010 at 11:22 PM, mgoodson 
>> wrote:
>>
>> >
>> > Hi, this could be a stupid question but I am just wondering what the best
>> > way
>> > is to hide a component.
>> > Say I have a button on a form and when it renders sometimes I want it to
>> > show and some times not.
>> > I could either use 2 fragments, one with the button in it and one that's
>> > empty and switch between the two. Or the other option that I can think of
>> > is
>> > to turn the visibility on and off.
>> > Anyone got any reasons for or against with option?
>> > Thanks
>> > --
>> > View this message in context:
>> >
>> http://apache-wicket.1842946.n4.nabble.com/Best-way-to-hide-a-component-tp2299412p2299412.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
>> >
>> >
>>
>

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



Re: Best way to hide a component

2010-07-23 Thread Nivedan Nadaraj
I have done the setVisible too for hiding components. Sometimes if there
were a group of them, placing them in a container(WebMarkupContainer)
and setting the visibility to t/f on the container works too.

Cheers
Niv


On Fri, Jul 23, 2010 at 2:36 PM, Andrea Selva  wrote:

> Hi,
> Instead of switching between components, i think that using the setVisible
> method of component class could be a better solution. This is the principle
> i read in the in Wicket in Action book when the want to hide a container of
> other thing.
> I hope this could help you
>  Andrea
>
> On Thu, Jul 22, 2010 at 11:22 PM, mgoodson 
> wrote:
>
> >
> > Hi, this could be a stupid question but I am just wondering what the best
> > way
> > is to hide a component.
> > Say I have a button on a form and when it renders sometimes I want it to
> > show and some times not.
> > I could either use 2 fragments, one with the button in it and one that's
> > empty and switch between the two. Or the other option that I can think of
> > is
> > to turn the visibility on and off.
> > Anyone got any reasons for or against with option?
> > Thanks
> > --
> > View this message in context:
> >
> http://apache-wicket.1842946.n4.nabble.com/Best-way-to-hide-a-component-tp2299412p2299412.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: Best way to hide a component

2010-07-22 Thread Andrea Selva
Hi,
Instead of switching between components, i think that using the setVisible
method of component class could be a better solution. This is the principle
i read in the in Wicket in Action book when the want to hide a container of
other thing.
I hope this could help you
 Andrea

On Thu, Jul 22, 2010 at 11:22 PM, mgoodson  wrote:

>
> Hi, this could be a stupid question but I am just wondering what the best
> way
> is to hide a component.
> Say I have a button on a form and when it renders sometimes I want it to
> show and some times not.
> I could either use 2 fragments, one with the button in it and one that's
> empty and switch between the two. Or the other option that I can think of
> is
> to turn the visibility on and off.
> Anyone got any reasons for or against with option?
> Thanks
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Best-way-to-hide-a-component-tp2299412p2299412.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
>
>


Best way to hide a component

2010-07-22 Thread mgoodson

Hi, this could be a stupid question but I am just wondering what the best way
is to hide a component.
Say I have a button on a form and when it renders sometimes I want it to
show and some times not. 
I could either use 2 fragments, one with the button in it and one that's
empty and switch between the two. Or the other option that I can think of is
to turn the visibility on and off.
Anyone got any reasons for or against with option?
Thanks 
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Best-way-to-hide-a-component-tp2299412p2299412.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